summaryrefslogtreecommitdiff
path: root/polux/tools/makeflash
diff options
context:
space:
mode:
authorJérémy Dufour2012-11-22 17:13:43 +0100
committerJérémy Dufour2012-11-22 17:27:15 +0100
commit7724b3be5f3a84de5eddc3ee84849035cadd90e5 (patch)
tree27b13059c03172e97de99f55b7e40c969dc1fe7f /polux/tools/makeflash
parent491c5a2b40aa16174de6f7d651768c1a45d08036 (diff)
polux/tools/makeflash: create dynamically dd commands, refs #3536
Diffstat (limited to 'polux/tools/makeflash')
-rwxr-xr-xpolux/tools/makeflash/makeflash.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/polux/tools/makeflash/makeflash.sh b/polux/tools/makeflash/makeflash.sh
index 27ab181e2c..74774f5be7 100755
--- a/polux/tools/makeflash/makeflash.sh
+++ b/polux/tools/makeflash/makeflash.sh
@@ -6,14 +6,22 @@ then
exit
fi
+declare -A IMAGES
+
OUTPUT=$1
-BOOTLOADER=$2
-NVRAM=$3
-JFFS=$4
-IMAGE=$5
+IMAGES[file_boot]="$2"
+IMAGES[spc200_boot]="64"
+IMAGES[file_nvram]="$3"
+IMAGES[spc200_nvram]="64"
+IMAGES[file_userfs]="$4"
+IMAGES[spc200_userfs]="512"
+IMAGES[file_image]="$5"
+IMAGES[spc200_image]="1728"
touch "$OUTPUT"
-dd if="$BOOTLOADER" of="$OUTPUT" seek="0"
-dd if="$NVRAM" of="$OUTPUT" bs="1024" seek="64"
-dd if="$JFFS" of="$OUTPUT" bs="1024" seek="128"
-dd if="$IMAGE" of="$OUTPUT" bs="1024" seek="640"
+offset=$((0))
+for IMAGE in "boot" "nvram" "userfs" "image"
+do
+ dd if="${IMAGES[file_$IMAGE]}" of="$OUTPUT" bs="1024" seek="$offset"
+ offset=$(($offset+${IMAGES[spc200_$IMAGE]}))
+done