-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve compilation speed for android build
Currently FFTF python script is used for creating flashfiles.zip. It uses ZipWrite python api which is time consuming and adds overhead to build time. Say, flash.json generation, unpacking of target files, installer.cmd generation, etc. This fix helps to optimize build time and involves below changes: - Use tar + pigz combo for faster flashfiles generation. - Make FFTF a bash script as python doesn't directly support tar + pigz - This new bash script will support old python FFTF. Just pass LEGACY_FLASHZIP_TRUE=true flag to "make flashfiles" to enable it. - The new script still supports all old functionalities, say, generation of installer.cmd, flash.json, repacking of bootloader.img, etc. Tracked-On: OAM-112083 Signed-off-by: sgnanase <[email protected]>
- Loading branch information
1 parent
9489d80
commit 6653ba4
Showing
3 changed files
with
149 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
echo "========================" | ||
echo "Preparing flashfiles - New Method" | ||
echo "No more Zip. We use tar + pigz" | ||
echo "========================" | ||
|
||
|
||
## PRE-REQUISITE | ||
flashfile=`basename $1` | ||
flashfile_dir=`echo $flashfile | sed 's/\.tar\.gz//g'` | ||
PRODUCT_OUT=`dirname $1` | ||
VARIANT=`grep -i "ro.system.build.type=" $PRODUCT_OUT/system/build.prop | cut -d '=' -f2` | ||
TARGET=`grep -i "ro.build.product=" $PRODUCT_OUT/system/build.prop | cut -d '=' -f2` | ||
ANDROID_ROOT=${PWD} | ||
|
||
echo "========================" | ||
echo "Images / Files to be packed" | ||
echo "========================" | ||
IMAGES_TUPLE=`./device/intel/build/releasetools/flash_cmd_generator.py device/intel/project-celadon/$TARGET/flashfiles.ini $TARGET $VARIANT | tail -1` | ||
c=-2 | ||
for i in $IMAGES_TUPLE | ||
do | ||
if [[ $c -gt 0 && `expr $c % 2` == 1 ]]; then | ||
i=`echo ${i::-3} | sed "s/'//g"` | ||
echo $i | ||
j="$j $i" | ||
fi | ||
c=$((c+1)) | ||
done | ||
|
||
IMAGES=`echo $j | xargs -n1 | sort -u` | ||
echo "========================" | ||
echo "Generating Tar ..." | ||
echo "========================" | ||
cd $PRODUCT_OUT | ||
rm -rf $flashfile_dir | ||
mkdir $flashfile_dir | ||
|
||
for i in $IMAGES | ||
do | ||
echo "Adding $i" | ||
if [[ $i == "super.img" ]]; then | ||
SUPER_IMG=true | ||
cp ./obj/PACKAGING/super.img_intermediates/super.img $flashfile_dir/. | ||
else | ||
if [[ $i == "installer.efi" ]]; then | ||
cp efi/installer.efi $flashfile_dir/. | ||
else | ||
if [[ $i == "startup.nsh" ]]; then | ||
cp efi/startup.nsh $flashfile_dir/. | ||
else | ||
if [[ $i == "bootloader.img" ]]; then | ||
cd $ANDROID_ROOT | ||
device/intel/build/releasetools/bootloader_from_target_files $PRODUCT_OUT/obj/PACKAGING/target_files_intermediates/$TARGET-target_files-*/ $PRODUCT_OUT/$flashfile_dir/bootloader.img | ||
cd - | ||
else | ||
if [[ $i == "system.img" || $i == "odm.img" || $i == "vbmeta.img" || $i == "vendor_boot.img" ]]; then | ||
cp obj/PACKAGING/target_files_intermediates/$TARGET-target_files-*/IMAGES/$i $flashfile_dir/. | ||
else | ||
cp $i $flashfile_dir/. | ||
fi | ||
fi | ||
fi | ||
fi | ||
fi | ||
done | ||
|
||
cd $ANDROID_ROOT | ||
echo "========================" | ||
echo "Generate installer.cmd" | ||
echo "========================" | ||
device/intel/build/releasetools/flash_cmd_generator.py device/intel/project-celadon/$TARGET/flashfiles.ini $TARGET $VARIANT | sed '$d' | sed '$d' | sed -n '/installer.cmd/,$p' | sed '1d' > $PRODUCT_OUT/$flashfile_dir/installer.cmd | ||
sed -i 's/flash super super.img/flash super super.img.part00 super.img.part01/g' $PRODUCT_OUT/$flashfile_dir/installer.cmd | ||
|
||
echo "========================" | ||
echo "Generate flash.json" | ||
echo "========================" | ||
device/intel/build/releasetools/flash_cmd_generator.py device/intel/project-celadon/$TARGET/flashfiles.ini $TARGET $VARIANT | sed -n '/installer.cmd/q;p' | sed '1d' > $PRODUCT_OUT/$flashfile_dir/flash.json | ||
|
||
if [[ $SUPER_IMG == "true" ]]; then | ||
cd $PRODUCT_OUT | ||
rm -f $flashfile_dir/system.img $flashfile_dir/vendor.img $flashfile_dir/product.img | ||
fi | ||
|
||
tar -cvf - $flashfile_dir/ | /usr/bin/pigz > $flashfile | ||
|
||
echo "========================" | ||
echo "Flashfiles Tar created" | ||
echo "========================" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters