What You Will Need:
- A linux OS. I now use
Ubuntu 14.04Manjaro, and Manjaro or Arch are preferred. (Ubuntu is easiest)
- (Optional) A boot.img for your device
- Required files
In Ubuntu/ Debian:
sudo apt-get install abootimg git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
sudo pacman -S gcc git gnupg flex bison gperf sdl wxgtk squashfs-tools curl ncurses zlib schedtool perl-switch zip unzip libxslt python2-virtualenv bc
sudo pacman -S gcc-multilib lib32-zlib lib32-ncurses lib32-readline
yaourt -S abootimg-git
Also, make sure you have setup git and it is ready to go.
Setting Up Folders:
Downloading The Source:
- Download the zip from http://opensource.samsung.com/ or from InsanelyCool's stock kernel source. Then I put it in the SPH-L300 folder. Afterwards, unzip it. You should have 2 files, Kernel.tar.gz and Platform.tar.gz. We are going to focus on Kernel.tar.gz, so unzip it. This will make the Kernel folder.
- Now, in your terminal, cd to somewhere to keep your toolchains. I keep mine in ~/android/kernel.
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
Modifying The Kernel:
Now is the time to modify the kernel. You can apply patches and change governors and frequencies etc here.
Applying a Patch:
- First, download patch-3.0.31-32.bz2 (or .gz) and download patch-3.0.32-33.bz2 (or .gz).
- Extract both and move the extracted files into the Kernel source folder.
- Cd to this folder in your terminal and type
patch -p1 < patch-3.0.31-32
...assume -R? [n]
Do the same steps for applying the other patch, just mod the command to work.
Building The Kernel:
Setting Up Environment:
Make sure your terminal is in the Kernel source directory.
If you want to change the kernel name, in terminal type
Almost there. The next step is to type
If you added options such as governors, do
- where x is the number of processes per core. I use
Actually Putting The Kernel Together:
Kernel: arch/arm/boot/zImage is ready
- In terminal, type
abootimg -x boot.img
mkdir initrd && cd initrd && zcat ../initrd.img | cpio -i
find . | cpio -o -H newc | gzip > ../initrd.img
- Now, navigate to (kernel source)/arch/arm/boot and copy the zImage to where you were before (the SPH-L300 folder for me). When you paste, override the pre-existing zImage.
- If you would like to change the splash screen before the bootanimation, swap out initlogo.rle in the initrd folder with the image of you choice. It must be a rle image and must be named initlogo to work. I won't tell you how to convert png's to rle's cuz I am sure you know how to Google.
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
cd ../ && abootimg --create boot.img -k zImage -r initrd.img && abootimg --create boot.img -f bootimg.cfg -k zImage -c "bootsize=xxxxxx" -r initrd.img
Feel free to ask any questions below.
I WOULD LIKE TO THANK ONE PERSON IN SPECIFIC, AND THAT IS INSANELYCOOL FOR TEACHING ME MOST OF THE STEPS HERE.