Thursday, December 10, 2015

How do I create a ClockworkMod installation package?


I'm a seasoned Linux veteran and recently bought a Samsung Galaxy S2 from T-Mobile. I've been feeling the tinkering bug, so I opted to download the source code from Samsung's site and start fiddling.


My problem is that I've already got ClockworkMod installed on my phone, so I don't want to odin flash a new kernel and thereby corrupt ClockworkMod, so I'm looking for details on how to create a proper ClockworkMod install package (generally/always a zip file?) so that I can test the newly compiled kernels.


My searching on google thus far has brought up naught. The ClockworkMod page seems to be pretty barren of documentation. Can anyone point me to some documentation on the install package creation process?



Answer



The required part of a kernel .zip file looks like this:


META-INF
com
google

android
update-binary
updater-script

You'll also want to have the kernel zImage file somewhere else, easiest if you just have it in the root of the archive.


updater-script contains the following at minimum (assumes zImage in the root):


assert(package_extract_file("zImage", "/tmp/zImage");
write_raw_image("/tmp/zImage", "/dev/block/mmcblk0p8");
delete("/tmp/zImage")
);


You can also do things like show a progress bar, print messages, wipe /cache, and so on.


You'll want to grab update-binary from another kernel package for the SGS2. One at random is attached to this XDA post.


I tested this method on my SGS Vibrant without issue, using a kernel from an Odin package and an update-binary from another Vibrant kernel .zip. Note that this is perfectly safe as long as you're writing to the correct partition -- for the Vibrant it was bml17, for the SGS2 it appears to be mmcblk0p5 (based on the kernel from XDA I linked above) or mmcblk0p8 if you're flashing an entire boot image (see comments below). You'll want to verify it for sure. Worst case your kernel doesn't work and you flash a known good one.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...