yashsingh1/xdaforums huggingface dataset:
[Nexus 10 Android Development] cdesai:
Hello everyone.

This guide will help you in building a kernel from source for your Nexus 10

Later, when 4.2 hits AOSP, i'll add a guide for building that too :)

You will need a computer running Linux / OSX to build the kernel, natively, or via a VM.

This guide assumes you’re running any Linux distro.

Getting a toolchain:

You need a toolchain to build the kernel.

The preferred one is Google’s toolchain, the same they use to build AOSP.

In a terminal, type:

git clone [url]https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/[/url]
export PATH=$PATH:$(pwd)/arm-linux-androideabi-4.6/bin
export CROSS_COMPILE=arm-linux-androideabi-

TIp: paste the export statements in your ~/.bashrc to have them exported each login.

Getting the kernel source:

The kernel source for Nexus devices is available from Google’s servers.

Source : https://android.googlesource.com/kernel/exynos

Github Mirror: https://github.com/chirayudesai/android_kernel_exynos

Open the terminal, and type the below commands to get the kernel source on your computer.

mkdir -p android/kernel
cd android/kernel

For Nexus 10, we get the exynos kernel sources.

git clone [url]https://android.googlesource.com/kernel/exynos[/url]

Next, we change our directory to the newly fetched source.

Type

cd exynos

Figuring out what to build:

Now, we need to figure out which revision to build.

You need to be exactly sure about this, otherwise there are chances that the compiled kernel won’t work.

The commit to build upon can be found by a few ways.

To get the kernel sources matching the device tree, type the below in the device tree.

git log kernel

Then type the below in the kernel tree

git checkout <commit>

The commit of the version running on the current review units is 52f6ab1 (probably), which is same as branch android-exynos-manta-3.4-jb-mr1-fr .

Compiling:

Name of defconfig: manta_defconfig

cd to the directory of the kernel source, then type the below in a terminal.

export ARCH=arm
export SUBARCH=arm

make <name_of_defconfig>
make

The kernel image will be ready at arch/arm/boot/zImage

To flash it, you need to make it into a boot.img, more on that later. when we have more sources.
[Nexus 10 Android Development] alias_neo:
Nice work, it's been nice to see some instructions on building additional kernel modules too.
[Nexus 10 Android Development] shimp208:
Great guide! I look forward to seeing your tutorial on compiling 4.2 from source :).
[Nexus 10 Android Development] jdbeitz:
Super awesome! :D I'm currently thoroughly:good: learning the rom building process with my nexus... ill get to this!
[Nexus 10 Android Development] d4nntheman:
looking forward towards the development
[Nexus 10 Android Development] matt95:
Great! This is very helpful and useful
[Nexus 10 Android Development] matt95:
hey man, i got stuck at this point

git log kernel

it gives me this error

fatal: ambiguous argument 'kernel': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

didn't really get that point... thanks :good:
[Nexus 10 Android Development] cdesai:
It has to be typed in the device tree, which hasn't hit AOSP yet, but should soon.

Sent from my GT-P1000
[Nexus 10 Android Development] matt95:
oh, now i get this :) :good:
[Nexus 10 Android Development] renzyyy:
i was able to make a build tonight from aosp, waiting for my device to arrive & then ill be able to test. but as far as i could tell the output sizes were pretty on compared to the factory image files i extracted http://renzy.me/aoi

...just realized i didnt extract proprietary binaries.
[Nexus 10 Android Development] padest.com:
Hello, Cdesai.

Thanks for your guide!

I will do my best to learn it.
[Nexus 10 Android Development] jrod091:
so you say that you need to make the zImage into a boot.img (being a noob about this...) on my SGSII, I can flash zImages and boot.img, so I'm confused, lol
[Nexus 10 Android Development] renzyyy:
i think it depends on how youre flashing. with the sgsii youre prob using odin/heimdall & it might just overwrite the kernel. flashing with fastboot might require the boot.img cause it contains a ramdisk image after the kernel & is writing a partition. thats just my guess at least, someone else might have a better/more accurate answer for ya
[Nexus 10 Android Development] matt95:
yeah that's true, but for instance with HTC S-OFFed devices you don't even need to flash the boot.img....
[Nexus 10 Android Development] renzyyy:
you can extract the contents from the factory image & use getramdisk.py to get the ramdisk.img out of the current boot.img (or use this ramdisk.img)

then once youve compiled the kernel successfully, use mkbootimg from android_bootimg_tools.tar.gz to repack your boot.img.

if you want to just test...

fastboot boot [new-boot.img]

and flash if satisfied...

fastboot flash boot [new-boot.img]

just tested out if anyone wants some verification... screenshot
[Nexus 10 Android Development] craigacgomez:
@cdesai, shouldn't we be using arm-eabi- instead of arm-linux-androideabi- as CROSS_COMPILE

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/
export PATH=$PATH:$(pwd)/arm-eabi-4.6/bin
export CROSS_COMPILE=arm-eabi-

Building with arm-linux-androideabi- causes issues with kernel modules... here's an example of such an issue https://groups.google.com/forum/?fromgroups=#!topic/android-kernel/dzEIOVuxtEo

And the most updated kernel branch is android-exynos-manta-3.4-jb-mr1 not android-exynos-manta-3.4-jb-mr1-fr
[Nexus 10 Android Development] Matthileo:
Is there any chance of this becoming an OC kernel in the future?
[Nexus 10 Android Development] sam3000:
Yes, I couldn't get md4 and cifs modules to load with arm-linux-androideabi-4.6:

<3>[ 1250.492203] md4: unknown relocation: 27

<4>[ 1260.230901] cifs: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)

However, with this:

git clone https://android.googlesource.com/platform/prebuilt

export PATH=$PATH:$PWD/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin

export CROSS_COMPILE=arm-eabi-

The modules load okay:

shell@android:/mnt/shell/emulated/0 # lsmod

cifs 269223 0 - Live 0x00000000

md4 3442 0 - Live 0x00000000

(Now I have to work out why neither mount nor cifsmanager are working as expected...)
[Nexus 10 Android Development] craigacgomez:
I know the reason... busybox needs to be patched... i guess it's something new in 3.4.5 kernel... I haven't done the patch yet

https://github.com/OpenELEC/OpenELEC.tv/commit/f66041febdb07d13a158dab5da901d208cf4fff9
[Nexus 10 Android Development] sam3000:
I had actually just got to the point of realising I could make it work by explicitly setting the unc path in mount command options. The missing patch would explain it.
[Nexus 10 Android Development] digitalrurouni:
Awesome step by step guide. Really great for an amateur like me.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] riyasopr:
The Facebook integration disabled after unlocking bootloader.

Anyone know How to enable this on stock ics in sk17i?

I saw fbinside addon in Xperia Arc-s session.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] gmp009:
its working on my LWW! just flash this zip..:P
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] riyasopr:
Thank you. Working.

Do u know any other features removed Sony after unlocking bootloader?.

1.Track Id. Solved by downloading latest version from play store.

2. Facebook integration. Solved by your solution.

Others Post please
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] zhanjia:
After unlocking bootloader dont do OTAs and dont use PC Companion to update.

Sent from my WT19i
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Raphinha:
I'm using the Serenity Rom v2 (in WT19a ), and integration with facebook and timescape are not working. I mark the box, it opens the facebook, loading appears, but then disappears and the box is unchecked again. it's funny because if I open the facebook app for it runs smoothly.

