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
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Kernel compile and install for newbies

#81 Post by stevepusser »

You can also get vanilla source for a release from the liquorix repo. Note that this is something like 3.0.0-0 source, for example, you will need to apply the point patch to bring it up to something like 3.0.6 vanilla. The Liqourix patch includes these point patches along with lots of other, more exotic , patches.


http://liquorix.net/debian/pool/main/l/linux-liquorix/
MX Linux packager and developer

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

Re: Kernel compile and install for newbies

#82 Post by acimmarusti »

stevepusser wrote:You can also get vanilla source for a release from the liquorix repo. Note that this is something like 3.0.0-0 source, for example, you will need to apply the point patch to bring it up to something like 3.0.6 vanilla. The Liqourix patch includes these point patches along with lots of other, more exotic , patches.


http://liquorix.net/debian/pool/main/l/linux-liquorix/
Yes I've used this before as well. It's really good for desktop applications, although it's hard to see a difference between a liquorix kernel and a mainline one (modified for performance) on a very new computer.

Thanks

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

Re: Kernel compile and install for newbies

#83 Post by acimmarusti »

Do you guys know how to compile a kernel with all the firmware (non-free and free) built-in?

I tried building the kernel activating the option to include the firmware blobs in the kernel, but when I boot this kernel it still cannot bring my wifi card on.

My wireless card only became supported with 3.0.x but I don't want to rely on the firmware shipped by debian.

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

Re: Kernel compile and install for newbies

#84 Post by Ibidem »

acimmarusti wrote:Do you guys know how to compile a kernel with all the firmware (non-free and free) built-in?

I tried building the kernel activating the option to include the firmware blobs in the kernel, but when I boot this kernel it still cannot bring my wifi card on.

My wireless card only became supported with 3.0.x but I don't want to rely on the firmware shipped by debian.
Troubleshooting:

Code: Select all

lsmod
modinfo <drivername>
dmesg|grep drivername
I would not recommend building wireless in--"modprobe -r ; modprobe" often beats having to reboot.

Do you have a RTL819x card?

Anyhow, here are the lines I have that seem relevant to the issue:

Code: Select all

# CONFIG_PREVENT_FIRMWARE_BUILD is not set
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""
Debian defaults to CONFIG_PREVENT_FIRMWARE_BUILD=y .
You would need to disable this to build the nonfree firmware.

Run "make deb-pkg" to build the kernel--it will give you about 4 packages (kernel, firmware, headers, and linux-libc-dev). Then I use the resulting firmware package from the compile instead of some unmatching Debianized package that can't be counted on to include any firmware for the driver, let alone have the right version.
I'm not sure if make deb-pkg/other ways of generating debs override some .config options.
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

#85 Post by acimmarusti »

Ibidem wrote: Troubleshooting:

Code: Select all

lsmod
modinfo <drivername>
dmesg|grep drivername
I would not recommend building wireless in--"modprobe -r ; modprobe" often beats having to reboot.
Yeah I guess your right about this
Ibidem wrote: Do you have a RTL819x card?
Yes I do. My card is:

Code: Select all

rtl8192se
PCI: 10EC:8172 Realtek Semiconductor Co., Ltd. RTL8191SEvB Wireless LAN Controller
Ibidem wrote: Anyhow, here are the lines I have that seem relevant to the issue:

Code: Select all

# CONFIG_PREVENT_FIRMWARE_BUILD is not set
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""
Debian defaults to CONFIG_PREVENT_FIRMWARE_BUILD=y .
You would need to disable this to build the nonfree firmware.

Run "make deb-pkg" to build the kernel--it will give you about 4 packages (kernel, firmware, headers, and linux-libc-dev). Then I use the resulting firmware package from the compile instead of some unmatching Debianized package that can't be counted on to include any firmware for the driver, let alone have the right version.
I'm not sure if make deb-pkg/other ways of generating debs override some .config options.
I see. I normally use 'make-kpkg' to build my customized kernels. Would that also build the extra firmware packages? I still follow the procedure outlined at the beginning of this thread to build the kernels, basically. Is there a newer better way using 'make deb-pkg' ?

Thanks, I will give this a try, though for the moment, the firmware from backports is working well, but I would prefer to try the vanilla one.

the dsc
Posts: 100
Joined: 2007-08-18 22:14

Re: Kernel compile and install for newbies

#86 Post by the dsc »

How to apply one of those official debian patches to the kernel sources? I don't get it. It seems that "non-debian" patches would be in some .gz file, and you would apply by symlinking it to the root of the kernel source, then using the command patch, whatever is the syntax.

These patches I'm talking about, however, are installed at /usr/src/kernel-patches/all/3.0.0/.

This one specifically is named just "debian":

