LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-20-2009, 06:56 PM   #1
ColInvictus
Member
 
Registered: Apr 2009
Posts: 42

Rep: Reputation: 15
Advice on building kernel for the first time


Hi

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?


Cheers folks
Col
 
Old 04-20-2009, 10:17 PM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Quote:
Originally Posted by ColInvictus View Post
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 View Post
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 View Post
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.
 
Old 04-21-2009, 08:17 AM   #3
ColInvictus
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks weibullguy. So if the symlink method is deprecated, do I therefor not need it, or should it point to the original linux-headers folder?
 
Old 04-21-2009, 08:23 AM   #4
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
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.
 
Old 04-21-2009, 08:58 AM   #5
ColInvictus
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Okay, thanks. Now then *rolls up sleeves* lets get to work...
 
Old 04-21-2009, 05:10 PM   #6
ColInvictus
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Success! I've written myself a wee note so I can remember how, so I thought I'd share it with you all:
Quote:
Debian Lenny kernel build method 2009-04-21
linux-2.6.29.1

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
 
Old 04-21-2009, 09:21 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Just a few random thoughts...
  1. 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.
  2. 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...
  3. 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.)
 
Old 12-22-2010, 07:11 PM   #8
ColInvictus
Member
 
Registered: Apr 2009
Posts: 42

Original Poster
Rep: Reputation: 15
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.
 
  


Reply

Tags
kernel



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice on Building an Appliance jimbo1954 Linux - Hardware 1 12-18-2006 08:12 AM
Need advice building MiniDistro werfer Linux From Scratch 2 09-10-2006 09:27 AM
Need Advice on Building New Computer Jubalint Linux - Newbie 9 03-27-2004 12:12 PM
Motherboard advice -- Building a PC mattv Linux - Hardware 6 02-21-2004 09:22 PM
Any helpfull advice on building a fast kernel? DarkXtar Linux - Newbie 6 05-29-2003 11:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration