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 for newbies

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
User avatar
Troels
Posts: 119
Joined: 2008-10-20 14:15
Location: Denmark, Scandinavia

#31 Post by Troels »

This is a very good howto.

Just to help, you have a typo:
Make a directory to avoid having to compile as root
Code:
mkdir ~/kernel_compiling/


Copy the source to that folder
Code:
cp /usr/src/linux-source-2.6.26.tar.bz2 ~/kernel_compiling/


Goto the directory
Code:
cd ~/kernel_compilling/
;)

Guess it should be compiling
Which mindset is right? Mine, of course. People who disagree with me are by definition crazy. (Until I change my mind, when they can suddenly become upstanding citizens. I'm flexible, and not black-and-white.) - Linus Torvalds.

User avatar
Rolling Stone
Posts: 366
Joined: 2009-02-15 18:55
Location: Turku, Finland

#32 Post by Rolling Stone »

Thanks! Typo fixed.

I never expected anybody to read anything I write that carefully! ;)

bibimidi
Posts: 5
Joined: 2009-04-15 04:14

Kernel panic (new compile)

#33 Post by bibimidi »

Hello,

This is a nice current howto of kernel compile. I posted my kernel compile problem in this thread:
http://forums.debian.net/viewtopic.php?p=224464#224464

I hope you guys can lend a helping hand. I like to know if my problem is fixable or no. Otherwise i can start anew the same exercise. Thanks.

bibs

User avatar
dbbolton
Posts: 2129
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Kernel compile and install on Debian 5.0 for newbies

#34 Post by dbbolton »

I followed this guide but my kernel panicked. I described the problem here: http://forums.debian.net/viewtopic.php?f=5&t=40081

Edit: I guess there is a bug concerning initramfs-tools and newer kernels (thanks to garrincha for pointing this out) - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=523735
GitHub | zsh docs in Letter PDF
Telemachus wrote:Put down the CGI.

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: Kernel compile and install on Debian 5.0 for newbies

#35 Post by Stian1979 »

I just realized that my amd64 don't regulate the frequency on a standard kernel, but it dos on a custom kernel where I change prosesor type and build in the various governors.
Building a kernel from source is deficiently worth the effort if you run a laptop and want a longer battery life.

I have noticed that using the 2.6.30 liquorix kernel make it necessary to change grub and fstab to read /dev/sda instead of /dev/hda if I use the debian 2.6.30.
Why is the debian kernel still using hda? I think the vanilla kernel changed into using sda a year or two ago.

Is there any issues?
Image
Debian Bullseye

User avatar
hazel
Posts: 135
Joined: 2009-08-01 16:34

Re: Kernel compile and install on Debian 5.0 for newbies

#36 Post by hazel »

This was an eye-opener for me. I've built kernels before but it never occurred to me to do so for a distro which comes with a pre-compiled kernel. I was amazed at the amount of stuff that was configured in that I knew I didn't need. So I got rid of everything that related to hardware I knew I didn't have and everything that kernel help flagged with "If unsure, say no", then built in the ide driver and my root partition's filesystem so that I could dump the initrd.

Result: boot time reduced by 35% and disk space occupied by modules down by a whopping 62%. The actual kernel footprint is only a little less (about 4%) but I plan to gradually decrease it further. Thank you very much!

gnudude
Posts: 1684
Joined: 2009-04-05 17:30
Location: gone....

Re: Kernel compile and install on Debian 5.0 for newbies

#37 Post by gnudude »

hazel makes me want to compile my kernel.... :shock:

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: Kernel compile and install on Debian 5.0 for newbies

#38 Post by Stian1979 »

hazel wrote:This was an eye-opener for me. I've built kernels before but it never occurred to me to do so for a distro which comes with a pre-compiled kernel. I was amazed at the amount of stuff that was configured in that I knew I didn't need. So I got rid of everything that related to hardware I knew I didn't have and everything that kernel help flagged with "If unsure, say no", then built in the ide driver and my root partition's filesystem so that I could dump the initrd.

Result: boot time reduced by 35% and disk space occupied by modules down by a whopping 62%. The actual kernel footprint is only a little less (about 4%) but I plan to gradually decrease it further. Thank you very much!
I have tryed this ass well, but always ended up with kernel panic.
Image
Debian Bullseye

