LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to compile and install new kernel (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-compile-and-install-new-kernel-741152/)

av.dubey 07-19-2009 06:35 AM

how to compile and install new kernel
 
i want to download latest kernel release and compile and download it in my fedora 8..

can anyone tell me what are the commands and steps needed for the same..
i do not want to use yum or rpm..i want to download the full kernel and compile it from scratch

vonbiber 07-19-2009 07:06 AM

Quote:

Originally Posted by av.dubey (Post 3612605)
i want to download latest kernel release and compile and download it in my fedora 8..

can anyone tell me what are the commands and steps needed for the same..
i do not want to use yum or rpm..i want to download the full kernel and compile it from scratch

I use slackware. Here's what I do to build new kernels
After I downloaded the source (linux-2.6.*.tar.bz2) I unpack it in
/usr/src:
# cd /usr/src
# tar jxf /path/where/the/archive/is/located/linux-2.6...tar.bz2

Then I cd to the new directory and I copy there the
current config file as .config, then I run make oldconfig

# cd linux-2.6-...
# cp /boot/config-$(uname -r) .config
# make oldconfig

I then run make menuconfig

# make menuconfig

After going selecting/deselecting the different options I click on
ok and I proceed with the building:

# make bzImage modules

I store the version in a variable (that'll be convenient later on):

# version=${PWD##*/linux-}

Now is the time to backup the current kernel and its modules
in case something goes wrong after I booted with the new kernel

# cd /boot
save a copy of the current kernel, the config file System.map ...
somewhere
# cd /lib/modules
save the directory $(uname -r) and its contents somewhere

then go back to the source tree, and start copying some files

# cd /usr/src/linux-$version
# cp System.map /boot/System.map-$version
# cp arch/x86/boot/bzImage /boot/vmlinuz-$version
# cp .config /boot/config-$version

now cd to /boot to create symbolic links

# cd /boot
# for f in System.map-$version config-$version vmlinuz-$version
do
l=${f%-*}
ln -sf $f $l
done

go back to the source tree to install the modules

# cd /usr/src/linux-$version
# make modules_install

I don't use lilo.
I use grub and in my grub entry I prefer to have a line like

kernel /boot/vmlinuz

rather than
kernel /boot/vmlinuz-some_version

that's the purpose of renewing the soft link vmlinuz in /boot
and I don't have to edit the grub config file each time the
kernel changes

Whenever something goes wrong after I rebooted, I use
either a linux on another partition if there's one available
or a linux live system on a cd or usb stick to put back
the previous kernel and its modules and the soft links


All times are GMT -5. The time now is 08:56 PM.