Install a rootfs on an AT91 board
This section describes How to load a jffs2 root filesystem into the NAND FLASH of the board with SAM-BA and right through the u-boot command line. SAM-BA is the simplest way.
Note that the root file system is installed at offset 0x0 in the NAND FLASH. From a Linux kernel point of view, this corresponds to the index 0 of the MTD subsystem device (/dev/mtd0 and /dev/mtdblock0).
Note also that this operation will need a complete erase of the board NAND FLASH. Be sure not to lost data during this operation.
Using SAM-BA
- Make sure that the chip can execute the bootROM monitor SAM-BA-boot.
Indeed, the chip must not find an executable code on any boot media, otherwise it will execute it instead of giving access to SAM-BA. link to AT91Bootstrap for explaining how (or the boot_strategies document from FredOBoYeR? )
- Reset the board
- Connect the USB Device Interface to your host machine using the USB Device Cable
- Start SAM-BA GUI Application
- Select the the board in the drop-down menu and choose the USB Connection

- Eventually plug back a jumper to access the media on which u-boot must be loaded to
- In the main SAM-BA window :
- Choose the NandFlash media tab in the SAM-BA GUI interface
- Initialize the media choosing the NandFlash Init action in the Scripts rolling menu and press Execute
- In the same Scripts menu choose the NandFlash Erase All action and press Execute . A Please Wait... dialog window is appearing: wait for the end of the erase process
- Press on Send File Name Browse button
- Choose the filesystem image file ( x11-image-demo-at91sam9263ek.jffs2 for example) and press Open
- Enter the proper address in NAND FLASH in the Address text field. You can find a media map for each product in AT91Bootstrap
find chapter in page AT91Bootstrap
- Press Send File button. A Please Wait... dialog window is appearing: wait for the end of the flashing process
- Close SAM-BA, remove the USB cable
Ok, now you must have a the Linux root filesystem flashed on your board.
Using u-boot commands
Here is a reference documentation about JFFS2 as root filesystem on the u-boot documentation website.
Following commands documentation is available in the u-boot doc/README.nand documentation file.
1. erase the whole NAND FLASH
U-Boot> nand erase
NAND erase: device 0 whole chip
Skipping bad block at 0x000c0000
Skipping bad block at 0x009c0000
Erasing at 0xffe0000 -- 100% complete.
OK
2. download the JFFS2 filesystem from TFTP to the board RAM (address 0x21400000)
U-Boot> tftp 0x21400000 x11-image-demo-at91sam9263ek.jffs2
TFTP from server 10.159.240.137; our IP address is 10.159.245.170
Filename 'nferre/x11-image-demo-at91sam9263ek.jffs2'.
Load address: 0x21400000
Loading: T #################################################################
#######################################################T ##########
#################################################################
[..]
#########################
done
Bytes transferred = 26083328 (18e0000 hex)
remember the number of Bytes transferred just indicated above. It will be useful for the nand write.jffs2 command.
3. write the filesystem from RAM@0x21400000 to NAND FLASH at offset 0x0 (Linux /dev/mtdblock0). Note the last parameter : it is the number of Bytes transferred indicated in the previous command.
U-Boot> nand write.jffs2 0x21400000 0x0 0x18e0000
NAND write: device 0 offset 0, size 26083328 ...
Bad block at 0xc0000 in erase block from 0xc0000 will be skipped
Bad block at 0x9c0000 in erase block from 0x9c0000 will be skipped
Writing data at 0x195f800 -- 100% complete.
OK
Note that bad blocks just shown above are normal behavior of a NAND FLASH : they are skipped and the filesystem will not mind, it is designed to manage them.
Good, now you have a fresh JFFS2 filesystem you can boot on. |