SlideShare a Scribd company logo
Team Emertxe
Embedded Linux Kernel
Contents
Embedded Linux Kernel
Contents
● General Information
● Configuration
● Build
● Deploy
Embedded Linux Kernel
General Information
Embedded Linux Kernel
General Information
● Where to get?
● Kernel Subsystem
● Source Code Browsing
Embedded Linux Kernel
General Information – Where to get?
Note: Snapshot of www.kernel.org. Expect changes on updates
Embedded Linux Kernel
General Information – Kernel Subsystem
●
Process Scheduler:
– To provide control, fair access
of CPU to process, while
interacting with HW on time
●
Memory Manager:
– To access system memory
securely and efficiently by
multiple processes. Supports
Virtual Memory in case of
huge memory requirement
●
Virtual File System:
– Abstracts the details of the
variety of hardware devices
by presenting a common file
interface to all devices
Embedded Linux Kernel
General Information – Kernel Subsystem
● Network Interface:
– provides access to several
networking standards and a
variety of network hardware
● Inter Process
Communications:
– supports several
mechanisms for process-to-
process communication on a
single Linux system
Embedded Linux Kernel
General Information – Source Code Browsing
● Untar the Linux kernel code
– tar xvf linux-<version>.<compression_format>
● Enter the Linux kernel directory
– cd linux-<version>
● The following slide discuss the contents of the Linux
directory
Embedded Linux Kernel
General Information – Source Code Browsing
● The left side of the slide shows
the source content of the Linux
kernel
● The directory structure might
vary depending on the picked
version.
● Lets us discuss some important
directories and files
init
arch
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
Embedded Linux Kernel
General Information – Source Code Browsing
● Architecture specific kernel
code
● Has sub directories per
supported architecture
● Example:
– arm
– powerpc
– X86
● We can also find low level
memory management, interrupt
handling, early inits, assembly
code and much moreinit
arch
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains core block layer files
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Cryptographic API for use by
kernel itself
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains system's device drivers
● Sub directories contain classes
of device drivers like video
drivers, network card drives,
low level SCSI drivers etc.,
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains the device firmwares
which will be uploaded to
devices with help of drivers
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● File system related code
● Contains both generic file
system code (VFS) and different
files system code
● Sub directories of supported file
system
● Examples:
– ext2
– ext3
– fat
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Most of the header files used in
the .c file of the kernel source
● It has further sub directories
including asm-generic
● Architecture specific header
file would be found in
arch/<arch>/include/
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Note: File level organization will vary based
on different versions of kernel sources
especially architecture and machine related
header files
Embedded Linux Kernel
General Information – Source Code Browsing
● Initialization code for kernel
● Best directory to start with to
know on how kernel works
● Has main.c of kernel
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains kernel's inter process
communication code like shared
memory, semaphores and other
forms
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Generic kernel level code which
can't fit anywhere else
● Contain upper level codes for
signal handling, scheduling
etc.,
● The architecture specific kernel
code will be in
arch/<arch_name>/kernel
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains kernel's library code
● Common string operations,
code for debugging and
command line parsing code can
be found here
● The architecture specific library
code will be in
arch/<arch_name>/lib
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains memory management
code
● The architecture specific
memory management code
would be found in
arch/<arch_name>/mm
● Example:
– arch/x86/mm/init.c
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● The kernels networking code
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Some sample programs
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains scripts that are used
while kernel configuration
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains code for different
security models
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains all the sound card
drivers
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Certain configuration and
testing tools
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● Contains code that builds a
cpio-format archive containing
a root file system image, which
will be used for early userspace
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
General Information – Source Code Browsing
● This is top level Makefile for
the whole source tree
● Contains useful rules and
variables like default gcc
compilation flags
init
block
crypto
drivers
firmware
scripts
security
ipc
kernel
lib
mm
net
sound
tools
usr
Makefile
fs samples
include
linux-<version>
arch
Embedded Linux Kernel
Configuration
Embedded Linux Kernel
Configuration
● The kernel configuration is based on multiple Makefiles
● As discussed already the top level Makefile would be
used for this purpose
● The configuration you should know the target. You can
find of the target as mentioned below
$ cd linux-<version>
$ make help
● Now you may look for “Configuration targets:” section of
the output and decide one
Embedded Linux Kernel
Configuration
● Once you decide on the target you may try the following
command
$ make target
● The modified configurations would be saved on a file
called as .config which can be found on the top level of
the linux-<version> directory.
● All the target options use the same .config file, so you
may use any interchangeably.
Embedded Linux Kernel
Configuration
● Some most commonly used target are
– make config
– make menuconfig
– make xconfig
● Configuring Architecture specific targets
● Configuring for specific architecture from scratch
Embedded Linux Kernel
Configuration – make config
user@hostname:linux-<version>$ make config
scripts/kconfig/conf --oldaskconfig Kconfig
*
* Linux/<ARCH> <version> Kernel Configuration
*
Patch physical to virtual translations at runtime (ARCH_PATCH_PHYS_VIRT) [Y/n/?]
●
The above image show snap shot typical output of make config
command
●
Updates current config utilizing a line-oriented program
●
No user friendly approach. Could be used if you have limited host
installations
●
The problem with this approach is that, It force you to follow an
sequence of questions while configuration.
●
Have to use “Ctrl C” to exit
Embedded Linux Kernel
Configuration – make menuconfig
●
The above image shows the snapshot of typical output of make menuconfig
command
Embedded Linux Kernel
Configuration – make menuconfig
● Most commonly used method and simple method
● Can be used if graphics is unavailable
● Requires libncurses-dev installation
● Easy to navigate between options, using arrow keys
● Use <Help> to know more on menuconfig
Embedded Linux Kernel
Configuration – make xconfig
●
The above image shows the snapshot of typical output of make xconfig
command
Embedded Linux Kernel
Configuration – make xconfig
● Most commonly used graphical method of configuration
● Easy to use, better search option
● Use Help menu to know more on xconfig
● Requires libqt-dev packages installation
Embedded Linux Kernel
Configuration – Architecture Specific
● Most preferably used in Embedded Linux configuration
● You can find then at arch/<arch>/configs/
● These files are best possible minimal .config file you can have
for your board
● Just type the following on the command to know available
target
$ make help
– Now you may look for “Architecture specific targets:” section of the
output to look for default configuration for your target architecture
● Now the following command
$ make <controller_name>_defconfig
Embedded Linux Kernel
Configuration – Architecture Specific
● The previous command would rewrite the existing .config file.
● Now you can use any of the general configuration method to
discussed above to configure further if required
● If you feel the you are done and need to preserve your
configuration then you can save it by
$ make savedefconfig
● The above line will create a file call defconfig on root of
kernel source directory
● Now you can mv it to the config directory by the following
command
$ mv defconfig /arch/<arch>/configs/my_defconfig
Embedded Linux Kernel
Configuration – From Scratch
●
Its possible to configure a kernel from scratch without using
any default configuration
●
It would obvious if your a board vendor where you might
have to do for your board
● Point to be kept in mind in this case
– Make sure you alteast select a proper architecture for your board
– Most of the architecture dependent basic things would be set by
default, so just leave it as it is, unless you know what you
change
– Might have to change certain thing like select a correct device
driver for your board
Embedded Linux Kernel
Building
●
Assuming the required configuration are done, The next
step would be to compile the kernel.
●
Type the following command on the prompt to start the
compilation
make
●
Can use the below command if you have multicore CPU
make -j
●
The above command will speed up your compilation process
● You may even specify the no of jobs you want to run
simultaneously based on your CPU configuration
Embedded Linux Kernel
Building - Compilation
●
Once the compilation is done you will get the kernel image
in the following location arch/<arch>/boot
● make install this is rarely used in embedded dev as the
kernel image is single file, But still can be done by
modifying its behavior arch/<arch>/boot/install.sh
●
You can install all the configured modules by the following
command
make INSTALL_MOD_PATH=<dir>/ module_install
●
The above line direct the module installation on the path
provided by the INSTALL_MOD_PATH variable and this is
important to avoid installation in host root path
Embedded Linux Kernel
Building - Compilation
● Most of the embedded system uses U-Boot as its second
stage boot loader
● U-Boot require the kernel image to be converted into a
format which it can load. This converted format is called
as uImage
● The discussion done here is on how create the uImage
from vmlinux
● vmlinux is the output of the kernel compilation which you
would find on the root directory of the kernel directory
● vmlinux consists of multiple information like ELF header,
COFF and binary
Embedded Linux Kernel
Building – Kernel Image
● So it required to extract the binary file from the vmlinux
first, Which is done by the following command
arm-linux-objcopy -O binary vimlinux linux.bin
● After extraction the U-Boot header can be added using
mkimage command, This is done by the following
command
mkimage -A arm -O linux -T kernel -C none -a
20008000 -e 20008000 -n “Embedded Linux” -d
linux.bin uImage.arm
● After all the above steps the kernel image is ready for
deployment on target
Embedded Linux Kernel
Building - Kernel Image
Embedded Linux Kernel
Deploy
Embedded Linux Kernel
Deploy
● Assuming the host is already configured with TFTP server
and Target is running U-Boot with TFTP client
● Copy uImage.arm in /var/lib/tftpboot/
● Copy the kernel image to the target board as mentioned
below
U-boot> tftp <TEXTBASE_ADDRESS> uImage.arm
● TEXTBASE_ADDRESS is defined configuring u-boot
● Once the image is transferred you can boot the image as
U-boot> bootm
● Your kernel should be loaded and executed now :)
Thank You
Ad

