Sakoman Incorporated

How to write u-boot to NAND

The images on this site are normally run from a bootable SD card.  For OMAP boards with NAND, it is also possible to boot from a NAND image.  To boot from NAND you will need to write four different binary images to NAND:

This article covers the second step of that process, u-boot.  Click on each of the other links above for instructions on how to write the other images to NAND.

U-boot is the second stage boot loader and is responsible for completing the hardware initialization and loading the Linux kernel.  Like MLO/x-loader, u-boot must be written to nand with hwecc. The following instructions assume that you are using a bootable SD card prepared from the GNOME or console images available on this site.

Power up or reset your OMAP board and break into u-boot by pressing a key on your serial console when you see the message:

Hit any key to stop autoboot:

Next have u-boot scan to find your bootable SD card and load the u-boot binary from the FAT partition of the bootable SD card.

# mmc rescan 0
# fatload mmc 0 ${loadaddr} u-boot.img
reading u-boot.img
266308 bytes read

At this point the u-boot binary has been copied into RAM. We now specify the use of hwecc and erase the area of NAND where u-boot will reside:

# nandecc hw
HW ECC selected
# nand erase 80000 1c0000
NAND erase: device 0 offset 0x80000, size 0x1c0000
Erasing at 0x220000 -- 100% complete.
OK

Next we write the u-boot image to the just erased area of NAND:

# nand write ${loadaddr} 80000 ${filesize}
NAND write: device 0 offset 0x80000, size 0x3672c
 266308 bytes written: OK

It is recommended that you also erase the u-boot environment partition every time you install a new version of u-boot.  This will cause u-boot to use its default environment.

The images on this site are always matched sets - the u-boot default enviroment will be appropriate for the kernel and rootfs in the set.  You should only change the default u-boot environment if you know what you are doing.  You shouldn't normally need to change this default unless you want to use a different display resolution than the default 1024x768.

For Overo, type:

Overo # nand erase 240000 20000
NAND erase: device 0 offset 0x240000, size 0x20000
Erasing at 0x240000 -- 100% complete.
OK

For Beagle, type:

OMAP3 beagleboard.org # nand erase 260000 20000
NAND erase: device 0 offset 0x260000, size 0x20000
Erasing at 0x260000 -- 100% complete.
OK

The next time you reboot your machine you will see confirmation thas you have successfully erased the environment partition when u-boot prints the following message:

*** Warning - bad CRC or NAND, using default environment

 

You are here: Home Articles How to write u-boot to NAND