LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-05-2007, 05:20 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Compile My 1st Kernel?


I am running Debian etch 2.6.18-4-686 and I am wanting to try and compile a kernel for the 1st time. However I really have never done this and I am wondering what things I need to be aware of (good and ugly) or even what is involved in compiling a kernel (for Debian).

What is the process to getting 2.6.20.1 kernel on my Linux box?

I downloaded patch-2.6.20.1.bz2 from www.kernel.org but I don't even know if that is a correct file I need...or should be using on my Debian system.

Anyone care to steer me in the proper direction?
 
Old 03-05-2007, 05:26 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Wrong file you will need the full release. The patch is only for the 2.6.20 family.

This one applies to the Fedora class but the same over all. Just not sure the config file exist. http://www.linuxquestions.org/questi...45#post2643245

The basic steps: Read the post I mention for details of the commands listed.
make xconfig
make
make modules_install
make install
 
Old 03-05-2007, 05:45 PM   #3
mikieboy
Member
 
Registered: Apr 2004
Location: Warrington, Cheshire, UK
Distribution: Linux Mint 19.1 Xfce
Posts: 555

Rep: Reputation: 33
Apt-get the kernel image from Debian or you'll make life hard for yourself. I suggest you read the sticky on the topic of recompiling right here on this forum!

http://www.linuxquestions.org/questi...d.php?t=206992

Last edited by mikieboy; 03-05-2007 at 05:48 PM.
 
Old 03-05-2007, 05:54 PM   #4
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
It's actually "linux-image" (life after Sarge ) but I am wondering why you say this is going to make life difficult...???
 
Old 03-05-2007, 05:57 PM   #5
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Carl,

You're very busy on your system(s) aren't you? Get the "linux-2.6.xxx" file from kernel.org. I've had success with all the 2.6.19.x versions on debian. I've also had no problems at all compiling a kernel using the following as my guide:

http://freesf.tnc.edu.tw/docs/debian...-kernel-debian

This used to be on debian.org, but for some reason they pulled it down. I emailed the owner and he said they just didn't figure it worked anymore. Of course, you have to change the 2.4.etc to 2.6.etc, but it works, just the same. And, you'll want to leave out the step "apt-get install kernel-source-2.4.18 # use latest version" if you're using one downloaded from kernel.org. Even if you decide to do it some other way, this page is good as it tells you all the helper packages that you'll need to be able to compile the kernel, no matter what method you use.

As an example, 2.6.19.7 is at: http://www.kernel.org/pub/linux/kern...6.19.7.tar.bz2

Be wary of 2.6.20 kernels. They've changed the parameters to the workqueue and you've got enough problems with your raid that you don't want to add that to the mix.

Last edited by Quakeboy02; 03-05-2007 at 06:05 PM.
 
Old 03-05-2007, 06:05 PM   #6
mikieboy
Member
 
Registered: Apr 2004
Location: Warrington, Cheshire, UK
Distribution: Linux Mint 19.1 Xfce
Posts: 555

Rep: Reputation: 33
Which link basically says to use apt-get............
 
Old 03-05-2007, 09:50 PM   #7
JackieBrown
Member
 
Registered: Dec 2004
Location: San Antonio, TX
Distribution: Debian-AMD64 Sid
Posts: 481

Rep: Reputation: 31
apt-get install linux-source-2.6.18 kernel-package libncurses5-dev libqt3-mt-dev

Then
1) tar -jxf /usr/src/linux-source-2.6.18.tar.bz2
2) ln -s linux-source-2.6.18 linux
3) cd linux
4) make oldconfig
5) make xconfig # (You can trim your kernel if you want)
6) fakeroot make-kpkg --initrd --append-to-version=-whatever kernel_image kernel_headers

Now you have your kernel image and headers (you should install both if you are going to need to install drivers that require it - like nVidia drivers.)

Last edited by JackieBrown; 03-06-2007 at 06:58 AM.
 
Old 03-06-2007, 01:33 AM   #8
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
The link that Mikieboy gave is right on the money. It was written for 2.6.8, but it still works, and is SUPER easy. Long story really short -

1) Download full sources for the newest kernel from kernel.org
2) Extract to /usr/src
3) Remove the symbolic link named linux, replace it with on pointing at the new sources you just unzipped
4) Copy the file /boot/config-(current kernel) to .config in /usr/src/linux
5) I do make menuconfig, others like xconfig, but config it, changing things you want/don't want or just want to check out.
6) make-kpkg clean (apt-get install kernel-package if you lack it)
7) make-kpkg --initrd --append-to-version=-mykernelname kernel_image (get a beer or 3, it takes a good bit of time to compile, even on brand new hardware. You're looking at hundreds of Mb of sources to put together).
8) cd /usr/src
9) Install the nice .deb file sitting there with the command dpkg -i kernel-image-2.6.20-mykernelname_10.00.deb
10) Reboot, reinstall your NVidia or ATI drivers, and away you go!