Sorry for english, I was using Google Translator. :p
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
I know this report should rather be posted in the developer forum (http://xdaforums.com/showthread.php?t=1780326), but as I've just registered, I'm not allowed to post there, so I hope you all will excuse me.

I've been testing the latest CyanogenMod 10 version (FXP145) on my Xperia Active (ST17i), tried both the bundled and DDS kernel, but I've been encountering two bugs:

Gallery bug

Right after the ROM starts and I insert my PIN, I get a message: "Unfortunately, Gallery has stopped". Everything then works as expected, no trouble with the gallery or anything else, just this (a bit annoing, but not deadly) message.

WiFi bug

I'm unable to connect to a WPA2-PSK protected network. An unsecured WiFi works well, but WPA2 gets into a loop, where it keeps trying to authenticate and aquite an IP. I tried to change my hostname, tried to change the kernel to DDS, nothing helped. It seems like the same bug that's troubling the stock ICS for Xperia Active, though how it got into the JB is a mystery. In all the custom ICS kernels I tested (with the fixed WLAN modules) it worked well, but the fix is not usable in the JB kernel.

In the DDS kernel thread (http://xdaforums.com/showthread.php?t=1956283) there seemed to be some talking about WiFi trouble since FXP144, but it puzzles me that no one else seemed to notice anyting (might be very isolated bug).

Just wanted to report my findings and see if I'm the only one having these trouble and if there's something to be done about it...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] mdfzhi:
https://code.google.com/p/freexperia/issues/list
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
Thanks, gotta admit I know about this bug list, I was hoping to get some feedback on the matter before posting it as a bug (because here I know that I'm talking to people with similair phones, in the buglist, my phone and bug will be quite rare).
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] mdfzhi:
probably its just you, or everyone else haven't notice it yet. u should do clean install with cm default kernel and try to replicate the bug. if its still there then just do bug report with logcat included on the fxp's googlecode page. that should help fxp to fix the bug (if its a bug).
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Saqib Nazm:
I have no problem with wpa2 psk I use it everyday with the kernel in the rom zip. May be u can give a try with mesa kernelv2.2 by an0nym0us Im currently using it with no wifi trouble. & if u want the gallery force close to be fixed u can go through it

http://xdaforums.com/showpost.php?p=33806921&postcount=1739
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
Thanks, I'll try to replicate it and see what happens.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
Thanks for the tip for the first bug. As for the second one, I thought MESA kernel isn't compatible with CM10? I remember reading in an0nym0us's MESA thread, that CM10 isn't mature enough, so he's not using it and his kernel is not made to be used with it (maybe he'll correct me, if I'm wrong :o).
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Saqib Nazm:
No he made a wonderful job & released v2.2. Im using it with fxp 145 cm10. U will get better battery life with better performance with more CPU governor & I/O scheduler :D try it & if wifi doesnt turn on to system & delete wlanfixed & reboot twice & thank an0nym0us :highfive:
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
So, I've been experimentating some more during the weekend and: I've tested the WiFI with the following: a clean installation of FXP145 (+its original kernel), FXP146 (and its original kernel) and finally with MESA v2.2 for JB + FXP146, tried to delete wlanfixed and reboot twice. The problem is always the same, WiFi generally works, but doesn't want to connect to my WPA2+AES protected router. There is no MAC filtering or anything like that enabled on the router. Just to be sure I'll try to find the ICS kernel + ROM that used to work and test it again, so I can see there is a working config.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
Alright, after hours of flashing and booting, I need to correct my first statement and appologize for misleading all of you. After testing 4 ICS kernels with various ROMS (stock+stock ROM, Rage v3.2 + HaSa MIUI v2.11.2, Mesa v2.2 + RealICSLite r4, KernelPanic v1.25 + HyperbeamCream v4.0) I can confirm, that WiFi with WPA2+AES security works on none of them (with my Xperia Active). It only works on GB (tested with stock kernel + ROM and also Rage v3 + Hasa v5) :(.

Looks like I'm stuck with GB, because both ICS and JB Wifi drivers fail to work properly for me :-/.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] pitchblack5691:
I think you would have done it but still, have you tried factory wipe from CWM AFTER flashing the kernel? I've faced this problem sometimes but doing factory wipe after flashing the kernel helped me.

Press thanks if I helped you
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] fox-03:
What I generally did during the tests was this:

1) Enter CWM and do a full wipe (data, cache, system, dalvik cache)

2) Flash Kernel

3) Flash ROM

4) Test WiFi

5) if the Wifi does not work -> fiddle with the ROM

- delete wlanfixed and reboot twice

- flash some wifi fixes, reboot, test

Though I did follow the instructions written for each kernel and ROM, so sometimes I did the wipes after the kernel flash.
[Nexus 10 General] udimars30:
Here is a giveaway coming just vote for nexus 10 if you want it for free:

http://www.youtube.com/watch?v=QcWX6jHrQqk
[Nexus 10 General] kingsnoopy:
Thanx for the chance !!
[Nexus 10 General] K1LLER HORNET:
Nice :)
[Nexus 10 General] dfullerman:
I'm in for my nexus 10! Thanks for helping put us poor nexus junkies....we need our fix!
[Nexus 10 General] neiljackson:
Cool
[Nexus 10 General] Pleskot:
I want one!

