Changes between Version 11 and Version 12 of linux/ubi

03/05/2019 10:33:28 PM (16 months ago)
Bobby Jones

Add split update section


  • linux/ubi

    v11 v12  
    327327'''Note that operating on the ubi device as described here destroys the wear-leveling information contained in the UBI therefore it is recommended to work at the ubi volume layer to replace ubifs volumes as described below'''
     330==== Updating UBI with low RAM devices:
     331For some devices, the size of the NAND flash exceeds the size of RAM. In this scenario the instructions from the prior section would fail as you would run out of RAM space before you could finish retrieving the file to program the NAND flash with.
     333To work around this limitation Gateworks has created an installable U-Boot script that will apply UBI files containing a single partition image. This can be particularly useful for updating the firmware of a running target.
     335To update using a split UBI:
     336 '''1. Split your UBI
     337  In most situations the RAM of your device will be smaller than the image file required to update your system, therefore it is necessary to split the image file and apply the resulting compressed parts in a piece wise update. The below example uses the {{{split}}} command to split the input file into parts that are reasonably smaller than the RAM size of the board which will be consuming the update.
     338 {{{#!bash
     340# Split file every 200M with suffix ".part" and decimal increment
     341split -d -b 200M ${FILE} ${FILE}.part
     342for i in $(ls ${FILE}.*); do
     343 mv $i ${FILE}.$(echo $i | cut -d'.' -f3)
     346# Result will be multiple files such as xenial-large.ubi.partXX that are <= 200M and
     347# which adhere to the naming convention required by the script (ends with .partXX in sequential order)
     349 '''2. Install the U-Boot script
     350  On the target machine, source the [ nand_split_update.scr] U-Boot script attached to this page (or copy its contents with an editor). For example via tftp:
     352setenv serverip
     353tftp nand_split_update.scr
     354source $loadaddr
     356 '''3. Configure your U-Boot environment
     357  From the script's usage:
     359The following environment variables need to be set in order for this script to run:
     361    splitfile    - full path file name prefix of the splitted files (eg file.ubi for file.ubi.part00)
     363  An example configuration:
     365setenv splitfile xenial-large.ubi          # ubi file from example above
     368 '''4. Run the added script with {{{run nand_split_update}}}