summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChris Cosby <cosbyc@cisco.com>2010-07-16 16:28:46 -0400
committerSteve Kondik <shade@chemlab.org>2010-07-16 16:38:37 -0400
commit98383563b0a1f8c9136c49f8289ae8fc0ec0d68e (patch)
treef0187fe98efcf5637b3b26a49abd522e5cef7bd4 /tools
parent890a21755fa32c6b18155fd973cde73f5e0df4c1 (diff)
downloadvendor_replicant-98383563b0a1f8c9136c49f8289ae8fc0ec0d68e.zip
vendor_replicant-98383563b0a1f8c9136c49f8289ae8fc0ec0d68e.tar.gz
vendor_replicant-98383563b0a1f8c9136c49f8289ae8fc0ec0d68e.tar.bz2
Make squisher create the squashfs correctly for Dream/Sapphire devices.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/squisher50
1 files changed, 29 insertions, 21 deletions
diff --git a/tools/squisher b/tools/squisher
index d06db57..797ccdc 100755
--- a/tools/squisher
+++ b/tools/squisher
@@ -4,7 +4,7 @@
# cyanogen
#
-OUT_TARGET_HOST=$(uname -a | grep Darwin)
+OUT_TARGET_HOST=`uname -a | grep Darwin`
if [ -z "$OUT_TARGET_HOST" ]
then
OUT_TARGET_HOST=linux-x86
@@ -60,7 +60,6 @@ if [ "$WANT_SQUASHFS" -eq 1 ]; then
fi
REPACK=$OUT/repack.d
-SYSTEM=$REPACK/ota/system
printf "Sanitizing environment..."
rm -rf $REPACK
mkdir -p $REPACK
@@ -83,22 +82,30 @@ for i in *.apk; do $OPTICHARGER $i; done
if [ "$WANT_SQUASHFS" -eq 1 ]; then
squash_opts="-force-uid 1000 -force-gid 1000 -no-progress -noappend -no-exports -no-recovery"
-
- # Create the xbin squashfs
- cp -a $SYSTEM/xbin $REPACK/xbin/
- rm -f $REPACK/xbin/su
- chmod -R 555 $REPACK/xbin/*
- ln -s ../bin/su $REPACK/xbin/su
-
- # Relocate su and put xbin.sqf where it belongs
- rm -f $SYSTEM/bin/su
- mv $SYSTEM/xbin/su $SYSTEM/bin/su
- rm -rf $SYSTEM/xbin/*
- mksquashfs $REPACK/xbin/* $SYSTEM/xbin/xbin.sqf $squash_opts
- chmod 444 $SYSTEM/xbin/xbin.sqf
+ updater=$REPACK/ota/META-INF/com/google/android/updater-script
+
+ # Relocate su
+ cp -a $REPACK/ota/system/xbin $REPACK/_xbin/
+ rm -f $REPACK/_xbin/su $REPACK/ota/system/bin/su
+ mv $REPACK/ota/system/xbin/su $REPACK/ota/system/bin/su
+ chmod -R 555 $REPACK/_xbin/*
+
+ # Create symlinks for su and busybox (since updater-script can't work on the squashfs filesystem).
+ # Forgive me for the regex hell here.
+ ln -s ../bin/su $REPACK/_xbin/su
+ for link in `sed -n -e's/,//g' -e'/symlink(.*busybox/,/xbin.*);/p' $updater | tr '"' '\n' | sed -n -e'\,/system/xbin/,s,/system/xbin/,,p'`
+ do
+ ln -s busybox $REPACK/_xbin/$link
+ done
+
+ # Create the squashfs with new and improved symlinkage!
+ mksquashfs $REPACK/_xbin/* $REPACK/_xbin.sqf $squash_opts
+ rm -rf $REPACK/ota/system/xbin/*
+ mv $REPACK/_xbin.sqf $REPACK/ota/system/xbin/xbin.sqf
+ chmod 444 $REPACK/ota/system/xbin/xbin.sqf
# Remove xbin stuff and fix up updater-script
- sed -i -e's,system/xbin/su,system/bin/su,g' -e'/xbin/d' $REPACK/ota/META-INF/com/google/android/updater-script
+ sed -i -e's,system/xbin/su,system/bin/su,g' -e'/xbin/d' $updater
fi
@@ -106,26 +113,26 @@ fi
sed -i \
-e '/ro\.kernel\.android\.checkjni/d' \
-e '/ro\.build\.type/s/eng/user/' \
- $SYSTEM/build.prop
+ $REPACK/ota/system/build.prop
# Delete unnecessary binaries
-( cd $SYSTEM/bin; echo $DELETE_BINS | xargs rm -f; )
+( cd $REPACK/ota/system/bin; echo $DELETE_BINS | xargs rm -f; )
# Delete leftover wireless driver
-rm -rf $SYSTEM/lib/modules/*/kernel/drivers/net
+rm -rf $REPACK/ota/system/lib/modules/*/kernel/drivers/net
# No need for recovery
rm -rf $REPACK/ota/recovery
# Strip modules
-find $SYSTEM/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded
+find $REPACK/ota/system/lib/modules -name "*.ko" -print0 | xargs -0 arm-eabi-strip --strip-unneeded
# Determine what to name the new signed package
if [ -z "$CYANOGEN_NIGHTLY" ]; then
OUTFILE=$OUT/update-squished.zip
else
- MODVERSION=`sed -n -e'/ro\.modversion/s/^.*CyanogenMod-//p' $SYSTEM/build.prop`
+ MODVERSION=`sed -n -e'/ro\.modversion/s/^.*CyanogenMod-//p' $REPACK/ota/system/build.prop`
: ${MODVERSION:=nightly}
OUTFILE=$OUT/update-cm-$MODVERSION-signed.zip
fi
@@ -145,6 +152,7 @@ printf "Cleaning up..."
rm -rf $REPACK
echo
+# Create a md5 checksum image of the repacked package
(
img=`basename $OUTFILE`
cd `dirname $OUTFILE`