[SOLVED] Advice on building kernel for the first time
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I decided I'd attempt to build the 2.6.29.1 kernel from source using this guide as it seems pretty straightforward - just to see if I could do so without totally bricking my PC - and I hoped someone might be able to answer a couple of questions:
- If I've used 'sudo su' before I start this, do I need to use fakeroot?
- There are apparently new options that weren't in the old kernel. If I accept the default option and the default changes in a later release will I need to manually change it then, or will the new default be used? i.e. if I build 2.6.30 when it is released and, for example, the TREE_RCU option has become default will I need to change it from the value stored in '/boot/config-2.6.29.1-custom'? Does the default option for a build config ever change after it's initial appearance? Am I making any sense?
- Once I've finished and it's working, do I leave the folder '/usr/src/linux-2.6.29.1/' alone or can I delete it to free up space?
If I've used 'sudo su' before I start this, do I need to use fakeroot?
Those are Debian specific instructions, so I can't answer this question. Don't really know why you would need a fakeroot for building a kernel. I'm assuming the instructions you're following are good instructions for a Debianish system.
Quote:
Originally Posted by ColInvictus
There are apparently new options that weren't in the old kernel. If I accept the default option and the default changes in a later release will I need to manually change it then, or will the new default be used? i.e. if I build 2.6.30 when it is released and, for example, the TREE_RCU option has become default will I need to change it from the value stored in '/boot/config-2.6.29.1-custom'? Does the default option for a build config ever change after it's initial appearance? Am I making any sense?
Not really. The config file you save in your /boot directory is the configuration for the kernel you just built. If you use it as a starting point for configuring a new version of the kernel, then you would want to execute 'make oldconfig' first.
Quote:
Originally Posted by ColInvictus
Once I've finished and it's working, do I leave the folder '/usr/src/linux-2.6.29.1/' alone or can I delete it to free up space?
No, but are you really that strapped for memory? Also, you might want to take a look at this --> http://linuxmafia.com/faq/Kernel/usr...x-symlink.html as it explains why the /usr/src/linux symlink is a bad idea and has been for years. And this --> http://www.kroah.com/lkn/ as it explains in much greater detail how to build a kernel. And don't delete your old, known-good kernel too soon or remove it's entry from your Grub or Lilo config file.
It means don't change what you currently have as far as the /usr/src/linux symlink is concerned. If you don't have one, don't create one. If you do have one, don't change it. The symlink is not necessary for a Linux machine to operate. None of my 10 machines have a /usr/src/linux symlink.
Check kernel.org for latest version, then to build from ~/kernel/ do this in the terminal:
mkdir ~/kernel/
cd ~/kernel/
# substitute the correct version in:
wget http://www.kernel.org/pub/linux/kern...6.29.1.tar.bz2
tar xjvf linux-2.6.29.1.tar.bz2
cd linux-2.6.29.1/
make clean && make mrproper
cp /boot/config-`uname -r` ./.config
# this will parse the old config file as stored in /boot and ask you to fill in any blanks:
make oldconfig
# if you want to change anything do this:
make menuconfig
make-kpkg clean
# change 'custom' in the following to whatever you want:
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
# note to self: would using sudo rather than fakeroot make a difference? must find out
sudo dpkg -i linux-image-2.6.29.1-custom_2.6.29.1-custom-10.00.Custom_amd64.deb
sudo dpkg -i linux-headers-2.6.29.1-custom_2.6.29.1-custom-10.00.Custom_amd64.deb
# finally, restart:
sudo shutdown -r now
And hey presto! Or rather not, as I have an NVIDIA graphics card, which doesn't get on well with a kernel until they've been introduced. So I did some reading (in Lynx, which took a while) and figured it out. And here's my notes on the subject:
Quote:
Install NVIDIA graphics drivers in Debian Lenny
Driver version 180.51
First ascertain newest version of the drivers, then in ~ or anywhere with wr permission:
# substitute the correct version in:
wget http://uk.download.nvidia.com/XFree8...80.51-pkg2.run
# need to use the --x-module-path option otherwise fail and pain
sudo sh NVIDIA-Linux-x86_64-180.51-pkg2.run --x-module-path=/usr/lib/xorg/modules
# DON'T let it download a file, it has to build it
# otherwise, the options are pretty self-explanatory
startx
Huzzah!
This didn't take the 5+ hours since my last post. In fact, I reckon if I didn't have to stop to look around it would have been about an hour or so - the build of the kernel took a while of course, and as ever YMMV.
Hope someone, somewhere, finds this useful. If not, at least I have an online backup of my notes
Col
Last edited by ColInvictus; 12-22-2010 at 02:51 PM.
Reason: Fix double dashes
I happen to find a /usr/src/linux symlink to be quite handy, just because when I want to browse some file in "the Linux source," I only have one place to look.
Always make a backup copy of the .config file. I keep numerous copies of it in a folder under /root, each appropriately named in some meaningful-to-me way. If you want to know "exactly what has changed," the answer's just a diff away...
I always do make distclean before rebuilding the source, bearing in mind that this will delete ".config"! (Just rename the file to keep it out of harm's way, then rename it back.)
It's been a while, but I'm back in the land of Linux, having just inherited an old Compaq NC6400. This is entirely for my own benefit - I freely admit I'm using LinuxQuestions as a notepad... Sorry.
Debian 5.07 installed and it all worked with the usual minor fiddling, except for the Wifi power button. Solution was to update the kernel. 2 issued going from 2.6.26 to 2.6.36.2, which were:
lguest seems to require a version of libc which lenny doesn't have - solved by editing <kernel source dir>/Documentation/lguest/Makefile to remove everything after the colon in the line "all: lguest"
and
UTS release version problem. When the build stops with
Code:
The UTS Release version in include/linux/version.h
""
does not match current version:
"2.6.36.2"
Please correct this.
make[1]: *** [debian/stamp/install/linux-image-2.6.34] Error 2
make[1]: Leaving directory `/home/lilo/temp/linux-2.6.34'
make: *** [kernel_image] Error 2
do this
Code:
cp include/generated/utsrelease.h include/linux/
then rerun the make-kpkg and continue.
Job done.
EDIT: These problems went away when I upgraded to Squeeze and did it again.
Last edited by ColInvictus; 12-28-2010 at 06:46 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.