Difference between revisions of "Linux kernel"

From Christoph's Personal Wiki
Jump to: navigation, search
Line 1: Line 1:
 
The '''kernel''' is the core piece of the [[Linux]] operating system.
 
The '''kernel''' is the core piece of the [[Linux]] operating system.
*Current (stable version): '''[http://www.kernel.org 3.4.4]''' (2012-06-22)
+
*Current (stable version): '''[http://www.kernel.org 3.4.5]''' (2012-07-16)
  
 
==Resources==
 
==Resources==

Revision as of 23:49, 16 July 2012

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

  • Current (stable version): 3.4.5 (2012-07-16)

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}"

openSUSE 10.2 returns:

/usr/src/packages

Mandriva Linux 2007.1 returns:

/usr/src/rpm

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 (some distributions omit the "-25" at the end of each name) to a floppy disc (handy for quickly restoring them). These would include:

/sbin/depmod-25
/sbin/insmod-25
/sbin/lsmod-25
/sbin/modinfo-25
/sbin/modprobe-25
/sbin/rmmod-25

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.

Kernel files

Note: These files are found in the /boot directory.

Kernel files
Distribution Kernel file Ram disk
SuSE linux initrd
Mandriva vmlinuz all.rdz
Fedora vmlinuz initrd.img
Knoppix vmlinuz initrd.img
Slackware bzImage initrd.img
Ubuntu vmlinuz initrd.gz
Gentoo gentoo gentoo.igz
Debian vmlinuz initrd.gz


See also

External links