2011-08-04 17:16:17     Firmware upgrade

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-08-04 17:16:17     Firmware upgrade

Timur Aydin (TURKEY)

Message: 102817   


I have a BF537 based board that uses a 16MByte EEPROM has the root file system. u-boot initially boots off of an initramfs. Then the startup script mounts the EEPROM as the root file system and switches the root from initramfs to flash. This works fine.


Now I want to add the ability to upgrade the firmware on the EEPROM. Here is what I am contemplating to do:


- Create a ramfs, mount it to a folder.


- Copy the core libraries, busybox to the ramfs.


- Create a script called /sbin/init, which will erase the EEPROM, wirte the new firmware image and reboot the system.


- Switch root to this new filesystem using "switch_root"


I tried reusing the rootfs filesystem from which I had switched during boot. But it seems the rootfs cannot be reused once having switched from it.


What do you think about this method of upgrading the firmware?




2011-08-04 21:22:07     Re: Firmware upgrade

Aaron Wu (CHINA)

Message: 102819   


Which part do you want to upgrade? u-boot, kernel or filesystem?


For the u-boot and kernel, you can load the u-boot/kernel image into RAM, then programme it into the EEPROM for upgrading. BTW, what's your 16MB EEPROM, is it a parallel Nor Flash?


For the filesystem, first you need to build a filesystem on your EEPROM, like jffs2, then just add/change whatever you want on it. Generally you won't want to replace them all, of course you can replace it as a whole like what you will do to the u-boot/kernel.




2011-08-05 03:18:35     Re: Firmware upgrade

Timur Aydin (TURKEY)

Message: 102828   


Hello Aaron,


the 16MByte image consists of u-boot, uImage and romfs (jffs2). In order to guarantee consistency and compatibility between these components, I want to upgrade the entire image. Because I can't upgrade the live jffs2 filesystem while root is mounted on it, I want to create a minimal root that is just able to erase and write the EEPROM.


The 16MByte image is built suck that the u-boot, uImage and the jffs2 image are properly aligned to their respective offsets. The EEPROM is a NOR flash.


One other question, when building the 16MByte image, I am using dd, but I wasn't able to find a way to fill the spaces between the three components with FF. The dd program always pads the spaces with 00. I want to help minimize flash wear by using an FF fill value. Any way to use an FF fill, other than writing a custom image creation utility?




2011-08-05 04:48:58     Re: Firmware upgrade

Scott Jiang (CHINA)

Message: 102831   


Don't use dd. You should always use mtd utility to handle image and flash.