Monday, 17 September 2007

How to compile a kernel

kernel version 2.4.30.tar.gz

Go to old kernel directory .Find the .config file and copy it to the new decompressed Kernel directory .If .config file is not exist then create .

[root@ns1 linux-2.4.18]#make dep

[root@ns1 linux-2.4.18]#change few option .then save

[root@ns1 linux-2.4.18]#ls –alh | grep .config

[root@ns1 /usr/src]#tar –zxvf linux-2.4.30.tar.gz

[root@ns1 src]#cd /usr/src/linux-2.4.30

[root@ns1 linux-2.4.30]#cp /usr/src/linux-2.4.18/.config /usr/src/linux-2.4.30

[root@ns1 linux-2.4.30]#make dep

[root@ns1 linux-2.4.30]#make modules

[root@ns1 linux-2.4.30]#make modules_install

[root@ns1 linux-2.4.30]#make bzImage

[root@ns1 linux-2.4.30]#cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.30

[root@ns1 linux-2.4.30]#cp System.map /boot/System.map-2.4.30

[root@ns1 linux-2.4.30]# mkinitrd /boot/initrd-2.4.30.img 2.4.30

[root@ns1 linux-2.4.30]#vi /etc/grub.conf

#root (hd0,0)

#kernel /vmlinuz-version ro root=/dev/hda5

#initrd /initrd-version.img

#boot=/dev/hda

default=0

timeout=10

splashimage=(hd0,0)/grub/splash.xpm.gz

title Red Hat Linux (2.4.30)

root (hd0,0)

kernel /vmlinuz-2.4.30 ro root=LABEL=/ vga=0x0309

initrd /initrd-2.4.30.img

title Red Hat Linux (2.4.18)

root (hd0,0)

kernel /vmlinuz-2.4.18 ro root=LABEL=/ vga=0x0309

initrd /initrd-2.4.18.img

== Kernel==2.6==

make menuconfig
make
make modules_install
make install

No comments: