This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Firmware Upgrade on AM335x

We are trying to build a controller based on AM335x with 4GB eMMC, and 256MB RAM using embedded Linux.

As an embedded system, one of the feature required is the ability to do remote upgrade. I found some example online, but they are all based on MTD (Memory Technology Device) operating on RAW flash.  However, eMMC is a block device, so I probably should use ext3 instead.

Considering that there might be multiple files changed during software upgrade, kernel, application, scripts,  etc. so the easy thing might be replacing all the files on the root file system.

Should I create a partition just for the new firmware, and create scripts to overwrite the file system during firmware upgrade? Is there any existing framework handling this?

Your help are greatly appreciated.

Jing

  • Hi Jing,

    I don't think the TI EZSDK has any ready mechanism to implement this.

  • Biser,

    Thanks for your reply.

    With no existing solution, plenty of eMMC flash space, I am thinking creating at least six partitions,

    1. FAT32 partition which contains the SPL (named MLO) and U-Boot. 
    2. Minimum Linux with scripts to upgrade the application
    3. Main Linux partition with up-to-date application
    4. System Configuration
    5. System Data and Log Files
    6. Temporary Files such as new firmware upgrade

    The first two partitions are programmed only once at the factory.

    During the firmware upgrade,

    1. The new firmware is uploaded through the WEB interface and saved to Partition 6
    2. The U-boot variable is manipulated to boot into Partition 2.
    3. The firmware in Partition 6 is validated, if not good, the image is deleted, and the system is boot back into partition 3.
    4. If the firmware in partition 6 is good, copy everything from the new firmware into the new partition (Do I need to format the partition again?)
    5. Verify the copy into partition 3 is successful.
    6. Boot back into partition 3. The application should take care of data migration of the system configuration.

    However, there are a few missing pieces:

    1. How do I change the U-Boot environmental variables from Linux when the U-boot environment variables is saved in the eMMC instead of MTD. Most of the example I see is based on MTD (Raw Flash). Do I have to port the code from U-Boot myself or somebody else has already done it.
    2. How do I verify if the copy to partition 3 is successful? (Diff every file?)

  • Hi Jing,

    Usually when the system is updated - the updated images can be everywhere in a user space. After saving the update images the update program have to specify a flag (in a file) located in a unerasing area (in your case in eMMC). After rebooting the system u-boot read this flag (from a file) and if it specified use other kernel boot parameters - for update. These parameters are generated from u-boot, not read from eMMC or other memory (read/write are used only for test purpose). The changed environment parameters start either special kernel who make update, or other ramfs with the application to make update. This is for 1. point.
    For the second point you can calculate CRC or calculate MD5 or many other verification method to be sure that update code is written well.

    BR
    Ivan

  • Ivan,

    Thank for your comments.

    I think that I got your idea, let me know if I am wrong:

    • Create a file called boot.cfg in the FAT32 partition.
    • In the boot.cfg, define which partition to boot.
    • Updated U-Boot to read boot.cfg file, and boot based on boot.cfg

    For the second point, I am not sure how do I calculate the MD5 for the whole root file system.

    In addition, what's the best way to create a file image for the rootfs, cpio or squashfs?

    Regards,

    Jing

  • Hi Jing,

    I don't know what is your update files are, but for me you not needed to make MD5/SHA1... of whole file systems. Only need to make this on the updated files from FS - library (.so file), application (.apk), .... The kernel and u-boot are small and they are only a file.
    For source of MD5 I found on Google some sites:
    https://polarssl.org/md5-source-code
    http://dollar.ecom.cmu.edu/sec/cryptosource.htm
    ...

    BR
    Ivan

  • Ivan,

    I have done MD5 before, so that's not a problem. It should be easy to maintain the MD5 verification for some important files such as kernel, library. I am worried about the configuration files, scripts, which can be difficult to track since there are too many.

    BR.

    Jing

  • Hi Jing,

    Script and other small configuration files you can be grouped all in a one MD5 check file. You have to make a list of all updated file.

    BR
    Ivan