SlideShare a Scribd company logo
1 of 19
Download to read offline
Configuring the Kernel
             By
    Buddhika Siddhisena
     Co­Founder & CTO
 THINKCube Systems Pvt. Ltd
   <bud at thinkcube.com>
  Member of LKLUG & FOSS.LK
    <bud at babytux.org>
 Coverage



   •   What is the kernel

   •   Why customize?

   •   Obtaining the kernel source

   •   Quick compile HOWTO

   •   Configuring the kernel

   •   Loading/Unloading modules




                                     2
What is the Kernel




  •   What is the Kernel?
      •   Linux is the Kernel
      •   Developed by Linus Torvalds in1991
      •    Modular kernel as opposed to a micro­kernel
      •   Ported to more than 20 architectures
      •   Over 6M lines of code




                                                         3
What is the Kernel




                        read()
         Program                      GNU C Library



 User space                      syscall(SYS_read)



 Kernel space
                                 Virtual File System (vfs)
                     Linux
                     Kernel        Filesystem drivers

                                  Block device drivers




                                                             4
Why customize?


 •   Most of the time you actually 
     dont!

 •   Optimize to the hardware
 •   Optimize for the situation 
     (desktop/server,low 
     memory,SMP,64bit, diskless)
 •   Add an unofficial driver or feature
 •   Upgrade the kernel to the latest 
     without waiting for your 
     distribution.



                                           5
 Obtaining the Linux Kernel source

  •   Patched Kernel source can be obtained for your distro

      •   e.g.: linux­source­2.6.16 on debian

  •   Vanilla kernels via kernel.org

  •   Specially patched kernels such Andrew Morton's ­mm patched 
      kernel and  Alan Cox's ­ac




                                                               6
 Quick kernel compile


   •   You need to install the kernel development packages

        •   e.g.: gcc, make, binutils, ncurses, qt

   •   Extract the kernel source in /usr/src
       linux:# tar jxvf /tmp/linux­2.6.16.8.tar.gz


   •   Optionally create a symlink
       linux:# ln 
       ­s /usr/src/linux­2.6.16.8 /usr/src/linux



   •   Quick configuration using an old configuration
       linux:# cp /boot/config­2.6.14 .config
       linux:# make oldconfig

   •   Compiling the kernel
       linux:# make && make install && make modules_install

                                                              7
 Configuring the Kernel 101
 # make config

                 OR
 # make menuconfig




                                   # make xconfig
                              OR

                                   OR If you are INSANE!
                                   # vi .config




                                                           8
 Configuring the Kernel 101

   But WHAT if you make a MESS and want
   to CLEAN UP?

                              Just use Mr. Proper
                              # make mrproper


                               This will clear all pre­compiled 
                              binaries as well as remove the .config 
                              file
                              # make clean

                               Just clean all pre­compiled binaries




                                                                      9
 Configuring the Kernel 101

   Module or Built-in (Static)?
                           Building drivers into the kernel makes 
                          the kernel FAT – require more memory 
                          and overall slower execution.

                          YET certain drivers are better of being 
                          built­in (e.g: motherboard drivers)

                      Building drivers as modules results in 
                     a thinner kernel that can load external 
                     modules as an when needed.

                     BUT make sure your kernel has 
                     access to essential drivers required to 
                     boot, through an initrd or making 
                     them built­in.
                                                                     10
 Configuring the Kernel 101

  Know your Hardware
  •   To see whats plugged into your motherboard, or USB ports.
      linux:# lspci ­v
      linux:# lsusb

  •   To check your processor and memory
      linux:# cat /proc/cpuinfo
      linux:# cat /proc/meminfo

  •   To see your hard drive partitions.
      linux:# fdisk ­l



  •   To see your kernel log
      linux:# dmesg




                                                                  11
 Configuring the Kernel 101

  Kernel config overview
  •   Code Maturity Level Options

      You will find options to compile alpha quality or experimental drivers. 
      Generally fine for a desktop system, but use with care for a production 
      quality server.

  •   General Setup

      Options to enable process accounting, optimize the kernel for size or 
      have .config support that allows you to see how the kernel was 
      configured (zcat /proc/config.gz).

  •   Loadable Module Support

      Its generally a good idea to enable this. If you will need third­party 
      kernel modules you will also need to enable Set Version Information 
      on All Module Symbols.


                                                                          12
 Configuring the Kernel 101

  Kernel config overview
  •   Processor Type and Features

      Included in this submenu are features such as Processor type, 
      Preemptible Kernel which can improve desktop responsiveness, 
      Symmetric Multi­processing Support for machines with multiple CPUs, 
      and High Memory Support for machines with more than 1G of RAM.


  •   Power Management Options

      Found here are options for ACPI and CPU Frequency Scaling which can 
      dramatically improve laptop power usage

  •   Bus Options ( PCI, PCMCIA, EISA, MCA, ISA)

      Here are found options for all system bus devices. On modern 
      machines the ISA and MCA support can often be disabled.

                                                                      13
 Configuring the Kernel 101

  Kernel config overview
  •   Networking

      Options to configure network protocols, firewalls, IR, Bluetooth etc.

  •   Device Drivers

      Features such as SCSI support, graphic card optimizations, sound, 
      USB, network cards and other hardware are configured here.

  •   File Systems

       Found here are options for filesystems which are supported by the 
      kernel, such as EXT3, ReiserFS, NTFS or VFAT. It is best to build 
      support for the root filesystems directly into the kernel rather than as a 
      module. 

  •   Security Options
      Interesting options here include support for NSA Security Enhanced 
      Linux and other, somewhat experimental, features to increase security. 
                                                                           14
 Configuring the Kernel 101

 Optimize for processor architecture
 •    You can optimize the kernel for your exact processor as shown 
      by /proc/cpuinfo
      Processor family (Pentium­4/Celeron(P4­based)/Pentium­4 
      M/Xeon)  ­­­>


 •    You could also turn off Generic x86 support

      < > Generic x86 support


  Kernel Preemption
  •    Normally, “preemption” can happen only at the “user space”
  •    For a system to be responsive, kernel space preemption needs to be 
       turned on.

       <*> Preemptible kernel
  •    Do not turn on kernel preemption in server systems
                                                                        15
 Configuring the Kernel 101

 Enable High memory
 •    By default the kernel can access only about 890MB. If you have 1GB or 
      more memory you need to enable high memory.
      <*> High Memory Support (4GB)

 FS drivers
  •    You can add file system drivers via the File systems menu.

       DOS/FAT/NT Filesystems  ­­­>  
         <M> VFAT (Windows­95) fs support
         <M> NTFS file system support
  •    Generally you should make the root file system built­in
  •    If you want to mount network file systems such as NFS or CIFS you 
       can enable it here.

       Network File Systems  ­­­>
         <M> SMB file system support (to mount Windows 
       shares etc.)
                                                                       16
 Configuring the Kernel 101

 Magic Sys rq
 •   On a desktop system Turn on Magic SysRq key in kernel hacking
     <*> Kernel debugging
     <*> Magic SysRq key


 •   In the unlikely event of a system ?crash? (not responding), press Alt
     + PrtSc and other keys to reduce the damage:

     Alt + PrtSc + S      :  flush buffers
     Alt + PrtSc + U      :  remount disks read only
     Alt + PrtSc + O      :  power off
     Alt + PrtSc + B      :  reboot




                                                                       17
