Every time that I make a kernel adjustment, I have to zip the boot image into a zip file with several other files to make a flash-able zip for my phone. While this is not tremendously laborious, every time I make a kernel adjustment I am also compiling 4 different kernels. Thus, I have to zip the kernels 4 different times.

Being human, I occasionally will make a mistake. Things like a typo, or worse yet, forgetting a directory or file in my zip can have catastrophic consequences! So, I decided to simplify things by making a bash script.

This script is specific for the Lollipop Developer kernel directory, and it resides there. Now a simple command line execution, or GUI double click zips my file with the current date! By God’s grace, it even works!

[CODE]#!/bin/bash

# zip all files/folders to make a flashable boot image zip.
when=$(date +%C%y%m%d)

zip -r ./aklu-lp-jf-dev-$when.zip ./install/
zip -r ./aklu-lp-jf-dev-$when.zip ./META-INF/
zip -r ./aklu-lp-jf-dev-$when.zip ./system/
zip -r ./aklu-lp-jf-dev-$when.zip ./boot.img
zip -r ./aklu-lp-jf-dev-$when.zip ./file_contexts

echo “Done”

exit 0
[/CODE]

Then I applied the same thing to my work on roms that I have made:

[CODE]
#!/bin/bash
# unzip first.
echo “extracting”
unzip -n ./Slim*

# copy updater script.
echo “copying”
cp ./updaterscript/updater-script ./META-INF/com/google/android/updater-script

# zip all files/folders to make a flashable system image zip.
echo “ziping”
when=$(date +%C%y%m%d)

zip -r ./slimlp-jf-$when.zip ./install/
zip -r ./slimlp-jf-$when.zip ./META-INF/
zip -r ./slimlp-jf-$when.zip ./system/
zip -r ./slimlp-jf-$when.zip ./boot.img
zip -r ./slimlp-jf-$when.zip ./file_contexts
zip -r ./slimlp-jf-$when.zip ./system.patch.dat
zip -r ./slimlp-jf-$when.zip ./system.transfer.list
zip -r ./slimlp-jf-$when.zip ./system.new.dat

echo “removing”
# remove old files.
rm -rf ./install/
rm -rf ./META-INF/
rm -rf ./system/
rm -rf ./boot.img
rm -rf ./file_contexts
rm -rf ./system.patch.dat
rm -rf ./system.transfer.list
rm -rf ./system.new.dat

echo “Done”
# exit gracefully.
exit 0
[/CODE]

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *