Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Kernel compile and install on Debian systems

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

Re: Kernel compile and install on Debian systems

#46 Post by garrincha »

Lavene wrote: Compile and install the new kernel
Now you should see a lot of text flickering by on your screen. This is the compile in progress. Please note that compiling the kernel takes quite some time depending on your system (approx 30-60 minutes give or take) so be patient. And if everything goes well you are rewarded with a nice .deb file in your /usr/src/
I compiled and installed a 2.6.19.2 kernel from kernel.org on my PII machine clocking at 350mHz. Has anyone had experience in doing so on an old machine similar to mine? It certainly took much longer to compile than the 60 minutes. In fact, it took something like 3 to 4 hours (I didn't check the time) to compile alone, mind you I had to go through the long configuration checklist, a lot of the stuffs left untouched must have resulted in a lot of modules being compiled. Maybe the next time after I get a better understanding of some of these modules I might be able to tweak the kernel further.

Anyway, the 2.6.19.2 kernel worked flawless.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Kernel compile and install on Debian systems

#47 Post by mzilikazi »

garrincha wrote: I compiled and installed a 2.6.19.2 kernel from kernel.org on my PII machine clocking at 350mHz. Has anyone had experience in doing so on an old machine similar to mine? It certainly took much longer to compile than the 60 minutes. In fact, it took something like 3 to 4 hours (I didn't check the time) to compile alone, mind you I had to go through the long configuration checklist, a lot of the stuffs left untouched must have resulted in a lot of modules being compiled. Maybe the next time after I get a better understanding of some of these modules I might be able to tweak the kernel further.

Anyway, the 2.6.19.2 kernel worked flawless.
That's normal. Building a kernel is very taxing on system resources. If you have a faster machine there is no reason you cannot build a kernel for your 350 on the fast machine, then just move your debs to the 350 and dpkg -i as per usual.

The best way to understand the multitude of options in your .config is to just read through it all. Rebuild a few times, each time removing more modules etc. that you feel are unnecessary. Be prepared for the compilation to break or for a kernel that will not boot. Of course you will always have your old kernel ready to boot if a new one fails.

BTW you can use time to time your kernel build:

Code: Select all

time make-kpkg blah blah blah
If you are successful in building a slim & trim kernel make sure to keep a copy of your .config someplace safe.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
garrincha
Posts: 2335
Joined: 2006-06-02 16:38

Re: Kernel compile and install on Debian systems

#48 Post by garrincha »

mzilikazi wrote:
That's normal. Building a kernel is very taxing on system resources. If you have a faster machine there is no reason you cannot build a kernel for your 350 on the fast machine, then just move your debs to the 350 and dpkg -i as per usual.

The best way to understand the multitude of options in your .config is to just read through it all. Rebuild a few times, each time removing more modules etc. that you feel are unnecessary. Be prepared for the compilation to break or for a kernel that will not boot. Of course you will always have your old kernel ready to boot if a new one fails.

BTW you can use time to time your kernel build:

Code: Select all

time make-kpkg blah blah blah
If you are successful in building a slim & trim kernel make sure to keep a copy of your .config someplace safe.
Yeah, I just belatedly realised that the processor on my PII machine will be too slow for thing like kernel compilation. Should have thought of it before - I did a little programming back in the early 1990s, so I understand that compiling took a lot of PC system resources.
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
shakka
Posts: 4
Joined: 2006-11-03 17:32

#49 Post by shakka »

Excellent guide, already I have been able to compile kernel.

Thanks :P

User avatar
Pobega
Posts: 833
Joined: 2007-01-04 04:30
Location: New York

#50 Post by Pobega »

I just recompiled a kernel, and I have two questions.

My Debian install came with the 2.6.18-3-686 Kernel, so I was able to just install ipw3945 support from the repos. How do I do something like that with a new kernel? I know this is kind of off-topic, but I have to be able to access the internet from that kernel eventually.

Also, if I'm unable to do that, how can I remove a compiled kernel (Completely, not just edit menu.lst) so that I can recompile another one with ipw3945 support?

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#51 Post by mzilikazi »

Pobega wrote:I just recompiled a kernel, and I have two questions.

My Debian install came with the 2.6.18-3-686 Kernel, so I was able to just install ipw3945 support from the repos. How do I do something like that with a new kernel? I know this is kind of off-topic, but I have to be able to access the internet from that kernel eventually.
You need module assistant

Code: Select all

su
aptitude install module-assistant
m-a a-i ipw3945
Also, if I'm unable to do that, how can I remove a compiled kernel (Completely, not just edit menu.lst) so that I can recompile another one with ipw3945 support?
With aptitude (apt-get) of course. :)

Code: Select all

aptitude remove <whatever>
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
Pobega
Posts: 833
Joined: 2007-01-04 04:30
Location: New York

#52 Post by Pobega »

mzilikazi wrote:
Pobega wrote:Also, if I'm unable to do that, how can I remove a compiled kernel (Completely, not just edit menu.lst) so that I can recompile another one with ipw3945 support?
With aptitude (apt-get) of course. :)

Code: Select all

aptitude remove <whatever>
apt-get doesn't seem to work for removing a compiled kernel.
pobega@ackbar:~$ sudo apt-get remove linux-
linux-headers-2.6.18-3 linux-kbuild-2.6.18
linux-headers-2.6.18-3-686 linux-kernel-headers
linux-headers-2.6-686 linux-patch-bootsplash
linux-image-2.6.18.3 linux-sound-base
linux-image-2.6.18-3-686 linux-source-2.6.18
linux-image-2.6-686
Mine was downloaded from kernel.org, although it is the same one as in the repositories.

User avatar
bluesdog
Posts: 2077
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada
Been thanked: 1 time

#53 Post by bluesdog »

