577 | | [=#SplitMethod] |
578 | | ==== Updating UBI with low RAM devices |
579 | | For 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. |
580 | | |
581 | | To 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. |
582 | | |
583 | | To update using a split UBI: |
584 | | '''1. Split your UBI |
585 | | In some 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. |
586 | | {{{#!bash |
587 | | FILE=xenial-large.ubi |
588 | | # Split file every 200M with suffix ".part" and decimal increment |
589 | | split -d -b 200M ${FILE} ${FILE}.part |
590 | | |
591 | | # Result will be multiple files such as xenial-large.ubi.partXX that are <= 200M and |
592 | | # which adhere to the naming convention required by the script (ends with .partXX in sequential order) |
593 | | }}} |
594 | | '''2. Install the U-Boot script |
595 | | On the target machine, source the [http://trac.gateworks.com/raw-attachment/wiki/linux/ubi/nand_split_update.scr nand_split_update.scr] U-Boot script attached to this page (or copy its contents with an editor). For example via tftp: |
596 | | {{{#!bash |
597 | | setenv serverip 192.168.1.100 |
598 | | tftpboot nand_split_update.scr |
599 | | source $loadaddr |
600 | | }}} |
601 | | '''3. Configure your U-Boot environment |
602 | | From the script's usage: |
603 | | {{{ |
604 | | The following environment variables need to be set in order for this script to run: |
605 | | |
606 | | splitfile - full path file name prefix of the split files (eg file.ubi for file.ubi.part00) |
607 | | }}} |
608 | | An example configuration: |
609 | | {{{#!bash |
610 | | setenv splitfile xenial-large.ubi # ubi file from example above |
611 | | }}} |
612 | | |
613 | | '''4. Run the added script with {{{run nand_split_update}}} |
614 | | |
615 | | |
616 | | |
| 595 | [=#SplitMethod] |
| 596 | === Updating UBI with low RAM devices |
| 597 | For 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. |
| 598 | |
| 599 | To 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. |
| 600 | |
| 601 | To update using a split UBI: |
| 602 | '''1. Split your UBI |
| 603 | In some 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. |
| 604 | {{{#!bash |
| 605 | FILE=xenial-large.ubi |
| 606 | # Split file every 200M with suffix ".part" and decimal increment |
| 607 | split -d -b 200M ${FILE} ${FILE}.part |
| 608 | |
| 609 | # Result will be multiple files such as xenial-large.ubi.partXX that are <= 200M and |
| 610 | # which adhere to the naming convention required by the script (ends with .partXX in sequential order) |
| 611 | }}} |
| 612 | '''2. Install the U-Boot script |
| 613 | On the target machine, source the [http://trac.gateworks.com/raw-attachment/wiki/linux/ubi/nand_split_update.scr nand_split_update.scr] U-Boot script attached to this page (or copy its contents with an editor). For example via tftp: |
| 614 | {{{#!bash |
| 615 | setenv serverip 192.168.1.100 |
| 616 | tftpboot nand_split_update.scr |
| 617 | source $loadaddr |
| 618 | }}} |
| 619 | '''3. Configure your U-Boot environment |
| 620 | From the script's usage: |
| 621 | {{{ |
| 622 | The following environment variables need to be set in order for this script to run: |
| 623 | |
| 624 | splitfile - full path file name prefix of the split files (eg file.ubi for file.ubi.part00) |
| 625 | }}} |
| 626 | An example configuration: |
| 627 | {{{#!bash |
| 628 | setenv splitfile xenial-large.ubi # ubi file from example above |
| 629 | }}} |
| 630 | |
| 631 | '''4. Run the added script with {{{run nand_split_update}}} |
| 632 | |