diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-07-31 18:34:02 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-08-31 13:05:19 +0200 |
commit | a84a74f618b0d3eadea622a45f62c9401c4f82ba (patch) | |
tree | b1b85488613c20e8ee001e388ffbedb6db4c0042 /scripts/ubinize-image.sh | |
parent | f29774bee35928d5efc09910568775bd2cecf423 (diff) | |
download | mtk-20170518-a84a74f618b0d3eadea622a45f62c9401c4f82ba.zip mtk-20170518-a84a74f618b0d3eadea622a45f62c9401c4f82ba.tar.gz mtk-20170518-a84a74f618b0d3eadea622a45f62c9401c4f82ba.tar.bz2 |
scripts/ubinize-image.sh: add support for adding custom partitions
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'scripts/ubinize-image.sh')
-rwxr-xr-x | scripts/ubinize-image.sh | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh index b87cbb4..09a00b1 100755 --- a/scripts/ubinize-image.sh +++ b/scripts/ubinize-image.sh @@ -1,5 +1,6 @@ #!/bin/sh +part="" ubootenv="" ubinize_param="" kernel="" @@ -22,6 +23,7 @@ ubivol() { name=$2 image=$3 autoresize=$4 + size="$5" echo "[$name]" echo "mode=ubi" echo "vol_id=$volid" @@ -29,6 +31,7 @@ ubivol() { echo "vol_name=$name" if [ "$image" ]; then echo "image=$image" + [ -n "$size" ] && echo "vol_size=${size}MiB" else echo "vol_size=1MiB" fi @@ -46,6 +49,22 @@ ubilayout() { ubivol $vol_id ubootenv2 vol_id=$(( $vol_id + 1 )) fi + for part in $parts; do + name="${part%%=*}" + prev="$part" + part="${part#*=}" + [ "$prev" = "$part" ] && part= + + image="${part%%=*}" + prev="$part" + part="${part#*=}" + [ "$prev" = "$part" ] && part= + + size="$part" + + ubivol $vol_id "$name" "$image" "" "$size" + vol_id=$(( $vol_id + 1 )) + done if [ "$3" ]; then ubivol $vol_id kernel "$3" vol_id=$(( $vol_id + 1 )) @@ -68,6 +87,12 @@ while [ "$1" ]; do shift continue ;; + "--part") + parts="$parts $2" + shift + shift + continue + ;; "-"*) ubinize_param="$@" break @@ -88,7 +113,7 @@ while [ "$1" ]; do done if [ ! -r "$rootfs" -o ! -r "$kernel" -a ! "$outfile" ]; then - echo "syntax: $0 [--uboot-env] [--kernel kernelimage] rootfs out [ubinize opts]" + echo "syntax: $0 [--uboot-env] [--part <name>=<file>] [--kernel kernelimage] rootfs out [ubinize opts]" exit 1 fi |