awesome!
[Nexus 10 General] Edoardo001:
This is only a dream :(
[Nexus 10 General] specter491:
i smell a troll
[Nexus 10 General] mskip:
Thread closed.

Mark.
[Galaxy S II Q&A, Help & Troubleshooting] jackURbody:
I like to keep my phone plugged into the USB port at my computer at work most of the day keeping it fully charged. Will this damage the battery?
[Nexus 4 Android Development] cdesai:
Hello everyone.

This guide will help you in building a kernel from source for your Nexus 4

Later, when 4.2 hits AOSP, i'll add a guide for building that too :)

You will need a computer running Linux / OSX to build the kernel, natively, or via a VM.

This guide assumes you’re running any Linux distro.

Getting a toolchain:

You need a toolchain to build the kernel.

The preferred one is Google’s toolchain, the same they use to build AOSP.

In a terminal, type:

git clone [url]https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/[/url]
export PATH=$PATH:$(pwd)/arm-linux-androideabi-4.6/bin
export CROSS_COMPILE=arm-linux-androideabi-

TIp: paste the export statements in your ~/.bashrc to have them exported each login.

Getting the kernel source:

The kernel source for Nexus devices is available from Google’s servers.

Nexus 4 : https://android.googlesource.com/kernel/msm

Github Mirror: https://github.com/android/kernel_msm

Open the terminal, and type the below commands to get the kernel source on your computer.

mkdir -p android/kernel
cd android/kernel

For Nexus 4, we get the msm kernel sources.

git clone [url]https://android.googlesource.com/kernel/msm[/url]

Next, we change our directory to the newly fetched source.

Type

cd msm

Figuring out what to build:

Now, we need to figure out which revision to build.

You need to be exactly sure about this, otherwise there are chances that the compiled kernel won’t work.

The commit to build upon can be found by a few ways.

To get the kernel sources matching the device tree, type the below in the device tree.

git log kernel

Next, type the below in the kernel tree

git checkout <commit>

The commit of the version running of the current review units is 7a47627, which is same as branch android-msm-mako-3.4-jb-mr1-fr .

Compiling:

Name of defconfig: mako_defconfig

cd to the directory of the kernel source, then type the below in a terminal.

export ARCH=arm
export SUBARCH=arm

make <name_of_defconfig>
make

The kernel image will be ready at arch/arm/boot/zImage

To flash it, you need to make it into a boot.img, more on that later, when we have more sources.
[Nexus 4 Android Development] m11kkaa:
1) what is the branch "android-msm-mako-3.4-jb-mr1-fr" for?

2) what does mr1 mean? sounds like milestone/alpha/beta. Maybe it's not final? Last commit is 2 weeks ago.

3) great guide :)
[Nexus 4 Android Development] cdesai:
mr1 could stand for "Milestone Release 1", it might not be final.

That being said, you should never checkout a branch directly for compiling a kernel, but the commit directly.
[Nexus 4 Android Development] espionage724:
Could you also use linaro to compile the kernel? I believe it's a toolchain anyway, but I'm not too sure on it's benefits or compatibility...
[Nexus 4 Android Development] randomblame:
nice didn't realize kernel source was already available- can't wait to test this zImage and start testing changes noticed they left out kernel compression makes for a big zimage
[Nexus 4 Android Development] DubelBoom:
Are you planning on developing for the N4?

Loved your work on the DHD :)
[Nexus 4 Android Development] cdesai:
Linaro isn't a toolchain, but they do make toolchains.

Yes, you can use it to compile the kernel, though it may not compile at all with it, or not work well - your mileage may vary.

Nope, LZO compression is enabled by default :)
[Nexus 4 Android Development] MikeC84:
Linaro has proven to increase android performance up 30 - 100% not sure if that is with -O3 optimizations or not. That is all I use on my kernels

Sucks this phone is not coming to Sprint, might be time to change carriers...

-mvectorize-with-neon-quad ---> I use this in my makefile for cflags and drops the zImage size from 5.0mb to 4.4mb.
[Nexus 4 Android Development] randomblame:
ah I didn't see it - 6+mb still pretty big from what I'm used to at least :D

I'm going through the mind numbing process of bringing in mainline patches and squashing them all together. I'm up to 3.4.1 ... woot :eek: where's the hang me emoticon lol

*finally got smart and cloned mainline and reset the head back to each sublevel and merged into my local n4 source

got it all the way up to date with mainline 3.4.18
[Nexus 4 Android Development] :
Thanks cdesai. I didn't think anything was out yet!!
[Nexus 4 Android Development] cdesai:
Yea, it's big, but partitions on new devices are big as well.

y u no use git to merge

Just add korg as a remote, fetch, merge.

Each version is tagged, so you can do that incrementally too.

Also, kernel.org hosts patches as well, if you prefer that way.

