[Epic 4G Android Development] Tortel1210:
This is a basic kernel build guide, to help those that keep coming into IRC asking for help.

If you follow this, you should have a working kernel that will work with ext4 or RFS.

NOTE::I wrote this at 1am, when Im kinda falling asleep, so there might be errors. Please let me know, and Ill fix it up :)

What you need:

A Linux system, with about 2gb free (This is written for 32bit systems, 64bit will need a compatible toolchain)

Development libraries

The kernel source

An ARM toolchain

An initramfs from an existing kernel

Downloads

EB13 source - search for D700 under mobile phone

Code Sourcery 2009q3 ARM toolchain

Daemon's Ext4/RFS Initramfs

Steps:

Set up the build environment

The first thing you need to do is set up the build environment.

For Ubuntu or other Debian-based system, you need the build-essential package and libncurses.

You can install this by running this command:

sudo apt-get install build-essential libncurses5-dev

If your not running Ubuntu/Debian, the packages are gcc, g++, libc-dev, and make.

Next, your going to need a directory for all your kernel build. You can't have spaces in any folder name. Im going to use /home/tortel/build/ for the rest of this guide.

Now you need to extract the kernel source to your directory. In the Samsung source file, its SPH-D700_kernel.tar

Next, extract the ARM toolchain into your build directory.

Last, extract your initramfs into the directory.

After this, your build directory should contain 4 things:

arm-2009q3/
eb13init/
Kernel/
build.sh

For this guide, Im not going to use the build.sh. If you want to, you'll need to configure that yourself.

Configure your kernel

Now the fun begins.

You need to edit the Kernel/Makefile file, and change line 184 to match where your toolchain is. My line 184:

CROSS_COMPILE	?= /home/tortel/build/arm2009q3/bin/arm-none-linux-gnueabi-

Now you need to configure the kernel.

The kernel configuration file is called .config, which is hidden by default (Ctrl+H shows hidden files in GNOME). You need to set lines 81-91, so it uses your initramfs. My lines:

CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="/home/tortel/kernel/eb13init/"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
# CONFIG_INITRAMFS_COMPRESSION_NONE is not set
CONFIG_INITRAMFS_COMPRESSION_GZIP=y
# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set

This will build your initramfs into the kernel image.

Now, your set to build.

Build the kernel

This is the easy part. Open a terminal, cd to build/Kernel and run make.

The commands:

cd build/Kernel/
make

If you have more than one core, you should add -j {1+ # of CPU cores} to make so it finishes faster. It only takes about 5min on my 2ghz C2D laptop.

Make it flashable!

Congrats, its built!

The file you want is Kernel/arch/arm/boot/zImage in your kernel source directory. After make finishes, run:

cp arch/arm/boot/zImage ..

This copies your kernel image file into your main build directory. Now, you need to put it into a flashable zip. To make it easy, here. Just throw the zImage into the root of that zip, put it on your SD card, and flash it.