Skip to content

Commit

Permalink
squisher: Get rid of it.
Browse files Browse the repository at this point in the history
The pngcrush tool does not add any noticeable value any more, such that it justifies the extra build time: 240MB vs 238MB.
The build.prop changes are now no ops, since the key for ro.kernel.android.checkjni no longer exists.
Changing the ro.build.type from eng to user is also a no op, since CM is now userdebug.
Deleting bins is also unncessary now.
Stripping modules is also unnecessary now. (plenty of space)

At this point, I think we can just symlink $OUTFILE to $OTAPACKAGE, and not even bother
with a copy.

Change-Id: I431ac6425dedb6cd02eb2d31fc9ff82b49df9f50
  • Loading branch information
koush committed Dec 22, 2012
1 parent 129989b commit 6ed2e1b
Showing 1 changed file with 5 additions and 73 deletions.
78 changes: 5 additions & 73 deletions tools/squisher
Original file line number Diff line number Diff line change
Expand Up @@ -30,81 +30,13 @@ if [ ! -f "$OTAPACKAGE" ]; then
exit 1
fi

OPTICHARGER=$ANDROID_BUILD_TOP/vendor/cm/tools/opticharger
QUIET=-q
DELETE_BINS="applypatch applypatch_static check_prereq recovery updater"

REPACK=$OUT/repack.d
printf "Sanitizing environment..."
rm -rf $REPACK
mkdir -p $REPACK
echo


# Unpack the otapackage and opticharge all apks
mkdir $REPACK/ota
(
cd $REPACK/ota
printf "Unpacking $OTAPACKAGE..."
unzip $QUIET $OTAPACKAGE
echo

# Move all apks to the same directory so xargs can
# use also with framework-res.apk. This allow process
# framework-res.apk in parallel with other apks
mkdir -p $REPACK/parallel
cd $REPACK/parallel
cp $REPACK/ota/system/framework/framework-res.apk .
cp $REPACK/ota/system/app/*.apk .

# Do optimization in parallel
find ./ -name \*.apk | $XARGS $OPTICHARGER

# Move optimized apks to repack directory
mv -f $REPACK/parallel/framework-res.apk $REPACK/ota/system/framework/framework-res.apk
mv -f $REPACK/parallel/*.apk $REPACK/ota/system/app/

# Return to directory
cd $REPACK/ota
rm -rf $REPACK/parallel
)

# Fix build.prop
$SED -i \
-e '/ro\.kernel\.android\.checkjni/d' \
-e '/ro\.build\.type/s/eng/user/' \
$REPACK/ota/system/build.prop


# Delete unnecessary binaries
( cd $REPACK/ota/system/bin; echo $DELETE_BINS | xargs rm -f; )

# No need for recovery
rm -rf $REPACK/ota/recovery

# Strip modules
[ -d $REPACK/ota/system/lib/modules ] && \
find $REPACK/ota/system/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded

# Determine what to name the new signed package
MODVERSION=`sed -n -e'/ro\.cm\.version/s/^.*=//p' $REPACK/ota/system/build.prop`
OUTFILE=$OUT/cm-$MODVERSION.zip
# Determine what to name the new package
MODVERSION=`sed -n -e'/ro\.cm\.version/s/^.*=//p' $OUT/system/build.prop`
echo -e $CL_CYN"MODVERSION: $MODVERSION"$CL_RST
OUTFILE=$OUT/cm-$MODVERSION.zip

# Pack it up and sign
printf "Zipping package..."
( cd $REPACK/ota; zip $QUIET -r $REPACK/update.zip . )
echo
printf "Signing package..."
SECURITYDIR=$ANDROID_BUILD_TOP/build/target/product/security
java -Xmx1024m \
-jar $OUT/../../../host/$OUT_TARGET_HOST/framework/signapk.jar \
-w $SECURITYDIR/testkey.x509.pem $SECURITYDIR/testkey.pk8 \
$REPACK/update.zip $OUTFILE
echo
printf "Cleaning up..."
rm -rf $REPACK
echo
cp $OTAPACKAGE $OUTFILE.tmp
mv $OUTFILE.tmp $OUTFILE

# Create a md5 checksum image of the repacked package
(
Expand Down

0 comments on commit 6ed2e1b

Please sign in to comment.