LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Re-compiling Kernel (https://www.linuxquestions.org/questions/linux-newbie-8/re-compiling-kernel-766514/)

Do7AN 11-03-2009 09:45 AM

Re-compiling Kernel
 
I am running slackware current using the 2.6.29.6-smp kernel. I am using an HP Compaq 6910p laptop with 4GB of RAM. I would like to continue using the kernel that I have but add HIGHMEM support. I have found many directions on how to compile a new kernel but I would prefer to continue using the version I'm on now. Is there any difference between compiling a new kernel and recompiling my current kernel? I have never need to compile a kernel before and I want to make sure that I do it right as this is my primary computer for work. Sorry if this has already been discussed.

catkin 11-03-2009 10:31 AM

Here's what I did recently to do something similar (EDAC rather than HIMEM) and building a kernel for the first time -- so I am no expert and others may correct the steps below or have better ideas. The most helpful web page was Alien BOB's WIKI.

The key step is zcat /proc/config.gz > .config to create a config file that will replicate your current kernel. My user name is c, the old kernel had CONFIG_LOCALVERSION="-smp" and the new CONFIG_LOCALVERSION="-smp-c1".
Code:

root:/usr/src# cp -pR linux-2.6.29.6 ~c/src
root:/usr/src# cd ~c/src
root:/home/c/src# chown -R c:users linux-2.6.29.6/

c:~/src/linux-2.6.29.6$ cp -p .config .config.org
c:~/src/linux-2.6.29.6$ make mrproper
c:~/src/linux-2.6.29.6$ zcat /proc/config.gz > .config
c:~/src/linux-2.6.29.6$ cp -p .config .config.from_running_kernel
c:~/src/linux-2.6.29.6$ make oldconfig
c:~/src/linux-2.6.29.6$ make menuconfig &
[GUI stuff to change .config]

# Review changes mad in menuconfig
c:~/src/linux-2.6.29.6$ diff .config .config.from_running_kernel

# Build
c:~/src/linux-2.6.29.6$ make bzImage modules

# Check for any extra modules
c:~/src/linux-2.6.29.6$ cd /var/log/packages
c:/var/log/packages$ grep -l "lib/modules/$(uname -r)" *
[That identified kernel-modules-smp-2.6.29.6_smp-i686-2 but I had no
idea what -- if anything -- had to be done to replicate it for the new
kernel so I ignored it, planning to fix any breakage later.  Never did
encounter any breakage but have not used the new kernel much]

root:/home/c/src/linux-2.6.29.6# make modules_install
root:/home/c/src/linux-2.6.29.6# cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.29.6-smp-c1
root:/boot# cd /boot
root:/boot# rm System.map
root:/boot# ln -s System.map-2.6.29.6-smp-c1 System.map

# No modules changed so can use old rc.modules but make a backup "in case ..."
root:/etc/rc.d# mv rc.modules rc.modules.aside
root:/etc/rc.d# cp -p  rc.modules-2.6.29.6-smp  rc.modules-2.6.29.6-smp-c1

# Back up old modules "in case ..."
root:~# cp -pR /lib/modules/2.6.29.6-smp /lib/modules/2.6.29.6-smp.bu

# Added stanza to GRUB's menu (some system-specific details here)
title      Slackware 13.0 (-c1, with EDAC kernel)
root        (hd0,1)
kernel      /vmlinuz-huge-smp-2.6.29.6-smp-c1 root=/dev/sda6 vga=791 ro

Changed default run level in /etc/inittab from 4 to 3.

After booting the new kernel for the first time, reinstalled the nvidia driver by running the nividia *.run file as root and the VirtualBox modules by /etc/rc.d/rc.vboxdrv setup as root.

Used startx after boot and logon as c to get GUI. After testing GUI OK, Changed default run level in /etc/inittab from 3 to 4.

On reverting to the old kernel, found /lib/modules/2.6.29.6-smp/kernel/drivers/video/nvidia.ko was missing (why?) so restored it from /lib/modules/2.6.29.6-smp.bu/kernel/drivers/video/nvidia.ko.


All times are GMT -5. The time now is 11:36 PM.