apt-get doesn't seem to work for removing a compiled kernel.

# dpkg --purge --force-remove-essential kernel-image-NNN


(replace NNN with your kernel version and revision number, of course)

For more info...

afaik, this only works if you installed using a .deb, according to this how-to.
Tips & Tricks

Something more to read while waiting

If you obviously have not read THIS, don't expect too much...




*winter bluesdog....*

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

#54 Post by mzilikazi »

Pobega wrote: apt-get doesn't seem to work for removing a compiled kernel.
apt-get doesn't work if you installed a kernel in any way except the Debian way which, coincidentally is what this howto is about. So I presumed that was what you did. If you did not build/install a Debian kernel try make uninstall.

BTW you can have as many kernels as you like installed. It has no bearing on the compilation or use of another kernel unless you run out of disk space. ;)
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G

User avatar
Pobega
Posts: 833
Joined: 2007-01-04 04:30
Location: New York

#55 Post by Pobega »

Ah, I noticed that if I do dpkg -r linux-image-<tab><tab> it will show me a list of the installed Linux kernels. Long live .deb files!

User avatar
Lost Dog
Posts: 249
Joined: 2006-08-11 21:54
Location: North of the Columbia River

#56 Post by Lost Dog »

You can also remove them via synaptic (with the same caveat of installing them with dpkg -i).

Blyiss
Posts: 584
Joined: 2007-02-10 19:47
Location: Yakutia

#57 Post by Blyiss »

This is a very nice tutorial. But I want to warn people that, I don't know why, 2.4.xx kernels are disobedient and don't want to be compiled. I run Debian Etch.

User avatar
Mrbigshot08
Posts: 243
Joined: 2006-09-07 01:30
Location: PA, USA

#58 Post by Mrbigshot08 »

Just a small question... :)

In the past i have noticed that when i build a custom kernel ... the kernel compiles as a 386 kernel.

However, whenever I have installed kernels from apt-get, a 686 kernel is usually installed.

I have an Intel Pentium 4 and I always made sure to select the Pentium 4 option in the kernel config.

Should I be doing something different or is it something I shouldn't worry my pretty little head about?

could someone elaborate?? :? :)

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#59 Post by actionM »

OMG it worked! Thanks Lavene for the exelent guide.

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#60 Post by actionM »

Oh damnit, no it didn't work. I just picked an old kernel when I booted. After picking the new one I get this:

Code: Select all

Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Anyone know whats the deal with that? I see that 2 others in this thread had the same problem but I'm not understanding how they fixed the problem. I will read over the posts again and hopefully something will click while I wait for a reply.

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#61 Post by actionM »

OK! Never mind. I just needed to complete the last step. I thought I was suposed to skip that. And after that was done, it worked, and I also finally figured out why the "Debian way" of setting up Nvidia drivers is so nice :)

User avatar
987687
Posts: 2110
Joined: 2007-06-11 10:58
Location: Vacation Land

#62 Post by 987687 »

Thanks for the guide on the "Debian way". I was just manually compiling my kernels before, which worked, but this is better
Desktop - 3.2GHz core2 quad
Laptop - 2.4GHz core2 duo ancient macbook
Bring back the penguin!! http://tinyurl.com/d57jwv

User avatar
bluesdog
Posts: 2077
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada
Been thanked: 1 time

#63 Post by bluesdog »

You can also automate initrd creation and modification of /boot/grub/menu.lst

Edit /etc/kernel-img.conf to read something like:
# Kernel Image management overrides
# See kernel-img.conf(5) for details
do_symlinks = Yes
warn_initrd = no
ramdisk = /usr/sbin/mkinitrd.yaird /usr/sbin/mkinitramfs /usr/sbin/mkinitrd
do_bootloader = no
do_bootfloppy = no
link_in_boot = no
postinst_hook = /usr/sbin/update-grub
postrm_hook = /usr/sbin/update-grub
When you type your kernel build command, add a switch to build initrd.
Example:

Code: Select all

# make-kpkg clean
# make-kpkg binary --initrd --revision=tigger.1.a --append-to-version -k7 kernel_image modules_image
creates packages for the kernel image, matching headers and compiled source, modules such as madwifi, and kernel docs, etc, and the InitialRamDisk -- initrd
dpkg -i the kernel package reads /etc/kernel-img.conf script, which auto-generates initrd, and automagically re-writes /boot/grub/menu.lst with the appropriate lines...

Debian is amazing!
Last edited by bluesdog on 2007-07-21 06:59, edited 1 time in total.
Tips & Tricks

Something more to read while waiting

If you obviously have not read THIS, don't expect too much...




*winter bluesdog....*

User avatar
Telemachus
Posts: 4574
Joined: 2006-12-25 15:53
Been thanked: 2 times

#64 Post by Telemachus »

@ Bluesdog, two quick questions. First, don't you need the target "kernel_headers" in order to get headers? Second, is building module packages with the target "modules_image" necessary if you are going to install on that machine or only if you want to install it on a different machine? I've never used that, but kernels seem to work fine without it. Just curious.

User avatar
bluesdog
Posts: 2077
Joined: 2006-02-01 09:02
Location: Similkameen, British Columbia, Canada
Been thanked: 1 time

#65 Post by bluesdog »

make-kpkg binary creates the following packages:
linux-doc-xxxx.deb, linux-image-xxxx.deb, linux-headers-xxxx.deb, linux-manual-xxxx.deb and linux-source-xxxx.deb

The optional modules_image switch only seems to build certain modules, iirc. I never could get it to build the nvidia module, for example.
I really only used it to see how it worked.
Normally I build modules with module-assistant
Tips & Tricks

Something more to read while waiting

If you obviously have not read THIS, don't expect too much...




*winter bluesdog....*

Post Reply