lisa: add board file with script to build and flash wahoo device

Add board config file holding device and update configuration parameters.
It is used by LISA scripts to allow image rebuilding and reimaging of
the target device. External script to build and flash wahoo device is
provided.

Change-Id: I7581cdb6d475aa3206a26bd230baeeb89782b920
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan
2017-08-31 13:35:48 -07:00
parent 28ad3b196c
commit 4c4b82fdbb
2 changed files with 152 additions and 0 deletions

41
lisa/board.json Normal file
View File

@@ -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"
}
}
}

111
lisa/update-script.sh Executable file
View File

@@ -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