Debian-kernel
From Bashlinux
Revision as of 05:42, 12 June 2012 by (talk)
GNU/Debian Kernel setup
How to build the Kernel from Debian repositories
Get the sources and setup the environment
- Install the proper packages to build the kernel
apt-get install ncurses-dev fakeroot kernel-package build-essential devscripts
- Build kernel dependencies
apt-get build-dep linux-2.6
- Get Debian kernel sources
apt-get source linux-2.6
- Note that `deb-src` must be present on `/etc/apt/sources.list` file
Build Debian Kernel
- If kernel is patched, check it twice as follows
make -f debian/rules source-all
- First time must fail
- If building all kernel related packages, then do as follows. It takes almos 40GB on Hard drive.
~/src/linux-2.6-2.6.24~rc6$ debuild -e DEBIAN_KERNEL_JOBS=${NR_CPUS}
- If building an specific architecture, then
fakeroot make -f debian/rules.gen setup_i386_none_k7
- This will build the packages for AMD K7
- If there is any change to apply, then go the the `k7` folder and config the kernel
debian/build/build_i386_none_k7 make menuconfig
- Build the kernel
fakeroot make -f debian/rules.gen binary-arch_i386_none_k7 binary-indep DEBIAN_KERNEL_JOBS=${NR_CPUS}
Install Debian Kernel
Kernel packages will be created in `/usr/src` folder. Install them as any other deb package
dpkg -i linux*.deb
How to build Real-Time Vanilla Kernel for Debian
Get sources and setup environment
- Create `vanilla` folder in `/usr/src` and change directory to such location
mkdir -p /usr/src/vanilla cd !$
- Download the latest rt patch
http://www.kernel.org/pub/linux/kernel/projects/rt/
- Download the matched kernel for the proper patch downloaded in previous step
http://www.kernel.org/pub/linux/kernel/v2.6/
- Decompress both, the linux kernel sources and the patch
tar jxvf *.bz2
- Patch the kernel
cd linux-2.6.AA.BB patch -p1 <../patch-2.6.AA.BB-rtNN
- Create a link `linux` which points to the linux kernel sources
ln -s /usr/src/vanilla/linux-2.6.AA.BB /usr/src/linux
Build RT Kernel
- Go to the linux source folder
- Configure the kernel, if necessary `make menuconfig`
- Backup the old config file
cd /usr/src/linux cp .config config.yy-mm-dd
- When finish save your changes
- Build the bzImage
cd /usr/src/linux make
Install RT Kernel
- If only modules are needed, then use `make modules`
- Install the modules
make modules_install
- Install the kernel, usually locate on `arch/MY_ARCH/boot` in kernel sources
cp arch/MY_ARCH/boot/bzImage /boot/vmlinuz-2.6.AA.BB-rtNN
- Create initial root filesystem
cd /usr/src/linux update-inintramfs -c -k 2.6.AA-BB-rtNN
- Add the proper entry to grub in `/boot/grub/menu.lst`
title RT kernel 2.6.AA.BB-rtNN root (hd0,0) kernel /boot/vmlinuz-2.6.AA.BB-rtNN root=/dev/hda1 ro initrd /boot/initrd.img-2.6.AA.BB-rtNN
- TIP: if `default` parameter is set to `0` at the beginning of the `menu.lst` file, then try to put this entry at the top of the entries list.