-
Notifications
You must be signed in to change notification settings - Fork 50
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 - Add use_tar=true flag to "make flashfiles" to enable it. e,g, "make flashfiles -j<N> use_tar=true" - 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]> Signed-off-by: Chen, Gang G <[email protected]>
- Loading branch information
1 parent
27fc3a1
commit 2c201f9
Showing
3 changed files
with
158 additions
and
32 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,83 @@ | ||
#!/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 == "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 | ||
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 $PRODUCT_OUT/$flashfile_dir/$flashfile 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