Linux Installation, Kernel Compilation, and and Kernel Build PowerPoint PPT Presentation

presentation player overlay
1 / 22
About This Presentation
Transcript and Presenter's Notes

Title: Linux Installation, Kernel Compilation, and and Kernel Build


1
Linux Installation, Kernel Compilation, and and
Kernel Build
  • Dr. Ching-Cheng Lee

2
Outline
  • Linux Distributions
  • Linux Installation
  • Fedora Core 4 Installation
  • Kernel Source Installation
  • Linux kernel Source Tree
  • Kernel Compilation/Build
  • Example New System Call/Kernel

3
Linux Distributions
  • Debian GNU/Linux
  • A distribution produced by Debian Project,
    maintained by volunteers with no commercial
    intentions.
  • The name came from the founders DEBra and IAN
    Murdock
  • Fedora Linux
  • Formally known as Fedora Core
  • Sponsored primarily by RedHat with
    significant community participation.
  • Produced by Fedora Project and was based on
    the original RedHat Distribution and is made
    entirely of free and open source software

4
Linux Distributions - Continued
  • Mandriva Linux
  • Consumer-oriented distribution available in
    both freely downloadable form and as a boxed
    retail product. Parent company is Mandriva.
  • Red Hat Enterprise Linux
  • It is the most successful commercial
    distribution of Linux. The company offers
    versions of Red Hat Enterprise Linux (RHEL) for
    servers and workstations. It also sponsors the
    non-commercial distribution Fedora.
  • SUSE Linux
  • It is a family of Linux distributions
    developed by Novell. It has commercial
    distributions SLED and free-of-charge openSUSE
    (open source community)

5
Linux Distributions - Continued
  • Ubuntu
  • A community developed Linux distribution
    with the slogan Linux for human beings. It is
    one of the most popular Linux distribution for
    laptops and desktop machines. It is based on
    Debian GNU/Linux. The name Ubuntu is an African
    word that can be translated as humanity towards
    others..
  • Others
  • There are many other distributions such as
    Slackware, CenOS, Damn Small Linux,
    Linspire/Freespire, Linux Mint, PCLinuxOS, etc.

6
Linux Installation
  • This presentation shows how to install Fedora
    Core 4 on a Windows XP as dual boot system
  • Fedora Core 4 CDs
  • Installation size 2-3GB
  • Installation time 30 minutes 1 hr. (average)
    depending the PC speed.
  • Microsoft Windows installed first or existing
  • Backup important data in case corruption
  • Put the CD (1st) in the drive

7
Fedora Core 4 Installation
  • Insert the CD
  • To install or upgrade in graphical mode, press
    ..
  • To install..texttype linux text
  • boot
  • Welcome to Fedora Core
  • Upgrade Examine
  • Install Fedora Core
  • Upgrade an existing installation
  • Language Selection ? English
  • Keyboard Configuration ? U.S. English

8
Fedora Core 4 Installation - Continue
  • Installation Type
  • Workstation
  • Server
  • Custom ? select this to gain complete control
    and package selection
  • Disk Partitioning Setup
  • One of the large obstacles for a new user during
    a Linux installation is partitioning. This
    process is made easier by selecting automatic
  • Automatic partition?
  • Manually partition with Disk Druid?
  • If you used automatic partitioning, you can
    either accept the current partition setting
    (click next) or modify the setup using the manual
    partitioning tool.

9
Fedora Core 4 Installation - Continue
  • Disk Setup
  • Choose where you would like Fedora Core to
    be installed.
  • Boot Loader Configuration
  • The GRUB boot loader will be installed on
    /dev/xxx
  • Change boot loader if you do not want
    to install GRUB
  • Network Configuration
  • Any network devices you have on the system are
    automatically detected and shown in the Network
    Devices list
  • Firewall Configuration
  • Enable firewall
  • You can use a firewall to allow access to
    specific services on your computer from other
    computer SSH, HTTP, FTP..

10
Fedora Core 4 Installation - Continue
  • Time Zone Selection
  • Set your time zone such as New York,
    Pacific region
  • Set Root Password
  • Package Group Selection
  • Select (check) the package groups that you want
    to install.
  • Once a package group has been selected,
    click on Details to view which are default and
    add/remove optional ones from that group.
  • About to Install
  • Click next to begin installation. The
    Installation log can be found inn
    /root/install.log (To abort this installation,
    reset using Control-Alt-Delete)
  • Will see the following messages on the Screen
  • Installing Packages .
  • Congratulations, the installation is
    complete.reboot your system

11
Fedora Core 4 Installation - Continue
  • Welcome (message) after reboot
  • There are a few more steps to take before
    your system is ready to
  • use. The setup agent will guide some basic
    configuration.
  • License Agreement Check yes
  • Date and Time select and setup
  • System User
  • Create a system username, non-
    administrative
  • Additional CDs
  • Insert other CDs for third-party plug-in and
    applications
  • Finish Setup
  • Screen show login as follows -
  • username

12
Kernel Source Installation
  • Download the kernel source code
  • Visit http//kernel.org/ and download the latest
    source code. File name would be
    linux-x.y.z.tar.bz2, where x.y.z is actual
    version number.
  • For example file inux-2.6.23.tar.bz2
    represents 2.6.23 kernel version. Use wget
    command to download kernel source code
  • cd /tmp wget http//www.kernel.org/pub/linux/k
    ernel/v2.6/linux-x.y.z.tar.bz2
  • Note the current kernel version of your Linux can
    be found
  • uname -a
  • Note Replace x.y.z with actual version number.