More Related Content

What's hot (20)

A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
Emertxe Information Technologies Pvt Ltd
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
Emertxe Information Technologies Pvt Ltd
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
Rashila Rr
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
RuggedBoardGroup
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
Sherif Mousa
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
Linaro
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Mahmoud Shiri Varamini
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
GlobalLogic Ukraine
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
mukul bhardwaj
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
Emertxe Information Technologies Pvt Ltd
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa
 
Linux device drivers
Linux device driversLinux device drivers
Linux device drivers
Abhishek Sagar
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
Emertxe Information Technologies Pvt Ltd
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech
 
Spi drivers
Spi driversSpi drivers
Spi drivers
pradeep_tewani
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
Emertxe Information Technologies Pvt Ltd
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
National Cheng Kung University
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
Rashila Rr
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
RuggedBoardGroup
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
Sherif Mousa
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
Linaro
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
Wave Digitech
 

Viewers also liked (20)

File systems for Embedded Linux
File systems for Embedded LinuxFile systems for Embedded Linux
File systems for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
Emertxe Information Technologies Pvt Ltd
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
Emertxe Information Technologies Pvt Ltd
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
Emertxe Information Technologies Pvt Ltd
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
Emertxe Information Technologies Pvt Ltd
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
Emertxe Information Technologies Pvt Ltd
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
Emertxe Information Technologies Pvt Ltd
 
Embedded Linux - Building toolchain
Embedded Linux - Building toolchainEmbedded Linux - Building toolchain
Embedded Linux - Building toolchain
Emertxe Information Technologies Pvt Ltd
 
Introduction to Embedded Systems
Introduction to Embedded Systems Introduction to Embedded Systems
Introduction to Embedded Systems
Emertxe Information Technologies Pvt Ltd
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
Emertxe Information Technologies Pvt Ltd
 
Getting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded LinuxGetting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded Linux
Emertxe Information Technologies Pvt Ltd
 
Emertxe : Linux training portfolio
Emertxe : Linux training portfolioEmertxe : Linux training portfolio
Emertxe : Linux training portfolio
Emertxe Information Technologies Pvt Ltd
 
Emertxe : Training portfolio
Emertxe : Training portfolioEmertxe : Training portfolio
Emertxe : Training portfolio
Emertxe Information Technologies Pvt Ltd
 
Interview preparation workshop
Interview preparation workshopInterview preparation workshop
Interview preparation workshop
Emertxe Information Technologies Pvt Ltd
 
Resume Preparation - Workshop
Resume Preparation - WorkshopResume Preparation - Workshop
Resume Preparation - Workshop
Emertxe Information Technologies Pvt Ltd
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
Emertxe Information Technologies Pvt Ltd
 