User avatar
Rolling Stone
Posts: 366
Joined: 2009-02-15 18:55
Location: Turku, Finland

Re: Kernel compile and install on Debian 5.0 for newbies

#39 Post by Rolling Stone »

hazel wrote:Thank you very much!
Glad to hear you found this thread useful. :)
gnudude wrote:hazel makes me want to compile my kernel.... :shock:
Do it tonight man!
Stian1979 wrote:I have tryed this ass well, but always ended up with kernel panic.
Sure you've gotten the initrd part right?

gnudude
Posts: 1684
Joined: 2009-04-05 17:30
Location: gone....

Re: Kernel compile and install on Debian 5.0 for newbies

#40 Post by gnudude »

I am waiting for hazels howto on the subject!

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: Kernel compile and install on Debian 5.0 for newbies

#41 Post by Stian1979 »

Rolling Stone wrote: Sure you've gotten the initrd part right?
Not suposed to have initrd on a initrd free kernel.
With initrd I got no problems.
Image
Debian Bullseye

User avatar
kanonmat
Posts: 59
Joined: 2008-10-28 21:33
Location: Linköping, Sweden

Re: Kernel compile and install on Debian 5.0 for newbies

#42 Post by kanonmat »

I compiled, rebooted and got a kernel panic. What's the approach to find what's wrong? As hazel posted, there is so much stuff in the kernel that I won't ever use. (I removed what I thought unnecessary and among other things changed timer frequency to 1000Hz and set voluntary kernel preemption.) Just changing one item at a time, compile for an hour and reboot feels very inefficient.
phenomII965, gigabyte ma790xt-ud4p, 8600gt on desktop
hp 6910p laptop. athlon 3200+, asus an8e, 6600gt on spare desktop
sid user

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: Kernel compile and install on Debian 5.0 for newbies

#43 Post by Stian1979 »

kanonmat wrote:I compiled, rebooted and got a kernel panic. What's the approach to find what's wrong? As hazel posted, there is so much stuff in the kernel that I won't ever use. (I removed what I thought unnecessary and among other things changed timer frequency to 1000Hz and set voluntary kernel preemption.) Just changing one item at a time, compile for an hour and reboot feels very inefficient.
Do you have a initrd for that kernel? for some reason it's not created automatically anymore.
Image
Debian Bullseye

User avatar
kanonmat
Posts: 59
Joined: 2008-10-28 21:33
Location: Linköping, Sweden

Re: Kernel compile and install on Debian 5.0 for newbies

#44 Post by kanonmat »

***TOTAL EDIT OF POST***
No, I didn't get an initrd. I'm using sid.
I read dbboltons post above, but I didnt follow the link :oops: I was trying to figure out why I couldn't boot with the new kernel, keeping myself busy trying to generate initrds and writing a lengthy post. Its shorter now.

Kernel panicked with this:

Code: Select all

no filesystem could mount root, tried:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
It wouldn't boot with an initrd borrowed from the other kernel. (The vanilla kernel wouldn't boot without an initrd either.) Maybe I don't need an initrd, a guru on irc said it was unnecessary. I guess I need to move some of the stuff that the initrd does to the kernel. What and how?

I cant see whats in the initrd. "file initrd.img-2.6.30-1-amd64" says its a gzip, but i can't gunzip it. What is it? I read in some post on a mailinglist from around 2003 that the debian initrd uses cramfs. This fails anyway:

Code: Select all

mount -o loop -t cramfs initrd.img-2.6.30-1-amd64 tmp/
***TOTAL EDIT OF POST***
Last edited by kanonmat on 2009-09-05 08:51, edited 1 time in total.
phenomII965, gigabyte ma790xt-ud4p, 8600gt on desktop
hp 6910p laptop. athlon 3200+, asus an8e, 6600gt on spare desktop
sid user

User avatar
dbbolton
Posts: 2129
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Kernel compile and install on Debian 5.0 for newbies

#45 Post by dbbolton »

kanonmat wrote: Maybe I don't need an initrd, a guru on irc said it was unnecessary. I guess I need to move some of the stuff thats in the initrd to the kernel. The questions are: what and how?
You will need drivers for your hard disk (IDE/SATA) as well as drivers for your root filesystem build into the kernel (*), not as modules (m).

