Rebuild kernel

I want to build a kernel for voyage from the squeeze-backports or testing repository.

Prepare the build environment

Add backports to apt source:

cat > /etc/apt/sources.list.d/backports.list <<EOT
deb http://backports.debian.org/debian-backports squeeze-backports main
deb-src  http://backports.debian.org/debian-backports squeeze-backports main
EOT

apt-get update

Install build tools:

apt-get -t squeeze-backports install fakeroot build-essential devscripts

Get the kernel source:

# old 2.6:
# apt-get -t squeeze-backports install linux-source-2.6.39

apt-get -t squeeze-backports install linux-source-3.2

Install the ocf patch ocf-linux-20120127.tgz:

tar zxvf ocf-linux-20120127.tar.gz
cd ocf-linux-20120127/ocf/
make patch
cp ocf-linux-26.patch /usr/src/
cd /usr/src/linux-source-2.6.39/
patch -p1 < ../ocf-linux-26.patch

Config for voyage

Clean up first:

cd /usr/src/linux-source-3.2/
make clean

Load voyage config from the voyage /boot folder:

cat config-xx.xx.xx-voyage > .config

Run make menuconfig, go to General setup ยป Local version add signature -3open.

To avoid build errors in this combination, run make menuconfig, go to OCF Configuration and disable all HiFn options.

For kernel 3.2, to make the LEDs work on the alix board, you must build these into the kernel instead of building as modules:

# search these in the .config file:
CONFIG_GPIO_CS5535=y
CONFIG_GPIO_SYSFS=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_IDE_DISK=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_CS5535_MFGPT=y
CONFIG_CS5535_MFGPT_DEFAULT_IRQ=7
CONFIG_CS5535_CLOCK_EVENT_SRC=y
CONFIG_MFD_CS5535=y

Ready made config for kernel 3.2, for alix boards only: config-3.2.9-alix.4.txt

Compile

Compile and create deb packages, using 2 CPU cores:

make -j2 KDEB_PKGVERSION=voyage-1 deb-pkg

After done, collect the binaries at /usr/src.

Install the new kernel

Move the binaries to voyage box.

At voyage box, disable these hook scripts to avoid error:

  • /etc/kernel/postinst.d/symlink_hook
  • /etc/kernel/postinst.d/zz-update-grub
  • /etc/kernel/postrm.d/zz-update-grub

Add backports to apt source:

cat > /etc/apt/sources.list.d/backports.list <<EOT
deb http://backports.debian.org/debian-backports squeeze-backports main
deb-src  http://backports.debian.org/debian-backports squeeze-backports main
EOT

apt-get update

Install required packages:

apt-get -t squeeze-backports install initramfs-tools linux-base

Install the the new kernel:

dpkg -i linux-image-2.6.39-3open_voyage-1_i386.deb

Fix the /boot/grub/menu.lst manually. Example:

#
# Manual edited: 2011-10-10
#
serial --speed=38400
terminal serial

timeout 5
default 0

title voyage-3open
root (hd0,0)
kernel /boot/vmlinuz-2.6.39-3open root=LABEL=ROOT_FS  console=ttyS0,38400n8 clocksource=tsc
initrd /boot/initrd.img-2.6.39-3open

title voyage-linux-11Sep11
root (hd0,0)
kernel /vmlinuz root=LABEL=ROOT_FS  console=ttyS0,38400n8 clocksource=tsc
initrd /initrd.img

Alternative method (offical debian way)

Prepare source

Add backports to apt source:

cat > /etc/apt/sources.list.d/backports.list <<EOT
deb http://backports.debian.org/debian-backports squeeze-backports main
deb-src  http://backports.debian.org/debian-backports squeeze-backports main
EOT

Get the kernel source:

apt-get update

apt-get -t squeeze-backports install fakeroot build-essential devscripts

mkdir -p ./build/kernel
cd ./build/kernel
apt-get -t squeeze-backports source linux-2.6
apt-get -t squeeze-backports build-dep linux-2.6

Modification

Clean up first:

cd linux-2.6-2.6.39
make -f debian/rules clean

Generate the build environment:

make -f debian/rules source

Set kernel revision:

dch --local +voyage

Load kernel config:

fakeroot make -f debian/rules.gen setup_i386_none_486

Modify kernel config:

cd debian/build/build_i386_none_486/
rsync alix::tmp/config-2.6.38-voyage .
mv config-2.6.38-voyage .config
make menuconfig

Compile

Compile and create deb packages:

# go back to ~/build/kernel/linux-2.6-2.6.39 
cd ../../../

fakeroot make -f debian/rules.gen binary-arch_i386_none_486 DEBIAN_KERNEL_JOBS=2

After done, collect the binaries at ~/build/kernel/.

Install required packages:

apt-get -t squeeze-backports install initramfs-tools linux-base

Install the the new kernel:

dpkg -i linux-image...deb

Fix the /boot/grub/menu.lst manually.

Reference

voyage/rebuild_kernel.txt · Last modified: 2012-03-22 14:55 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0