Linux Internals - Interview essentials 3.0
Linux Internals - Interview essentials 3.0Linux Internals - Interview essentials 3.0
Linux Internals - Interview essentials 3.0
Emertxe Information Technologies Pvt Ltd
 
Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0Linux Internals - Interview essentials 4.0
Linux Internals - Interview essentials 4.0
Emertxe Information Technologies Pvt Ltd
 
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
EneaSoftware
 
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
Open Enea Linux workshop at the Embedded Conference Scandinavia 2014
EneaSoftware
 
Ad

Similar to Embedded Linux Kernel - Build your custom kernel (20)

Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
abinaya m
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Siji Sunny
 
Introduction to lkm
Introduction to lkmIntroduction to lkm
Introduction to lkm
pradeep_tewani
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
Dom Cimafranca
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
guest547d74
 
NXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded LinuxNXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded Linux
NEEVEE Technologies
 
Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
mcganesh
 
Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-service
Rohit Sansiya
 
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteUnit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Tushar B Kute
 
managing kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating systemmanaging kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating system
mohammadshahnawaz77
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
les_02.ppt of the Oracle course train_2 file
les_02.ppt of the Oracle course train_2 fileles_02.ppt of the Oracle course train_2 file
les_02.ppt of the Oracle course train_2 file
YulinLiu27
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
Priyank Kapadia
 
Lect 1_Embedded Linux Embedded RTOS ppt
Lect 1_Embedded Linux Embedded RTOS  pptLect 1_Embedded Linux Embedded RTOS  ppt
Lect 1_Embedded Linux Embedded RTOS ppt
Varsha506533
 
Linux
LinuxLinux
Linux
Giridaran Manivannan
 
Introduction and course Details of Embedded Linux Platform Developer Training
Introduction and course Details of Embedded Linux Platform Developer TrainingIntroduction and course Details of Embedded Linux Platform Developer Training
Introduction and course Details of Embedded Linux Platform Developer Training
Veda Solutions - Embedded Systems & Linux Device Drivers Training
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
dibyajyotig
 
Ceh v5 module 18 linux hacking
Ceh v5 module 18 linux hackingCeh v5 module 18 linux hacking
Ceh v5 module 18 linux hacking
Vi Tính Hoàng Nam
 
Building
BuildingBuilding
Building
Satpal Parmar
 
Linux concept workshop
Linux concept workshopLinux concept workshop
Linux concept workshop
Tahmoures Shabanian
 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
abinaya m
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
Dom Cimafranca
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
guest547d74
 
NXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded LinuxNXP IMX6 Processor - Embedded Linux
NXP IMX6 Processor - Embedded Linux
NEEVEE Technologies
 
Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
mcganesh
 
Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-service
Rohit Sansiya
 
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B KuteUnit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute
Tushar B Kute
 
managing kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating systemmanaging kernal module from egineering sunject operating system
managing kernal module from egineering sunject operating system
mohammadshahnawaz77
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
Tushar B Kute
 
les_02.ppt of the Oracle course train_2 file
les_02.ppt of the Oracle course train_2 fileles_02.ppt of the Oracle course train_2 file
les_02.ppt of the Oracle course train_2 file
YulinLiu27
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
Priyank Kapadia
 
Lect 1_Embedded Linux Embedded RTOS ppt
Lect 1_Embedded Linux Embedded RTOS  pptLect 1_Embedded Linux Embedded RTOS  ppt
Lect 1_Embedded Linux Embedded RTOS ppt
Varsha506533
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
dibyajyotig
 
Ad

More from Emertxe Information Technologies Pvt Ltd (20)

Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
Emertxe Information Technologies Pvt Ltd
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf
10_isxdigit.pdf
Emertxe Information Technologies Pvt Ltd
 
01_student_record.pdf
01_student_record.pdf01_student_record.pdf
01_student_record.pdf
Emertxe Information Technologies Pvt Ltd
 
02_swap.pdf
02_swap.pdf02_swap.pdf
02_swap.pdf
Emertxe Information Technologies Pvt Ltd
 
01_sizeof.pdf
01_sizeof.pdf01_sizeof.pdf
01_sizeof.pdf
Emertxe Information Technologies Pvt Ltd
 
07_product_matrix.pdf
07_product_matrix.pdf07_product_matrix.pdf
07_product_matrix.pdf
Emertxe Information Technologies Pvt Ltd
 
06_sort_names.pdf
06_sort_names.pdf06_sort_names.pdf
06_sort_names.pdf
Emertxe Information Technologies Pvt Ltd
 
