summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2017-04-28 01:02:42 (GMT)
committerRobert Foss <robert.foss@collabora.com>2017-04-28 01:18:10 (GMT)
commit389acc58e77d2284734746923a7164198066d1ab (patch)
tree5e2adba3770e5114dd8f149830e5f3062b202bcc
parent3998dc8d21afe54b9c2c019020fca02d1a573ee0 (diff)
downloadrdu2-389acc58e77d2284734746923a7164198066d1ab.tar.gz
rdu2-389acc58e77d2284734746923a7164198066d1ab.tar.xz
Added support for -b option to specify block device
-rwxr-xr-xbuild_android.sh30
-rwxr-xr-xsetup_sdcard.sh35
2 files changed, 64 insertions, 1 deletions
diff --git a/build_android.sh b/build_android.sh
index 7122893..ca9c824 100755
--- a/build_android.sh
+++ b/build_android.sh
@@ -15,6 +15,35 @@ PATH="$UBOOT_TOOLS/:$PATH"
CPU_CORES=$(nproc --ignore=1)
BLK_DEV=/dev/mmcblk0
+print_help()
+{
+ echo ""
+ echo "$ ./build_android.sh [option]"
+ echo ""
+ echo "Options:"
+ echo "-b [device] -- Create bootable image on device, default /dev/mmcblk0"
+ echo ""
+
+ exit 1
+}
+
+parse_args()
+{
+ while getopts "b:" opt
+ do
+ case "$opt" in
+ b)
+ BLK_DEV=$OPTARG
+ [[ -a "${BLK_DEV}" ]] || print_help
+ export BLK_DEV
+ ;;
+ *)
+ print_help
+ ;;
+ esac
+ done
+ shift $((OPTIND-1))
+}
help_mmc()
{
@@ -183,6 +212,7 @@ build_android()
}
+parse_args $@ && \
cd $PROJECT_PATH && \
build_kernel && \
build_android && \
diff --git a/setup_sdcard.sh b/setup_sdcard.sh
index f016f4c..9c040ff 100755
--- a/setup_sdcard.sh
+++ b/setup_sdcard.sh
@@ -2,9 +2,42 @@
DEV=${1:-"/dev/mmcblk0"}
+
+print_help()
+{
+ echo ""
+ echo "$ ./setup_sdcard.sh [option]"
+ echo ""
+ echo "Options:"
+ echo "-b [device] -- Create bootable image on device, default /dev/mmcblk0"
+ echo ""
+
+ exit 1
+}
+
+parse_args()
+{
+ while getopts "b:" opt
+ do
+ case "$opt" in
+ b)
+ DEV=$OPTARG
+ [[ -a "${DEV}" ]] || print_help
+ export DEV
+ ;;
+ *)
+ print_help
+ ;;
+ esac
+ done
+ shift $((OPTIND-1))
+}
+
+parse_args
+
if ! [[ -a $DEV ]]; then
echo "No valid device found, \"${DEV}\" is not valid"
- exit 1
+ print_help
fi
sudo umount ${DEV}*