diff --git a/lisa/board.json b/lisa/board.json new file mode 100644 index 000000000..65d7777c7 --- /dev/null +++ b/lisa/board.json @@ -0,0 +1,41 @@ +{ + "board" : { + "cores" : [ + "a53", "a53", "a53", "a53", + "a72", "a72", "a72", "a72" + ], + "big_core" : "a72", + "modules" : ["bl", "cpufreq"] + }, + "nrg_model" : { + "little" : { + "cpu" : { + "nrg_max" : 201, + "cap_max" : 438 + }, + "cluster" : { + "nrg_max" : 66 + } + }, + "big": { + "cpu" : { + "nrg_max" : 1138, + "cap_max" : 1024 + }, + "cluster" : { + "nrg_max" : 203 + } + } + }, + + "update-config" : { + "kernel" : { + "build-script" : "update-script.sh kernel build", + "flash-script" : "update-script.sh kernel flash" + }, + "all" : { + "build-script" : "update-script.sh all build", + "flash-script" : "update-script.sh all flash" + } + } +} diff --git a/lisa/update-script.sh b/lisa/update-script.sh new file mode 100755 index 000000000..6255dae71 --- /dev/null +++ b/lisa/update-script.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +build_kernel() { + echo "==========Building kernel image==========" + cd $ANDROID_BUILD_TOP + source build/envsetup.sh + lunch walleye-userdebug + cd $LOCAL_KERNEL_HOME + . ./build.config + make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${DEFCONFIG} + make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -j32 + cp $LOCAL_KERNEL_HOME/arch/arm64/boot/Image.lz4-dtb arch/arm64/boot/dtbo.img `find . -name '*.ko'` $ANDROID_BUILD_TOP/device/google/wahoo-kernel +} + +build_image() { + cd $ANDROID_BUILD_TOP + source build/envsetup.sh + lunch walleye-userdebug + if [ "$1" = "bootimage" ]; then + echo "==========Building bootimage==========" + make -j32 vendorimage-nodeps + make -j32 vbmetaimage-nodeps + make -j32 bootimage + else + echo "==========Building complete image==========" + make -j32 + fi +} + +wait_for_fastboot() { + # wait for device to enter fastboot, max wait is 200secs + local i=0 + while [ $i -lt 100 ] + do + if [ -n "`fastboot devices`" ]; then + break + else + sleep 2 + i=$((i+1)) + fi + done +} + +flash_android() { + # reboot the device if it's online + if [ "`adb devices`" != "List of devices attached" ]; then + echo "==========Rebooting the device into fastboot==========" + adb reboot bootloader + fi + + echo "==========Waiting for device to enter fastboot==========" + wait_for_fastboot + + if [ -z "`fastboot devices`" ]; then + echo "==========Device failed to enter fastboot==========" + exit + fi + + # flash the device + if [ "$1" = "bootimage" ]; then + echo "==========Flashing bootimage==========" + fastboot flash vbmeta + fastboot flash vendor + fastboot flash boot + fastboot reboot + else + echo "==========Flashing complete image==========" + fastboot flashall + fi + + echo "==========Waiting for device to come online==========" + # wait for device to boot + adb wait-for-device +} + +# check input parameters +if [ "$1" != "kernel" ] && [ "$1" != "all" ]; then + echo "First parameter \"$1\" is invalid. Should be \"kernel\" or \"all\"." + exit +fi + +if [ "$2" != "build" ] && [ "$2" != "flash" ]; then + echo "Second parameter \"$2\" is invalid. Should be \"build\" or \"flash\"." + exit +fi + +if [ -z "$ANDROID_BUILD_TOP" ]; then + echo "ANDROID_BUILD_TOP environment variable is not set." + exit +fi + +if [ -z "$LOCAL_KERNEL_HOME" ]; then + echo "LOCAL_KERNEL_HOME environment variable is not set." + exit +fi + +if [ "$2" = "build" ]; then + build_kernel + if [ "$1" = "kernel" ]; then + build_image bootimage + else + build_image + fi +else + if [ "$1" = "kernel" ]; then + flash_android bootimage + else + flash_android + fi +fi +