Hammer How to build Kernel

From eLinux.org
Revision as of 13:32, 11 April 2011 by Peter Huewe (talk | contribs) (spellcheck)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here is how to build a custom kernel: NOTE: Kernel 2.6.29 seemed a little easier to build then 2.6.22 did, Check towards bottom for instructions. NOTE: If you are installing a custom rootfs, you may have to increase the size of the space in flash to hold the new rootfs image. You do this by editing the linux-<version>/arch/arm/mach-s3c2410/mach-tct_hammer.c file. Find the .size string and change the value to be a little larger than your rootfs image is. The image size is in hex, so you will have to do a conversion to get the right value.

Some common values for .size are:

 2 MB = 0x340000
 3 MB = 
 4 MB = 
 5 MB = 
 6 MB = 
 8 MB = 

You may have to increase the size of your initramfs/initrd to accommodate your ramdisk image if the uncompressed size is larger than about 12 MB. There will be both compressed and uncompressed rootfs images in the buildroot/binaries/<project> directory. To do this, you have to set the size of the initramfs/initrd in the kernel. Find Block Devices in the kernel configuration and set the size to be just a little larger than your uncompressed initramfs/initrd. Only add a multiple of 1024 bytes.

Do:

tar xzf linux-2.6.22.tar.gz
cd linux-2.6.22
zcat ../Hammer-linux-2.6.22-09122007.diff.gz | patch -p1
Edit linux-<version>/arch/arm/mach-s3c2410/mach-tct_hammer.c to change .size if needed.
cp hammer-config .config
make oldconfig
make zImage
make modules

The kernel can be found in arch/arm/boot/zImage


If your kernel and rootfs compress size is bigger than 1Mo, you will need to change some Apex config.

If you want to flash the bootloader, do

make menuconfig
In Environment
Regions
(nor:1280k+2048k) Source region for ramdisk image to have a rootfs image smaller than 2048k
make

and then reflash with the new apex.bin file


newer kernel (2.6.22 to 2.6.29)

If you want to compile a kernel upper than 2.6.22, you don't need to patch the kernel. To make a new kernel, just :

export ARCH=arm
export CROSS_COMPILE=arm-linux-uclibc-
make tct_hammer_defconfig
make menuconfig

In Device drivers -> Character devices -> Serial drivers
Type Y for Samsung SoC serial support
In Device drivers 
Type 'Y' for: GPIO support, SPI support, and SD Support.

make zImage 
export INSTALL_MOD_PATH=../../buildroot/project_build_arm/Hammer/root/ ==> depend on your kernel source directory location
make modules_install

If you don't want to type export ARCH=arm and CROSS_COMPILE=arm-linux-uclibc- every time you make a fresh zImage you could edit the kernel top-level Makefile. Goto ../../buildroot/build_arm/linux-2.6.29.x/Makefile, somewhere on line 193 and 194 you will see:

ARCH		?= $(SUBARCH)
CROSS_COMPILE	?= arm-linux-

Change it to:

ARCH		:= arm
CROSS_COMPILE	:= arm-linux-uclibc-

Next step

http://elinux.org/Hammer_How_to_Reflash_Apex_and_kernel