10

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?

2
  • 1
    Flashing a kernel with Odin breaks CWM? Commented Feb 29, 2012 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. Commented Feb 29, 2012 at 14:54

2 Answers 2

8

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.

5
  • 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! Commented Feb 29, 2012 at 15:59
  • @PeterGrace Ah, the boot image is more than just the kernel, so that's why it's different. Commented Feb 29, 2012 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
    Commented Jun 28, 2012 at 2:55
  • @Rognon You could try running mount to see which blocks are mapped where. Otherwise, find a ROM. Commented Jun 28, 2012 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
    Commented Jun 29, 2012 at 14:06
-1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .