Kernel compilation

  • 1,184 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,184
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
89
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. OTP Training - Ganesh M C
  • 2. Drivers and the kernel
    • UNIX system has three layers:
      • The hardware
      • The operating system kernel
      • The user-level programs
    • Kernel
      • Kernel hides the hardware, provides a abstract, high-level programming interface
        • Process
        • Signal and semaphores
        • Virtual memory
        • The filesystem
        • Interprocess communication
      •   Kernel contains device drivers that manage its interaction with specific pieces of hardware.
      • Size of kernel
  • 3. Why Configure the kernel
    • Generic kernel
      • Many device drivers
      • Optional packages
    • Tailor the kernel for your need
      • Less memory
      • Well-tuned configuration
    • Add support for new types of device
      • Some system is simple
      • Some may need to several steps.
    • Read this:
      • Building the kernel is not difficult; its just difficult to fix when you break it.
      • Get a good reference book for your OS
  • 4. Kernel Source Repository
    • http://kernel.org/
      • Is the place where you could get the kernel source
      • Compile it according to your need
  • 5. Packages required to start compilation
    • apt-get install build-essential
    • apt-get install bin86 kernel-package
    • apt-get install module-init-tools initrd-tools
    • apt-get install fakeroot
    • apt-get install libncurses5-dev
  • 6. Kernel Compilation
    • Decide where to build your kernel
      • Good place is $HOME
    • Deciding on a kernel version
      • For any kernel version x.y.z,
      • * x - This is the major revision number
      • * y - This is the minor revision number, where:
      • Even numbers indicate "stable" kernel releases
      • Odd numbers indicate "development" or "beta" kernel releases which may be less stable.
      • * z - This is the patch level of the kernel
  • 7.
    • Downloading the maintainer-specific patch.
    • Unpacking the kernel source
        • bash$ cd $HOME
        • bash$ tar zxvf linux-x.y.z.tar.gz
        • bash$ cd linux-x.y.z
        • bash$ zcat ../patch-x.y.z-vrs1.gz | patch -p1
    • For Cross compilation
          • linux/README and linux/Documentation/arm/README before proceeding. Both these files provide further useful information which may be specific to your kernel version.
  • 8. Configuration of the kernel build environment
    • To use the default configuration present in kernel source
          • bash$ make <machinename>_defconfig
              • Copies the config of /linux-2.6-2.6.32/arch/x86/configs/i386_defconfig to .config
          • In this case no need to run oldconfig
    • To do manual configuration run the command
          • $make menuconfig
  • 9. Example for configuration
    • Selecting necessary file systems
      • File systems --->
      • Pseudo Filesystems --->
      • [*] /proc file system support
      • [*] Virtual memory file system support (former shm fs)
      • (Select one or more of the following options as needed by your system)
      • Reiser, ext3, ext4, jfs, etc.,
  • 10. Selecting PPPoE necessary drivers
    • Device Drivers ---> Networking Support ---> <*> PPP (point-to-point protocol) support
    • <*> PPP support for async serial ports
    • <*> PPP support for sync tty ports
  • 11. Activating SMP support
    • Processor type and features ---> [*] Symmetric multi-processing support
    • Like that we can do for the following options
      • Activating USB Support for Input Devices
      • Enabling PCMCIA support
  • 12. Manual Installation
    • Compiling the kernel
        • Make
        • Make modules_install
    • Installing the kernel
        • cp arch/i386/boot/bzImage /boot/vmlinuz
        • Generate the initrd by using the tool mkinitrd
          • mkinitramfs -k -o /boot/initrd.img-KVN KVN
    • Edit the grub.cfg & boot the kernel
  • 13. To get the kernel in DEB
    • make-kpkg --initrd --revision=boss4.0 kernel_image kernel_headers --us –uc
          • --append-to-version
          • --revision
  • 14. SELinux
    • Configure
    • Compile as like normal kernel
    • Edit the /etc/init.d/rc
    • Add the parameter selinux=1 to kernel line of grub