13
Kernel Source Installation - Continued
  • Extract tar (.tar.bz3) file
  • Type the following command tar -xjvf
    linux-2.6.23.tar.bz2 -C /usr/src cd /usr/src
  • ls
  • (you will see a subdirectory linux-2.6.23)
  • ln s linux-2.6.23 linux
  • Create soft link linux pointing to
    linux-2.6.23 subdirectory
  • Your kernel source subdirectory now will
    be /usr/src/linux (Kernel
  • source tree)

14
Linux Kernel Source Tree
  • Kernel Source is under /usr/src
  • cd /usr/src
  • cd linux (based upon our installation)
  • ls
  • arch crypto include lib
    net security
  • configs Documentation init MAINTAINERS
    README sound
  • COPYING drivers ipc Makefile
    REPORTING-BUGS usr
  • CREDITS fs kernel mm
    scripts
  • ls kernel
  • acct.c extable.c Makefile
    profile.c sysctl.c
  • audit.c fork.c module.c
    ptrace.c sys_ni.c
  • auditsc.c futex.c
    module-verify.c rcupdate.c time.c
  • capability.c intermodule.c
    module-verify.h resource.c timer.c
  • ..

15
Kernel Compilation/Build
  • Kernel Source is under /usr/src
  • cd /usr/src
  • cd linux (based upon our installation)
  • For other installation, you need to find the
    subdirectory
  • that has kernel source
  • make mrproper
  • This ensure that the kernel source in
    proper/clean state usually done in the 1st
    time

16
Kernel Compilation/Build - Continued
  • Configure the .config File
  • The .config file contains everything that is
    specific to the kernel you compile. You must
    have a starting .config file. For example, you ca
    use the previous Fedora .config file from the
    fedora kernel.src.rpm.
  • If you have another kernel source from another
    RPM or a previously downloaded kernel source, you
    can use that .config instead of Fedora's. Bring
    the .config file up to date to match the new
    kernel. This will prompt for many new options. If
    you know what they are, answer them correctly.
    Otherwise just hit Enter even you see no
    prompts.Usually we suggest that
  • make oldconfig (this is usually done
    especially for our project)
  • Once done, configure all the necessary options by
    using any of the following This step usually
    can be skipped
  • make config or (text based)
  • make xconfig (GUI based)

17
Kernel Compilation/Build - Continued
  • make all
  • This will compile all the kernel source code
    using the Makefile and create a compressed kernel
    image.
  • This step may take between 30min 2 hours
    depending on the speed of your system.
  • make modules
  • compiling kernel modules
  • make modules_install
  • Install kernel modules

18
Kernel Compilation/Build - Continued
  • make install
  • Install the kernel. The following files will
    be installed into the /boot directory
  • System.map-2.6.x,
  • config-2.6.x..,
  • vmlinuz-2.6.x (Newly compiled/compressed
    kernel image)
  • Edit Grub
  • To set the default to the new kernel, edit
    /boot/grub/grub.conf. Change the line default1
    to default0. This maybe slightly different per
    each computer. This ensure that the new kernel
    will be booted by default.
  • reboot
  • After reboot, Verify if the new kernel was
    booted.
  • uname a (see the version and date
    built)
  • If you failed to boot, reboot the old
    kernel (when powering up the machine, you will
    see menu selection of kernels to be booted).
    Otherwise, you must have the original kernel boot
    image save on a bootable floppy.

19
Example New System Call/Kernel
  • To implement a new system call (i.e. foo), you
    must modify the kernel source, recompile the
    kernel, rebuild the kernel. The user program can
    invoke the new system call with the new kernel
  • Modify the system call table
  • /usr/src/linux/arch/i386/kernel/entry.S or
  • (/usr/src/linux/arch/i386/kernel/syscall_tab
    le.S)
  • with new entry
  • .login SYMBOL_NAME (sys_foo)

20
Example New System Call/kernel Cont.
  • System Call Stubs for Users
  • /usr/src/linux/include/asm-i386/unitstd.h
  • define __NR_keyctl 288 (last entry)
  • add the following at the end
  • define __NR_foo 289
  • Change the folllowing
  • define NR_syscall 289 (changed to 290)

21
Example New System Call/Kernel Cont.
  • System Call Implementation Routine foo()
  • Find appropriate subdirectory lets say this
    foo() should be in kernel subdirectory of the
    source code
  • cd /usr/src/linux/kernel
  • vi sys.c (lets say that we want put
    this routine in sys.c file)
  • Follow the same pattern of existing sysall
    implementation
  • asmlinkage long sys_foo()
  • ..
  • printk(KERNEL_EMERG foo syscall entered\n)

22
Example New System Call/Kernel Cont.
  • Go to /usr/src/linux directory
  • Recompile the kernel source and build new kernel
    as in previous described steps.
  • Reboot the new kernel
  • Verify if the system has the newly build kernel
  • uname -a
  • Write a test program to test this new system call
Write a Comment
User Comments (0)
About PowerShow.com