Manually loading Linux device drivers


  •    To list modules that are currently loaded you can issue
       #lsmod

  •   To list available modules (compiled) for the current kernel
       #modprobe ­l

  •   To get a small description about a module ...
       #modinfo radeon

  •   To load a kernel module driver manually
      #modprobe radeon


  •   To load a kernel drive automatically as the machine boots consider 
      adding it to /etc/modules.conf (2.4) or /etc/modprobe.conf (2.6)




                                                                        18
 Happy compiling...




                          Thank You
                              &
                      Happy compiling ...




                                            19

More Related Content

What's hot

Linux booting process!!
Linux booting process!!Linux booting process!!
Linux booting process!!sourav verma
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot) Omkar Rane
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal BootloaderSatpal Parmar
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsQUONTRASOLUTIONS
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image艾鍗科技
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/CoreShay Cohen
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux TroubleshootingKeith Wright
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel SourceMotaz Saad
 
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting ProcessGaurav Sharma
 

What's hot (20)

A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
 
Linux booting process!!
Linux booting process!!Linux booting process!!
Linux booting process!!
 
Linux
LinuxLinux
Linux
 
Linux OS presentation
Linux OS presentationLinux OS presentation
Linux OS presentation
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Linux - Introductions to Linux Operating System
Linux - Introductions to Linux Operating SystemLinux - Introductions to Linux Operating System
Linux - Introductions to Linux Operating System
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux Troubleshooting
 
Getting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded LinuxGetting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded Linux
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Browsing Linux Kernel Source
Browsing Linux Kernel SourceBrowsing Linux Kernel Source
Browsing Linux Kernel Source
 
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting Process
 

Viewers also liked

Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modulesEddy Reyes
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modulesdibyajyotig
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelNeel Parikh
 
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM SystemLabmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM SystemSyuan Wang
 
Psi android telephony_case_study_v10
Psi android telephony_case_study_v10Psi android telephony_case_study_v10
Psi android telephony_case_study_v10Primesoftinc
 
Encrypted Voice Communications
Encrypted Voice CommunicationsEncrypted Voice Communications
Encrypted Voice Communicationssbwahid
 
Voice encryption for gsm using arduino
Voice encryption for gsm using arduinoVoice encryption for gsm using arduino
Voice encryption for gsm using arduinoiruldaworld
 
Centralized Logging with syslog
Centralized Logging with syslogCentralized Logging with syslog
Centralized Logging with syslogamiable_indian
 
RT Procedure new KTM
RT Procedure new KTMRT Procedure new KTM
RT Procedure new KTMRaj Pradhan
 
Supervised WSD Using Master- Slave Voting Technique
Supervised WSD Using Master- Slave Voting TechniqueSupervised WSD Using Master- Slave Voting Technique
Supervised WSD Using Master- Slave Voting Techniqueiosrjce
 
Introduction to Kernel Functions
Introduction to Kernel FunctionsIntroduction to Kernel Functions
Introduction to Kernel FunctionsMichel Alves
 
Android telephony stack
Android telephony stackAndroid telephony stack
Android telephony stackDavid Marques
 
Android Telephony Manager and SMS
Android Telephony Manager and SMSAndroid Telephony Manager and SMS
Android Telephony Manager and SMSJussi Pohjolainen
 

Viewers also liked (20)

Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
 
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM SystemLabmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
Labmeeting - 20150211 - Novel End-to-End Voice Encryption Method in GSM System
 
Psi android telephony_case_study_v10
Psi android telephony_case_study_v10Psi android telephony_case_study_v10
Psi android telephony_case_study_v10
 
Encrypted Voice Communications
Encrypted Voice CommunicationsEncrypted Voice Communications
Encrypted Voice Communications
 
Kernel modules
Kernel modulesKernel modules
Kernel modules
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Voice encryption for gsm using arduino
Voice encryption for gsm using arduinoVoice encryption for gsm using arduino
Voice encryption for gsm using arduino
 
Centralized Logging with syslog
Centralized Logging with syslogCentralized Logging with syslog
Centralized Logging with syslog
 
RT Procedure new KTM
RT Procedure new KTMRT Procedure new KTM
RT Procedure new KTM
 
Cellular network
Cellular networkCellular network
Cellular network
 
Supervised WSD Using Master- Slave Voting Technique
Supervised WSD Using Master- Slave Voting TechniqueSupervised WSD Using Master- Slave Voting Technique
Supervised WSD Using Master- Slave Voting Technique
 
Viva
VivaViva
Viva
 
Wsd final paper
Wsd final paperWsd final paper
Wsd final paper
 
228-SE3001_2
228-SE3001_2228-SE3001_2
228-SE3001_2
 
Introduction to Kernel Functions
Introduction to Kernel FunctionsIntroduction to Kernel Functions
Introduction to Kernel Functions
 
Advances In Wsd Aaai 2005
Advances In Wsd Aaai 2005Advances In Wsd Aaai 2005
Advances In Wsd Aaai 2005
 
Android telephony stack
Android telephony stackAndroid telephony stack
Android telephony stack
 
Android Telephony Manager and SMS
Android Telephony Manager and SMSAndroid Telephony Manager and SMS
Android Telephony Manager and SMS
 

Similar to Kernel Configuration and Compilation

Kernel Configuration
Kernel ConfigurationKernel Configuration
Kernel Configurationdinusha4010
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Bud Siddhisena
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库maclean liu
 
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdf
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdfBasics_of_Kernel_Panic_Hang_and_ Kdump.pdf
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdfstroganovboris
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008mwlang88
 
Linux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisLinux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisPaul V. Novarese
 
Kernel compilation
Kernel compilationKernel compilation
Kernel compilationmcganesh
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisBuland Singh
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsCumulus Networks
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningLenz Grimmer
 
02 install cluster using npaci rocks
02 install cluster using npaci rocks02 install cluster using npaci rocks
02 install cluster using npaci rocksEni Budiyarti
 
