summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-07-18 18:34:03 +0200
committerRobert Foss <robert.foss@collabora.com>2017-07-19 19:06:57 +0200
commit7fab7d667e903e00a688c4fe754f1e956f0c959a (patch)
treea0ede0b3dda8d480d89d715e295d2ea836139647
parent1458b61fc90ed9de1c72dca9835af8baf074e8a4 (diff)
downloadandroid-etnaviv-android-etnaviv-network.tar.gz
android-etnaviv-android-etnaviv-network.tar.xz
build: allow just building kernel and/or aospandroid-etnaviv-network
-rwxr-xr-xbuild_android.sh59
1 files changed, 40 insertions, 19 deletions
diff --git a/build_android.sh b/build_android.sh
index 6c79e54..2647547 100755
--- a/build_android.sh
+++ b/build_android.sh
@@ -15,6 +15,9 @@ IMX6_DEVBOARDS=$(find $LINUX_BOOT -name "imx6q*.dts" | sort | sed 's=.*/==' | se
UBOOT_DEVBOARDS="imx6q-sabrelite imx6q-sabresd imx6qp-sabresd"
DEVBOARD=""
+DO_BUILD_KERNEL=0
+DO_BUILD_AOSP=0
+DO_FLASH=0
print_devboards()
{
@@ -34,8 +37,12 @@ print_help()
echo "$ ./build_android.sh [option]"
echo ""
echo "Options:"
- echo "-b [device] -- Create bootable image on device, default /dev/mmcblk0"
- echo "-d [devboard] -- Set the imx6q board type"
+ echo "-d [devboard] -- Set the imx6q board type (required)"
+ echo ""
+ echo "Actions:"
+ echo "-k -- Build kernel"
+ echo "-a -- Build AOSP"
+ echo "-b [device] -- Build everything and create bootable image on device"
echo ""
if [ ! -z ${2+x} ]; then
@@ -88,18 +95,25 @@ devboard_is_valid()
parse_args()
{
- while getopts ":b:d:" opt;
+ while getopts ":kab:d:" opt;
do
- case "$opt" in
- b)
- mmc_is_valid $OPTARG || print_help "Invalid valid MMC supplied!"
+ case "$opt" in
+ k)
+ DO_BUILD_KERNEL=1
+ ;;
+ a)
+ DO_BUILD_AOSP=1
+ ;;
+ b)
+ DO_BUILD_KERNEL=1
+ DO_BUILD_AOSP=1
+ DO_FLASH=1
+ mmc_is_valid $OPTARG || print_help "Invalid MMC supplied!"
BLK_DEV=$OPTARG
- export BLK_DEV
;;
d)
- devboard_is_valid $OPTARG || print_help "Invalid ($OPTARG) valid devboard supplied!" "$(print_devboards)"
+ devboard_is_valid $OPTARG || print_help "Invalid ($OPTARG) devboard supplied!" "$(print_devboards)"
DEVBOARD=$OPTARG
- export DEVBOARD
;;
*)
echo "*)"
@@ -109,7 +123,13 @@ parse_args()
done
shift $((OPTIND-1))
- devboard_is_valid $DEVBOARD || print_help "No valid devboard supplied!" "$(print_devboards)"
+ [ -n "$DEVBOARD" ] || print_help "No devboard supplied!"
+
+ [ $DO_BUILD_KERNEL -eq 1 ] || [ $DO_BUILD_AOSP -eq 1 ] || [ $DO_FLASH -eq 1 ] || print_help "No action specified!"
+
+ [ $DO_BUILD_KERNEL -eq 1 ] && echo "requested to build kernel..."
+ [ $DO_BUILD_AOSP -eq 1 ] && echo "requested to build AOSP..."
+ [ $DO_FLASH -eq 1 ] && echo "requested to flash..."
}
flash_uboot()
@@ -137,7 +157,7 @@ flash_uboot()
flash_kernel_mmc()
{
mmc_is_valid || return
- print_header "Copying zImage & dtb to mmc"
+ print_header "Copying zImage & dtb to mmc"
TMPDIR=$(mktemp -d)
ME=$(whoami)
@@ -177,7 +197,6 @@ build_kernel()
make -j$CPU_CORES olddefconfig zImage dtbs
}
-
flash_android_mmc()
{
mmc_is_valid || return
@@ -239,13 +258,15 @@ do_flash_uboot()
return 1
}
-parse_args $@ && \
-cd $PROJECT_PATH && \
-build_kernel && \
-flash_kernel && \
-build_android && \
-flash_android
+parse_args $@
+cd $PROJECT_PATH
-do_flash_uboot && flash_uboot
+[ $DO_BUILD_KERNEL -eq 0 ] || build_kernel || exit 1
+[ $DO_BUILD_AOSP -eq 0 ] || build_android || exit 1
+
+[ $DO_FLASH -eq 1 ] && {
+ flash_kernel && flash_android || exit 1
+ do_flash_uboot && flash_uboot || exit 1
+}
exit 0