Kernel DIY

From ZENotes
Jump to: navigation, search

All this happens in /usr/src http://alien.slackbook.org/dokuwiki/doku.php?id=linux:kernelbuilding


Get current config:

zcat /proc/config.gz > /usr/src/linux/.config

(or copy from /boot, if available)


Apply it to your sources:

make oldconfig


Change whatever you need to change:

make xconfig


Compile

make bzImage modules            # compile the kernel and the modules
make modules_install            # installs the modules to /lib/modules/<kernelversion>


Install:

cp arch/x86/boot/bzImage /boot/vmlinuz-<yourentryhere>   # copy the new kernel file
cp System.map /boot/System.map-<yourentryhere>           # copy the System.map (optional)
cp .config /boot/config-<yourentryhere>                  # backup copy of your kernel config
cd /boot


Optional: build simple links for grub/lilo so 'Linux' always boot latest kernel:

rm System.map                                                # delete the old link
ln -s System.map-<yourentryhere> System.map              # create a new link
ln -s vmlinuz-<yourentryhere> vmlinuz
ln -s config-<yourentryhere> config


Then, edit grub/lilo accordingly (samples:)

title Fedora (2.6.27.9-159.fc10.x86_64)
       root (hd0,0)
       kernel /boot/vmlinuz-2.6.27.9-159.fc10.x86_64 ro root=UUID=2d056f31-9f3c-423a-8d5f-9a85354eb2c1 vga=791 video=vesafb
       initrd /boot/initrd-2.6.27.9-159.fc10.x86_64.img
title Sabayon Linux (kernel-genkernel-x86_64-2.6.31-sabayon)
       root (hd0,3)
       kernel /boot/kernel-genkernel-x86_64-2.6.31-sabayon  root=/dev/ram0 ramdisk=8192 real_root=/dev/sda4 dolvm init=/linuxrc splash=verbose,theme:sabayon vga=791 console=tty1 quiet resume=swap:/dev/sda3 real_resume=/dev/sda3
       initrd /boot/initramfs-genkernel-x86_64-2.6.31-sabayon
       savedefault
title Default Kernel
       root (hd0,3)
       kernel /boot/vmlinuz ro root=/dev/sda4 vga=791 video=vesafb
       initrd /boot/initrd

back to linux or howtos

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox