Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

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?

share|improve this question
1  
Flashing a kernel with Odin breaks CWM? –  Matthew Read Feb 29 '12 at 3:43
1  
I figured it would since ODIN seems to flash the main bootblock of the phone, but I could be totally off base there. I didn't want to try it without knowing for sure. My understanding was that CWM is a middle-man thin kernel that would pivot to the proper kernel, but again, could be totally off base. –  Peter Grace Feb 29 '12 at 14:54

2 Answers 2

up vote 8 down vote accepted

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.

share|improve this answer
    
For the Samsung Galaxy S2 (T-Mobile) SGH-T989, the proper directive (gathered from a known good rom I already installed) shows that the boot block goes in /dev/block/mmcblk0p8, not p5. Might want to edit that for safety's sake. I made a zip based on this post and it worked like a charm! Thanks! –  Peter Grace Feb 29 '12 at 15:59
    
@PeterGrace Ah, the boot image is more than just the kernel, so that's why it's different. –  Matthew Read Feb 29 '12 at 16:47
    
Is there a way to make sure that I should use /dev/block/mmcblk0p8? I've got a Galaxy S2 from Virgin Mobile Canada (same one a Bell Canada), so it's not from T-Mobile and I have no known good ROM (except for CM7, but it writes a boot image, not a zImage). Should I assume that my Virgin Mobile GS2 works the same way as your T-Mobile GS2 or is there a way to check for sure? –  Rognon Jun 28 '12 at 2:55
    
@Rognon You could try running mount to see which blocks are mapped where. Otherwise, find a ROM. –  Matthew Read Jun 28 '12 at 5:23
    
@MatthewRead mount doesn't show either p8 nor p5. Googling around seems to indicate that the zImage should be written to p5, and so does this site : forum.xda-developers.com/showthread.php?t=1691867. I have tried to list the content of folder mentioned in the thread, but it doesn't exist on my phone... –  Rognon Jun 29 '12 at 14:06

I've found you can use fastboot without affecting CWM.

sudo /path/to/fastboot boot boot.img

or

sudo /path/to/fastboot flash:raw boot /path/to/zImage /path/to/ramdisk.img
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.