Difference between revisions of "SYA710 Building a New Kernel"

From CDOT Wiki
Jump to: navigation, search
(New page: === Building a New Kernel === * download source from kernel.org ** wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.bz2 * unpack source ** tar xvjf linux-2.6.26.tar.bz2 * ...)
 
 
(8 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
* create configuration (.config) file
 
* create configuration (.config) file
 
** cd linux-2.6.26
 
** cd linux-2.6.26
** cp /proc/config.gz .
+
** cp /proc/config.gz . (If this file does not exist, skip ahead to the alternate approach below.)
 
** gzip -d config.gz
 
** gzip -d config.gz
 
** mv config .config
 
** mv config .config
** make oldconfig
+
 
 +
Alternate method of getting .config:
 +
* If the file /proc/config.gz does not exist on your system, you can get the required file by issuing the following commands:
 +
# yum install kernel-devel kernel-headers gcc
 +
# cp /usr/src/kernels/2.6.23.1-42.fc8-x86_64/.config ./
 +
 
 +
* make oldconfig
 
* customize your configuration
 
* customize your configuration
 
** make menuconfig
 
** make menuconfig
Line 21: Line 27:
 
** make modules_install
 
** make modules_install
 
* create initial ram disk image
 
* create initial ram disk image
** mkinitrd -k vmlinuz-2.6.26 -i initrd-2.6.26
+
** mkinitrd -k vmlinuz-2.6.26 -i initrd-2.6.26 (this did not work for me - mkinitrd considered it do be invalid syntax. Using 'mkinitrd initrd-2.6.26 2.6.26' worked, so try that if the first version gives you problems. -Katherine Masseau)
 +
** For simplicity the syntax of mkinitrd file for here can be as ..
 +
      mkinitrd name-of- image kernel-version .i.e mkinitrd initrd-2.6.26 2.6.26
 +
** In generel if we have to create a initrd for the current running system the command i normally use
 +
    mkinitrd -v /boot/initrd-$(uname -r).img $(uname -r)
 
* update GRUB
 
* update GRUB
 
** vi /boot/grub/menu.lst
 
** vi /boot/grub/menu.lst
 
* reboot
 
* reboot

Latest revision as of 22:38, 16 July 2012

Building a New Kernel

  • download source from kernel.org
  • unpack source
    • tar xvjf linux-2.6.26.tar.bz2
  • create configuration (.config) file
    • cd linux-2.6.26
    • cp /proc/config.gz . (If this file does not exist, skip ahead to the alternate approach below.)
    • gzip -d config.gz
    • mv config .config

Alternate method of getting .config:

  • If the file /proc/config.gz does not exist on your system, you can get the required file by issuing the following commands:
  1. yum install kernel-devel kernel-headers gcc
  2. cp /usr/src/kernels/2.6.23.1-42.fc8-x86_64/.config ./
  • make oldconfig
  • customize your configuration
    • make menuconfig
  • compile kernel and modules
    • make
  • copy kernel image to /boot
    • cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.26
  • copy system map to /boot
    • cp System.map /boot/System.map-2.6.26
  • install the modules
    • make modules_install
  • create initial ram disk image
    • mkinitrd -k vmlinuz-2.6.26 -i initrd-2.6.26 (this did not work for me - mkinitrd considered it do be invalid syntax. Using 'mkinitrd initrd-2.6.26 2.6.26' worked, so try that if the first version gives you problems. -Katherine Masseau)
    • For simplicity the syntax of mkinitrd file for here can be as ..
     mkinitrd name-of- image kernel-version .i.e mkinitrd initrd-2.6.26 2.6.26
    • In generel if we have to create a initrd for the current running system the command i normally use
    mkinitrd -v /boot/initrd-$(uname -r).img $(uname -r)
  • update GRUB
    • vi /boot/grub/menu.lst
  • reboot