Peace,
JimBass
 
Old 03-06-2007, 05:57 AM   #9
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
I do it like this:
Code:
cd
mkdir kernels ; cd kernels
wget http://kernel.org/pub/linux/kernel/v...6.20.1.tar.bz2
tar xvzf linux-2.6.20.1.tar.bz2
cd linux-2.6.20.1
make oldconfig
fakeroot make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-featureX+featureY --revision 1.0.0 kernel_image
cd ..
sudo dpkg -i linux-image-2.6.20.1-featureX+featureY_1.0.0_i386.deb
It takes me 14mn to recompile my kernel on 1.6Ghz laptop. I only take what I need.

Last edited by nx5000; 03-06-2007 at 05:58 AM.
 
Old 03-06-2007, 06:54 AM   #10
JackieBrown
Member
 
Registered: Dec 2004
Location: San Antonio, TX
Distribution: Debian-AMD64 Sid
Posts: 481

Rep: Reputation: 31
Quote:
Originally Posted by JimBass
The link that Mikieboy gave is right on the money. It was written for 2.6.8, but it still works, and is SUPER easy. Long story really short -

1) Download full sources for the newest kernel from kernel.org
2) Extract to /usr/src
From the kernel readme

Quote:
- If you install the full sources, put the kernel tarball in a
directory where you have permissions (eg. your home directory) and
unpack it:

Do NOT use the /usr/src/linux area!

Last edited by JackieBrown; 03-06-2007 at 06:59 AM.
 
Old 03-06-2007, 07:58 AM   #11
mikieboy
Member
 
Registered: Apr 2004
Location: Warrington, Cheshire, UK
Distribution: Linux Mint 19.1 Xfce
Posts: 555

Rep: Reputation: 33
@JackieBrown:
I think you're misunderstanding the instructions. You download into e.g. your home directory but unpack it into /usr/src.
 
Old 03-06-2007, 08:06 AM   #12
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
JackieBrown understood it correctly. This warning has been in the README unchanged since I started using Linux (2.0 kernel) and probably before. I've always ignored it without any harmful consequences. Some distros ignore it, too. For compiling foreign modules it's good to have it in a standard location.
 
Old 03-06-2007, 08:29 AM   #13
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
I take the README at its literal value - don't download the tarball to /usr/src, because to do that you would have to be root. That would be great for the kernel developers, if people developed problems because they were accessing the internet as root, and put some sort of malware/virus on their machines.

I download as a normal user to home, just as the readme suggests, but I don't compile it there. I have always unpacked and compiled as root in /usr/src, and it has never caused me a problem.

Peace,
JimBass
 
Old 03-06-2007, 09:17 AM   #14
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
/usr/src is supposed to have the kernel headers for the running kernel if I remember well. Linus made a discussion about this a long time ago (if I find it, I will post)
It's more relevant for cross compiling.
Compiling a 2.6 on a 2.6 shouldn't be a problem so putting in /usr/src/linux is ok.

I used to put them in /usr/src too but there is no advantage at all.
You are supposed also to create a user for compiling and give him the rights to access /usr/src. I had also created a group src that had write access to /usr/src.
Like put sguid for user:src on this directory.
(this was taken from a debian or kernel official readme, I didn't invent anything)


Quote:
compiled as root in /usr/src
I wouldn't do this but.. it's your machine and I'm sure you know the risk.
An error in a makefile or a bad make clean could wipe your disk.
Theorically

Last edited by nx5000; 03-06-2007 at 09:19 AM.
 
Old 03-06-2007, 12:21 PM   #15
JackieBrown
Member
 
Registered: Dec 2004
Location: San Antonio, TX
Distribution: Debian-AMD64 Sid
Posts: 481

Rep: Reputation: 31
The use of fakeroot avoids the need to go to root for the whole compile process untill the instalation of the restulting debs.

Going to root when not needed, unpacking to /usr/src, etc are completely not needed steps that have the added potentional damaging side effects
 
  


Reply



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
1st topic questions....kernel alaios Linux - General 5 07-14-2004 08:02 AM
1st compiled kernel but still have cpu issues RIgimp75 Slackware 1 01-12-2004 05:05 AM
Uhuu... finally got my 1st Kernel working but fbarre Linux - Newbie 2 08-28-2003 07:02 PM
1st kenel compile problems Howloweener Linux - Newbie 0 05-31-2003 01:08 AM
my 1st kernel compile! centr0 Linux - General 1 04-22-2003 04:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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

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