KernelCustomBuild

Differences between revisions 68 and 69
Revision 68 as of 2008-05-16 00:33:52
Size: 6940
Editor: 203-59-182-84
Comment:
Revision 69 as of 2008-06-02 00:19:29
Size: 7252
Editor: CPE0040052dd6d6-CM001692429fb4
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:

'''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?

The Kernel build documentation has moved to https://help.ubuntu.com/community/Kernel/Compile

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?

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

SteveEdmondson

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?

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.


CategoryKernel

KernelCustomBuild (last edited 2011-03-13 19:14:33 by 84-73-137-162)