Google <3
[Nexus 4 Android Development] randomblame:
I got it straightened out :D so it's up to date with mainline and I think I've got overclocking up to 1.89ghz ready lots of more fun to be had but damn I'm just teasing myself till tuesday/whenever the thing comes in the mail. hard to test anything without hardware.
[Nexus 4 Android Development] josjator:
I may need a tip. I have followed your guide - which I find great and simple - but I'm having a problem with the arm binaries when I launch the make command after checking out the remotes/origin/android-msm-mako-3.4-jb-mr1-fr and executed make mako_defconfig:

/bin/sh: 1: arm-linux-androideabi-ld: not found

I have cloned the toolchain and msm repos, and added to the PATH environment var the location of the bin directory. I can reach arm-linux-androideabi-ld from the command line, but no luck executing it:

echedey@torinux:~/android/kernel/msm$ /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld
bash: /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld: No such file or directory

And it is there with execution rights:

echedey@torinux:~/android/kernel/msm$ ll /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld
-rwxrwxr-x 1 echedey echedey 3145332 Nov 10 16:32 /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld*

My repos are in these paths:

/home/echedey/android/arm-linux-androideabi-4.6
/home/echedey/android/kernel

And my $PATH is:

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/echedey/android/arm-linux-androideabi-4.6/bi

Am I missing anything?
[Nexus 4 Android Development] cdesai:
You path has a "n" missing from bin at the end.

You could type arm- and try to use tab-completion to see if it's accessible, then the same thing with full path (~/android/arm-linux-androideabi-4.6)
[Nexus 4 Android Development] josjator:
Sorry, the missing 'n' came from the c&p. I can actually see the file by tabing it from any path but after the auto completing it tells this weird thing:

echedey@torinux:~$ arm-linux-androideabi-ld
bash: /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld: No such file or directory

I'm a experienced *nix user but I don't get this. The repos are correctly cloned and all files under bin has exec rights. I'm running ubuntu 12.10. Maybe a problem with the shell? I should try any other environment, but that would be like killing flies with missiles. Thanks for your help.
[Nexus 4 Android Development] bevanweiss:
Do you definitely have the appropriate executable at

'/home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld'?

Can you do an ls -lF of that directory?

Perhaps the arm-linux-androideabi-ld file there is actually just a symlink which has lost its target.
[Nexus 4 Android Development] dsana123:
@josjator Yeah, seems I have the same problem as you. I'm also using Ubuntu 12.10 with a bash shell. I think it may be a recursive make/shell issue thing (sorry, I'm not too hot on make files). Will keep plugging away to see if I can resolve the problem.
[Nexus 4 Android Development] cdesai:
The device trees have hit AOSP :D

https://android.googlesource.com/device/lge/mako/
[Nexus 4 Android Development] dsana123:
@josjator: Using the 4.7 toolchain sorted me out (at least it's building now and past the initial problem).

The objdump and ld binaries are much happier now.

BTW, I did download the 4.6 toolchain again (just in case there was some problem in the initial git clone), but I still encountered objdump and ld problems.
[Nexus 4 Android Development] magn2o:
Works like a champ on Ubuntu 12.10 exactly as outlined in the OP. Thanks!

android@ubuntu:~/Documents/AOSP/kernel/msm$ ls -l arch/arm/boot/zImage
-rwxrwxr-x 1 android android 6314888 Nov 16 23:45 arch/arm/boot/zImage

android@ubuntu:~/Documents/AOSP/kernel/msm$ uname -a
Linux ubuntu 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

android@ubuntu:~/Documents/AOSP/kernel/msm$ arm-linux-androideabi-gcc -v
[...]
gcc version 4.6.x-google 20120106 (prerelease) (GCC)
[Nexus 4 Android Development] jerdog:
So what would need to be done to build the entire ROM instead of just the kernel?
[Nexus 4 Android Development] jerdog:
Also, following the instructions I get:

jerdog@build1 ~/android-nexus4/kernel/msm/.git $ git log kernel
fatal: ambiguous argument 'kernel': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
[Nexus 4 Android Development] randomblame:
Woot got my nexi's today my kernel and custom rom are working amazingly first try - I must be smarter than I thought 3.4.19 :P

I LOVE THIS PHONE
[Nexus 4 Android Development] cdesai:
Sorry, didnt get time to update the guide yet.

Will do when i get time.

It's in device/lge/mako-kernel, that repository contains just the kernel.

If you want to be sure of the correct version, checkout the android-4.2_r1 tag and then run git log kernel :)