Basic knowledge of Linux and compiling is required to be able to build a kernel. You need a modern Linux box (preferably) with git and linaro toolchain installed (


First, you need to setup the directory that within you will clone the kernel and initramfs repository. In this guide we will setup them in ~/semaphore but you can do it in any directory you want.


1. Setup build environment

In your home directory (~/) create the directories:

mkdir -p semaphore/output/galaxys
mkdir -p semaphore/output/captivate
mkdir -p semaphore/output/vibrant


The above will be the output directories for galaxy s, captivate and vibrant versions.

Build script also needs a symbolic link to your toolchain bin directory:

cd semaphore
ln -s gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin/ toolchain


The directory structure is complete. Now, you are ready to clone Semaphore code.


2. Setting up repositories

While you are still in ~/semaphore directory do the following.

Clone the main kernel repository branch jellybean:

git clone -b jellybean git://


Clone the initramfs:

git clone git://


Due to the fact that github does not preserve file permissions, I also included initramfs for each SGS variant as a tarball. You need to do the following only the first time you clone the ics-ramdisk repo. Of course, you can safely do this every time you fetch new code.

cd ics-ramdisk
tar zxvf jb_combo.tar.gz
tar zxvf jb_combo_c.tar.gz
tar zxvf jb_combo_v.tar.gz


3. Kernel configuration

I use 3 files to keep kernel's configuration for each variant. The files are placed in arch/arm/configs directory and they are named:



When, you will run the build script, the proper configuration will be used according to the selected variant (please see next section).

If you need any change kernel configuration, you have to edit these files before the building procedure. 

Leave these files unchanged, if you want Semaphore's default settings.

You are ready to build! 


4. Building the kernel

I create a script that automates the building procedure. The script can accept 2 arguments: 

a) Kernel variant: galaxys, captivate, vibrant 

b) s argument to build the kernel for hugemem compatible ROMs

If you run the script without arguments, it will build the normal version for galaxys.

To build the kernel for galaxys:

cd ~/semaphore/samsung-kernel-aries
./sbuild galaxys

and for 's' version:

./sbuild galaxys s


Wait few minutes (time depends on the machine - on my laptop 15-20) and hopefully the compilation will end. Watch the output for possible errors. A successful compilation must NOT have any error. It may have some warnings, but you can safely ignore them. If everything was OK, you must have the zImage file in 

~/semaphore/samsung-kernel-aries/arch/arm/boot directory.

Also the script will automatically prepare the CWM flashable zip and the ODIN/Heimdall flashable in ~/semaphore/output directory (in respective variant)


Now, you are ready to flash the kernel!


When I started to hack this kernel I decided to build some stuff as modules to make an as much as possible light kernel.
What exactly is a kernel module? Coping from The Linux Kernel Module Programming Guide 
Modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. For example, one type of module is the device driver, which allows the kernel to access hardware connected to the system. Without modules, we would have to build monolithic kernels and add new functionality directly into the kernel image. Besides having larger kernels, this has the disadvantage of requiring us to rebuild and reboot the kernel every time we want new functionality.
Below the stuff that compiled as modules:
  • Conservative governor
  • CIFS
  • Netfilter
  • TUN
  • Deadline I/O scheduler
  • Semaphore_oc
There are also other parts of the kernel compiled as modules but loaded by default.
In order to load these module I created some scripts that may run from a terminal emulator or may be copied from /res/scripts to /system/etc/init.d to run every time the phone boots. These scripts must have executable permission to be able to run. Since 1.7.5 version Semaphore Script Manager application by HM.Carbide may be used to handle the scripts easily.
A brief description of each module:

Conservative CPU governor (enable_conservative)

The default CPU governor of Semaphore kernel is the ondemand. Ondemand uses the maximum CPU frequency immediately after the CPU load is above a specific threshold. This makes the device to respond quickly to the demand of load and make it faster.
The conservative governor, when a load is detected above a threshold it starts to scale step by step the frequencies (100,200,400...) until it reaches to the highest frequency. This takes some time and it makes the device to react a little slower. But conservative has better battery life. 

CIFS (enable_cifs)

CIFS (Common Internet File System) protocol is used to mount shared folder usually of Windows machines. The mounted folder may be accessed from the phone as a local directory. After loading this module you can handle mounting using application from Market as CIFS manager and Mount Manager.

Netfilter (enable_netfilter)

Netfilter (iptables) is a set of modules that is used in Linux for firewall or routing purposes. These modules are needed for firewall applications (Droidwall for example) or for Wifi or USB tethering.

TUN (enable_tun)

TUN module is needed for VPN connections.

Deadline I/O scheduler (enable_deadline)

By default the noop I/O scheduler is used by Semaphore kernel. If you want to change it you have the option to load and enable the deadline scheduler.

Overclocking Scripts (enable_oc_1000, enable_oc_1200, enable_oc_1300)

These scripts are used to enable overclocking. By default the kernel (as the stock one) uses 5 frequency steps: 100,200,400,800,1000 Mhz. Using enable_oc_1200 or enable_oc_1300 the highest frequency step 1000Mhz is replaced with the 1200MHz/1300MHz step. Using enable_oc_1000 the OC frequency resets to default. 
enable_oc_1200, enable_oc_1300 are also exist in Test section of Semaphore Script Manager just for testing purpose. After reboot the phone will reset to default 1000MHz frequency.

Speedmod Color scripts

These scripts do not load modules but are used to enable the speedmod color presets:
- enable_sm_cold script for SpeedMod cold preset
- enable_sm_warm script for SpeedMod warm preset
- enable_sm_neutral script for SpeedMod neutral preset (please note that this is enabled by default)

Addon Scripts 

Virtual /cache to 50MB (enable_cache_50)

You may use this script if you want to download an application larger than 30MB from Android Market. After running this script check that the /cache partition has grown to 50MB from chainfire's ext4 application. Please note that you have to disable this option before converting file systems to ext4.

Kernel Scheduler

Chainfire's tweaks to the kernel scheduler

VM Dirtyness

Chainfire's tweaks to the I/O buffering of the kernel.

HM.Carbide's Addon Scripts

Low Memory Killer (LMK)

32mb-multitasking, 48mb-default, 64mb-bigmem, 92mb-chainfire

Hard to kill launcher

reconfigures the priorities

SD-Card read ahead

128kb-default, 256kb-64kb-best, 512kb-64kb-good, 1024kb-64kb, 3072kb-chainfire

Startup/Shutdown Sound

Restores the sound files, if they were backuped by the kernel (since 1.7.5)

Footej Camera

Footej Camera

The most simple yet powerful camera app to capture your best moments!

Get it on Google Play 

Drive Syncrypt app

Semaphore Manager

Use Drive Syncrypt to keep in sync your phone files with Google Drive.

Get it on Google Play 

Semaphore Manager app

Semaphore Manager

Semaphore Manager app helps you to easily full control all Semaphore kernel features.

Get it on Google Play 

Please donate