Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
How to compile kernel with vserver-patch

How to apply vserver-kernel to a fresh Debian etch installation with apt-get (12/2007)

Something changed in the Debianworld. There are ready kernels for Vserver available. I did this on a fresh installed system which acts as mother for my vservers:

# apt-get install vserver-debiantools util-vserver
# apt-get install linux-image-2.6-vserver-686

After rebooting I see this in my menu of choosing kernels for starting my system:

...
Debian GNU/Linux, kernel 2.6.18-5-vserver-686
...

I took this. But I have to make it my default kernel in a minute. I take a look into /boot/grub/menu.lst and find my kernel as menu-entry number 2 (count starts from zero!), so I change the "default"-line to 2 like this:

default   2
This command should now work:
# vserver-stat
CTX  PROC  VSZ    RSS  userTIME  sysTIME  UPTIME  NAME
0      37  44M  13.4M   0m00s86  0m11s23 3m52s90  root server

After that I install a new vserver like this

HOSTNAME=echolon
IPADDRESS=10.1.1.73
NETMASK=255.255.255.0
DEBIAN=etch
CONTEXT=73
vserver $HOSTNAME build --context $CONTEXT -m debootstrap --interface eth0:${IPADDRESS}/${NETMASK} --hostname $HOSTNAME -- -d $DEBIAN 

Usually vserver's files are in /var/lib/vserver

Start vserver automatically

HOSTNAME=echolon
echo "default" > /etc/vservers/${HOSTNAME}/apps/init/mark

How to compile your own kernel with vserver-patch, the standard linux-way

This is how I did it. This document will be a little bit outdated in the time and you have to change filenames but this is about the way to go.

Get right vserver-patch and the kernel

  1. First get the patch for vserver: http://www.13thfloor.at/vserver/s_release/overview/
    I took http://www.13thfloor.at/vserver/s_release/v1.26/patch-2.4.25-vs1.26.diff.gz
  2. You need the right kernel-sources for that patch from http://www.kernel.org/, I took http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.25.tar.bz2

Apply the patch

tanzwut:/usr/src/kernel# tar -xjf linux-2.4.25.tar.bz2
tanzwut:/usr/src/kernel# gunzip patch-2.4.25-vs1.26.diff.gz
tanzwut:/usr/src/kernel# ls -CF
linux-2.4.25/  linux-2.4.25.tar.bz2  patch-2.4.25-vs1.26.diff
tanzwut:/usr/src/kernel# ls -l
drwxr-xr-x   15 573      573          4096 Feb 18 14:36 linux-2.4.25
-rw-r--r--    1 root     src      30626548 Mar 17 07:35 linux-2.4.25.tar.bz2
-rw-r--r--    1 root     src          154599 Mar 17 07:23 patch-2.4.25-vs1.26.diff

tanzwut:/usr/src/kernel# cd linux-2.4.25
tanzwut:/usr/src/kernel/linux-2.4.25# patch -p1 <../patch-2.4.25-vs1.26.diff.gz | less

There should be no errors in applying the patch! Don't do anything further if there are error, maybe you have the wrong patch for your kernel.

Configure, compile

tanzwut:/usr/src/kernel/linux-2.4.25# apt-get install libdb3-dev
tanzwut:/usr/src/kernel/linux-2.4.25# apt-get install libdb3-dev
tanzwut:/usr/src/kernel/linux-2.4.25# make menuconfig

Don't forget to include into the kernel:

Save config to /boot

tanzwut:/usr/src/kernel/linux-2.4.25# cp .config /boot/config-2.4.25

Compile:

tanzwut:/usr/src/kernel/linux-2.4.25# make dep
tanzwut:/usr/src/kernel/linux-2.4.25# make bzImage
tanzwut:/usr/src/kernel/linux-2.4.25# make modules
tanzwut:/usr/src/kernel/linux-2.4.25# make modules_install

Modules are in /lib/modules/2.4.25-vs1.26 (you need this directory in a second)

tanzwut:/usr/src/kernel/linux-2.4.25# mkinitrd -o /boot/initrd.img-2.4.25-vs1.26 /lib/modules/2.4.25-vs1.26
tanzwut:/usr/src/kernel/linux-2.4.25# cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.25-vs1.26

I don't know why you need this:

tanzwut:/usr/src/kernel/linux-2.4.25# cp System.map /boot/System.map-2.4.25-vs1.26

Put extra lines into /etc/lilo.conf

tanzwut:/usr/src/kernel/linux-2.4.25# lilo

Reboot and check...

Impressum