05_fragments.pdf
05_fragments.pdf05_fragments.pdf
05_fragments.pdf
Emertxe Information Technologies Pvt Ltd
 
04_magic_square.pdf
04_magic_square.pdf04_magic_square.pdf
04_magic_square.pdf
Emertxe Information Technologies Pvt Ltd
 
03_endianess.pdf
03_endianess.pdf03_endianess.pdf
03_endianess.pdf
Emertxe Information Technologies Pvt Ltd
 
02_variance.pdf
02_variance.pdf02_variance.pdf
02_variance.pdf
Emertxe Information Technologies Pvt Ltd
 
01_memory_manager.pdf
01_memory_manager.pdf01_memory_manager.pdf
01_memory_manager.pdf
Emertxe Information Technologies Pvt Ltd
 
09_nrps.pdf
09_nrps.pdf09_nrps.pdf
09_nrps.pdf
Emertxe Information Technologies Pvt Ltd
 
11_pangram.pdf
11_pangram.pdf11_pangram.pdf
11_pangram.pdf
Emertxe Information Technologies Pvt Ltd
 
10_combinations.pdf
10_combinations.pdf10_combinations.pdf
10_combinations.pdf
Emertxe Information Technologies Pvt Ltd
 
08_squeeze.pdf
08_squeeze.pdf08_squeeze.pdf
08_squeeze.pdf
Emertxe Information Technologies Pvt Ltd
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
Emertxe Information Technologies Pvt Ltd
 
06_reverserec.pdf
06_reverserec.pdf06_reverserec.pdf
06_reverserec.pdf
Emertxe Information Technologies Pvt Ltd
 
05_reverseiter.pdf
05_reverseiter.pdf05_reverseiter.pdf
05_reverseiter.pdf
Emertxe Information Technologies Pvt Ltd
 

Recently uploaded (20)

machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
CSUC - Consorci de Serveis Universitaris de Catalunya
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient CareAn Overview of Salesforce Health Cloud & How is it Transforming Patient Care
An Overview of Salesforce Health Cloud & How is it Transforming Patient Care
Cyntexa
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 

