dfu: add 'SCRIPT' entity

Define a new 'SCRIPT' type for DFU entities. The downloaded data are
treated as simple u-boot's scripts and executed with run_command_list()
function.

Flashing the 'SCRIPT' entity might result in changing the 'dfu_alt_info'
environment variable from the flashed script, so add a global variable
for tracking the potential need to reinitialize the dfu_alt_info related
structures.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
This commit is contained in:
Marek Szyprowski
2020-12-22 11:32:22 +01:00
committed by Marek Vasut
parent b5f3405b9d
commit c533f94c10
4 changed files with 46 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ Overview:
- The access to mediums is done in DFU backends (driver/dfu)
Today the supported DFU backends are:
- MMC (RAW or FAT / EXT2 / EXT3 / EXT4 file system / SKIP)
- MMC (RAW or FAT / EXT2 / EXT3 / EXT4 file system / SKIP / SCRIPT)
- NAND
- RAM
- SF (serial flash)
@@ -92,6 +92,7 @@ Commands:
<name> fat <dev> <part_id> [mmcpart <num>] file in FAT partition
<name> ext4 <dev> <part_id> [mmcpart <num>] file in EXT4 partition
<name> skip 0 0 ignore flashed data
<name> script 0 0 execute commands in shell
with <partid> being the GPT or DOS partition index,
with <num> being the eMMC hardware partition number.
@@ -116,6 +117,20 @@ Commands:
"u-boot-<board1>.bin raw 0x80 0x800; u-boot-<board2>.bin skip 0 0"
When flashing new system image requires do some more complex things
than just writing data to the storage medium, one can use 'script'
type. Data written to such entity will be executed as a command list
in the u-boot's shell. This for example allows to re-create partition
layout and even set new dfu_alt_info for the newly created paritions.
Such script would look like:
--->8---
setenv dfu_alt_info ...
setenv mbr_parts ...
mbr write ...
--->8---
Please note that this means that user will be able to execute any
arbitrary commands just like in the u-boot's shell.
"nand" (raw slc nand device)
cmd: dfu 0 nand <dev>
each element in "dfu_alt_info" =