summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2013-01-22 18:06:25 +0000
committerRyan Harkin <ryan.harkin@linaro.org>2013-01-22 18:06:25 +0000
commit460b47fadc6764e5bc463d8b3e11d896430020c8 (patch)
tree337a6051a4f5c3d948a2d6d0710c84e4782e4560
parent8f429d068af92a2098a59397cb82ae7e9d5b782a (diff)
parentb6262b0fb334d13043380825d97b36c39628c2f9 (diff)
Merge branch 'linaro-topic-arndale' into linaro-tracking-2013.01linaro-uefi-2013.01-rc3
-rwxr-xr-xSamsungPlatformPkg/Apps/Tools/mkbl2/imgburn.sh85
1 files changed, 67 insertions, 18 deletions
diff --git a/SamsungPlatformPkg/Apps/Tools/mkbl2/imgburn.sh b/SamsungPlatformPkg/Apps/Tools/mkbl2/imgburn.sh
index 0cdf3eead9..dee12604aa 100755
--- a/SamsungPlatformPkg/Apps/Tools/mkbl2/imgburn.sh
+++ b/SamsungPlatformPkg/Apps/Tools/mkbl2/imgburn.sh
@@ -1,15 +1,68 @@
#!/bin/bash
-
+# set the default image filename, this can be overwritten by a parameter
IMAGE=../../../../Build/Arndale-Exynos/DEBUG_ARMLINUXGCC/FV/ARNDALE_EFI.fd
-if [ $# -ne 2 ]
+# set the default SoC, this can be overwritten by a parameter
+SOC=5250
+
+function usage
+{
+ echo "Usage: $0"
+ echo " --disk path to the SD card device to write to, eg /dev/sdd"
+ echo " This can be found by looking at dmesg output"
+ echo " --image The image to write to the SD card"
+ echo " This defaults to:"
+ echo " $IMAGE"
+ echo " --soc Which SoC we are using"
+ echo " This defaults to: 5250"
+}
+
+while [ "$1" != "" ]; do
+ case $1 in
+ -s | --soc )
+ shift
+ SOC=$1
+ ;;
+
+ -d | --disk )
+ shift
+ DISK=$1
+ ;;
+
+ -i | --image )
+ shift
+ IMAGE=$1
+ ;;
+
+ /h | /? | -? | -h | --help )
+ usage
+ exit
+ ;;
+ -* )
+ usage
+ echo "unknown arg $1"
+ exit 1
+ esac
+ shift
+done
+
+echo "Config:"
+echo "IMAGE $IMAGE"
+echo "SoC $SOC"
+echo "DISK $DISK"
+
+
+if [ ! -b "$DISK" ]
+then
+ echo "You must specify a valid --disk option"
+ exit 1
+fi
+
+if [ ! -f $IMAGE ]
then
echo ""
- echo "ERROR: Not input parameter for making image"
- echo ""
- echo "USAGE:"
- echo " sudo ./imgburn.sh 5250 /dev/sdb"
+ echo "ERROR: UEFI image $IMAGE does not exist.."
echo ""
exit
fi
@@ -21,25 +74,21 @@ then
fi
# make BL2
-if [ -f $IMAGE ]
+./mkbl2 $IMAGE
+
+if [ ! -f fwbl2.bin ]
then
- ./mkbl2 $IMAGE
- echo "BL2 image is created."
- echo ""
- echo ":::: You SHOULD check platform of ARNDALE_EFI.fd"
- echo ""
-else
echo ""
- echo "ERROR: UEFI is not built.."
+ echo "ERROR: Failed to create BL2 image."
echo ""
exit
fi
# select platform
-if [ "$1" = "5250" ]
+if [ "$SOC" = "5250" ]
then
# write BL1
- dd if=./5250/fwbl1_5250.bin of=$2 seek=1 count=16
+ dd if=./5250/fwbl1_5250.bin of=$DISK seek=1 count=16
else
echo ""
echo "ERROR: Please select platform.."
@@ -49,9 +98,9 @@ fi
# write BL2
-dd if=./fwbl2.bin of=$2 seek=17 count=32
+dd if=./fwbl2.bin of=$DISK seek=17 count=32
# write bootloader file e.g. u-boot or UEFI firmware image
-dd if=$IMAGE of=$2 seek=49
+dd if=$IMAGE of=$DISK seek=49
sync