Flash an UBI/UBIFS root filesystem

Introduction

This section describes how to load a UBI root filesystem image into the NAND FLASH of the board with SAM-BA and right through the U-Boot command line.

Note that the root filesystem is installed at offset 0x800000 in the NAND FLASH. From a Linux kernel point of view, this corresponds to the index 0 of the MTD subsystem device (/dev/mtd1 and /dev/mtdblock1).

Using SAM-BA

sam-ba_5series_fs.jpg

1. Choose the NandFlash media tab in the SAM-BA GUI.

2. Initialize the media choosing the Enable NandFlash action in the Scripts rolling menu and press Execute.

3. Select Enable OS PMECC parameters in the Scripts rolling menu and press Execute. Configure ECC as done on the following picture:

sam-ba_5series_ecc.jpg

Beware: the trimffs option must be selected for UBI filesystem. Then press the OK button.

4. To erase only the nand flash rootfs partition, type this command after the SAM-BA prompt:

NANDFLASH::EraseBlocks 0x800000 0xFFFFFFF

The SAM-BA EraseBlocks command takes two parameter: a start and an end address of FLASH that you want to erase.

5. Press Send File Name Browse button and choose your UBI filesystem.

6. Enter the proper address on media in the Address text field. You can find the product map in GettingStarted_9x5. So in our case, the value for the filesystem is 0x800000.

7. Press Send File button. A Please Wait... dialog window is appearing: wait for the end of the flashing process.

8. Close SAM-BA, remove the USB cable.

Ok, now you must have the Linux root filesystem flashed on your board.

Using U-Boot

You can also flash root filesystem image with U-Boot. You must have configured your network access in U-Boot as the binary image will be transferred to the target using TFTP protocol.
Download your ubi file (choose the proper name instead of <my_rootfs.ubi>):

tftp 0x22000000 <my_rootfs.ubi>
Erase the rootfs flash partition (248 MB):
nand erase 0x800000 0xf800000
And write the downloaded ubi file on the flash memory. You must use the nand write.trimffs function to avoid ECC errors.
nand write.trimffs 0x22000000 0x800000 0x8e0000
If the default arguments are not correct, you can also set them with this command:
setenv bootargs 'mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0
:rootfs'

Additional information

Pointing hand Check for additional information about specific Open source embedded distributions on their dedicated page:


I Attachment Action Size Date Who Comment
JPEGjpg sam-ba_5series_ecc.jpg manage 22.7 K 2011-07-11 - 08:56 NicolasFerre  
JPEGjpg sam-ba_5series_fs.jpg manage 102.8 K 2011-07-11 - 08:56 NicolasFerre