How to build Semaphore ICS kernel

Prerequisites

Basic knowledge of Linux is required to be able to build the kernel. We will also need a modern Linux box (preferably).

 

Basic Setup

First, we need to setup a directory in which we will clone the kernel and initramfs repositories. In this guide, we will setup them in /tmp but you can do it in any directory you want.

 

In a terminal we run:

 

mkdir /tmp/semaphore
cd /tmp/semaphore

 

Then we clone the basic kernel repository:

git clone https://github.com/stratosk/samsung-kernel-aries

 

Finally we clone the initramfs repository:

git clone https://github.com/stratosk/ics-ramdisk

 

OK, first step done. We got the code. Now we have to do some preparation and compile it.

 

Configuration

I prefer to use a mini ugly script to compile the kernel and pack it. It's located in the root of the kernel tree (/tmp/semaphore/samsung-kernel-aries/sbuild.sh)

 

We open this file with an editor of our choice (I prefer vi) and edit:

1) The two lines with the 'make' command, changing the CROSS_COMPILE= option. We need to set the path from the cross compiler toolchain. I use the one that it's included in CM9 repository.

2) The line starting with the 'find' command, changing the kernel source directory and destination directory of the modules location. This is into the initramfs directory. In our example it's /tmp/semaphore/ics-ramdisk/ics_combo/files/modules

 

The Semaphore's kernel configuration is located in the file config_sema in the root kernel directory. So, we need to copy this file as .config:

 

cp config_sema .config

 

Then we run this command to start the Linux kernel configuration utility (again change the CROSS_COMPILE according to your toolchain directory):

make CROSS_COMPILE=/kernels/semaphore_cap/android/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- ARCH=arm menuconfig

 

We go to 'General Setup' section and we change the 'Initramfs source files' option to /tmp/semaphore/ics-ramdisk/ics_combo/

We also need to change the next 2 options User ID and Group ID to whatever uid and gid we are logged in in the Linux box. In my case is 500,500. We exit and save the configuration.

 

Compiling

Now we are ready to build the kernel!

 

We just run:

./sbuild.sh

 

We wait few minutes (time depends on the machine) and hopefully the compilation will end.

 

The script will produce 2 files.

1) /tmp/semaphore/samsung-kernel-aries/arch/arm/boot/zImage 

2) /tmp/semaphore/ics-ramdisk/cwm/Semaphore_ICS_1.2.0s.zip

 

These are the 2 known files that we can flash via Heimdal or CWM respectively.