Linux Kernel Basics - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Linux Kernel Basics

Description:

http://www.kernel.org - official source repository. Versions. 2.4.X - previous generation, ... If the kernel will not boot, several problems may be the culprit: ... – PowerPoint PPT presentation

Number of Views:58
Avg rating:3.0/5.0
Slides: 13
Provided by: walters70
Category:

less

Transcript and Presenter's Notes

Title: Linux Kernel Basics


1
Linux Kernel Basics
  • Walter J. Scheirer
  • CSE 403

2
Step 1 Obtaining the Source
  • http//www.kernel.org - official source
    repository
  • Versions
  • 2.4.X - previous generation, standard on
    Fedora Core 1
  • 2.6.X - current generation, standard on Fedora
    Core 2 and above

3
Step 2 Unpack the Source
  • Move the tarball to /usr/src
  • mv linux.2.X.X.tar.bz2 /usr/src
  • Decompress and unarchive the code
  • bzip2 -cd linux.2.X.X.tar.bz2 tar xvf -
  • Note this must be done as root (permissions)

4
Step 3 Configuration
  • Enter the source directory
  • cd linux-2.X.X
  • Before compilation, a .config file must be
    generated. This file contains configuration
    information specific for the machine the kernel
    is to run on.
  • There are several methods to generate this file
  • make config - prompts one item at a time (avoid)
  • make menuconfig - text based menu system
    (recommended)
  • make xconfig - X windows based configuration
    tool
  • make oldconfig - merges an old configuration
    with a newer kernel

5
Step 3 Configuration Cont.
  • Invoke make menuconfig
  • make menuconfig

Select hardware and options that appropriate for
your particular machine. Information about the
machine may be gleaned from the dmesg command.
6
Step 4 Compilation
  • Once you have settled on a configuration, the
    next step is to compile the kernel
  • For version 2.6, simply run the make command from
    the source root
  • make
  • For version 2.4, you must first build the
    dependencies, then compile the compressed kernel
    image
  • make dep
  • make bzImage

7
Step 5 Modules
  • The Linux kernel is modular, thus, you must deal
    with these code snippets as well.
  • For version 2.6, the modules are built
    concurrently with the kernel image. You need only
    to install them
  • make modules_install
  • For version 2.4, the modules must be built and
    installed
  • make modules
  • make modules_install
  • Installed modules are located in /lib/modules/

8
Step 6 Preparing for Boot
  • The compressed kernel image is found within the
    source directory at arch/i386/boot/bzImage
  • This image must be copied to the /boot directory
  • cp arch/i386/boot/bzImage /boot/vmlinuz-2.X.X

9
Step 6 Preparing for Boot Cont.
  • For the kernel to appear on the next boot, the
    bootloader configuration must be altered.
  • Edit /etc/grub.conf
  • vi /etc/grub.conf
  • Add an entry for your new kernel
  • title Fedora Core (2.X.X)
  • root (hd0,0)
  • kernel /vmlinuz-2.X.X root/dev/hdaX rhgb
    quiet
  • make sure you know the device name of /

10
Problems
  • If the kernel will not compile, there may be a
    conflict in your configuration - double check.
  • If the kernel will not boot, several problems may
    be the culprit
  • The configuration - have you selected the correct
    hardware?
  • The root device - have you specified the correct
    device in the boot arguments?

11
Problems - Recompiling
  • If you do need to reconfigure and recompile, do
    not do the following right away
  • make clean (removes compiled objects)
  • make mrproper (removes compiled objects and
    the .config file)
  • You will save much time by only compiling what
    needs to be added or changed.
  • Compile just as you did in your first attempt
    make bzImage or make modules for 2.4, and make
    for 2.6.
  • If the recompilation fails, then try a make
    clean, for a fresh source base

12
Questions?
Write a Comment
User Comments (0)
About PowerShow.com