summaryrefslogtreecommitdiff
path: root/SamsungPlatformPkg
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2013-01-18 18:09:29 +0000
committerRyan Harkin <ryan.harkin@linaro.org>2013-09-17 18:27:56 +0100
commitb7fac5c54e3f017d3dcc2ab0def53dc8233bdabd (patch)
tree3932b8a8cbd8efbaef35fb2cdd86da9cfd3e6d2f /SamsungPlatformPkg
parent75bd829a3b542ceb3858d9189b087e0d8fd50b71 (diff)
Samsung/Arndale: imgburn.sh: add parameters and defaults
Add parameters and some sensible defaults to imgburn.sh. The old imgburn.sh took 2 parameters but didn't allow the user to specify the image location. Now, the simplest command form is: ./imgburn --disk /dev/sdX However, other options exist, eg: ./imgburn.sh --disk /dev/sdX --soc 5250 --image filename.fd The default SoC is 5250. The default image is ARNDALE_EFI.fd, with the assumption that we are in uefi-next tree. Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Diffstat (limited to 'SamsungPlatformPkg')
-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 0cdf3eead..dee12604a 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