GitKernelBuild

Differences between revisions 17 and 18
Revision 17 as of 2008-08-06 16:40:40
Size: 3646
Editor: localhost
Comment: converted to 1.6 markup
Revision 18 as of 2008-08-06 17:01:40
Size: 3648
Editor: localhost
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''<<BR>><<TableOfContents>>|| ||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<TableOfContents>>||
Line 19: Line 19:
  {{{ cd /home/ubuntu   {{{
cd /home/ubuntu
Line 22: Line 23:
  {{{ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git   {{{
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Line 25: Line 27:
  {{{ cd linux-2.6   {{{
cd linux-2.6
Line 28: Line 31:
  {{{ cp /boot/config-`uname -r` .config   {{{
cp /boot/config-`uname -r` .config
Line 31: Line 35:
  {{{ make oldconfig   {{{
make oldconfig
Line 34: Line 39:
  {{{ make menuconfig   {{{
make menuconfig
Line 37: Line 43:
  {{{ make-kpkg clean   {{{
make-kpkg clean
Line 40: Line 47:
  {{{ CONCURRENCY_LEVEL=N fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers   {{{
CONCURRENCY_LEVEL=N fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
Line 43: Line 51:
  {{{ cd ..   {{{
cd ..
Line 46: Line 55:
  {{{ sudo dpkg -i linux-image-2.6.24-rc5-custom_2.6.24-rc5-custom-10.00.Custom_i386.deb   {{{
sudo dpkg -i linux-image-2.6.24-rc5-custom_2.6.24-rc5-custom-10.00.Custom_i386.deb
Line 50: Line 60:
  {{{ sudo reboot   {{{
sudo reboot

Also refer to https://help.ubuntu.com/community/Kernel/Compile for building Ubuntu kernels.

Many times patches for bugs are committed upstream but have yet to make their way down to the Ubuntu kernel. It is often helpful if users are able to verify if the upstream patches do indeed resolve the issue they are witnessing. Likewise, in the opposite situation, it is useful to know if a bug may still exist upstream.

The following document should help users build their own kernel from the upstream mainline kernel to help verify if a bug still exists or not. If a bug is still present in the upstream kernel, it is encouraged that the bug be reported to http://bugzilla.kernel.org . The bug submission process for http://bugzilla.kernel.org is outlined at the end of the document. Please note that the following steps are targeted towards Ubuntu users and focuses on building the mainline kernel from the git repository at http://git.kernel.org .

Prerequisites

There are a few tools that are necessary in order to build your own kernel(s). The 'git-core' package provides the git revision control system which will be used to clone the mainline git repository. The 'kernel-package' provides the make-kpkg utility which automatically build your kernel and generate the linux-image and linux-header .deb files which can be installed. You will need to install both of these packages.

sudo apt-get install git-core kernel-package fakeroot build-essential

Kernel Build and Installation

  1. Change to the directory where you want to clone the git tree. In this example we will use /home/ubuntu
    •  cd /home/ubuntu
  2. Clone the mainline kernel git tree.
    •  git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
  3. Change to linux-2.6 directory.
    •  cd linux-2.6
  4. Copy the kernel config file from your existing system to the kernel tree.
    •  cp /boot/config-`uname -r` .config
  5. Bring the config file up to date. (Answer any questions that get prompted).
    •  make oldconfig
  6. (optional) If you need to make any kernel config changes, do the following and save your changes when prompted:
    •  make menuconfig
  7. Clean the kernel source directory.
    •  make-kpkg clean
  8. Build the linux-image and linux-header .deb files (where "N" is how many CPUs to use to build the kernel).
    •  CONCURRENCY_LEVEL=N fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
  9. Change to one directory level up (this is where the linux-image and linux-header .deb files were put)
    •  cd ..
  10. Now install the .deb files. In this example, the files are linux-image-2.6.24-rc5-custom_2.6.24-rc5-custom-10.00.Custom_i386.deb and linux-headers-2.6.24-rc5-custom_2.6.24-rc5-custom-10.00.Custom_i386.deb. You may receive warnings about '/lib/firmware/2.6.24-rc5-custom/' - this is expected and will only be problematic if the driver you are trying to test requires firmware.
    •  sudo dpkg -i linux-image-2.6.24-rc5-custom_2.6.24-rc5-custom-10.00.Custom_i386.deb
      sudo dpkg -i linux-headers-2.6.24-rc5-custom_2.6.24-rc5-custom-10.00.Custom_i386.deb
  11. You are now ready to boot into your new kernel. Just make sure you select the new kernel when you boot.
    •  sudo reboot

Reporting Bugs Upstream

KernelTeam/GitKernelBuild (last edited 2021-04-10 11:22:56 by pmaydell)