Upload
utkarsh-thakkar
View
221
Download
0
Embed Size (px)
Citation preview
8/14/2019 Kernel Development in LINUX
1/29
KernelKernelDevelopment inDevelopment in
LINUXLINUXPrepared by: Utkarsh ThakkarPrepared by: Utkarsh Thakkar
Guided by: Prof. JitendraGuided by: Prof. JitendraBhatiaBhatia
8/14/2019 Kernel Development in LINUX
2/29
ContextContext
KernelKernel DefinitionDefinition
TypesTypes
ArchitectureArchitecture
RequirementsRequirements
ModulesModules
LinuxLinux FeaturesFeatures
AdvantagesAdvantages
8/14/2019 Kernel Development in LINUX
3/29
Defination of KernelDefination of Kernel
Kernel is a set of interrelated Modules by whichKernel is a set of interrelated Modules by which
the the operating system can handle all thethe the operating system can handle all the
resources of the system hardware.resources of the system hardware.
The kernel is a program that constitutes theThe kernel is a program that constitutes thecentral core of a computer operating system. Itcentral core of a computer operating system. It
has complete control over everything thathas complete control over everything that
occurs in the system.occurs in the system.
The kernel code is written in C with someThe kernel code is written in C with somemodules as assembly codes.modules as assembly codes.
8/14/2019 Kernel Development in LINUX
4/29
How to get the KernelHow to get the Kernel
Code??Code?? We can download the kernel source from theWe can download the kernel source from the
command line, using the wget or curl utilities,command line, using the wget or curl utilities,
both of which should come with your Linuxboth of which should come with your Linux
distribution.distribution.To download the 2.6.17.8 kernel versionTo download the 2.6.17.8 kernel version
using wget, enter:using wget, enter:
$ wget$ wget
http://www.kernel.org/pub/linux/kernel/v2.6/lihttp://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.8.tar.gznux-2.6.17.8.tar.gz
8/14/2019 Kernel Development in LINUX
5/29
Types of KernelTypes of Kernel
Monolithic KernelMonolithic Kernel
Micro KernelMicro Kernel
Exo KernelExo Kernel Hybrid KernelHybrid Kernel
8/14/2019 Kernel Development in LINUX
6/29
Monolithic KernelMonolithic Kernel
Monolithic kernels are part of Unix-Monolithic kernels are part of Unix-
like operating systems like Linuxlike operating systems like Linux
,FreeBSD etc.,FreeBSD etc.
These types of kernels consist of theThese types of kernels consist of the
core functions of the operatingcore functions of the operating
system and the device drivers withsystem and the device drivers with
the ability to load modules atthe ability to load modules atruntime.runtime.
8/14/2019 Kernel Development in LINUX
7/29
Micro KernelMicro Kernel
These types of kernels normallyThese types of kernels normally
provide only the minimal servicesprovide only the minimal services
such as defining memory addresssuch as defining memory address
spaces, Inter-process communicationspaces, Inter-process communication(IPC) and the process management.(IPC) and the process management.
The other functions such as runningThe other functions such as running
the hardware processes are notthe hardware processes are nothandled directly by microkernels.handled directly by microkernels.
8/14/2019 Kernel Development in LINUX
8/29
Exo KernelExo Kernel
Exokernels are evolving and still underExokernels are evolving and still under
experimental stage in development of anexperimental stage in development of an
operating system that could incorporateoperating system that could incorporate
multiple library operating systems and aremultiple library operating systems and areintended to simultaneously run multipleintended to simultaneously run multiple
operating systems of different kinds like Linuxoperating systems of different kinds like Linux
and Microsoft Windows together usingand Microsoft Windows together using
appropriate Application Programmingappropriate Application ProgrammingInterface (API).Interface (API).
8/14/2019 Kernel Development in LINUX
9/29
Traditional Unix KernelTraditional Unix Kernel
Hardware
Hardware control
Kernel levelHardware level
Device drivers
Character Block
Buffer cache
File subsystem
Process control
subsystem
IPC
scheduler
Memory
management
System call interface
LibrariesUser programs
Kernel levelUser level
8/14/2019 Kernel Development in LINUX
10/29
Tools to Build the KernelTools to Build the Kernel
Only three packages that are neededOnly three packages that are needed
in order to successfully build a kernelin order to successfully build a kernel A CompilerA Compiler
A LinkerA Linker
A Make utilityA Make utility
Module-init-toolsModule-init-tools
8/14/2019 Kernel Development in LINUX
11/29
CompilerCompiler
The Linux kernel is written in the C programmingThe Linux kernel is written in the C programming
language, with a small amount of assemblylanguage, with a small amount of assembly
language in some places. To build the kernel, thelanguage in some places. To build the kernel, the
gcc C compiler must be used.gcc C compiler must be used.
To determine which version of gcc you have onTo determine which version of gcc you have on
your system, run the following command:your system, run the following command:
$ gcc --version$ gcc --version
8/14/2019 Kernel Development in LINUX
12/29
LinkerLinker
The C compiler, gcc, does not do all of the compiling onThe C compiler, gcc, does not do all of the compiling on
its own. It needs an additional set of tools known asits own. It needs an additional set of tools known as
binutils to do the linking and assembling of source files.binutils to do the linking and assembling of source files.
The binutils package also contains useful utilities thatThe binutils package also contains useful utilities that
can manipulate object files in lots of useful ways, suchcan manipulate object files in lots of useful ways, suchas to view the contents of a library.as to view the contents of a library.
To determine which version of binutils you have on yourTo determine which version of binutils you have on your
system, run the following command:system, run the following command:
$ ld v$ ld v
8/14/2019 Kernel Development in LINUX
13/29
Make UtilityMake Utility
Make is a tool that walks the kernelMake is a tool that walks the kernel
source tree to determine which filessource tree to determine which files
need to be compiled, and then callsneed to be compiled, and then calls
the compiler and other build tools tothe compiler and other build tools todo the work in building the kernel.do the work in building the kernel.
8/14/2019 Kernel Development in LINUX
14/29
Module-init-toolsModule-init-tools
The module-init-tools package is neededThe module-init-tools package is needed
if you wish to use Linuxif you wish to use Linux kernel moduleskernel modules..
To determine which version of theTo determine which version of the
module-init-tools package you have onmodule-init-tools package you have onyour system, run the followingyour system, run the following
command:command:
$ depmod -V$ depmod -V
http://c/Documents%20and%20Settings/UTKARSH/Desktop/final%20touch/Kernel%20description.txthttp://c/Documents%20and%20Settings/UTKARSH/Desktop/final%20touch/Kernel%20description.txthttp://c/Documents%20and%20Settings/UTKARSH/Desktop/final%20touch/Kernel%20description.txt8/14/2019 Kernel Development in LINUX
15/29
Metadata In KernelsMetadata In Kernels
All kernels can and should contain metadatadescriptiveAll kernels can and should contain metadatadescriptive
information about the basic kernel data.information about the basic kernel data.
Metadata might convey:Metadata might convey:
when, where, how and by whom the file was madewhen, where, how and by whom the file was made
for what purpose the file was madefor what purpose the file was made what source data were used to make the filewhat source data were used to make the file
key characteristics of the file, such as:key characteristics of the file, such as:
start and stop timesstart and stop times
information about data gapsinformation about data gaps notes on expected data accuracynotes on expected data accuracy
cautions on use of the filecautions on use of the file
whatever else the file creator thinks could be usefulwhatever else the file creator thinks could be useful
to consumers of the data productto consumers of the data product
8/14/2019 Kernel Development in LINUX
16/29
Booting of KernelBooting of Kernel
Initially the Kernel image is loadedInitially the Kernel image is loaded
into the primary memory, which is ainto the primary memory, which is a
secured one for the kernel.secured one for the kernel.
Then the Kernel creates a limitedThen the Kernel creates a limited
address space including the kernel'saddress space including the kernel's
code and data segment, the initialcode and data segment, the initial
Page Tables, and a 128KB for somePage Tables, and a 128KB for somedynamic data structures.dynamic data structures.
8/14/2019 Kernel Development in LINUX
17/29
Examples of KernelExamples of Kernel
ModulesModules SchedulerScheduler
SupervisorSupervisor
Interrupt HandlerInterrupt Handler
Memory MangerMemory Manger
8/14/2019 Kernel Development in LINUX
18/29
Examples of KernelExamples of Kernel
Modules(2)Modules(2) SchedulerScheduler : Which is concerned with the Time of: Which is concerned with the Time of
kernel provided to the processes.kernel provided to the processes.
SupervisorSupervisor : Which grants the Use of Kernel to: Which grants the Use of Kernel toeach process.each process.
Interrupt HandlerInterrupt Handler: Handles all the mask able: Handles all the mask ableand non mask able interrupts like io request,and non mask able interrupts like io request,exception etc.exception etc.
Memory ManagerMemory Manager: Handles the memory: Handles the memory
allocation to the file and maintains the uarea.allocation to the file and maintains the uarea.
8/14/2019 Kernel Development in LINUX
19/29
History of LinuxHistory of Linux
Linux was created originally by and named after a youngstudent Linus Torvald at the University of Helsinki in Finland.
Linux began searching for ways to get more out of Minix inthe spring of 1991.
On october 5th 1991, Linus announced his first "official"version of Linux, version 0.02.
Three years later, in 1994, version 1.0 was officially released.
Some Basic Characteristics ofSome Bas c C aracter st cs o
8/14/2019 Kernel Development in LINUX
20/29
Some Basic Characteristics ofSome Bas c C aracter st cs oLinuxLinux
Multi-user System
Multiprogramming/Multitasking system
Uses Time Sharing
Access rights for Files and Processes
Uses File and Process hierarchies
8/14/2019 Kernel Development in LINUX
21/29
Advantages and DisadvantagesAdvantages and Disadvantages
AdvantagesAdvantages::
(a) Cost(a) Cost
The Linux OS is entirely cost- and license-free. The only expensesThe Linux OS is entirely cost- and license-free. The only expenses
involved are those of hardware and maintenance.involved are those of hardware and maintenance.
(b) OS Stability(b) OS Stability Linux almost never freezes under normal use.Linux almost never freezes under normal use.
Linux has been known to run some applications for months and yearsLinux has been known to run some applications for months and years
at a time.at a time.
(c) Speed(c) SpeedLinux machines are also known to be extremely fast, because theLinux machines are also known to be extremely fast, because the
operating system is very efficient at managing resources .operating system is very efficient at managing resources .
8/14/2019 Kernel Development in LINUX
22/29
Advantages and DisadvantagesAdvantages and Disadvantages
AdvantagesAdvantages::
(d) Portability(d) Portability
Linux can run on ARMs, DEC Alphas, SUN Sparcs, M68000 machinesLinux can run on ARMs, DEC Alphas, SUN Sparcs, M68000 machines
(like Atari and Amiga), MIPS and PowerPCs, and others. So no matter(like Atari and Amiga), MIPS and PowerPCs, and others. So no matter
what computer you're running, Linux will work on your hardware.what computer you're running, Linux will work on your hardware.(e) Power and Customization(e) Power and Customization
Linux can be tailored to your specific hardware and software needs,Linux can be tailored to your specific hardware and software needs,
as well as other operating systems.as well as other operating systems.
(f) Support(f) SupportSupport for the Linux OS is entirely free. There is extensiveSupport for the Linux OS is entirely free. There is extensive
documentation covering almost everything you will use.documentation covering almost everything you will use.
8/14/2019 Kernel Development in LINUX
23/29
Advantages and DisadvantagesAdvantages and Disadvantages
Disadvantages:Disadvantages:
(a) Lack of technical support(a) Lack of technical supportHaving no source of technical support for the linuxHaving no source of technical support for the linux
operating system, so for its application.operating system, so for its application.
(b) Hardware problems(b) Hardware problems
Linux can be hard to install and doesnt work on allLinux can be hard to install and doesnt work on allhardware platforms as it is not a commercialhardware platforms as it is not a commercial
program development operation.program development operation.
8/14/2019 Kernel Development in LINUX
24/29
Advantages and DisadvantagesAdvantages and Disadvantages
Disadvantages:Disadvantages:
(c) Maintainance(c) MaintainanceLinux requires that you learn to perform administrationLinux requires that you learn to perform administration
tasks like adding new users and installing software.tasks like adding new users and installing software.
(d) Lack of experience(d) Lack of experienceIt has many features which require patience to learn, andIt has many features which require patience to learn, and
experience to fully understand.experience to fully understand.
(e) Accountability(e) Accountability
Use of the Linux OS is strictly at-your-own-risk. There is noUse of the Linux OS is strictly at-your-own-risk. There is no
one who is responsible if the OS fails.one who is responsible if the OS fails.
8/14/2019 Kernel Development in LINUX
25/29
ApplicationsApplications
Linux contains a wide variety of applications.Linux contains a wide variety of applications.
(a)General Business Applications - Office Suites, Financial(a)General Business Applications - Office Suites, Financial
Programs, Word Processors, Text Editors, SpreadsheetsPrograms, Word Processors, Text Editors, Spreadsheets
(b)Database Tools - Databases, Database Tools and Utilities(b)Database Tools - Databases, Database Tools and Utilities
(c) Development Tools - Programming Software, Tools, and(c) Development Tools - Programming Software, Tools, andUtilitiesUtilities
8/14/2019 Kernel Development in LINUX
26/29
ApplicationsApplications
(e(e)) Internet Utilities - HTML Editors, Internet ApplicationsInternet Utilities - HTML Editors, Internet Applications
and Utilities, Email ,Software, Web Browsers, Web Serversand Utilities, Email ,Software, Web Browsers, Web Servers
(f) Networking Tools -- Networking Tools and Utilities(f) Networking Tools -- Networking Tools and Utilities
(g) Miscellaneous Applications(g) Miscellaneous Applications
(h) Linux Software Map (LSM)(h) Linux Software Map (LSM)
8/14/2019 Kernel Development in LINUX
27/29
What Next?????????What Next?????????
Hybrid KernelHybrid Kernel
The Kernel with the extendedThe Kernel with the extended
functionalities added by the means offunctionalities added by the means of
the modules.the modules. Ex: Device DriversEx: Device Drivers
8/14/2019 Kernel Development in LINUX
28/29
ReferencesReferences
www.wikipedia.orgwww.wikipedia.org
http://it.toolbox.com/http://it.toolbox.com/
www.linuxforumes.orgwww.linuxforumes.org www.kernel.org.inwww.kernel.org.in
http://www.wikipedia.org/http://www.wikipedia.org/http://it.toolbox.com/http://it.toolbox.com/http://www.linuxforumes.org/http://www.linuxforumes.org/http://www.kernel.org.in/http://www.kernel.org.in/http://www.kernel.org.in/http://www.linuxforumes.org/http://it.toolbox.com/http://www.wikipedia.org/8/14/2019 Kernel Development in LINUX
29/29
AnyAny
Questions???????Questions???????