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
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....*

tjh
Posts: 2
Joined: 2007-07-20 10:00

#66 Post by tjh »

Can someone tell me why this is important:

Do not configure or build your kernel with superuser permissions enabled.

This is also interesting:

Do not do any kernel development under
the /usr/src/....


source:
http://www.kernel.org/pub/linux/kernel/ ... f/ch01.pdf (page 2)

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#67 Post by Lavene »

tjh wrote:Can someone tell me why this is important:

Do not configure or build your kernel with superuser permissions enabled.

This is also interesting:

Do not do any kernel development under
the /usr/src/....


source:
http://www.kernel.org/pub/linux/kernel/ ... f/ch01.pdf (page 2)
It's been discussed several times. I don't remember exactly but I'm sure you can find it by searching the board.

But basically it does not matter on Debian, and the common way to do it in Debian is to use /usr/src/. You will notice that if you get the kernel source via APT it will be placed in /usr/src/. Also, 'make-kpkg' require root privileges (it will fail if run with fake-root').

Tina

tjh
Posts: 2
Joined: 2007-07-20 10:00

#68 Post by tjh »

Lavene wrote:
tjh wrote:Can someone tell me why this is important:

Do not configure or build your kernel with superuser permissions enabled.

This is also interesting:

Do not do any kernel development under
the /usr/src/....


source:
http://www.kernel.org/pub/linux/kernel/ ... f/ch01.pdf (page 2)
It's been discussed several times. I don't remember exactly but I'm sure you can find it by searching the board.

But basically it does not matter on Debian, and the common way to do it in Debian is to use /usr/src/. You will notice that if you get the kernel source via APT it will be placed in /usr/src/. Also, 'make-kpkg' require root privileges (it will fail if run with fake-root').

Tina

OK, thanks!

Zael
Posts: 9
Joined: 2007-08-05 00:29

#69 Post by Zael »

Hey. I am new to Debian, so it might be something really stupid that I am doing, but for some reason it seems that every time I try to make a custom kernel the .config file in my linux source directory is ignored, or at least most of it is. My sound card isn't recongnized, nor is my ethernet device despite the fact that I have both device drivers checked to compile with the kernel in menuconfig. I am pretty sure I have been following the steps exactly.

make menuconfig
(save)

make-kpkg -rev=custom.1.0 kernel-image

cd ..

dpkg -i image.deb
(where image represents the name of the deb file generated by make-kpkg.)

reboot

After I reboot I am able to get into my gui, but I am missing (as I said) my sound card driver and my ethernet driver. If I boot into the stock kernel both are detected so I am pretty sure it is a problem with my installation of a custom kernel. I just have no clue what I am doing wrong. Any ideas?

Thanks,
-Zael-

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

#70 Post by mzilikazi »

Zael wrote:Hey. I am new to Debian, so it might be something really stupid that I am doing, but for some reason it seems that every time I try to make a custom kernel the .config file in my linux source directory is ignored, or at least most of it is. My sound card isn't recongnized, nor is my ethernet device despite the fact that I have both device drivers checked to compile with the kernel in menuconfig. I am pretty sure I have been following the steps exactly.

make menuconfig
(save)

make-kpkg -rev=custom.1.0 kernel-image

cd ..

dpkg -i image.deb
(where image represents the name of the deb file generated by make-kpkg.)

reboot

After I reboot I am able to get into my gui, but I am missing (as I said) my sound card driver and my ethernet driver. If I boot into the stock kernel both are detected so I am pretty sure it is a problem with my installation of a custom kernel. I just have no clue what I am doing wrong. Any ideas?

Thanks,
-Zael-
You can easily make a copy of your current known working config. When you do it this way you'll be asked about any NEW options in the config. Might I also suggest making a kernel headers package. You're going to need it. So instead of make menuconfig:

Code: Select all

make oldconfig
make-kpkg -rev=custom.1.0 kernel_image kernel_headers
Which module does your ethernet card require? After booting into your new kernel see if it's loaded:

Code: Select all

lsmod
Also try to reconfigure your sound card if necessary:

Code: Select all

alsaconf
If you're currently booting a 2.4 kernel and you try to apply that .config to a 2.6 series kernel I have no idea what might or might not happen.
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

Zael
Posts: 9
Joined: 2007-08-05 00:29

#71 Post by Zael »

Nah. I was using a 2.6 kernel since install... I pretty much just took out the stuff I didn't need from the stock kernel config. I've made this exact kernel before in gentoo on this machine where I did the config from scratch so I am pretty sure I have included everything I need, but maybe I missed something. Another question that may ore may not be related. I wound up saying yes to my sound card and eth card in the config options instead of compiling them as modules; however, I noticed that a lot of stuff is compiled as a module by default with the stock kernel. Could this perhaps be the problem in some way, or is there a significant difference?

My cards by the way are:
Ensoniq ES1371 [AudioPCI-97] (rev 02)
Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

Perhaps I will try either restarting with the stock config or creating a new one from scratch.

Zael
Posts: 9
Joined: 2007-08-05 00:29

#72 Post by Zael »

Hm... well replacing the .config with the old stock kernel's config file seemed to work fine. I guess I either just missed something stupid in the config options or there is something with the modules... oh well. I'll mess with it more later.

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

#73 Post by mzilikazi »

Zael wrote: I wound up saying yes to my sound card and eth card in the config options instead of compiling them as modules; however, I noticed that a lot of stuff is compiled as a module by default with the stock kernel. Could this perhaps be the problem in some way, or is there a significant difference?
If you build them as modules you can make sure they get loaded on boot by listeing them in /etc/modules.
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

bennyj
Posts: 1
Joined: 2007-08-01 04:49

#74 Post by bennyj »

Thanks for the Nice How To.Now running etch with 2.6.22.1

adityavpratap
Posts: 3
Joined: 2007-08-19 05:36

Kernel

#75 Post by adityavpratap »

Hi,
I was able to successfully compile and build kernel 2.6.22 on my Debian Etch installation.
However when I try to log into the new kernel, I get the kernel panic message -
initrd-tools : 0.1.84.2
mount : unknown filesystem type 'devfs'
SCSI subsystem initialized
unmount : devfs : not mounted
mount : unknown filesystem type 'devfs'
umount : devfs : not mounted
pivot_root : no such file or directory
/sbin/init : 432 : cannot open /dev/console : no such file
kernel panic - not syncing : Attempted to kill init!
Can anyone help me out of this one?
The relevant portion of my menu.lst reads as under
title Debian GNU/Linux, kernel 2.6.22
root (hd0,9)
kernel /boot/vmlinuz-2.6.22 root=/dev/sda10 ro
initrd /boot/initrd.img-2.6.22
savedefault
Aditya Pratap V.,
Goshamahal, Hyderabad - A. P.,
I N D I A

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

#76 Post by garrincha »

I was going to compile a custom kernel for my Debian amd64/sid box, currently I have linux 2.6.22-2-amd64 from Debian distro. However, I ran into this problem when I tried to run make menuconfig:

Code: Select all

/usr/src/linux # make menuconfig
scripts/Makefile.build:17: /usr/src/linux-headers-2.6.22-2-amd64/scripts/basic/Makefile: No such file or directory
make[1]: *** No rule to make target `/usr/src/linux-headers-2.6.22-2-amd64/scripts/basic/Makefile'.  Stop.
make: *** [scripts_basic] Error 2
Have I forget something?
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

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

#77 Post by Telemachus »

I think that to make the kernel from Debian sources, you need to download the kernel source rather than kernel headers. So first you want to get the "linux-source-2.6.22 " package and then work with that. After you install, go to /usr/src and you should see /usr/src/linux-source-2.6.22.tar.bz2. Decompress that tarball and cd and then start with make menuconfig. Edit - maybe you already have the file. In that case, you just moved into the wrong directory. Based on what you wrote, you were in a headers folder when you typed the command.

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

#78 Post by 987687 »

Telemachus wrote:I think that to make the kernel from Debian sources, you need to download the kernel source rather than kernel headers. So first you want to get the "linux-source-2.6.22 " package and then work with that. After you install, go to /usr/src and you should see /usr/src/linux-source-2.6.22.tar.bz2. Decompress that tarball and cd and then start with make menuconfig. Edit - maybe you already have the file. In that case, you just moved into the wrong directory. Based on what you wrote, you were in a headers folder when you typed the command.
I usually use xconfig because I like the graphical interface better.
Desktop - 3.2GHz core2 quad
Laptop - 2.4GHz core2 duo ancient macbook
Bring back the penguin!! http://tinyurl.com/d57jwv

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

#79 Post by garrincha »

Telemachus wrote:I think that to make the kernel from Debian sources, you need to download the kernel source rather than kernel headers. So first you want to get the "linux-source-2.6.22 " package and then work with that. After you install, go to /usr/src and you should see /usr/src/linux-source-2.6.22.tar.bz2. Decompress that tarball and cd and then start with make menuconfig. Edit - maybe you already have the file. In that case, you just moved into the wrong directory. Based on what you wrote, you were in a headers folder when you typed the command.
*Doh!!!*

Thanks for pointing it out. I was in the wrong directory indeed. :) :)
Maurice Green on Usain Bolt's 9.58: "The Earth stopped for a second, and he went to Mars."

User avatar
qandd
Posts: 10
Joined: 2007-08-16 12:08

#80 Post by qandd »

*Doh!!!*

Thanks for pointing it out. I was in the wrong directory indeed
me feels better now, I'm not alone :D
I did that the other week as well, then when I realized what was going on I felt a little bit hommerish, but was very happy when I successfully compiled my Kernel
qandd
Debian Sid
64Studio 2.0

Post Reply