BTW, for sake of completeness, to write the x-load/MLO image to nand
properly using u-boot you would do the following (assuming you have
MLO on a microSD card):
fatload mmc 0 82000000 mlo
nand erase 0 80000
nand write 82000000 0 20000
nand write 82000000 20000 20000
nand write 82000000 40000 20000
nand write 82000000 60000 20000
Note that four copies are written (one to each of the first 4 blocks)
to deal with the possibility of the mlo blocks going bad over time.
The omap processor knows to skip to the next block & retry if it
detects a bad block.
These blocks are write protected in lunux, so that you won't be
tempted to try to do this from linux. They must be written with a
special form of hw ecc that linux doesn't know about yet.
On Wed, Nov 26, 2008 at 12:04 PM, Steve Sakoman <sakoman@...> wrote:
> On Wed, Nov 26, 2008 at 11:31 AM, Frank Agius <ftagius@...> wrote:
>> I avoid the complications of upgrading/downgrading the uImage and
>> filesystem in nand by creating bootable microSD cards. The overo u-boot
>> environment is set up at the factory such that at boot time if an SD
>> card is found, and if the file uImage can be loaded from the first fat
>> partition on the the SD card, then u-boot will load that image and pass
>> it boot parms to look for the file system on the second (ext2/ext3)
>> partition of the SD card. I have multiple SD cards with various
>> combinations of kernels and file systems. Changing kernels is as easy
>> as swapping SD cards. The wiki has information on creating a bootable
>> SD card:
> I highly recommend this method of working -- it is what I do myself.
> It is incredibly easy to do most of your development booting from
> microSD cards.
> I'll start by saying that you probably don't ever want to use u-boot
> to write to nand (other than for the x-load partition, but that is
> written at the factory and will likely *never* need to be
> overwritten). It is much easier and safer to rewrite nand by booting
> into linux on a microSD card.
> There are certainly reasons you might want to want to have everything
> in nand. Here's the process I use when the need arises.
> 1. I create a bootable microSD card as described in the link above.
> 2. Before unmounting the microSD from my development machine I create
> a subdirectory in /home/root on the ext3 partition of the card, let's
> call it nandwrite.
> 3. I then copy over my desired versions of u-boot, uImage, and rootfs
> tarball to nandwrite.
> 4. I copy the below script to nandwrite and chmod it as executable
> 5. I unmount the microSD card, place in in the Overo slot, and boot.
> 6. I log into a console session, cd to nandwrite and execute the script.
> 7. Done - u-boot, uImage, and the rootfs are now in nand.
> The script:
> if [ -e $uboot ]; then
> echo "Erasing u-boot partition ..."
> flash_eraseall /dev/mtd1
> echo "Erasing u-boot environment partition ..."
> flash_eraseall /dev/mtd2
> echo "Writing u-boot to NAND ..."
> nandwrite -p /dev/mtd1 $uboot
> echo "ERROR: couldn't find u-boot binary"
> if [ -e $uimage ]; then
> echo "Erasing kernel partition ..."
> flash_eraseall /dev/mtd3
> echo "Writing kernel to NAND ..."
> nandwrite -p /dev/mtd3 $uimage
> echo "ERROR: couldn't find kernel binary"
> if [ -e $rootfs ]; then
> umount /dev/mtdblock4
> echo "Erasing and formatting rootfs partition ..."
> flash_eraseall -j /dev/mtd4
> echo "Mounting rootfs partition ..."
> mkdir -p /media/mtdblock4
> mount -t jffs2 /dev/mtdblock4 /media/mtdblock4
> cd /media/mtdblock4
> tar xjf $dir/$rootfs
> echo "ERROR: couldn't find rootfs tarball"