diff options
Diffstat (limited to 'target/linux/mvebu/image/gen_mvebu_sdcard_img.sh')
-rwxr-xr-x | target/linux/mvebu/image/gen_mvebu_sdcard_img.sh | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh b/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh index 63acc79f40..67416ed80c 100755 --- a/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh +++ b/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh @@ -18,21 +18,27 @@ # usage() { - echo "$0 <outfile> <bootloader> [<type_partitionN> <sectors_partitionN> <img_partitionN>]?" + echo "$0 <outfile> [<bootloader> <type_partitionN> <sectors_partitionN> <img_partitionN>]?" } -# always require first 3 arguments +# always require first 2 or 3 arguments # then in pairs up to 8 more for a total of up to 4 partitions -if [ $# -lt 2 ] || [ $# -gt 15 ] || [ $((($# - 2) % 3)) -ne 0 ]; then - usage - exit 1 +if [ $# -lt 1 ] || [ $# -gt 14 ] || [ $((($# - 1) % 3)) -ne 0 ]; then + if [ $# -lt 2 ] || [ $# -gt 15 ] || [ $((($# - 2) % 3)) -ne 0 ]; then + usage + exit 1 + else + BOOTLOADER="$2" + fi fi set -e # parameters OUTFILE="$1"; shift -BOOTLOADER="$1"; shift +if [ -n "$BOOTLOADER" ]; then + shift +fi # generate image file printf "Creating $OUTFILE from /dev/zero: " @@ -54,9 +60,11 @@ set `ptgen -o "$OUTFILE" -h $head -s $sect -l 1024 -S 0x$SIGNATURE $ptgen_args` printf "Done\n" # install bootloader -printf "Writing bootloader: " -dd of="$OUTFILE" if="$BOOTLOADER" bs=512 seek=1 conv=notrunc 2>/dev/null -printf "Done\n" +if [ -n "$BOOTLOADER" ]; then + printf "Writing bootloader: " + dd of="$OUTFILE" if="$BOOTLOADER" bs=512 seek=1 conv=notrunc 2>/dev/null + printf "Done\n" +fi i=1 while [ "$#" -ge 2 ]; do |