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

HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)Linaro
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugginglibfetion
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Macpaul Lin
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKBshimosawa
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxMr. Vengineer
 
Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and outputSanidhya Chugh
 
The e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernationThe e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernationjoeylikernel
 
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 device driver
linux device driverlinux device driver
linux device driverRahul Batra
 
Linux Instrumentation
Linux InstrumentationLinux Instrumentation
Linux InstrumentationDarkStarSword
 
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)Linaro
 

What's hot (20)

Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)HKG15-107: ACPI Power Management on ARM64 Servers (v2)
HKG15-107: ACPI Power Management on ARM64 Servers (v2)
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)Bootstrap process of u boot (NDS32 RISC CPU)
Bootstrap process of u boot (NDS32 RISC CPU)
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKB
 
Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
 
Power Management from Linux Kernel to Android
Power Management from Linux Kernel to AndroidPower Management from Linux Kernel to Android
Power Management from Linux Kernel to Android
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & Linux
 
Linux scheduling and input and output
Linux scheduling and input and outputLinux scheduling and input and output
Linux scheduling and input and output
 
The e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernationThe e820 trap of Linux kernel hibernation
The e820 trap of Linux kernel hibernation
 
Linux Programming
Linux ProgrammingLinux Programming
Linux Programming
 
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 Internals - Interview essentials - 1.0
Linux Internals - Interview essentials - 1.0Linux Internals - Interview essentials - 1.0
Linux Internals - Interview essentials - 1.0
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
linux device driver
linux device driverlinux device driver
linux device driver
 
Kernel module in linux os.
Kernel module in linux os.Kernel module in linux os.
Kernel module in linux os.
 
Linux Instrumentation
Linux InstrumentationLinux Instrumentation
Linux Instrumentation
 
kernels
 kernels kernels
kernels
 
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
 

Viewers also liked

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)

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
 
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
 

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

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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Recently uploaded (20)

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?
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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)
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

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