Howtoinstallarchlinuxtousb final-120610172253-phpapp01
Howtoinstallarchlinuxtousb final-120610172253-phpapp01Howtoinstallarchlinuxtousb final-120610172253-phpapp01
Howtoinstallarchlinuxtousb final-120610172253-phpapp01decenttr
 
Install power linux through cdrom and network redhat and suse
Install power linux through cdrom and network   redhat and suseInstall power linux through cdrom and network   redhat and suse
Install power linux through cdrom and network redhat and susezhangjunli
 
How to Install ArchLinux to a USB Flashdrive in 2012
How to Install ArchLinux to a USB Flashdrive in 2012How to Install ArchLinux to a USB Flashdrive in 2012
How to Install ArchLinux to a USB Flashdrive in 2012Chukwuma Onyeije, MD, FACOG
 

Similar to Kernel Configuration and Compilation (20)

Kernel Configuration
Kernel ConfigurationKernel Configuration
Kernel Configuration
 
Kdump
KdumpKdump
Kdump
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)
 
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
图文详解安装Net backup 6.5备份恢复oracle 10g rac 数据库
 
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdf
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdfBasics_of_Kernel_Panic_Hang_and_ Kdump.pdf
Basics_of_Kernel_Panic_Hang_and_ Kdump.pdf
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008
 
Linux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisLinux Crash Dump Capture and Analysis
Linux Crash Dump Capture and Analysis
 
Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center Operations
 
Ilf2013
Ilf2013Ilf2013
Ilf2013
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery Planning
 
BSDCan2013
BSDCan2013BSDCan2013
BSDCan2013
 
Self 2013
Self 2013Self 2013
Self 2013
 
02 install cluster using npaci rocks
02 install cluster using npaci rocks02 install cluster using npaci rocks
02 install cluster using npaci rocks
 
Howtoinstallarchlinuxtousb final-120610172253-phpapp01
Howtoinstallarchlinuxtousb final-120610172253-phpapp01Howtoinstallarchlinuxtousb final-120610172253-phpapp01
Howtoinstallarchlinuxtousb final-120610172253-phpapp01
 
Texas 2013
Texas 2013Texas 2013
Texas 2013
 
Install power linux through cdrom and network redhat and suse
Install power linux through cdrom and network   redhat and suseInstall power linux through cdrom and network   redhat and suse
Install power linux through cdrom and network redhat and suse
 
How to Install ArchLinux to a USB Flashdrive in 2012
How to Install ArchLinux to a USB Flashdrive in 2012How to Install ArchLinux to a USB Flashdrive in 2012
How to Install ArchLinux to a USB Flashdrive in 2012
 

More from Bud Siddhisena

Building apis that don’t suck!
Building apis that don’t suck!Building apis that don’t suck!
Building apis that don’t suck!Bud Siddhisena
 
Why should you android (archived)
Why should you android (archived)Why should you android (archived)
Why should you android (archived)Bud Siddhisena
 
Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Bud Siddhisena
 
Building the Next big thing (archived)
Building the Next big thing (archived)Building the Next big thing (archived)
Building the Next big thing (archived)Bud Siddhisena
 
GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)Bud Siddhisena
 
Gaming on linux (archived)
Gaming on linux (archived)Gaming on linux (archived)
Gaming on linux (archived)Bud Siddhisena
 
FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)Bud Siddhisena
 
Contributing to FOSS (archived)
Contributing to FOSS (archived)Contributing to FOSS (archived)
Contributing to FOSS (archived)Bud Siddhisena
 
Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Bud Siddhisena
 
Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Bud Siddhisena
 
Opensource opportunity
Opensource opportunityOpensource opportunity
Opensource opportunityBud Siddhisena
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through IptablesBud Siddhisena
 
Secure your IT infrastructure with GNU/Linux
Secure your IT infrastructure  with GNU/LinuxSecure your IT infrastructure  with GNU/Linux
Secure your IT infrastructure with GNU/LinuxBud Siddhisena
 

More from Bud Siddhisena (19)

JIT qa-docker
JIT qa-dockerJIT qa-docker
JIT qa-docker
 
Building apis that don’t suck!
Building apis that don’t suck!Building apis that don’t suck!
Building apis that don’t suck!
 
Why should you android (archived)
Why should you android (archived)Why should you android (archived)
Why should you android (archived)
 
Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)Virtualization, The future of computing (archived)
Virtualization, The future of computing (archived)
 
Building the Next big thing (archived)
Building the Next big thing (archived)Building the Next big thing (archived)
Building the Next big thing (archived)
 
GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)GNU/Linux for a better home (archived)
GNU/Linux for a better home (archived)
 
Gaming on linux (archived)
Gaming on linux (archived)Gaming on linux (archived)
Gaming on linux (archived)
 
FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)FOSS in Sri Lanka (archived)
FOSS in Sri Lanka (archived)
 
Contributing to FOSS (archived)
Contributing to FOSS (archived)Contributing to FOSS (archived)
Contributing to FOSS (archived)
 
Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)Choosing your GNU/Linux distribution (archived)
Choosing your GNU/Linux distribution (archived)
 
Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)Beyond desktop/server with GNU/Linux (archived)
Beyond desktop/server with GNU/Linux (archived)
 
UX talk
UX talkUX talk
UX talk
 
Opensource opportunity
Opensource opportunityOpensource opportunity
Opensource opportunity
 
Remembering steve
Remembering steveRemembering steve
Remembering steve
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Introduction to firewalls through Iptables
Introduction to firewalls through IptablesIntroduction to firewalls through Iptables
Introduction to firewalls through Iptables
 
FOSS and Security
FOSS and SecurityFOSS and Security
FOSS and Security
 
Secure your IT infrastructure with GNU/Linux
Secure your IT infrastructure  with GNU/LinuxSecure your IT infrastructure  with GNU/Linux
Secure your IT infrastructure with GNU/Linux
 
Foss Gadgematics
Foss GadgematicsFoss Gadgematics
Foss Gadgematics
 

Recently uploaded

Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxYounusS2
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServiceRenan Moreira de Oliveira
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum ComputingGDSC PJATK
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?SANGHEE SHIN
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 

Recently uploaded (20)

Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
Babel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptxBabel Compiler - Transforming JavaScript for All Browsers.pptx
Babel Compiler - Transforming JavaScript for All Browsers.pptx
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer ServicePicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Introduction to Quantum Computing
Introduction to Quantum ComputingIntroduction to Quantum Computing
Introduction to Quantum Computing
 
Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?Do we need a new standard for visualizing the invisible?
Do we need a new standard for visualizing the invisible?
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 

