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
vbrummond
Posts: 4432
Joined: 2010-03-02 01:42

Re: Kernel compile and install for newbies

#91 Post by vbrummond »

I never saw any performance benefit to use make localmodconfig. All it does is detect what modules your system is currently using and disable all (except what you need) of the options (already) marked as a kernel module. So basically it makes your kernel into a monolithic binary. It might save some space or compile time; However if you ever add a new piece of hardware that requires a missing module you will need to recompile a new kernel.
Always on Debian Testing

Ibidem
Posts: 160
Joined: 2010-12-24 18:28

Re: Kernel compile and install for newbies

#92 Post by Ibidem »

vbrummond wrote:I never saw any performance benefit to use make localmodconfig. All it does is detect what modules your system is currently using and disable all (except what you need) of the options (already) marked as a kernel module. So basically it makes your kernel into a monolithic binary. It might save some space or compile time; However if you ever add a new piece of hardware that requires a missing module you will need to recompile a new kernel.
That's all that it does. But the point is to start there, so you won't have to spend 2 hours building the kernel, and have 100+ MB used for the kernel.

Since it only disables modules, you can reconfigure the sources later to re-enable a driver, make modules, and install the modules (I've done this at least a couple times, it's not just speculation).
Then you do the tuning:
check if you need ISA (lspci|grep ISA)--some boards use it for odd purposes;
disable MCA (you almost certainly don't need it);
tune for the lowest CPU you'll use (eg, i586, i686, k{6,7,8}, Core whatever...); select your general options; etc.
If you messed up, you wasted maybe 1-2 hours, not 4-6 hours like you might otherwise.

If you're paranoid about "What if I end up needing to test a DEC network card or find an MGA card for a spare console :-P on my desktop, or get given some Infiniband card?", it's not for you. But otherwise, you can add back the useful stuff faster than you'd remove anything.
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0

acimmarusti
Posts: 397
Joined: 2009-02-27 04:59
Location: Portland, OR USA

Re: Kernel compile and install for newbies

#93 Post by acimmarusti »

make-kpkg is very well documented. It has a very helpful manpage, etc.

Is there any similar documentation regarding 'make deb-pkg' ? I cannot seem to find anything...

Also though I have been using 'make deb-pkg' as of late I have several grievances with it (apart from the apparent lack of documentation). The firmware package gets called "linux-firmware-x.x.x.deb". This package conflicts with the debianized firmware-linux, firmware-linux-free and nonfree. This is annoying, is there a way to change the names? (that's why I'm asking about that documentation).

Recently, nvidia-kernel-dkms from backports failed to compile and install the module on one of my computers running a 3.0.18 kernel customized and compiled by myself with "make deb-pkg". It failed saying that there were no sources for the kernel image (even though kernel headers were installed). Curiously module-assistant had no trouble at all compiling the nvidia module for the kernel... kernels from backports had no trouble with dkms though.

On the other hand make-kpkg doesn't seem to even offer the option of the separate firmware package.

Anyone encountered these problems and found documentation / solutions?

Thanks

Ibidem
Posts: 160
Joined: 2010-12-24 18:28

Re: Kernel compile and install for newbies

#94 Post by Ibidem »

acimmarusti wrote:make-kpkg is very well documented. It has a very helpful manpage, etc.

Is there any similar documentation regarding 'make deb-pkg' ? I cannot seem to find anything...

Also though I have been using 'make deb-pkg' as of late I have several grievances with it (apart from the apparent lack of documentation). The firmware package gets called "linux-firmware-x.x.x.deb". This package conflicts with the debianized firmware-linux, firmware-linux-free and nonfree. This is annoying, is there a way to change the names? (that's why I'm asking about that documentation).

Recently, nvidia-kernel-dkms from backports failed to compile and install the module on one of my computers running a 3.0.18 kernel customized and compiled by myself with "make deb-pkg". It failed saying that there were no sources for the kernel image (even though kernel headers were installed). Curiously module-assistant had no trouble at all compiling the nvidia module for the kernel... kernels from backports had no trouble with dkms though.

On the other hand make-kpkg doesn't seem to even offer the option of the separate firmware package.

Anyone encountered these problems and found documentation / solutions?

Thanks
linux-firmware-x.x.x contains the same files as firmware-lnux,firmware-linux-free, & firmware-linux-nonfree.
Therefore, it must always conflict. You only need one of the options, though.

dkms:
The default links (/lib/modules/`uname -r`/{build,source} point to the original build directory.
This is the one problem with this method...
I wrote a script to handle this.

Code: Select all

#!/bin/sh
#fixkernlink
usage(){
cat <<EOF
kernlinks.sh--clean up /lib/modules/<kernel-release> for building modules.
USAGE:
kernlinks.sh <kernelversion>
cd /lib/modules;for K in * ; do kernlinks.sh $K; done; cd -
EOF
}
if [ ! -d /lib/modules/$1 ]
        then usage; exit 255
fi
#If build is not a link, there are no headers or it's not a kernel version
test -L /lib/modules/$1/build||exit 127 
cd /lib/modules/$1/
export KERNVER=`pwd`; export KERNVER=`basename ${KERNVER}`
#Are headers installed?
export KERNHDR=/usr/src/linux-headers-${KERNVER}
test -d ${KERNHDR} || exit 126
unlink build
unlink source
ln -s ${KERNHDR} build
ln -s ${KERNHDR} source
cd ${KERNHDR}/arch/x86
#Makefile_32.cpu -- for OSS4
test -e Makefile_32.cpu || cp ../../../all/arch/x86/Makefile_32.cpu ./
exit 0
Note that all/arch/x86/Makefile_32.cpu was copied (cp --parents) from the build directory to /usr/src
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0

javidemon95
Posts: 1
Joined: 2012-02-25 20:18

Re: Kernel compile and install for newbies

#95 Post by javidemon95 »

Hello. Wireless don't work with my compiled kernel. What can I do?

Ibidem
Posts: 160
Joined: 2010-12-24 18:28

Re: Kernel compile and install for newbies

#96 Post by Ibidem »

javidemon95 wrote:Hello. Wireless don't work with my compiled kernel. What can I do?
Recompile your kernel, with the right version and configuration, of course. That's all your info tells us.

If you actually want to solve this, here are my recommendations:

0. Ask in another part of the forum with more details. (This forum is for "How-to"s, not for asking how to do something.)

This report is about as useless for getting help as it can be:
1. You did not state which Debian version you're using. (If you aren't using Debian, ask in your distro's forums.)
Please state whether it's Stable/Squeeze, Testing/Wheezy, or Sid.
2. You did not mention whether wireless worked without a custom kernel.
->If you didn't check, why do you expect your kernel to work?
3. You did not mention what kernel version you built (Kernel 3.x has drivers that are missing in 2.6.32, while some old drivers may have been dropped/broken)
4. You did not mention what wireless card you are using (As root run

Code: Select all

lspci -k #or lshw
)
5. You did not mention whether you enabled the driver for your wireless card.
(If you have no clue, run "make savedefconfig" and attach the defconfig that you get.)

If you don't have the details from at least 1-4, please ask in the beginners forum how to find out or go Google it.
Assuming that you post these details in another part of the forum (Hardware, System Configuration, or Beginners), I'd be happy to help.
But if you want help, please do not use this subforum.
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0

MarianHill
Posts: 1
Joined: 2012-04-18 10:01

Re: Kernel compile and install for newbies

#97 Post by MarianHill »

Hello,
I'm probably making some dumb mistake or two but I can't seem to get a .deb file out to install.
All I'm trying to do is change the system timer resolution from 250Hz to 1000Hz.

I followed instructions from these links; http://newbiedoc.sourceforge.net/system/kernel-pkg.html and https://docs.google.com/viewer?a=v&q=ca ... hsg_WYCLZA

after menuconfig it looks like the change is ok

Code: Select all

root@debian:/usr/src/linux# diff /boot/config-2.6.32-5-686 .config
3,4c3,4
< # Linux kernel version: 2.6.32
< # Mon Mar 26 03:57:35 2012
---
> # Linux kernel version: 2.6.32.hz1000
> # Tue Apr 17 05:45:44 2012
370c370
< CONFIG_HZ_250=y
---
> # CONFIG_HZ_250 is not set
372,373c372,373
< # CONFIG_HZ_1000 is not set
< CONFIG_HZ=250
---
> CONFIG_HZ_1000=y
> CONFIG_HZ=1000
root@debian:/usr/src/linux# 
here's the command I've been using
/usr/src$ fakeroot make-kpkg --append-to-version=.hz1000 kernel_image

So, can I just do some sort of make-deb-file from the newly created linux folder?
Can I just replace the old config file with the new one?
Or, somewhere I got the impression you can do this without installing a deb file.
Any ideas would be much appreciated.

este.el.paz
Posts: 199
Joined: 2012-03-09 19:56
Location: SoCal
Has thanked: 52 times
Been thanked: 1 time

Re: Kernel compile and install for newbies

#98 Post by este.el.paz »

@MHill: did you check my PM? was that any help to you? Sorry to cut into the How-to on the maiden post . . . .

e.e.p.

Ibidem
Posts: 160
Joined: 2010-12-24 18:28

Re: Kernel compile and install for newbies

#99 Post by Ibidem »

MarianHill wrote:Hello,
I'm probably making some dumb mistake or two but I can't seem to get a .deb file out to install.
All I'm trying to do is change the system timer resolution from 250Hz to 1000Hz.
...
after menuconfig it looks like the change is ok

Code: Select all

root@debian:/usr/src/linux# diff /boot/config-2.6.32-5-686 .config
3,4c3,4
< # Linux kernel version: 2.6.32
< # Mon Mar 26 03:57:35 2012
---
> # Linux kernel version: 2.6.32.hz1000
> # Tue Apr 17 05:45:44 2012
370c370
< CONFIG_HZ_250=y
---
> # CONFIG_HZ_250 is not set
372,373c372,373
< # CONFIG_HZ_1000 is not set
< CONFIG_HZ=250
---
> CONFIG_HZ_1000=y
> CONFIG_HZ=1000
root@debian:/usr/src/linux# 
here's the command I've been using
/usr/src$ fakeroot make-kpkg --append-to-version=.hz1000 kernel_image

So, can I just do some sort of make-deb-file from the newly created linux folder?
Can I just replace the old config file with the new one?
Or, somewhere I got the impression you can do this without installing a deb file.
Any ideas would be much appreciated.
I presume that make-kpkg is not creating a deb in the parent directory like it should?
In other words--does

Code: Select all

ls ../*.deb
show anything?

If it didn't work, do this in the kernel source directory:

Code: Select all

make menuconfig #Change CONFIG_LOCALVERSION, and make sure that CONFIG_HZ is properly set
make deb-pkg #as previously discussed in this thread
You have to boot the vmlinuz or bzImage, replacing a config will NOT work.
It's possible to install a kernel without a deb, but if you don't know how, you would be risking an unbootable system; the deb has several hooks for the system to configure everything properly.


PS: FYI, it's also possible to install linux-image-rt-686-pae from backports.org, if you want a realtime kernel.
Thinkpad X100e/Debian Squeeze (All reposiories enabled)/Linux 3.4.11:
1GB RAM/1.6GHz Neo X2/ATI HD 3200/RTL8191SEVA2 wlan0, RTL8169 eth0

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Kernel compile and install for newbies

#100 Post by Soapm »

Removed post...

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Kernel compile and install for newbies

#101 Post by Soapm »

Why so may different ways to compile a kernel? And how do you know which method is best for what you're trying to acheive?

http://kernelnewbies.org/FAQ/KernelCompilation

make
make modules_install
make install

http://wiki.debian.org/HowToRebuildAnOf ... nelPackage

fakeroot make -f debian/rules.gen setup_i386_none_686
fakeroot make -f debian/rules.gen binary-arch_i386_none_686 binary-indep \
DEBIAN_KERNEL_JOBS=${NR_CPUS}
"I have no idea which of the many packages this creates to install"

Then this thread has

make-kpkg clean
make-kpkg --rootcmd fakeroot --initrd --revision=custom.001 kernel_image kernel_headers
dpkg -i *.deb

User avatar
Soapm
Posts: 603
Joined: 2012-05-22 04:23
Has thanked: 1 time

Re: Kernel compile and install for newbies

#102 Post by Soapm »

Ibidem wrote:Since it only disables modules, you can reconfigure the sources later to re-enable a driver, make modules, and install the modules (I've done this at least a couple times, it's not just speculation)..
Or you can use module assitant if all you want to do is add a module

http://wiki.debian.org/ModuleAssistant

User avatar
manishthatte
Posts: 15
Joined: 2014-05-12 02:46

Re: Kernel compile and install for newbies

#103 Post by manishthatte »

I have just begun compiling my own kernel...version 3.15-rc7 for debian wheezy7.5
with local param settings.
This forum has been a tremendous help.

Hope this goes well.

Cheers !!!
Taking baby steps in Debian

User avatar
manishthatte
Posts: 15
Joined: 2014-05-12 02:46

Re: Kernel compile and install for newbies

#104 Post by manishthatte »

Finished. All went well till now. :)

Further steps after compiling:

1) sudo make modules_install
2) sudo make install
3) sudo depmod
4) sudo update-initramfs -c -k'(version number)'
5) Reboot
Taking baby steps in Debian

User avatar
manishthatte
Posts: 15
Joined: 2014-05-12 02:46

Re: Kernel compile and install for newbies

#105 Post by manishthatte »

And lastly, dont forget to update-grub ;)
Taking baby steps in Debian

acimmarusti
Posts: 397
Joined: 2009-02-27 04:59
Location: Portland, OR USA

Re: Kernel compile and install for newbies

#106 Post by acimmarusti »

Have you guys been able to compile kernels since 3.14 ?

From vanilla sources, I keep getting this annoying error about a "recipe" for a driver failing, for more details see this:

http://forums.debian.net/viewtopic.php?f=5&t=117033

Post Reply