KernelCustomBuild
|
Size: 11177
Comment: typos
|
← Revision 90 as of 2011-03-13 19:14:33 ⇥
Size: 11826
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| == Disclaimer == | The Kernel build documentation has moved to https://help.ubuntu.com/community/Kernel/Compile |
| Line 3: | Line 3: |
| Building and using a custom kernel will make it very difficult to get support for your system. You will not be allowed to file bugs on the custom-built kernel (if you do, they will be Rejected without explanation). | How to build upstream (or git) kernels is located [[KernelTeam/GitKernelBuild|here]] |
| Line 5: | Line 5: |
| If you have a commercial support contract with Ubuntu/Canonical, this will void such support. | Please update any bookmarks or links pointing to this page. |
| Line 7: | Line 7: |
| Also note that this page describes how to do things for the Edgy (2.6.17) kernel and newer! Until this kernel source, we did not have any mechanisms in place that would allow people to build their own kernels easily. This was intentional. This page does '''NOT''' describe how to build stock kernels from kernel.org. This is how to rebuild the actual Ubuntu kernel source. == Reasons for compiling a custom kernel == * You are a kernel developer. * You need the kernel compiled in a special way, that the official kernel is not compiled in (for example, with some experimental feature enabled). * You are attempting to debug a problem for which you have filed or will file a bug report on the stock Ubuntu kernel. == Reasons for NOT compiling a custom kernel == * You merely need to compile a special driver. For this, you only need to install the linux-headers packages. * You have no idea what you are doing, and if you break something, you'll need help fixing it. If you hose your box, reinstall. Don't bother asking for help. * You got to this page by mistake, but checked it out because it looked interesting. Believe me, this isn't interesting at all :) == What you'll need == To start, you will need to install a few packages. {{{ sudo apt-get install linux-kernel-devel fakeroot kernel-wedge kernel-package }}} This will install the compiler related packages and kernel packaging tools. It will also install the git-core package, which is the best way to interact with the Ubuntu kernel source. == How to get the kernel source == There are two ways to obtain the Ubuntu kernel source. The prefered way is to use git. Detailed instructions for using git can be found in KernelGitGuide. The other way is to simply: {{{ sudo apt-get install linux-source }}} This will give you the source to the latest available kernel. However, this will almost always be out of date compared to the latest development source. Using git allows you to always stay in sync with the latest Ubuntu kernel source. == Modifying the source for your needs == For most people, simply modifying the configs is enough. If you need to install a patch, read the instructions from the patch provider for how to apply. The stock Ubuntu configs are located in ''debian/config/ARCH/'' where ARCH is the architecture you are building for. In this directory are several files. The ''config'' file is the base for all targets in that architecture. Then there are several config.FLAVOUR files that contain options specific to that target. For example, here are the files for 2.6.17, i386: {{{ $ ls -l debian/config/i386/ total 88 -rw-r--r-- 1 me me 62737 Jun 14 18:31 config -rw-r--r-- 1 me me 1859 Jun 12 14:59 config.386 -rw-r--r-- 1 me me 1394 Jun 12 14:59 config.686 -rw-r--r-- 1 me me 1420 Jun 12 14:59 config.k7 -rw-r--r-- 1 me me 1519 Jun 12 14:59 config.server -rw-r--r-- 1 me me 1867 Jun 12 14:59 config.server-bigiron }}} If you need to change a config option, simply modify the file that contains the option. If you modify just the ''config'' file, it will affect all targets for this architecture. If you modify one of the target files, it only affects that target. Note: If you do not find the config files there, you may find them in your /boot directory. For instance: /boot/config-2.6.15-23-386 After applying a patch, or adjusting the configs, it is always best to regenerate the config files to ensure they are consistent. There is a helper command for this. To regenerate all architectures run: {{{ debian/rules updateconfigs }}} If you just want to update one architecture, run: {{{ debian/bin/oldconfig ARCH }}} == Building the kernel == To build the kernel(s) is very simple. Depending on your needs, you may want to build all the kernel targets, or just one specific to your system. However, you also want to make sure that you do not clash with the stock kernels. Use this command to build all targets for the architecture you are building on: {{{ AUTOBUILD=1 fakeroot debian/rules binary-debs }}} The ''AUTOBUILD'' environment variable triggers special features in the kernel build. First, it skips normal ABI checks (ABI is the binary compatibility). It can do this because it also creates a unique ABI ID. If you used a git repo, this unique ID is generated from the git HEAD SHA. If not, it is generated from the uuidgen program (which means every time you execute the debian/rules build, the UUID will be different!). Your packages will be named using this ID. To build a specific target, use this command: {{{ AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=k7 }}} This will only build the AMD k7 variant of the i386 architecture. The debs are placed in ubuntu-2.6/debian/build. == Alternate Build Method: The Old-Fashioned Debian Way == The new Ubuntu build system is great for developers, for people who need the absolute latest bleeding-edge kernel, and people who need to build a diverse set of kernels (several "flavours"). However it can be a little complex for ordinary users. If you don't need the latest development sources, there is a simpler way to compile your kernel from the linux-source package. As suggested above, all you need for this is: {{{ sudo apt-get install linux-source mkdir ~/src cd ~/src tar xjvf /usr/src/linux-source-[version-number-here].bz2 }}} Now you are in the top directory of a source tree; to configure and ocmpile your kernel simply {{{ make menuconfig make-kpkg --rootcmd fakeroot --initrd --append-to-version=-some-string-here kernel-image kernel-headers }}} The packages should be placed in ~/. == When it's done == Now that the build is complete, you can install the generated debs using dpkg: {{{ sudo dpkg -i linux-image-2.6.17-2-ef427c-k7_2.6.17-2.2_i386.deb sudo dpkg -i linux-headers--2.6.17-2-ef427c-k7_2.6.17-2.2_i386.deb }}} If you use modules from ''linux-restricted-modules'', you will need to recompile this against your new linux-headers package. Details on how to do this will be added later. == Linux-Restricted-Modules: the Tough Stuff == The Linux-Restricted-Modules (l-r-m) package contains a number of non-DFSG-free drivers (as well as some firmware and the ipw3945 wireless networking daemon) which, in a perfect world, wouldn't have to be packaged speerately, but which unfortunately are not available under a GPL-compatible license. If you use any of the hardware supported by the l-r-m package, you will likely find that your system does not work as well after switching to a custom kernel. In this case you should try to compile the l-r-m package. === Get the source === First, we make sure we have all the packages necessary to build l-r-m, and then we fetch the source: {{{ sudo apt-get build-dep linux-restricted-modules-2.6.some-version-ubuntu apt-get source linux-restricted-modules-2.6.some-version-ubuntu cd linux-restricted-modules-2.6.something }}} === Mess with debian/rules === Debian (and hence Ubuntu) packages are built by calling the the debian/rules script from the top source directory; this script is a specialized Makefile with 'targets' you can call as arguments when you run the script. The l-r-m debian/rules script is currently (2006-11) geared towards developers working with the official builds and makes certain assumptions about kernel version numbers and what header packages are installed; if you need to build l-r-m on your own, you will need to customize it. The full range of customizations are beyond the scope of this guide, but here are a couple examples of problems you're likely to run into and possible ways to solve them: '''Kernel Version Mismatch ''' If you built your kernel using one of the recommended methods, your kernel version is probably not precisely what debian/rules expects; for instance, my git-built kernel is called 2.6.19-7-ref-generic instead of 2.6.19-7-generic, while my make-kpkg-built kernel is called 2.6.19-7-suspend2-generic. You can solve this problem by changing this line (the actual value here will be different by the time you read this): {{{ abi_version = 7 }}} to something like this: {{{ abi_version = 7-ref }}} ''' Too Many Flavours ''' debian/rules expects you to have the header files for all possible kernel flavours already installed. If you only compiled one kernel flavour, this is of course impossible. So you need to look in debian/rules and change all the "flavours" lines so that only one flavour is listed -- the one you have already compiled. so for instance in my case, working on the i386 architecture: {{{ flavours := $(addprefix $(kernel_abi_version)-,generic, server, lowlatency) }}} became: {{{ flavours := $(addprefix $(kernel_abi_version)-,generic) }}} You may find that further modifications are necessary. ''' udebs mess you up ''' The standard "binary" target includes building udebs, which look for flavours that you may not have installed. I did two things: 1. Modified debian/d-i/kernel-versions.in 1. deleted "build-udebs" from the binary target I'm not sure the latter was necessary, but as you are not likely to need to build any udebs it's probably pretty safe to do. Now cross your fingers and hope! Try to build with: {{{ fakeroot debian/rules binary }}} I found that the system didn't recover very easily from errors and unsuccessful builds, and that the debian/rules "clean" target didn't always want to clean up, so I had to reinstall the source several times. It may be possible to redesign the debian/rules script to make it easier for non-devs to use. If I learn enough about Makefiles I will make an effort to do that... |
This page is now used for comments, questions and discussion. |
| Line 196: | Line 10: |
'''Q:''' How does one compile a driver module only without having to recompile the whole kernel. I have a custom joystick driver drivers/input/joystick/custom.c that I am tweaking. Will the procedure at http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html work? '''A:''' Here's some untested hints. There's "building external modules" instruction doc in the kernel source: http://lxr.linux.no/linux+v2.6.28.3/Documentation/kbuild/modules.txt If you do "make help" in the kernel it mentions a .ko target: dir/file.ko - Build module including final link (around http://lxr.linux.no/linux+v2.6.28.3/Makefile#L1258) MartinPitt: the easiest and best recipe that I found is to treat them as external modules, even when they are in-tree. This avoids having to configure the kernel tree, and also takes care to install them into `/extras/`, so that they don't overwrite the packages' kernel modules and you have an easy way to revert. For example, to test a patch to the i915 driver: {{{ cd linux-2.6.30/drivers/gpu/drm/i915/ patch i915_drv.c /tmp/patch # make any modification you need here make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules sudo make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules_install sudo depmod -a }}} This will put the driver into /lib/modules/*/extra/i915.ko; if it breaks, just remove that and do `depmod -a` again. If you want that the kernel uses the patched module during boot you need to do this as well: {{{ sudo update-initramfs -u }}} MattBehrens: If you run into missing include files with MartinPitt's recipe above, you may need to set KBUILD_SRC as well. For that same driver I had to do: {{{ make -C /usr/src/linux-headers-`uname -r` M=`pwd` KBUILD_SRC=`pwd`/../../../.. modules sudo make -C /usr/src/linux-headers-`uname -r` M=`pwd` KBUILD_SRC=`pwd`/../../../.. modules_install }}} |
|
| Line 199: | Line 49: |
| '''A:''' | '''A:''' Take a look at the Debian Installer instructions for this: http://wiki.debian.org/DebianInstaller/Modify/CustomKernel Although I haven't tried these instructions yet, and they might not quite work with the current Ubuntu Way, they look fairly comprehensive and should at least be a step in the right direction. (MatthewPalmer) |
| Line 218: | Line 68: |
| * you can try using make-kpkg, the standard debian kernel-building tool. There are lots of guides around, hopefully the net person to read this page will have more time and put in a link. * http://newbiedoc.sourceforge.net/system/kernel-pkg.html |
|
| Line 220: | Line 72: |
| '''Q:''' What is Ubuntu's default kernel config? The kernel doesn't put anything in /proc/config. * like all debian-based system, ubuntu's kernel puts the config in {{{ /boot/config-`uname -r` }}} '''Q:''' Maybe that's not the right place to ask, but I am stuck... I am trying to compile a vanilla kernel (to test an issue with suspend/resume). I do not want to use the make-kpkg method --- too slow on recompiles. So I can compile the kernel, install modules, and then I make the initrd.img with the update-initramfs thing... and all seems to work, but the new kernel simply boots on a BusyBox and does not boot the system. How do I build an initramfs image equivalent to the standard ubuntu one? RomanoGiannetti2 * Well, auto-answering. update-initramfs '''do''' work. I was bitten by this bug: http://lists.debian.org/debian-kernel/2006/07/msg00427.html which seems to still exists. Call update-initramfs with -v and it will fail. '''Q:''' What is the correct way to add 'lib/firmware/<custom-kernel>' to a custom kernel .deb so that the kernel and firmware can be distributed together? '''Q:''' Where do the firmware images from the generic kernel come from - (ie which package?) - or how does one get them so one can build a generic kernel? It would be useful if this was explained somewhere. I found that the system didn't recover very easily from errors and unsuccessful builds, and that the debian/rules "clean" target didn't always want to clean up, so I had to reinstall the source several times. It may be possible to redesign the debian/rules script to make it easier for non-devs to use. If I learn enough about Makefiles I will make an effort to do that... '''Q:''' Where can I find the .config file for the \casper\ live cd 7.04 kernel RichardWarwick '''Q:''' The page gives a stern warning against building kernels just to customize a driver. Could we please have some other page with step-by-step instructions for customizing a driver. E.G. adding a device ID to usbserial? BensonMargulies2 '''A/Q:''' I recently had to build a kernel with the same version names just so I could basically load a serial PCI module the kernel maintainers won't patch and this also required I include a new kernel because the module is built into kernel instead of being a module. I agree, it is a really crappy way to do it but this is the only way I know which still lets all the Ubuntu repository packages still keep on keeping on. They still think it's the regular Ubuntu kernel. It is, with the exception of one darn PCI module. For what it's worth, here's the batch file of all this entailed: *sudo apt-get build-dep linux-source-2.6.22 fakeroot *sudo apt-get source linux-image-2.6.22-14-generic *cd linux-source-2.6.22-2.6.22/ *# PATCH YOUR MODULE(s) SOURCE *sudo cp /boot/config-2.6.22-14-generic .config *# MAKE SMALL CHANGES TO THE KERNEL CONIFG IF NEEDED *sudo make menuconfig *cat /proc/version *# notice the -14-generic part of the version and use this in the Makefile: EXTRAVERSION = -14 *sudo vi Makefile *sudo make-kpkg --rootcmd fakeroot --initrd --append-to-version=-generic kernel-image *sudo cp arch/i386/boot/bzImage /boot/bzImage-2.6.22-14-generic *sudo cp YOUR-MODULE.ko to /lib/module/2.6.22-14-generic/kernel/MODULE-LOCATION/MODULE-NAME.ko *# copy the default grub menu item and change the vmlinuz.... kernel to use bzImage..... *sudo vi /boot/grub/menu.lst '''Q''':Is there a better way and is there a way to just build modules instead of the whole kernel and all modules? '''Q:''' When I try to run "debian/scripts/misc/oldconfig" I get the error: "bash: debian/scripts/misc/oldconfig: Permission denied" I get a similar error with debian/scripts/misc/splitconfig.pl This is easy to workaround with "chmod +x debian/scripts/misc/oldconfig". However, is this a bug or an error in the doc, or ...? '''Q:''' The linux-image-2.6.24-7-generic.deb is only 18MB, but my custom built kernel linux-image-2.6.24.3-kml-kml_2.6.24-16.30_i386.deb is 198MB. All I did was add the Kernel Mode Linux patch, and disable Paravirtualisation. Why would it be so large? Also when I try to install the deb it [[http://www.csse.uwa.edu.au/~john/bugs/InstallCustomKernel|claims]] it cannot find "/lib/firmware/2.6.24.3-kml-kml"; why? *This expansion occurs when I use make-kpkg. When I use the other approach the kernel size is normal, but it seems to not build the .config changes into the kernel (though it does put them in /boot/....config) *This expansion appears to be caused by the .ko files becoming larger. The standard net/ipv6/ipv6.ko file is 312K, but the one created by make-kpkg is 4.5MB. * The expansion has nothing to do with the KML patch. It also occurs when attempting to compile a standard Ubuntu kernel with make-kpkg. * A workaround is to set CONFIG_DEBUG_INFO=n in the .config file. '''A:''' This is explained elsewhere in the wiki. We compile our kernels with debug symbols to create the debug packages. In our build process, we strip the debug symbols from the modules in the main package. '''Q:''' The page says that I should copy the .config and customize it before doing a make-kpkg. However make-kpkg seems to overwrite the .config within a minute of starting. What gives? '''A:''' make-kpkg normalises the .config. If your additions to the .config specify features that are not in the tree, then they will be removed. (E.g. you may have enabled options in .config, but forgot to patch the kernel to add support for those options to the kernel) '''Q:''' How can you prevent Adept Updater from wanting to replace a custom kernel with the standard kernel before an update has occurred? '''A:''' I think Adept Update adds new kernels but does not remove old ones. Try Editing /boot/grub/menu.lst and copy the entry for your custom kernel above the "AUTOMAGIC KERNELS LIST" so that it will remain the default boot kernel even after newer kernels have been installed. '''Q/A:''' I have also noticed the warning against compiling your own kernel at the top of this howto, as well as the admonition that the availability of the linux-headers make it unnecessary to do a full kernel compile to build a single driver. It has been my experience that the linux-headers don't work. Every time I have to build vmware-tools modules, or third party drivers such as Tivoli Storage Manager tape library drivers the build fails with linux-headers. So, if the system is to support such applications I always build my own kernel so that the running kernel has a complete set of matching source code, that actually works, to build other software against. I also find it strange that a linux system with gcc installed can't build a 5 line "C" program that includes "stdio.h". I did an "apt-get install build-essential" to fix this. Do enjoy the package management. '''A:''' I have excellent experience building the VirtualBox guest kernel modules against absolutely clean installations of Ubuntu Desktop, in versions ranging from 6.06 to 10.04. '''Q:''' This question may be the same as the one above about Adept Updater but I'm not sure. After building a customized kernel using the first method (the Ubuntu way) the system updater will constantly try to downgrade your custom kernel to the stock Ubuntu kernel of the same version. For example, I just built a custom 2.6.28-14 kernel. After installing this custom kernel if I do an "apt-get dist-upgrade" it will replace my custom 2.6.28-14 kernel with the stock Ubutun 2.6.28-14 kernel. What is the correct way to prevent that? '''Q:''' In the sections on good and bad reasons to compile your own kernel, performance is not mentioned. Is there a performance gain after compiling the kernel locally? '''Q:''' How do you unpack your kernel after step "Get the kernel source" and before "Modify the source for your needs"? Particularly, where is debian/config? |
|
| Line 222: | Line 142: |
| CategoryKernel | CategoryKernel CategoryDocumentation |
The Kernel build documentation has moved to https://help.ubuntu.com/community/Kernel/Compile
How to build upstream (or git) kernels is located here
Please update any bookmarks or links pointing to this page.
This page is now used for comments, questions and discussion.
Comments
Q: How does one compile a driver module only without having to recompile the whole kernel. I have a custom joystick driver drivers/input/joystick/custom.c that I am tweaking. Will the procedure at http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html work?
A: Here's some untested hints.
There's "building external modules" instruction doc in the kernel source: http://lxr.linux.no/linux+v2.6.28.3/Documentation/kbuild/modules.txt
If you do "make help" in the kernel it mentions a .ko target:
- dir/file.ko - Build module including final link
(around http://lxr.linux.no/linux+v2.6.28.3/Makefile#L1258)
MartinPitt: the easiest and best recipe that I found is to treat them as external modules, even when they are in-tree. This avoids having to configure the kernel tree, and also takes care to install them into /extras/, so that they don't overwrite the packages' kernel modules and you have an easy way to revert. For example, to test a patch to the i915 driver:
cd linux-2.6.30/drivers/gpu/drm/i915/ patch i915_drv.c /tmp/patch # make any modification you need here make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules sudo make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules_install sudo depmod -a
This will put the driver into /lib/modules/*/extra/i915.ko; if it breaks, just remove that and do depmod -a again.
If you want that the kernel uses the patched module during boot you need to do this as well:
sudo update-initramfs -u
MattBehrens: If you run into missing include files with MartinPitt's recipe above, you may need to set KBUILD_SRC as well. For that same driver I had to do:
make -C /usr/src/linux-headers-`uname -r` M=`pwd` KBUILD_SRC=`pwd`/../../../.. modules sudo make -C /usr/src/linux-headers-`uname -r` M=`pwd` KBUILD_SRC=`pwd`/../../../.. modules_install
Q: What about custom install and netboot images (and their initrd etc)?, PeterMagnusson
A: Take a look at the Debian Installer instructions for this: http://wiki.debian.org/DebianInstaller/Modify/CustomKernel Although I haven't tried these instructions yet, and they might not quite work with the current Ubuntu Way, they look fairly comprehensive and should at least be a step in the right direction. (MatthewPalmer)
Q: What directory are you in when you run these commands ls -l debian/config/i386/ I'm sure you mean to untar the kernel source you just downloaded and cd into that tree (cd /usr/src ; tar xf linux-source-2.6.17.tar.bz2 ; cd linux-source-2.6.17) but there is no directory debian/config/i386 in there. debian/Config has .config files in it, but no bigiron file so i dono where that kernel comes from? EliCriffield
A: Maybe he meant debian/Config?
A2: On 6.06, the linux-source package does not include the debian directory, it seems. You need to install the source package for linux-image, with a command like
sudo apt-get source linux-image-2.6.15-27-386
Q: Is there any way to get a kernel build faster? I would like to do some "light" kernel hacking. What are the easy steps to just compile a kernel image?
- you can try using make-kpkg, the standard debian kernel-building tool. There are lots of guides around, hopefully the net person to read this page will have more time and put in a link.
Q: What is Ubuntu's default kernel config? The kernel doesn't put anything in /proc/config.
like all debian-based system, ubuntu's kernel puts the config in /boot/config-`uname -r`
Q: Maybe that's not the right place to ask, but I am stuck... I am trying to compile a vanilla kernel (to test an issue with suspend/resume). I do not want to use the make-kpkg method --- too slow on recompiles. So I can compile the kernel, install modules, and then I make the initrd.img with the update-initramfs thing... and all seems to work, but the new kernel simply boots on a BusyBox and does not boot the system. How do I build an initramfs image equivalent to the standard ubuntu one? RomanoGiannetti2
Well, auto-answering. update-initramfs do work. I was bitten by this bug:
http://lists.debian.org/debian-kernel/2006/07/msg00427.html which seems to still exists. Call update-initramfs with -v and it will fail.
Q: What is the correct way to add 'lib/firmware/<custom-kernel>' to a custom kernel .deb so that the kernel and firmware can be distributed together?
Q: Where do the firmware images from the generic kernel come from - (ie which package?) - or how does one get them so one can build a generic kernel? It would be useful if this was explained somewhere.
I found that the system didn't recover very easily from errors and unsuccessful builds, and that the debian/rules "clean" target didn't always want to clean up, so I had to reinstall the source several times. It may be possible to redesign the debian/rules script to make it easier for non-devs to use. If I learn enough about Makefiles I will make an effort to do that...
Q: Where can I find the .config file for the \casper\ live cd 7.04 kernel RichardWarwick
Q: The page gives a stern warning against building kernels just to customize a driver. Could we please have some other page with step-by-step instructions for customizing a driver. E.G. adding a device ID to usbserial? BensonMargulies2
A/Q: I recently had to build a kernel with the same version names just so I could basically load a serial PCI module the kernel maintainers won't patch and this also required I include a new kernel because the module is built into kernel instead of being a module. I agree, it is a really crappy way to do it but this is the only way I know which still lets all the Ubuntu repository packages still keep on keeping on. They still think it's the regular Ubuntu kernel. It is, with the exception of one darn PCI module. For what it's worth, here's the batch file of all this entailed:
- sudo apt-get build-dep linux-source-2.6.22 fakeroot
- sudo apt-get source linux-image-2.6.22-14-generic
- cd linux-source-2.6.22-2.6.22/
- # PATCH YOUR MODULE(s) SOURCE
- sudo cp /boot/config-2.6.22-14-generic .config
- # MAKE SMALL CHANGES TO THE KERNEL CONIFG IF NEEDED
- sudo make menuconfig
- cat /proc/version
- # notice the -14-generic part of the version and use this in the Makefile: EXTRAVERSION = -14
- sudo vi Makefile
- sudo make-kpkg --rootcmd fakeroot --initrd --append-to-version=-generic kernel-image
- sudo cp arch/i386/boot/bzImage /boot/bzImage-2.6.22-14-generic
- sudo cp YOUR-MODULE.ko to /lib/module/2.6.22-14-generic/kernel/MODULE-LOCATION/MODULE-NAME.ko
- # copy the default grub menu item and change the vmlinuz.... kernel to use bzImage.....
- sudo vi /boot/grub/menu.lst
Q:Is there a better way and is there a way to just build modules instead of the whole kernel and all modules?
Q: When I try to run "debian/scripts/misc/oldconfig" I get the error: "bash: debian/scripts/misc/oldconfig: Permission denied" I get a similar error with debian/scripts/misc/splitconfig.pl This is easy to workaround with "chmod +x debian/scripts/misc/oldconfig". However, is this a bug or an error in the doc, or ...?
Q: The linux-image-2.6.24-7-generic.deb is only 18MB, but my custom built kernel linux-image-2.6.24.3-kml-kml_2.6.24-16.30_i386.deb is 198MB. All I did was add the Kernel Mode Linux patch, and disable Paravirtualisation. Why would it be so large? Also when I try to install the deb it claims it cannot find "/lib/firmware/2.6.24.3-kml-kml"; why?
- This expansion occurs when I use make-kpkg. When I use the other approach the kernel size is normal, but it seems to not build the .config changes into the kernel (though it does put them in /boot/....config)
- This expansion appears to be caused by the .ko files becoming larger. The standard net/ipv6/ipv6.ko file is 312K, but the one created by make-kpkg is 4.5MB.
- The expansion has nothing to do with the KML patch. It also occurs when attempting to compile a standard Ubuntu kernel with make-kpkg.
- A workaround is to set CONFIG_DEBUG_INFO=n in the .config file.
A: This is explained elsewhere in the wiki. We compile our kernels with debug symbols to create the debug packages. In our build process, we strip the debug symbols from the modules in the main package.
Q: The page says that I should copy the .config and customize it before doing a make-kpkg. However make-kpkg seems to overwrite the .config within a minute of starting. What gives?
A: make-kpkg normalises the .config. If your additions to the .config specify features that are not in the tree, then they will be removed. (E.g. you may have enabled options in .config, but forgot to patch the kernel to add support for those options to the kernel)
Q: How can you prevent Adept Updater from wanting to replace a custom kernel with the standard kernel before an update has occurred?
A: I think Adept Update adds new kernels but does not remove old ones. Try Editing /boot/grub/menu.lst and copy the entry for your custom kernel above the "AUTOMAGIC KERNELS LIST" so that it will remain the default boot kernel even after newer kernels have been installed.
Q/A: I have also noticed the warning against compiling your own kernel at the top of this howto, as well as the admonition that the availability of the linux-headers make it unnecessary to do a full kernel compile to build a single driver. It has been my experience that the linux-headers don't work. Every time I have to build vmware-tools modules, or third party drivers such as Tivoli Storage Manager tape library drivers the build fails with linux-headers. So, if the system is to support such applications I always build my own kernel so that the running kernel has a complete set of matching source code, that actually works, to build other software against. I also find it strange that a linux system with gcc installed can't build a 5 line "C" program that includes "stdio.h". I did an "apt-get install build-essential" to fix this. Do enjoy the package management.
A: I have excellent experience building the VirtualBox guest kernel modules against absolutely clean installations of Ubuntu Desktop, in versions ranging from 6.06 to 10.04.
Q: This question may be the same as the one above about Adept Updater but I'm not sure. After building a customized kernel using the first method (the Ubuntu way) the system updater will constantly try to downgrade your custom kernel to the stock Ubuntu kernel of the same version. For example, I just built a custom 2.6.28-14 kernel. After installing this custom kernel if I do an "apt-get dist-upgrade" it will replace my custom 2.6.28-14 kernel with the stock Ubutun 2.6.28-14 kernel. What is the correct way to prevent that?
Q: In the sections on good and bad reasons to compile your own kernel, performance is not mentioned. Is there a performance gain after compiling the kernel locally?
Q: How do you unpack your kernel after step "Get the kernel source" and before "Modify the source for your needs"? Particularly, where is debian/config?
KernelCustomBuild (last edited 2011-03-13 19:14:33 by 84-73-137-162)