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

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
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module ProgrammingSaurabh Bangad
 
Unix
UnixUnix
UnixErm78
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedureDhaval Kaneria
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System AdministrationSreenatha Reddy K R
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
 
Kernel_Crash_Dump_Analysis
Kernel_Crash_Dump_AnalysisKernel_Crash_Dump_Analysis
Kernel_Crash_Dump_AnalysisBuland Singh
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modulesEddy Reyes
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Adrian Huang
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)shimosawa
 
Linux Kernel Programming
Linux Kernel ProgrammingLinux Kernel Programming
Linux Kernel ProgrammingNalin Sharma
 

What's hot (20)

Linux device drivers
Linux device driversLinux device drivers
Linux device drivers
 
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
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
 
Unix
UnixUnix
Unix
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
 
Kernel_Crash_Dump_Analysis
Kernel_Crash_Dump_AnalysisKernel_Crash_Dump_Analysis
Kernel_Crash_Dump_Analysis
 
Cuda
CudaCuda
Cuda
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
History of Linux
History of LinuxHistory of Linux
History of Linux
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...
 
Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
 
Linux Kernel Programming
Linux Kernel ProgrammingLinux Kernel Programming
Linux Kernel Programming
 

Viewers also liked

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
 
5432 cellular network
5432 cellular network5432 cellular network
5432 cellular networkRaafat younis
 

Viewers also liked (20)

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
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
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
 
5432 cellular network
5432 cellular network5432 cellular network
5432 cellular network
 

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

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

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