Embedded Linux Kernel - Build your custom kernel

  • 3. Embedded Linux Kernel Contents ● General Information ● Configuration ● Build ● Deploy
  • 5. Embedded Linux Kernel General Information ● Where to get? ● Kernel Subsystem ● Source Code Browsing
  • 6. Embedded Linux Kernel General Information – Where to get? Note: Snapshot of www.kernel.org. Expect changes on updates
  • 7. Embedded Linux Kernel General Information – Kernel Subsystem ● Process Scheduler: – To provide control, fair access of CPU to process, while interacting with HW on time ● Memory Manager: – To access system memory securely and efficiently by multiple processes. Supports Virtual Memory in case of huge memory requirement ● Virtual File System: – Abstracts the details of the variety of hardware devices by presenting a common file interface to all devices
  • 8. Embedded Linux Kernel General Information – Kernel Subsystem ● Network Interface: – provides access to several networking standards and a variety of network hardware ● Inter Process Communications: – supports several mechanisms for process-to- process communication on a single Linux system
  • 9. Embedded Linux Kernel General Information – Source Code Browsing ● Untar the Linux kernel code – tar xvf linux-<version>.<compression_format> ● Enter the Linux kernel directory – cd linux-<version> ● The following slide discuss the contents of the Linux directory
  • 10. Embedded Linux Kernel General Information – Source Code Browsing ● The left side of the slide shows the source content of the Linux kernel ● The directory structure might vary depending on the picked version. ● Lets us discuss some important directories and files init arch block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version>
  • 11. Embedded Linux Kernel General Information – Source Code Browsing ● Architecture specific kernel code ● Has sub directories per supported architecture ● Example: – arm – powerpc – X86 ● We can also find low level memory management, interrupt handling, early inits, assembly code and much moreinit arch block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version>
  • 12. Embedded Linux Kernel General Information – Source Code Browsing ● Contains core block layer files init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 13. Embedded Linux Kernel General Information – Source Code Browsing ● Cryptographic API for use by kernel itself init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 14. Embedded Linux Kernel General Information – Source Code Browsing ● Contains system's device drivers ● Sub directories contain classes of device drivers like video drivers, network card drives, low level SCSI drivers etc., init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 15. Embedded Linux Kernel General Information – Source Code Browsing ● Contains the device firmwares which will be uploaded to devices with help of drivers init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 16. Embedded Linux Kernel General Information – Source Code Browsing ● File system related code ● Contains both generic file system code (VFS) and different files system code ● Sub directories of supported file system ● Examples: – ext2 – ext3 – fat init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 17. Embedded Linux Kernel General Information – Source Code Browsing ● Most of the header files used in the .c file of the kernel source ● It has further sub directories including asm-generic ● Architecture specific header file would be found in arch/<arch>/include/ init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch Note: File level organization will vary based on different versions of kernel sources especially architecture and machine related header files
  • 18. Embedded Linux Kernel General Information – Source Code Browsing ● Initialization code for kernel ● Best directory to start with to know on how kernel works ● Has main.c of kernel init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 19. Embedded Linux Kernel General Information – Source Code Browsing ● Contains kernel's inter process communication code like shared memory, semaphores and other forms init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 20. Embedded Linux Kernel General Information – Source Code Browsing ● Generic kernel level code which can't fit anywhere else ● Contain upper level codes for signal handling, scheduling etc., ● The architecture specific kernel code will be in arch/<arch_name>/kernel init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 21. Embedded Linux Kernel General Information – Source Code Browsing ● Contains kernel's library code ● Common string operations, code for debugging and command line parsing code can be found here ● The architecture specific library code will be in arch/<arch_name>/lib init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 22. Embedded Linux Kernel General Information – Source Code Browsing ● Contains memory management code ● The architecture specific memory management code would be found in arch/<arch_name>/mm ● Example: – arch/x86/mm/init.c init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 23. Embedded Linux Kernel General Information – Source Code Browsing ● The kernels networking code init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 24. Embedded Linux Kernel General Information – Source Code Browsing ● Some sample programs init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 25. Embedded Linux Kernel General Information – Source Code Browsing ● Contains scripts that are used while kernel configuration init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 26. Embedded Linux Kernel General Information – Source Code Browsing ● Contains code for different security models init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 27. Embedded Linux Kernel General Information – Source Code Browsing ● Contains all the sound card drivers init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 28. Embedded Linux Kernel General Information – Source Code Browsing ● Certain configuration and testing tools init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 29. Embedded Linux Kernel General Information – Source Code Browsing ● Contains code that builds a cpio-format archive containing a root file system image, which will be used for early userspace init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 30. Embedded Linux Kernel General Information – Source Code Browsing ● This is top level Makefile for the whole source tree ● Contains useful rules and variables like default gcc compilation flags init block crypto drivers firmware scripts security ipc kernel lib mm net sound tools usr Makefile fs samples include linux-<version> arch
  • 32. Embedded Linux Kernel Configuration ● The kernel configuration is based on multiple Makefiles ● As discussed already the top level Makefile would be used for this purpose ● The configuration you should know the target. You can find of the target as mentioned below $ cd linux-<version> $ make help ● Now you may look for “Configuration targets:” section of the output and decide one
  • 33. Embedded Linux Kernel Configuration ● Once you decide on the target you may try the following command $ make target ● The modified configurations would be saved on a file called as .config which can be found on the top level of the linux-<version> directory. ● All the target options use the same .config file, so you may use any interchangeably.
  • 34. Embedded Linux Kernel Configuration ● Some most commonly used target are – make config – make menuconfig – make xconfig ● Configuring Architecture specific targets ● Configuring for specific architecture from scratch
  • 35. Embedded Linux Kernel Configuration – make config user@hostname:linux-<version>$ make config scripts/kconfig/conf --oldaskconfig Kconfig * * Linux/<ARCH> <version> Kernel Configuration * Patch physical to virtual translations at runtime (ARCH_PATCH_PHYS_VIRT) [Y/n/?] ● The above image show snap shot typical output of make config command ● Updates current config utilizing a line-oriented program ● No user friendly approach. Could be used if you have limited host installations ● The problem with this approach is that, It force you to follow an sequence of questions while configuration. ● Have to use “Ctrl C” to exit
  • 36. Embedded Linux Kernel Configuration – make menuconfig ● The above image shows the snapshot of typical output of make menuconfig command
  • 37. Embedded Linux Kernel Configuration – make menuconfig ● Most commonly used method and simple method ● Can be used if graphics is unavailable ● Requires libncurses-dev installation ● Easy to navigate between options, using arrow keys ● Use <Help> to know more on menuconfig
  • 38. Embedded Linux Kernel Configuration – make xconfig ● The above image shows the snapshot of typical output of make xconfig command
  • 39. Embedded Linux Kernel Configuration – make xconfig ● Most commonly used graphical method of configuration ● Easy to use, better search option ● Use Help menu to know more on xconfig ● Requires libqt-dev packages installation
  • 40. Embedded Linux Kernel Configuration – Architecture Specific ● Most preferably used in Embedded Linux configuration ● You can find then at arch/<arch>/configs/ ● These files are best possible minimal .config file you can have for your board ● Just type the following on the command to know available target $ make help – Now you may look for “Architecture specific targets:” section of the output to look for default configuration for your target architecture ● Now the following command $ make <controller_name>_defconfig
  • 41. Embedded Linux Kernel Configuration – Architecture Specific ● The previous command would rewrite the existing .config file. ● Now you can use any of the general configuration method to discussed above to configure further if required ● If you feel the you are done and need to preserve your configuration then you can save it by $ make savedefconfig ● The above line will create a file call defconfig on root of kernel source directory ● Now you can mv it to the config directory by the following command $ mv defconfig /arch/<arch>/configs/my_defconfig
  • 42. Embedded Linux Kernel Configuration – From Scratch ● Its possible to configure a kernel from scratch without using any default configuration ● It would obvious if your a board vendor where you might have to do for your board ● Point to be kept in mind in this case – Make sure you alteast select a proper architecture for your board – Most of the architecture dependent basic things would be set by default, so just leave it as it is, unless you know what you change – Might have to change certain thing like select a correct device driver for your board
  • 44. ● Assuming the required configuration are done, The next step would be to compile the kernel. ● Type the following command on the prompt to start the compilation make ● Can use the below command if you have multicore CPU make -j ● The above command will speed up your compilation process ● You may even specify the no of jobs you want to run simultaneously based on your CPU configuration Embedded Linux Kernel Building - Compilation
  • 45. ● Once the compilation is done you will get the kernel image in the following location arch/<arch>/boot ● make install this is rarely used in embedded dev as the kernel image is single file, But still can be done by modifying its behavior arch/<arch>/boot/install.sh ● You can install all the configured modules by the following command make INSTALL_MOD_PATH=<dir>/ module_install ● The above line direct the module installation on the path provided by the INSTALL_MOD_PATH variable and this is important to avoid installation in host root path Embedded Linux Kernel Building - Compilation
  • 46. ● Most of the embedded system uses U-Boot as its second stage boot loader ● U-Boot require the kernel image to be converted into a format which it can load. This converted format is called as uImage ● The discussion done here is on how create the uImage from vmlinux ● vmlinux is the output of the kernel compilation which you would find on the root directory of the kernel directory ● vmlinux consists of multiple information like ELF header, COFF and binary Embedded Linux Kernel Building – Kernel Image
  • 47. ● So it required to extract the binary file from the vmlinux first, Which is done by the following command arm-linux-objcopy -O binary vimlinux linux.bin ● After extraction the U-Boot header can be added using mkimage command, This is done by the following command mkimage -A arm -O linux -T kernel -C none -a 20008000 -e 20008000 -n “Embedded Linux” -d linux.bin uImage.arm ● After all the above steps the kernel image is ready for deployment on target Embedded Linux Kernel Building - Kernel Image
  • 49. Embedded Linux Kernel Deploy ● Assuming the host is already configured with TFTP server and Target is running U-Boot with TFTP client ● Copy uImage.arm in /var/lib/tftpboot/ ● Copy the kernel image to the target board as mentioned below U-boot> tftp <TEXTBASE_ADDRESS> uImage.arm ● TEXTBASE_ADDRESS is defined configuring u-boot ● Once the image is transferred you can boot the image as U-boot> bootm ● Your kernel should be loaded and executed now :)
  翻译: