forked from projectceladon/device-intel-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastboot-test-prepare
executable file
·83 lines (67 loc) · 2.17 KB
/
fastboot-test-prepare
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Bail on any errors
set -e
if [ -z "$ANDROID_BUILD_TOP" ]; then
echo "Run lunch first!"
exit 1
fi
function usage {
echo "Usage:"
echo
echo " fastboot-test-prepare <path to TFP zip file> [-V <variant>]"
echo " Generate a set of images from a target-files-package to use during testing"
echo
echo "Valid options:"
echo "-V <variant>: Device variant for IRDA builds"
echo "-M <mv_config_type>: MV configuration type for Sofia builds"
}
if [[ -z "$1" ]]; then
usage
exit 1
fi
export tfp=$1
shift $((OPTIND))
export IRDA_VARIANT=
export MV_CONFIG_TYPE=
while getopts "V:M:" opt; do
case $opt in
V)
export IRDA_VARIANT="--variant $OPTARG"
;;
M)
export MV_CONFIG_TYPE="-M $OPTARG"
;;
\?)
usage
exit 1
;;
esac
done
pushd $ANDROID_BUILD_TOP &> /dev/null
rm -rf fastboot
mkdir fastboot
cp $tfp fastboot/tfp.zip
make clean
make -j16 fastboot otatools
./build/tools/releasetools/img_from_target_files --verbose fastboot/tfp.zip fastboot/update.zip
./device/intel/build/releasetools/flashfiles_from_target_files --verbose $IRDA_VARIANT $MV_CONFIG_TYPE fastboot/tfp.zip fastboot/flashfiles.zip
unzip fastboot/flashfiles.zip -d fastboot/
# if .fls files are found extract fastboot images out of them
for file in fastboot/*.fls
do
dirname=${file%.fls}
filename_signed=${dirname##*/}
filename=${filename_signed%_signed}
./device/intel-imc/common/tools/FlsTool -o ${dirname} -x $file
cp ${dirname}/${filename}.*_LoadMap0.bin fastboot/${filename}.img
rm -rf ${dirname} $file
done
simg2img fastboot/system.img fastboot/unsparse.img
# if sofia bootloader image is found do not try to generate it
if [ ! -e fastboot/fwu_image.img ]; then
./device/intel/build/releasetools/bootloader_from_target_files --bootable --verbose fastboot/tfp.zip fastboot/fastboot-usb.zip
fi
cp device/intel/build/testkeys/oem.pk8 fastboot/oem.pk8
cp device/intel/build/testkeys/oem.x509.pem fastboot/oem.x509.pem
openssl rsa -pubout -inform DER -outform DER -in device/intel/build/testkeys/production-test/verity.pk8 -out fastboot/verity.pub
popd