August 31, 2010

mini2440 flash upgrade

How to upgrade mini2440/micro2440 kernel image after the systems boots to Linux:

killall processes
mount -o remount,ro /
cd /dev/shm
flash_erase /dev/mtd1 0 16
nandwrite -a -p /dev/mtd1 /zImage_new


There are two "official" bootloaders, supervivi-128M and viv. supervivi is a little bit less than 256K (0x40000), while vivi is only 3-4K. We have supervivi in NOR flash, and viv in NAND flash.

0x0,00000 - 0x0,40000    bootloader
0x0,48000 - 0x0,60000    bootloader parameters (linux_cmd_line           starts at 0x48000 and ends with the first 0x0)
0x0,60000 - 0x2,60000    2M of kernel space
0x2,60000 - 0x80,00000   close to 126M application image

Tools to read/write/erase flash after system is booted (all in mtd-utils project):

        - flash_erase
        - nandwrite
        - nanddump
        - mtd_debug

echo -n -e "VIVICMDLnoinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0\0000" > /tmp/cmdline
/cmdc/flash_erase /dev/mtd0 0x40000 1
/cmdc/nandwrite -p /dev/mtd0 -s 0x48000 /tmp/cmdline

You can probably use the same nandwrite to update the bootloader itself. I haven't tried that yet.

No comments:

Post a Comment