# Galaxy SII (SGH-T989): Need help building kernel (that works) from source



## aldj0293 (Nov 29, 2012)

I've been trying to build a custom kernel for my Galaxy SII (SGH-T989). I figured the easiest place to start would be to just build the stock source and make sure it works correctly before making any modifications. So I downloaded the SGH-T989_GB_Opensource_Update1.zip and got my dev environment (Ubuntu 10.04) setup with the CodeSourcery G++ Lite arm-none-eabi toolchain. I used the build steps and configuration specified in the kernel source readme, and after fixing some errors in assembly language definitions, I had a zImage.

Then I used this kernel kitchen to tear apart boot.img and recovery.img files from both the stock and CMW recovery, and repack them comparing to make sure the output was correct. After a modification to the ramdisk base in mkbootimg, I was able to pull apart the image and repack it to get an identical binary output.

During this process I noticed that the stock recovery image and boot image use the same kernel, and so did several of the CWM recovery images. The stock kernel is signed, but I have some other versions of CWM that use unsigned kernels, so I didn't figure it would be an issue. I decided to just flash the recovery so I could still use my phone without having to reflash if I ran into problems. I pulled the recovery image apart and repacked it with my newly build zImage. I flashed it with Odin, and booted into recovery, and it hung with just a black screen after the Samsung logo. I either have to hold the power button for a long time or pull the battery to get it to reboot. If I flash the stock or CMW recovery with Odin, it works fine. I have tried several times with the same results. I have also tried with the ICS source and no luck.

So, what am I missing? I would really appreciate guidance from someone who has actually built a kernel for this phone.

Also, in general how do you go about troubleshooting the boot process since it doesn't get far enough for adb to start. Is there a way to get serial output using a Riff box or something?

Thanks


----------



## aldj0293 (Nov 29, 2012)

Nobody? Should I repost in the general development forum?


----------



## aldj0293 (Nov 29, 2012)

This was finally answered in the Developer forum.


----------