If you just want to fix the initrd for the new kernel, see the link I posted above.
GitHub | zsh docs in Letter PDF
Telemachus wrote:Put down the CGI.

User avatar
hazel
Posts: 135
Joined: 2009-08-01 16:34

Re: Kernel compile and install on Debian 5.0 for newbies

#46 Post by hazel »

If you're using sid, you have a later kernel than I do. Apparently some of these recent kernels don't use the traditional hd*/sd* distinction; they put all the hard drives in the sd* series. So if your grub menu gives the root partition as /dev/hda*, the kernel won't be able to find it.

The official Debian solution to this is to use the UUID of the partition rather than a device file but I found out the hard way that this doesn't work without an initrd. So if you've got /dev/hda* in your grub menu, it might be worth editing it to /dev/sda* and see if that makes a difference.

PS: Why should I write a howto? We've got a perfectly good one in this thread already.

User avatar
Tadeas
Posts: 1013
Joined: 2008-09-22 09:11
Location: Prague
Contact:

Re: Kernel compile and install on Debian 5.0 for newbies

#47 Post by Tadeas »

I've just compiled 2.6.31-rc9 and I've encountered two problems. I post here the solution if anybody is interested...

First, the compilation fails with missing zlib.h library. This is probably a bug in kernel-package that it doesn't depend on it. Anyway, you need to install zlib1g-dev package.

Second, the --initrd parameter to make-kpkg didn't create initrd. You create it with this command in /boot after you have installed the kernel .deb:
# mkinitramfs -oinitrd-2.6.31-rc9 2.6.31-rc9
Run dpkg-reconfigure grub-pc if you use grub2 or dpkg-reconfigure grub-legacy (or whatever is the grub1 package) to notify grub of the new initrd.

Hope this helps anybody :) .
Because let’s face it, the unfortunate aspect of software development is that it involves humans. Mewling, disorganized, miserably analog humans. Sometimes they smell bad.

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: Kernel compile and install on Debian 5.0 for newbies

#48 Post by milomak »

The initrd issue can be solved using the solution in this post

i copied the initramfs-tools script and the initrd is created when i install using dpkg.
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

jalu
Posts: 1389
Joined: 2008-11-19 23:26

Re: Kernel compile and install on Debian 5.0 for newbies

#49 Post by jalu »

i followed the how-to in the first post, step by step, but changed some things according to the advices given later in this thread:
i get this error massage :

Code: Select all

/usr/bin/make  EXTRAVERSION=jalu  ARCH=i386 \
			     -C Documentation/lguest
make[1]: Entering directory `/home/jalu/Kernel/linux-2.6-2.6.26/Documentation/lguest'
cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include    lguest.c  -lz -o lguest
lguest.c:34:18: error: zlib.h: No such file or directory
make[1]: *** [lguest] Error 1
after running this command:

Code: Select all

 fakeroot make-kpkg --append-to-version "jalu" --revision "090909" --initrd kernel_image kernel_headers
i dont know what im doing wrong here (about append-to-version and revision im pretty unsure...)

----
[
i also followed this howto:
http://wiki.debian.org/HowToRebuildAnOf ... nelPackage
but changed some things according to my book (as i didnt understand everything).
There i had to to add a "revision-thingy" to those files:
/home/jalu/Kernel/linux-2.6-2.6.26/debian{changelog,config/defines}
That build went thru (but wasnt known by the package-system afterwards).
]


greetings

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

Re: Kernel compile and install on Debian 5.0 for newbies

#50 Post by garrincha »

jalu wrote:i followed the how-to in the first post, step by step, but changed some things according to the advices given later in this thread:
i get this error massage :

Code: Select all

/usr/bin/make  EXTRAVERSION=jalu  ARCH=i386 \
			     -C Documentation/lguest
make[1]: Entering directory `/home/jalu/Kernel/linux-2.6-2.6.26/Documentation/lguest'
cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include    lguest.c  -lz -o lguest
lguest.c:34:18: error: zlib.h: No such file or directory
make[1]: *** [lguest] Error 1
You're getting zlib error, something that I never got before. Anyway, check the 1st post on this very trend by Rolling Stone, near bottom:
Troubleshooting:

If you get an error about missing zlib.h, make sure you have these packages installed
Image
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

Post Reply