http://packages.debian.org/wheezy/linux ... bian-3.0.0

If I just leave it there and keep following some kernel compilation tutorial it will be applied "by itself" at some point, or there's something I need to do?

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Kernel compile and install for newbies

#87 Post by stevepusser »

It depends on how the kernel is built. Debian kernels use the standard Debian package build tools, following instructions inside a /debian folder that is added to the original source. The basic set of instructions is in /debian/rules, but from what I've seen for the kernel, it's very complicated. Policy for patches has them inside the /debian/patches folder.

However, for a manual build of the kernel, just apply the patche(s) with the patch command. They don't have to be in the kernel source folder if the full path of the patch is specified.
MX Linux packager and developer

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

Re: Kernel compile and install for newbies

#88 Post by acimmarusti »

Ibidem wrote: Run "make deb-pkg" to build the kernel--it will give you about 4 packages (kernel, firmware, headers, and linux-libc-dev). Then I use the resulting firmware package from the compile instead of some unmatching Debianized package that can't be counted on to include any firmware for the driver, let alone have the right version.
I'm not sure if make deb-pkg/other ways of generating debs override some .config options.
I looked at the Debian kernel handbook and I saw that now, the recommended method of building your own kernel packages is using 'make deb-pkg' instead of 'make-kpkg', however using both methods, with the same configuration file, leads to disproportionate package sizes!

With 'make-kpkg' I would usually get a size of kernel installation (as reported by synaptic) of about 116 Mb (for 3.0.7)

But now with 'make deb-pkg' I get 1645 Mb!! which is just CRAZY!

I read here: http://forums.debian.net/viewtopic.php?f=5&t=62969, that this is supposed to happen if I enable debugging symbols in the kernel configuration, but like I said before, I didn't change the config file at all!

As a result of this, the kernel takes noticeably longer to boot! How to you circumvent this problem?

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

Re: Kernel compile and install for newbies

#89 Post by Ibidem »

acimmarusti wrote:
I looked at the Debian kernel handbook and I saw that now, the recommended method of building your own kernel packages is using 'make deb-pkg' instead of 'make-kpkg', however using both methods, with the same configuration file, leads to disproportionate package sizes!

With 'make-kpkg' I would usually get a size of kernel installation (as reported by synaptic) of about 116 Mb (for 3.0.7)

But now with 'make deb-pkg' I get 1645 Mb!! which is just CRAZY!

I read here: http://forums.debian.net/viewtopic.php?f=5&t=62969, that this is supposed to happen if I enable debugging symbols in the kernel configuration, but like I said before, I didn't change the config file at all!

As a result of this, the kernel takes noticeably longer to boot! How to you circumvent this problem?
That's the first problem. If you build a custom kernel, why use the default config? That's not meant to provide what you need--it's meant to run on every x86 computer made since around 1995,provided it has enough ram, and support every peripheral known to the kernel developers.
I would strongly recommend that you do "make localmodconfig" and then configure with make nconfig ( or menuconfig/xconfig/gconfig ).
I'm getting install sizes of 9-12 MB, with wireless, KVM, and all. (9 MB when I use XZ compression, 12 MB when I use LZO compression--which is the lowest compression available)
Build times are well under an hour (maybe 30-40 minutes max, without any parallelization). I'm pretty sure a full default kernel would take over 3 hrs to build here.
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

#90 Post by acimmarusti »

Ibidem wrote: That's the first problem. If you build a custom kernel, why use the default config? That's not meant to provide what you need--it's meant to run on every x86 computer made since around 1995,provided it has enough ram, and support every peripheral known to the kernel developers.
I would strongly recommend that you do "make localmodconfig" and then configure with make nconfig ( or menuconfig/xconfig/gconfig ).
I'm getting install sizes of 9-12 MB, with wireless, KVM, and all. (9 MB when I use XZ compression, 12 MB when I use LZO compression--which is the lowest compression available)
Build times are well under an hour (maybe 30-40 minutes max, without any parallelization). I'm pretty sure a full default kernel would take over 3 hrs to build here.
Thanks for your response. Well I found out the problem I was having. My kernel images are still about 3 times larger than yours, but they are of the same size as the default debian amd64 kernel image.

The problem is that you have to turn off the kernel option CONFIG_DEBUG_INFO. Which is located under the Kernel hacking menu (if you use make menuconfig / xconfig /gconfig). Curiously, the other method of creating deb packages, strips this debug info out of the kernel image. I guess this eventually becomes the usual debianized linux-*-dbg package if you want it that way.

I'm interested about this localmodconfig option. I realize I can do better at customizing my kernels, but I'm just paranoid about not having a driver for some bizarre peripheral device that I could potentially hook up to my laptop / computer.

Andres

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

Post Reply