HOWTO: Compile Your Own Kernel v. 0.1

Adrynalyne

Account Deactivated
Dec 24, 2009
1,346
1,534
0
Visit site
Ok, so I know a lot of people would like to learn how to compile their own kernel. Hopefully this helps out.

First, you will need GNU/Linux. I do not care what you use in regards to flavor, but this guide will assume Ubuntu 11.10 64 bit. This guide will not go through how to install Linux, so I will leave that to you.

First thing to do with 11.10 is to get your build environment ready.


Part 1: Build Environment


Install all of this. You can actually copy and paste this into a terminal.
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev g++-multilib lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z-dev libgl1-mesa-dev git

Java 5 can be skipped for now, as its not needed for kernels.


Part 2: Get a toolchain.

Use this one: https://sourcery.men...tal/release1802

You want the GNU/Linux tar.


Part 3: Getting the source

I don't care which source you use, but being I am building kernels for Team BAMF, mine seems as good as any.

Follow along with this in terminal. Do this from your home directory (default when terminal is first open).

Code:
mkdir android
cd android
git clone git://github.com/adrynalyne/kernel_htc-mecha.git

While it is syncing, untar your toolchain into the android directory, This will make a folder called arm-2011.03.


Part 4: Building the kernel

When the kernel source sync is finished:

Code:
cd kernel_htc-mecha
make mecha-lte_defconfig
make -j5 ARCH=arm CROSS_COMPILE=/home/USERNAME/android/arm-2011.03/bin/arm-none-eabi-

Where USERNAME= your current username, which is cAsE sensitive.

This compiles your zImage (kernel) and modules.

Note: Please don't ask me where your modules are. Read the compiler output carefully. Near the end, it will tell you (they are .ko files). For example:

LD [M] fs/cifs/cifs.ko
LD [M] drivers/net/wireless/bcm4329_204/bcm4329.ko
LD [M] drivers/net/tun.ko

Please don't ask me where the kernel is either. The compiler output tells you:

Kernel: arch/arm/boot/zImage is ready


Part 5: Packing it up, AnyKernel style

This is useful because you can use the kernel with any rom you have installed without modifying the initramfs (ramdisk).

We will use the method created by Koush, modified for the Thunderbolt by ziggy471.

http://www.multiupload.com/VFER3TYX24

Unpack it. The zImage goes into the kernel folder, the modules go into system/lib/modules.

Repack it, and it should be ready to flash.


Part 6: Packing the kernel with an initramfs for flashing in a rom.

--Coming soon.



Congratulations! You just compiled your first kernel. Always make a Nandroid before flashing.

Note: I am aware that I did not tell you how to modify anything. That comes with experience, time, and knowledge. I am still learning all the time myself, so do not fear the Google Beast!




Ok, thats it for the first part of this guide. There will be more to come as I finish it.
 
Last edited:

Forum statistics

Threads
943,172
Messages
6,917,630
Members
3,158,860
Latest member
dumpsterrentals38