CyanogenMod
What you need
You can download it here: [1]
$ mkdir ~/bin $ export PATH=$PATH:~/bin $ curl http://android.git.kernel.org/repo > ~/bin/repo $ chmod +x ~/bin/repo $ mkdir ~/cmod $ cd ~/cmod $ repo init -u git://github.com/nadlabak/android.git $ repo sync $ vendor/cyanogen/get-rommanager $ . build/envsetup.sh $ lunch cyanogen_umts_sholes-eng $ make -j2 otapackage $ vendor/cyanogen/tools/squisher
Build kernel
Firstly, you need your own cross-toolchain. See Toolchain
Then copy mapphone_defconfig from kernel_sources_root_directory/arch/arm/configs/ and edit it:
cd arch/arm/configs cp mapphone_defconfig motorofl_defconfig vim motorofl_defconfig cd ../../../ make motorofl_defconfig make -f kernel/kernel.mk
Build ramdisk
A ramdisk is basically a small filesystem containing the core files needed to initialize the system. It includes the critical init process, as well as init.rc, which is where you can set many system-wide properties. If you really want to know more about it, here is the documentation (Documentation/filesystems/ramfs-rootfs-initramfs.txt). Here's a list of files on a typical ramdisk:
./init.rc ./default.prop ./proc ./dev ./init ./sys ./sbin ./sbin/adbd ./system ./data
Then pack them all in cpio archive:
find . | cpio -o -H newc | gzip > ../ramdisk.cpio.gz
The final step is to combine the kernel and your new ramdisk into the full image, using the mkbootimg program (which you should download and compile from the git repository):
mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel your-kernel-file --ramdisk ramdisk.cpio.gz -o boot.img