Difference between revisions of "Linux kernel"

From Christoph's Personal Wiki
Jump to: navigation, search
(External links)
Line 18: Line 18:
 
Note: some of the paths below include <code>$TOPDIR</code>, which is distribution-dependent and can be further redefined by user. To find out the proper location on your system, issue this command:
 
Note: some of the paths below include <code>$TOPDIR</code>, which is distribution-dependent and can be further redefined by user. To find out the proper location on your system, issue this command:
 
  rpm --eval "%{_topdir}"
 
  rpm --eval "%{_topdir}"
 +
 +
==Example kernel update protocol==
 +
For this example, I will be using [[Mandriva]] [[Linux]] and updating/upgrading from kernel '<code>kernel-smp-2.6.8.1.12mdk-1-1mdk</code> to '<code>kernel-smp-2.6.12.31mdk-1-1mdk</code>'.
 +
 +
The first thing you should do before updating your kernel is to backup your <code>/sbin/*25</code> files to a floppy disc (handy for quickly restoring them). It wouldn't hurt to also backup your entire <code>/etc</code> directory.
 +
 +
Then, update your old kernel's related [[rpm]]s:
 +
rpm -Uvh fbgrab-1.0-1mdv2007.0.i586.rpm
 +
rpm -Uvh libgtk-linux-fb-2.0_0-2.4.14-6mdk.i586.rpm
 +
rpm -Uvh bootsplash-3.1.12-0.2.20060mdk.i586.rpm
 +
rpm -Uvh mkinitrd-4.2.17-17.2.20060mdk.i586.rpm
 +
rpm -Uvh module-init-tools-3.2-0.pre8.2.1.20060mdk.i586.rpm
 +
rpm -Uvh aumix-text-2.8-12mdk.i586.rpm
 +
rpm -Uvh sound-scripts-0.35-1mdk.noarch.rpm
 +
rpm -Uvh hotplug-2004_09_23-7mdk.i586.rpm
 +
# Returns clashing dependencies (possible problem source):
 +
#rpm -Uvh udev-068-34mdk.i586.rpm
 +
 +
Now, install (_not_ "upgrade") your new kernel rpm:
 +
# Note: I am NOT using "rpm -Uvh", as I wish to _keep_ the old kernel
 +
# The "smp" RPM is for multi-processor systems
 +
rpm -ivh kernel-smp-2.6.12.31mdk-1-1mdk.i586.rpm
 +
 +
Notes:
 +
# Linux kernel RPM:
 +
# - kernel (/boot/vmlinux-2.X.XX-X);
 +
# - modules (/lib/modules/2.X.XX-X/...);
 +
# - /boot/System.map-2.X.XX-X; and
 +
# - /boot/module-info-2.X.XX-X
 +
Now, create the <code>initrd</code> image:
 +
/sbin/mkinitrd /boot/initrd-2.6.12.31mdksmp.img 2.6.12.31mdk-1-1mdk
 +
 +
Edit <code>/etc/lilo.conf</code> and add new/old kernel boots (you want to keep your old kernel, just in case anything goes wrong you can boot your old, working kernel). For an example,
 +
image=/boot/vmlinuz-2.6.12-31mdksmp
 +
        label="linux-2.6.12-31mdksmp"
 +
        root=/dev/sda1
 +
        initrd=/boot/initrd-2.6.12-31mdksmp.img
 +
        append="acpi=ht resume=/dev/sda5 splash=silent"
 +
        vga=788
 +
        read-only
 +
image=/boot/vmlinuz-2.6.8.1-12mdksmp
 +
        label="linux-2.6.8.1-12mdksmp"
 +
        root=/dev/sda1
 +
        initrd=/boot/initrd-2.6.8.1-12mdksmp.img
 +
        append="acpi=ht resume=/dev/sda5 splash=silent"
 +
        vga=788
 +
        read-only
 +
 +
Now commit the changes to <code>lilo</code>:
 +
lilo -v
 +
Reboot:
 +
shutdown -r now
 +
And that should do it.
 +
 +
===Possible problems/fixes===
 +
If you have problems with any kernel (old, new, or both), here are some possible troubleshooting steps you can take:
 +
#Boot in a rescue disk (e.g. Mandrake 10.1 installation CD)
 +
#Restore your old <code>/sbin/*25</code> files from the floppy disc (see above)
 +
#Check to make sure your <code>/etc/lilo.conf</code> is pointing to the correct kernels and images.
 +
#Then, try rebooting.
  
 
==See also==
 
==See also==
Line 29: Line 89:
 
*[http://wiki.openvz.org/Kernel_build Kernel build] &mdash; by openvz.org
 
*[http://wiki.openvz.org/Kernel_build Kernel build] &mdash; by openvz.org
 
*[http://kernelnewbies.org/ KernelNewbies]
 
*[http://kernelnewbies.org/ KernelNewbies]
 
  
 
[[Category:Linux Command Line Tools]]
 
[[Category:Linux Command Line Tools]]

Revision as of 02:31, 3 April 2007

The kernel is the core piece of the Linux operating system.

  • Current (stable version): 2.6.20.3 (2007-03-13)[1]

Resources

The kernel manages the resources of the Linux OS; such as the following:

  • File management
  • Multitasking
  • Memory management
  • I/O management
  • Process management: /proc/
  • Device management: /dev/
  • Networking support (including IPv4 and IPv6)
  • Virtual memory, shared libraries, demand loading, etc.

The kernel decides who will use these resources, for how long, and when.

Rebuilding kernel from SRPM

Note: some of the paths below include $TOPDIR, which is distribution-dependent and can be further redefined by user. To find out the proper location on your system, issue this command:

rpm --eval "%{_topdir}"

Example kernel update protocol

For this example, I will be using Mandriva Linux and updating/upgrading from kernel 'kernel-smp-2.6.8.1.12mdk-1-1mdk to 'kernel-smp-2.6.12.31mdk-1-1mdk'.

The first thing you should do before updating your kernel is to backup your /sbin/*25 files to a floppy disc (handy for quickly restoring them). It wouldn't hurt to also backup your entire /etc directory.

Then, update your old kernel's related rpms:

rpm -Uvh fbgrab-1.0-1mdv2007.0.i586.rpm
rpm -Uvh libgtk-linux-fb-2.0_0-2.4.14-6mdk.i586.rpm
rpm -Uvh bootsplash-3.1.12-0.2.20060mdk.i586.rpm
rpm -Uvh mkinitrd-4.2.17-17.2.20060mdk.i586.rpm
rpm -Uvh module-init-tools-3.2-0.pre8.2.1.20060mdk.i586.rpm
rpm -Uvh aumix-text-2.8-12mdk.i586.rpm
rpm -Uvh sound-scripts-0.35-1mdk.noarch.rpm
rpm -Uvh hotplug-2004_09_23-7mdk.i586.rpm
# Returns clashing dependencies (possible problem source):
#rpm -Uvh udev-068-34mdk.i586.rpm

Now, install (_not_ "upgrade") your new kernel rpm:

# Note: I am NOT using "rpm -Uvh", as I wish to _keep_ the old kernel
# The "smp" RPM is for multi-processor systems
rpm -ivh kernel-smp-2.6.12.31mdk-1-1mdk.i586.rpm

Notes:

# Linux kernel RPM:
# - kernel (/boot/vmlinux-2.X.XX-X);
# - modules (/lib/modules/2.X.XX-X/...);
# - /boot/System.map-2.X.XX-X; and
# - /boot/module-info-2.X.XX-X

Now, create the initrd image:

/sbin/mkinitrd /boot/initrd-2.6.12.31mdksmp.img 2.6.12.31mdk-1-1mdk

Edit /etc/lilo.conf and add new/old kernel boots (you want to keep your old kernel, just in case anything goes wrong you can boot your old, working kernel). For an example,

image=/boot/vmlinuz-2.6.12-31mdksmp
        label="linux-2.6.12-31mdksmp"
        root=/dev/sda1
        initrd=/boot/initrd-2.6.12-31mdksmp.img
        append="acpi=ht resume=/dev/sda5 splash=silent"
        vga=788
        read-only
image=/boot/vmlinuz-2.6.8.1-12mdksmp
        label="linux-2.6.8.1-12mdksmp"
        root=/dev/sda1
        initrd=/boot/initrd-2.6.8.1-12mdksmp.img
        append="acpi=ht resume=/dev/sda5 splash=silent"
        vga=788
        read-only

Now commit the changes to lilo:

lilo -v

Reboot:

shutdown -r now

And that should do it.

Possible problems/fixes

If you have problems with any kernel (old, new, or both), here are some possible troubleshooting steps you can take:

  1. Boot in a rescue disk (e.g. Mandrake 10.1 installation CD)
  2. Restore your old /sbin/*25 files from the floppy disc (see above)
  3. Check to make sure your /etc/lilo.conf is pointing to the correct kernels and images.
  4. Then, try rebooting.

See also

External links