From 577e95fce5470b855c6e46540fe041b2de80aa1e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 2 Sep 2020 04:46:11 +0300 Subject: kflash: Add argument to select which partitions to flash The --partitions argument can be used to select which partitions to flash. By default kflash will flash all partitions defined in the platform file. Signed-off-by: Laurent Pinchart --- kflash.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kflash.sh b/kflash.sh index 92ca9dd..448006f 100755 --- a/kflash.sh +++ b/kflash.sh @@ -18,6 +18,7 @@ fi # dry_run=0 +partitions= silent=0 sudo=sudo @@ -30,6 +31,10 @@ while [[ $# != 0 ]] ; do dry_run=1 sudo=echo ;; + --partitions) + partitions=($1) + shift + ;; --silent) silent=1 ;; @@ -112,7 +117,11 @@ fi # Validate the partition names and paths # -for part_name in ${!flash_parts[@]} ; do +if [[ ! $partitions ]] ; then + partitions=(${!flash_parts[@]}) +fi + +for part_name in ${partitions[@]} ; do case $part_name in dt|kernel|modules) ;; @@ -228,7 +237,7 @@ fi # Flash # -for part_name in ${!flash_parts[@]} ; do +for part_name in ${partitions[@]} ; do IFS=";" read -ra flash_part <<< "${flash_parts[$part_name]}" part_idx=${flash_part[0]} @@ -278,7 +287,7 @@ flash_fs() { ${sudo} umount "$flash_mount_point" } -for part_name in ${!flash_parts[@]} ; do +for part_name in ${partitions[@]} ; do IFS=";" read -ra flash_part <<< "${flash_parts[$part_name]}" part_idx=${flash_part[0]} part_path=${flash_part[2]} -- cgit v1.2.3