Kernel Configuration and Compilation

  • 1. Configuring the Kernel By Buddhika Siddhisena Co­Founder & CTO THINKCube Systems Pvt. Ltd <bud at thinkcube.com> Member of LKLUG & FOSS.LK <bud at babytux.org>
  • 2.  Coverage • What is the kernel • Why customize? • Obtaining the kernel source • Quick compile HOWTO • Configuring the kernel • Loading/Unloading modules 2
  • 3. What is the Kernel • What is the Kernel? • Linux is the Kernel • Developed by Linus Torvalds in1991 •  Modular kernel as opposed to a micro­kernel • Ported to more than 20 architectures • Over 6M lines of code 3
  • 4. What is the Kernel read() Program GNU C Library User space syscall(SYS_read) Kernel space Virtual File System (vfs) Linux Kernel Filesystem drivers Block device drivers 4
  • 5. Why customize? • Most of the time you actually  dont! • Optimize to the hardware • Optimize for the situation  (desktop/server,low  memory,SMP,64bit, diskless) • Add an unofficial driver or feature • Upgrade the kernel to the latest  without waiting for your  distribution. 5
  • 6.  Obtaining the Linux Kernel source • Patched Kernel source can be obtained for your distro • e.g.: linux­source­2.6.16 on debian • Vanilla kernels via kernel.org • Specially patched kernels such Andrew Morton's ­mm patched  kernel and  Alan Cox's ­ac 6
  • 7.  Quick kernel compile • You need to install the kernel development packages • e.g.: gcc, make, binutils, ncurses, qt • Extract the kernel source in /usr/src linux:# tar jxvf /tmp/linux­2.6.16.8.tar.gz • Optionally create a symlink linux:# ln  ­s /usr/src/linux­2.6.16.8 /usr/src/linux • Quick configuration using an old configuration linux:# cp /boot/config­2.6.14 .config linux:# make oldconfig • Compiling the kernel linux:# make && make install && make modules_install 7
  • 8.  Configuring the Kernel 101 # make config OR # make menuconfig # make xconfig OR OR If you are INSANE! # vi .config 8
  • 9.  Configuring the Kernel 101 But WHAT if you make a MESS and want to CLEAN UP? Just use Mr. Proper # make mrproper  This will clear all pre­compiled  binaries as well as remove the .config  file # make clean  Just clean all pre­compiled binaries 9
  • 10.  Configuring the Kernel 101 Module or Built-in (Static)?  Building drivers into the kernel makes  the kernel FAT – require more memory  and overall slower execution. YET certain drivers are better of being  built­in (e.g: motherboard drivers)  Building drivers as modules results in  a thinner kernel that can load external  modules as an when needed. BUT make sure your kernel has  access to essential drivers required to  boot, through an initrd or making  them built­in. 10
  • 11.  Configuring the Kernel 101 Know your Hardware • To see whats plugged into your motherboard, or USB ports. linux:# lspci ­v linux:# lsusb • To check your processor and memory linux:# cat /proc/cpuinfo linux:# cat /proc/meminfo • To see your hard drive partitions. linux:# fdisk ­l • To see your kernel log linux:# dmesg 11
  • 12.  Configuring the Kernel 101 Kernel config overview • Code Maturity Level Options You will find options to compile alpha quality or experimental drivers.  Generally fine for a desktop system, but use with care for a production  quality server. • General Setup Options to enable process accounting, optimize the kernel for size or  have .config support that allows you to see how the kernel was  configured (zcat /proc/config.gz). • Loadable Module Support Its generally a good idea to enable this. If you will need third­party  kernel modules you will also need to enable Set Version Information  on All Module Symbols. 12
  • 13.  Configuring the Kernel 101 Kernel config overview • Processor Type and Features Included in this submenu are features such as Processor type,  Preemptible Kernel which can improve desktop responsiveness,  Symmetric Multi­processing Support for machines with multiple CPUs,  and High Memory Support for machines with more than 1G of RAM. • Power Management Options Found here are options for ACPI and CPU Frequency Scaling which can  dramatically improve laptop power usage • Bus Options ( PCI, PCMCIA, EISA, MCA, ISA) Here are found options for all system bus devices. On modern  machines the ISA and MCA support can often be disabled. 13
  • 14.  Configuring the Kernel 101 Kernel config overview • Networking Options to configure network protocols, firewalls, IR, Bluetooth etc. • Device Drivers Features such as SCSI support, graphic card optimizations, sound,  USB, network cards and other hardware are configured here. • File Systems  Found here are options for filesystems which are supported by the  kernel, such as EXT3, ReiserFS, NTFS or VFAT. It is best to build  support for the root filesystems directly into the kernel rather than as a  module.  • Security Options Interesting options here include support for NSA Security Enhanced  Linux and other, somewhat experimental, features to increase security.  14
  • 15.  Configuring the Kernel 101 Optimize for processor architecture • You can optimize the kernel for your exact processor as shown  by /proc/cpuinfo Processor family (Pentium­4/Celeron(P4­based)/Pentium­4  M/Xeon)  ­­­> • You could also turn off Generic x86 support < > Generic x86 support Kernel Preemption • Normally, “preemption” can happen only at the “user space” • For a system to be responsive, kernel space preemption needs to be  turned on. <*> Preemptible kernel • Do not turn on kernel preemption in server systems 15
  • 16.  Configuring the Kernel 101 Enable High memory • By default the kernel can access only about 890MB. If you have 1GB or  more memory you need to enable high memory. <*> High Memory Support (4GB) FS drivers • You can add file system drivers via the File systems menu. DOS/FAT/NT Filesystems  ­­­>     <M> VFAT (Windows­95) fs support   <M> NTFS file system support • Generally you should make the root file system built­in • If you want to mount network file systems such as NFS or CIFS you  can enable it here. Network File Systems  ­­­>   <M> SMB file system support (to mount Windows  shares etc.) 16
  • 17.  Configuring the Kernel 101 Magic Sys rq • On a desktop system Turn on Magic SysRq key in kernel hacking <*> Kernel debugging <*> Magic SysRq key • In the unlikely event of a system ?crash? (not responding), press Alt + PrtSc and other keys to reduce the damage: Alt + PrtSc + S  :  flush buffers Alt + PrtSc + U  :  remount disks read only Alt + PrtSc + O  :  power off Alt + PrtSc + B  :  reboot 17
  • 18. Manually loading Linux device drivers •  To list modules that are currently loaded you can issue #lsmod • To list available modules (compiled) for the current kernel #modprobe ­l • To get a small description about a module ... #modinfo radeon • To load a kernel module driver manually #modprobe radeon • To load a kernel drive automatically as the machine boots consider  adding it to /etc/modules.conf (2.4) or /etc/modprobe.conf (2.6) 18
  • 19.  Happy compiling... Thank You & Happy compiling ... 19