[How-To] compile the Nexus S kernel from source

alwaysyours999

New member
Jun 15, 2011
1
0
0
Visit site
Downloading the Nexus S kernel source

As of today, the above isn't going to get you the Nexus S kernel source. That's easy to fix:

Code:
$ cd ~/mydroid
$ git clone git://android.git.kernel.org/kernel/samsung.git

Now you can go into that directory in your Android source tree:

Code:
$ cd ~/mydroid/samsung
Now the building. Copy and paste these lines into your terminal. BE SURE TO EDIT YOUR EXPORT COMMAND WITH THE CORRECT PATH!

Code:
export PATH=$PATH:/home/[B][COLOR="Red"]<your username>[/COLOR][/B]/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/
make ARCH=arm clean
make ARCH=arm herring_defconfig
make -j4 ARCH=arm CROSS_COMPILE=arm-eabi-

This builds the kernel, as well as the wireless module. It takes a few minutes, depending on your computer. If it hasn't stopped and spit out an error, it's not done :)
You find your kernel at:
~/mydroid/samsung/arch/arm/boot/zImage
The wlan module is at:
~/mydroid/samsung/drivers/net/wireless/bcm4329/bcm4329.ko

Next you need to package it up to test. I can't get a zImage to boot via fastboot on the NS, so you'll have to pack up a boot image. Download the attached file, and extract it. Put fastboot in your SDK/tools folder (if you don't have it) and place the unpack-bootimg.pl script and the mkbootimg binary into a folder in your home called NS-bootwork. Copy your zImage in there, too.

Now pull the boot image from your phone, either via adb or from a terminal app:
Code:
cat /dev/mtd/mtd2 > /sdcard/boot.img
Copy the boot.img from your Nexus S to your NS-bootwork folder, then it's time for more term c/p :)
Code:
cd ~/NS-bootwork
./unpack-bootimg.pl boot.img
cd boot.img-ramdisk/
find . | cpio -o -H newc | gzip > /home/[B][COLOR="Red"]<your username>[/COLOR][/B]/NS-bootwork/boot.img-ramdisk/ramdisk-repack.cpio.gz
cd ..
./mkbootimg --kernel zImage --ramdisk /home/[B][COLOR="Red"]<your username>[/COLOR][/B]/NS-bootwork/boot.img-ramdisk/ramdisk-repack.cpio.gz --base 0x30000000 --pagesize 4096 -o newtestboot.img
thanks to whoever originally created the unpack Perl script. If it was you, or you know who did, for the love of God let me know so I can thank them.

Now to test it :)
Take the newtestboot.img you just made, and put it in your SDK/tools folder. Shut your phone off, connect it to your computer, then hold volume up + power to enter fastboot. From the terminal (told you i love it)

Code:
cd ~/android-sdk-linux_86/tools
sudo fastboot boot newtestboot.img
<password>

If it boots, you won't have Wifi because we haven't pushed the kernel module over yet. But take the time to open settings>about phone and admire your own kernel showing there. Smoke a cig, have a beer, whatever you need to do to celebrate. If it doesn't boot, just pull the battery and reboot. We only told the phone to boot this one time from your new image, and the next boot will have you back where you started.

If it works well and you want to keep it, you need to put the bcm4329.ko (the kernel module) into /system/modules/. This will break wifi for any kernel except the one you have built, so only do it when you're ready to get final.

Then just like before, we're going to use fastboot to copy it over, except this time we flash it permanently.
Code:
sudo fastboot flash boot newtestboot.img
<password>
If you wanna play around with the boot image, and don;t feel like building your own kernel, there's one right here: NS-kernel_build.tar.bz2

Good luck!

Putting this here so i don't lose it (courtesy of Swetland -- a mighty Googler)
baseaddr 0x30000000
pagesize 4096
Thanks :cool:
 

rparna

New member
Jun 20, 2011
1
0
0
Visit site
Issue with wifi driver.

Thanks for the instructions. I have been able to compile the Kernel and load it.

Now the issue is with the wifi driver. I adb push the bcm4329.ko that is built along with my kernel. After that when I try to do insmod, the phone hangs. From the dmsg I see following:

[ 47.386943] wifi_set_power = 1
[ 47.476322] wifi_set_carddetect = 1
[ 47.476570] sdhci_s3c_force_presence_change : Enter
[ 47.479906]
[ 47.479916] Dongle Host Driver, version 4.218.248.6
[ 47.601560] mmc1: queuing unknown CIS tuple 0x80 (50 bytes)
[ 47.613995] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 47.654235] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 47.668740] mmc1: new SDIO card at address 0001
[ 47.706178] DHD: dongle ram size is set to 294912(orig 294912)
[ 47.740437] _dhdsdio_download_firmware: dongle nvram file download
failed
[ 55.479427] dhd_module_init: sdio_register_driver timeout
[ 56.855568] wake enabled for irq 164
[ 58.153481] dhd_bus_start failed bus is not ready
[ 58.157666] dhdsdio_probe: failed

I am on Nexus S phone. Any pointers to possible solutions would be helpful.

Thanks,
rparna
 

alberto.gonzalez

New member
May 9, 2011
2
0
0
Visit site
Hi

When I compile kernel I added some LOGD to cpp files. But when I do "adb logcat" I don't see it in console.

I think that when I re-compile kernel, the process doesnt clean old code and shows me the old code.

Any ideas?

Thanks!
 
Last edited:

Sraddha

New member
Aug 21, 2011
2
0
0
Visit site
scripts/kconfig/conf -s arch/arm/Kconfig

*** Error during update of the kernel configuration.

make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.

I am getting this error . Unable to figure out or find a solution.
Plz suggest .]
Regards
Sraddha
 

Sraddha

New member
Aug 21, 2011
2
0
0
Visit site
Sorry , I had the samsung git somewhere else and I had copy pasted into the gingerbread. I failed to follow steps correctly rather out of ignorance.
Thanks and hope this helps smone.
Regards
Sraddha
 

btricer

New member
Sep 22, 2011
1
0
0
Visit site
Hi, I have the same problem. Did you find any solution?

Thanks.

Same deal with getting stuck at the boot screen with Google, unlocked padlock, and FASTBOOT STATUS= OKAY at the bottom. I'm using the samsung kernel from another download since kernel.org is still down. (Note, the rest of the process, compilation, creating image, flashing image seem to work fine). It's after the fastboot this occurs. Any thoughts?

Edit: I also downloaded and flashed the premade boot.img you provided and was met with the same problem.

Also, I'm getting the same problem when following the instructions at http://glandium.org/blog/?p=2214.

The samsung kernel being used is found at git clone -b devrom-2.6.35 https://github.com/cgjones/samsung-android-kernel

Any and all help/input is welcome.
Best,
Brian
 
Last edited:

Trending Posts

Forum statistics

Threads
943,468
Messages
6,918,978
Members
3,159,032
Latest member
Shao61