Difference between revisions of "Linux Kernel"

From Blue-IT.org Wiki

(5.)
(Ubuntu)
Line 2: Line 2:
 
==Links==
 
==Links==
 
* mainly stolen from [http://www.howtoforge.com/kernel_compilation_ubuntu Howtoforge How To Compile A Kernel - The Ubuntu Way]
 
* mainly stolen from [http://www.howtoforge.com/kernel_compilation_ubuntu Howtoforge How To Compile A Kernel - The Ubuntu Way]
==1. Get the kernel==
+
==Get the kernel==
 
  apt-get install linux-source
 
  apt-get install linux-source
  
Line 11: Line 11:
 
  ln -s linux-linux-source-2.6.22 linux
 
  ln -s linux-linux-source-2.6.22 linux
  
==2. Install additional packages==
+
==Install additional packages==
  
 
  apt-get update
 
  apt-get update
 
  apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
 
  apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
  
==3. apply patches==
+
==apply patches==
 
  cd /usr/src
 
  cd /usr/src
 
  wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.19-rc4.bz2
 
  wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.19-rc4.bz2
Line 23: Line 23:
 
  bzip2 -dc /usr/src/patch-2.6.19-rc4.bz2 | patch -p1
 
  bzip2 -dc /usr/src/patch-2.6.19-rc4.bz2 | patch -p1
  
==4. Configure the kernel==
+
==Configure the kernel==
 
  cd /usr/src/linux
 
  cd /usr/src/linux
 
  cp /boot/config-`uname -r` ./.config
 
  cp /boot/config-`uname -r` ./.config
 
  make menuconfig
 
  make menuconfig
  
==4. Build the custom kernel==
+
==Build the custom kernel==
 
Now we are ready to compile the kernel and kernel_headers:
 
Now we are ready to compile the kernel and kernel_headers:
 
  make-kpkg clean
 
  make-kpkg clean
 
  fakeroot make-kpkg --initrd --append-to-version=-nfs3-with-acl-support kernel_image kernel_headers
 
  fakeroot make-kpkg --initrd --append-to-version=-nfs3-with-acl-support kernel_image kernel_headers
  
===5. Install the custom kernel===
+
===Install the custom kernel===
 
  cd /usr/src
 
  cd /usr/src
 
  dpkg -i linux-image-2.6*.deb
 
  dpkg -i linux-image-2.6*.deb
 
  dpkg -i linux-headers-2.6*.deb
 
  dpkg -i linux-headers-2.6*.deb
  
===6. Check grub & reboot ===
+
===Check grub & reboot ===
 
  vim /boot/grub/menu.lst
 
  vim /boot/grub/menu.lst
 +
 +
==Build custom modules afterwards==
 +
Download the source packages, e.g. 
 +
apt-get install nvidia-legacy-sources
 +
 +
Go to /usr/src and unpack it.
 +
tar xzvf nvidia-legacy.sources.tar.gz
 +
 +
Go tho the kernel directory and build the module image. Be aware that you use the same "append-to-version" information like for the custom kernel you compiled before. E.g.
 +
cd /usr/src/linux
 +
fakeroot make-kpkg --append_to_version=-nfs3-with-acl-support modules_image

Revision as of 17:00, 2 December 2007

Ubuntu

Links

Get the kernel

apt-get install linux-source

Alternatively you can get your own kernel from kernel org

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.YOUR-KERNEL-VERSION.tar.bz2
tar xjvf linux-2.6.YOUR-KERNEL-VERSION.tar.bz2
ln -s linux-linux-source-2.6.22 linux

Install additional packages

apt-get update
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

apply patches

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.19-rc4.bz2
cd /usr/src/linux
bzip2 -dc /usr/src/patch-2.6.19-rc4.bz2 | patch -p1 --dry-run
bzip2 -dc /usr/src/patch-2.6.19-rc4.bz2 | patch -p1

Configure the kernel

cd /usr/src/linux
cp /boot/config-`uname -r` ./.config
make menuconfig

Build the custom kernel

Now we are ready to compile the kernel and kernel_headers:

make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-nfs3-with-acl-support kernel_image kernel_headers

Install the custom kernel

cd /usr/src
dpkg -i linux-image-2.6*.deb
dpkg -i linux-headers-2.6*.deb

Check grub & reboot

vim /boot/grub/menu.lst

Build custom modules afterwards

Download the source packages, e.g.

apt-get install nvidia-legacy-sources

Go to /usr/src and unpack it.

tar xzvf nvidia-legacy.sources.tar.gz

Go tho the kernel directory and build the module image. Be aware that you use the same "append-to-version" information like for the custom kernel you compiled before. E.g.

cd /usr/src/linux
fakeroot make-kpkg --append_to_version=-nfs3-with-acl-support modules_image