SlideShare a Scribd company logo
Linux Porting 
& 
Linux Support Package 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 
All Rights Reserved.
What to Expect? 
Kernel Basics for Linux Porting 
W's of Linux Porting 
W's of Linux Support Package (LSP) 
Architecture of LSPs 
Browse & Understand the LSPs 
LSP & Board Bringup Connections 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 2 
All Rights Reserved.
Some Basics 
For 
Understanding Linux Porting 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 3 
All Rights Reserved.
Kernel Items to Consider 
Version 
Major 
Minor 
Sequence 
Extra version 
/proc/version 
Source Repositories & Mailing Lists 
Architecture Specific 
Architecture Merging Efforts 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 4 
All Rights Reserved.
Kernel Configuration (Detailed) 
Changing the .config by hand 
Preparing & Using a default config 
Example: arch/arm/configs/omap3evm 
Other Configs: rand, allmod, allyes, allno 
Adding an Entry 
Change in Kconfig 
Change in Makefile 
Let's have a demonstration 
The autoconf.h 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 5 
All Rights Reserved.
Kernel Image Components 
Observe the Makefile &/or vmlinux build with V=1 
Objects 
arch/<arch>/kernel/head.o 
Kernel Architecture specific startup code 
arch/<arch>/kernel/init-task.o 
Initial thread & task structs required by Kernel 
init/built-in.o 
Main kernel initialization code 
… 
Linker script 
arch/<arch>/kernel/vmlinux.lds 
Kernel Bootstrap Loader 
Initialize Processor's internal caches and C runtime environment (head*.o) 
Decompression & re-location (misc.o) 
Processor-specific initialization, e.g. endian related (*endian.o) 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 6 
All Rights Reserved.
Kernel Initialization (Detailed) 
Kernel Entry Point 
arch/<arch>/kernel/head*.o 
Kernel Startup 
init/main.c → start_kernel(); 
Browse the code 
Architecture Setup 
Command Line Processing & __setup macro(arg, f) 
Subsystem Initializations & Initcalls (for memory free up) 
Kernel init Thread → init process 
Idle Process 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 7 
All Rights Reserved.
Let's get down to the Source Code 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 8 
All Rights Reserved.
Let's Check 
Where are the following things done? 
MMU switching ON 
Starting of kernel 
Mounting of init ramdisk and root filesystem 
board_init invocation 
Where is the default command line setup? 
'Booting Kernel' message 
Machine Id verification 
Command Line parsing 
start_kernel location 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 9 
All Rights Reserved.
Linux Porting 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 10 
All Rights Reserved.
What is Porting? 
“To Port” is “To Carry” 
Adapting to the Environment 
That it was not Designed for 
And by “(Embedded) Linux Porting” we mean 
Adapting Linux to work on an Embedded Platform 
So, what does it take to port Linux 
At high level, the 5's of Embedded Systems 
And at kernel level, the 5 M's of OS 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 11 
All Rights Reserved.
5 M's of OS (Revisited) 
Architecture Porting 
Processor Management 
Memory Management 
Board Porting 
I/O Management 
Storage Management 
Network Management 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 12 
All Rights Reserved.
Linux Porting 
Architecture Porting is a subject in itself 
Would talk in a separate session 
Board Porting 
Board-specific Initialization Code 
And majorly Drivers Porting 
So, part of the Kernel Space 
Two categories of Drivers 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 13 
All Rights Reserved. 
Standard Device Drivers 
Part of the Kernel 
Or, Needs to be done as for writing the standard Linux Drivers 
At the standard directory locations 
Custom Device / Interface Drivers 
Board-specific Custom Code required 
Needs to be specifically brought-in with the Kernel
What is Linux Support Package? 
Collection of this board specific 
Initialization & Custom Code is referred as 
Board Support Package (BSP) – normal 
language 
Or, Linux Support Package (LSP) – Linux 
language 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 14 
All Rights Reserved.
Sources of LSPs 
Board Vendor 
For a reference board, Or 
For a board based on the reference design 
Develop your Own for a Custom Board 
developed In-House 
First, search the kernel source for existing code 
If found, use it 
Else, if found something close, modify & use it 
Otherwise, following material would provide 
further guidelines 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 15 
All Rights Reserved.
Architecture of Linux Support Packages 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 16 
All Rights Reserved.
Components of LSP 
As LSP is very specific to a board. It consists 
of code for things hard-wired on the board 
A Usual List 
Interrupt Request Numbers 
Audio Codecs 
Keypad Interfaces 
Switch Interfaces 
LED Interfaces 
... 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 17 
All Rights Reserved.
LSP Placement 
With these in mind, and a board being tied to an architecture, the 
natural place for an LSP becomes under the kernel's “arch” sub-tree 
To be more specific, under the specific <arch> of the arch/ 
Architecture Specific Code resides under 
arch/<arch> → Sources 
include/asm-<arch> → Headers 
So, Board Specific Code resides under 
arch/<arch>/mach-<board_name> → Sources 
include/asm/mach-<board_name> → Headers 
mach stands for Machine, lingo for Board in Linux community 
Many LSP vendors, violate these norms, and 
Place headers with sources 
Place the LSP at other inappropriate locations 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 18 
All Rights Reserved.
Design & Layout of LSPs 
Where does a keypad driver go? 
Under drivers, Or 
Linux Support Package 
What about code for Audio chip, when the controller doesn't have 
built-in audio support (say I2S)? 
Such gray areas create confusion 
People place the code as per their judgment 
Hence, we follow some thumb rules 
Design & Layout Rules of Thumb 
Look for something similar, already in kernel source 
Follow the norm 
If not there, start from the LSP 
Over time, if it becomes generic enough, move to drivers 
For all the above, appropriately update Kconfig & Makefile 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 19 
All Rights Reserved.
Initialization Code LSP 
Board specific Code 
UART Configuration – UART Pins, UART vs 
Device mapping, ... 
Ethernet Configuration – Interrupt Pin, ... 
… (the various device configurations) 
Let's browse the code 
mach-omap2/board-omap3evm.c 
plat-omap/... 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 20 
All Rights Reserved.
Custom Code LSP 
Interrupts 
Input / Output Management 
Audio 
Video 
Embedded Storage Management 
Flash Partitioning 
NB Separate sessions needed for each 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 21 
All Rights Reserved.
Let's Browse some LSPs 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 22 
All Rights Reserved.
LSP & Board Bringup Connections 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 23 
All Rights Reserved.
BSP in Bootloader 
Bootloader does some of the Board-specific 
tasks, which are done in kernel 
Device Initialization 
Some Device Access 
This could be taken advantage from 
Could serve as the reference for the LSP 
Many a times, it becomes other way round 
Code developed for LSP may help enhance 
Bootloader 
Improving a better Board Bringup Experience 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 24 
All Rights Reserved.
Board Id 
Unique Number designated to every 
Board Type 
Part of the LSP and exposed to Bootloader 
Populated by Bootloader 
Verified by LSP 
Let's browse to view it 
arch/arm/tools/mach-types 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 25 
All Rights Reserved.
Hacking the LSP 
Very often, we have initial boot, test & 
board bringup programs, written to run 
on the bare board 
They may be really useful to hack the LSP 
When it is not working as expected 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 26 
All Rights Reserved.
Steps in Porting 
Register the machine and get the machine id for board 
Create a board specific file 'board-<board_name>' at 
arch/arm/mach-<soc> 
Define the MACHINE_START for the board 
Update the Kconfig file at arch/arm/mach-<soc> 
Update the corresponding makefile 
Create the default configuration for the board and place the 
working .config file at arch/arm/configs/ 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 27 
All Rights Reserved.
What all have we learnt? 
Kernel Basics for Linux Porting 
W's of Linux Porting 
W's of Linux Support Package (LSP) 
Architecture of LSPs 
Browse & Understand the LSPs 
LSP & Board Bringup Connections 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 28 
All Rights Reserved.
Any Queries? 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 29 
All Rights Reserved.

More Related Content

What's hot

U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
Satpal Parmar
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
Anil Kumar Pugalia
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
Vandana Salve
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
Linaro
 
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
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
RuggedBoardGroup
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loader
iamumr
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
Omkar Rane
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
RuggedBoardGroup
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
Emertxe Information Technologies Pvt Ltd
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
Emertxe Information Technologies Pvt Ltd
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
Static partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-VStatic partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-V
RISC-V International
 
linux device driver
linux device driverlinux device driver
linux device driver
Rahul Batra
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
Anil Kumar Pugalia
 
A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
Emertxe Information Technologies Pvt Ltd
 

What's hot (20)

U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
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)
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loader
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Static partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-VStatic partitioning virtualization on RISC-V
Static partitioning virtualization on RISC-V
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
linux device driver
linux device driverlinux device driver
linux device driver
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
 
A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 

Viewers also liked

BeagleBoard-xM Bootloaders
BeagleBoard-xM BootloadersBeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
SysPlay eLearning Academy for You
 
References
ReferencesReferences
References
Anil Kumar Pugalia
 
Embedded C
Embedded CEmbedded C
Embedded C
Anil Kumar Pugalia
 
SPI Drivers
SPI DriversSPI Drivers
Interrupts
InterruptsInterrupts
Interrupts
Anil Kumar Pugalia
 

Viewers also liked (13)

BeagleBoard-xM Bootloaders
BeagleBoard-xM BootloadersBeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
 
File Systems
File SystemsFile Systems
File Systems
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
References
ReferencesReferences
References
 
Embedded C
Embedded CEmbedded C
Embedded C
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
Interrupts
InterruptsInterrupts
Interrupts
 
Block Drivers
Block DriversBlock Drivers
Block Drivers
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 

Similar to Linux Porting

Cisco Ios advanced
Cisco Ios advancedCisco Ios advanced
Cisco Ios advanced
Nallaparaju Varma
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded SystemsAnil Kumar Pugalia
 
Visão geral do hardware do servidor System z e Linux on z - Concurso Mainframe
Visão geral do hardware do servidor System z e Linux on z - Concurso MainframeVisão geral do hardware do servidor System z e Linux on z - Concurso Mainframe
Visão geral do hardware do servidor System z e Linux on z - Concurso Mainframe
Anderson Bassani
 
Ubuntu and Linux Terminal Server Project
Ubuntu and Linux Terminal Server ProjectUbuntu and Linux Terminal Server Project
Ubuntu and Linux Terminal Server Project
Sameer Verma
 
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx
LynellBull52
 
FreeBSD - LinuxExpo
FreeBSD - LinuxExpoFreeBSD - LinuxExpo
FreeBSD - LinuxExpowebuploader
 
17294_HiperSockets.pdf
17294_HiperSockets.pdf17294_HiperSockets.pdf
17294_HiperSockets.pdf
Eeszt
 
Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...
Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...
Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...
IBM India Smarter Computing
 
Kernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using BuildrootKernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using Buildroot
Anne Nicolas
 
Unix nim-presentation
Unix nim-presentationUnix nim-presentation
Unix nim-presentation
Rajeev Ghosh
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
SysPlay eLearning Academy for You
 
Leveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN PerformanceLeveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN Performance
brettallison
 

Similar to Linux Porting (20)

Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Cisco Ios advanced
Cisco Ios advancedCisco Ios advanced
Cisco Ios advanced
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
 
Visão geral do hardware do servidor System z e Linux on z - Concurso Mainframe
Visão geral do hardware do servidor System z e Linux on z - Concurso MainframeVisão geral do hardware do servidor System z e Linux on z - Concurso Mainframe
Visão geral do hardware do servidor System z e Linux on z - Concurso Mainframe
 
Slimline Open Firmware
Slimline Open FirmwareSlimline Open Firmware
Slimline Open Firmware
 
Ubuntu and Linux Terminal Server Project
Ubuntu and Linux Terminal Server ProjectUbuntu and Linux Terminal Server Project
Ubuntu and Linux Terminal Server Project
 
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx
© 2007 Cisco Systems, Inc. All rights reserved. Cisco Public 1.docx
 
FreeBSD - LinuxExpo
FreeBSD - LinuxExpoFreeBSD - LinuxExpo
FreeBSD - LinuxExpo
 
Slim Server Theory
Slim Server TheorySlim Server Theory
Slim Server Theory
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
17294_HiperSockets.pdf
17294_HiperSockets.pdf17294_HiperSockets.pdf
17294_HiperSockets.pdf
 
Embedded Applications
Embedded ApplicationsEmbedded Applications
Embedded Applications
 
Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...
Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...
Problem Reporting and Analysis Linux on System z -How to survive a Linux Crit...
 
Kernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using BuildrootKernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using Buildroot
 
Low-level Accesses
Low-level AccessesLow-level Accesses
Low-level Accesses
 
Ubuntu
UbuntuUbuntu
Ubuntu
 
Unix nim-presentation
Unix nim-presentationUnix nim-presentation
Unix nim-presentation
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
Leveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN PerformanceLeveraging Open Source to Manage SAN Performance
Leveraging Open Source to Manage SAN Performance
 

More from Anil Kumar Pugalia

File System Modules
File System ModulesFile System Modules
File System Modules
Anil Kumar Pugalia
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
Anil Kumar Pugalia
 
Processes
ProcessesProcesses
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
Anil Kumar Pugalia
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
Anil Kumar Pugalia
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversAnil Kumar Pugalia
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISPAnil Kumar Pugalia
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
Anil Kumar Pugalia
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingAnil Kumar Pugalia
 
Threads
ThreadsThreads

More from Anil Kumar Pugalia (20)

File System Modules
File System ModulesFile System Modules
File System Modules
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Processes
ProcessesProcesses
Processes
 
System Calls
System CallsSystem Calls
System Calls
 
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
 
Power of vi
Power of viPower of vi
Power of vi
 
"make" system
"make" system"make" system
"make" system
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
 
RPM Building
RPM BuildingRPM Building
RPM Building
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 
System Calls
System CallsSystem Calls
System Calls
 
Timers
TimersTimers
Timers
 
Threads
ThreadsThreads
Threads
 
Synchronization
SynchronizationSynchronization
Synchronization
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 

Linux Porting

  • 1. Linux Porting & Linux Support Package © 2010-14 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved.
  • 2. What to Expect? Kernel Basics for Linux Porting W's of Linux Porting W's of Linux Support Package (LSP) Architecture of LSPs Browse & Understand the LSPs LSP & Board Bringup Connections © 2010-14 SysPlay Workshops <workshop@sysplay.in> 2 All Rights Reserved.
  • 3. Some Basics For Understanding Linux Porting © 2010-14 SysPlay Workshops <workshop@sysplay.in> 3 All Rights Reserved.
  • 4. Kernel Items to Consider Version Major Minor Sequence Extra version /proc/version Source Repositories & Mailing Lists Architecture Specific Architecture Merging Efforts © 2010-14 SysPlay Workshops <workshop@sysplay.in> 4 All Rights Reserved.
  • 5. Kernel Configuration (Detailed) Changing the .config by hand Preparing & Using a default config Example: arch/arm/configs/omap3evm Other Configs: rand, allmod, allyes, allno Adding an Entry Change in Kconfig Change in Makefile Let's have a demonstration The autoconf.h © 2010-14 SysPlay Workshops <workshop@sysplay.in> 5 All Rights Reserved.
  • 6. Kernel Image Components Observe the Makefile &/or vmlinux build with V=1 Objects arch/<arch>/kernel/head.o Kernel Architecture specific startup code arch/<arch>/kernel/init-task.o Initial thread & task structs required by Kernel init/built-in.o Main kernel initialization code … Linker script arch/<arch>/kernel/vmlinux.lds Kernel Bootstrap Loader Initialize Processor's internal caches and C runtime environment (head*.o) Decompression & re-location (misc.o) Processor-specific initialization, e.g. endian related (*endian.o) © 2010-14 SysPlay Workshops <workshop@sysplay.in> 6 All Rights Reserved.
  • 7. Kernel Initialization (Detailed) Kernel Entry Point arch/<arch>/kernel/head*.o Kernel Startup init/main.c → start_kernel(); Browse the code Architecture Setup Command Line Processing & __setup macro(arg, f) Subsystem Initializations & Initcalls (for memory free up) Kernel init Thread → init process Idle Process © 2010-14 SysPlay Workshops <workshop@sysplay.in> 7 All Rights Reserved.
  • 8. Let's get down to the Source Code © 2010-14 SysPlay Workshops <workshop@sysplay.in> 8 All Rights Reserved.
  • 9. Let's Check Where are the following things done? MMU switching ON Starting of kernel Mounting of init ramdisk and root filesystem board_init invocation Where is the default command line setup? 'Booting Kernel' message Machine Id verification Command Line parsing start_kernel location © 2010-14 SysPlay Workshops <workshop@sysplay.in> 9 All Rights Reserved.
  • 10. Linux Porting © 2010-14 SysPlay Workshops <workshop@sysplay.in> 10 All Rights Reserved.
  • 11. What is Porting? “To Port” is “To Carry” Adapting to the Environment That it was not Designed for And by “(Embedded) Linux Porting” we mean Adapting Linux to work on an Embedded Platform So, what does it take to port Linux At high level, the 5's of Embedded Systems And at kernel level, the 5 M's of OS © 2010-14 SysPlay Workshops <workshop@sysplay.in> 11 All Rights Reserved.
  • 12. 5 M's of OS (Revisited) Architecture Porting Processor Management Memory Management Board Porting I/O Management Storage Management Network Management © 2010-14 SysPlay Workshops <workshop@sysplay.in> 12 All Rights Reserved.
  • 13. Linux Porting Architecture Porting is a subject in itself Would talk in a separate session Board Porting Board-specific Initialization Code And majorly Drivers Porting So, part of the Kernel Space Two categories of Drivers © 2010-14 SysPlay Workshops <workshop@sysplay.in> 13 All Rights Reserved. Standard Device Drivers Part of the Kernel Or, Needs to be done as for writing the standard Linux Drivers At the standard directory locations Custom Device / Interface Drivers Board-specific Custom Code required Needs to be specifically brought-in with the Kernel
  • 14. What is Linux Support Package? Collection of this board specific Initialization & Custom Code is referred as Board Support Package (BSP) – normal language Or, Linux Support Package (LSP) – Linux language © 2010-14 SysPlay Workshops <workshop@sysplay.in> 14 All Rights Reserved.
  • 15. Sources of LSPs Board Vendor For a reference board, Or For a board based on the reference design Develop your Own for a Custom Board developed In-House First, search the kernel source for existing code If found, use it Else, if found something close, modify & use it Otherwise, following material would provide further guidelines © 2010-14 SysPlay Workshops <workshop@sysplay.in> 15 All Rights Reserved.
  • 16. Architecture of Linux Support Packages © 2010-14 SysPlay Workshops <workshop@sysplay.in> 16 All Rights Reserved.
  • 17. Components of LSP As LSP is very specific to a board. It consists of code for things hard-wired on the board A Usual List Interrupt Request Numbers Audio Codecs Keypad Interfaces Switch Interfaces LED Interfaces ... © 2010-14 SysPlay Workshops <workshop@sysplay.in> 17 All Rights Reserved.
  • 18. LSP Placement With these in mind, and a board being tied to an architecture, the natural place for an LSP becomes under the kernel's “arch” sub-tree To be more specific, under the specific <arch> of the arch/ Architecture Specific Code resides under arch/<arch> → Sources include/asm-<arch> → Headers So, Board Specific Code resides under arch/<arch>/mach-<board_name> → Sources include/asm/mach-<board_name> → Headers mach stands for Machine, lingo for Board in Linux community Many LSP vendors, violate these norms, and Place headers with sources Place the LSP at other inappropriate locations © 2010-14 SysPlay Workshops <workshop@sysplay.in> 18 All Rights Reserved.
  • 19. Design & Layout of LSPs Where does a keypad driver go? Under drivers, Or Linux Support Package What about code for Audio chip, when the controller doesn't have built-in audio support (say I2S)? Such gray areas create confusion People place the code as per their judgment Hence, we follow some thumb rules Design & Layout Rules of Thumb Look for something similar, already in kernel source Follow the norm If not there, start from the LSP Over time, if it becomes generic enough, move to drivers For all the above, appropriately update Kconfig & Makefile © 2010-14 SysPlay Workshops <workshop@sysplay.in> 19 All Rights Reserved.
  • 20. Initialization Code LSP Board specific Code UART Configuration – UART Pins, UART vs Device mapping, ... Ethernet Configuration – Interrupt Pin, ... … (the various device configurations) Let's browse the code mach-omap2/board-omap3evm.c plat-omap/... © 2010-14 SysPlay Workshops <workshop@sysplay.in> 20 All Rights Reserved.
  • 21. Custom Code LSP Interrupts Input / Output Management Audio Video Embedded Storage Management Flash Partitioning NB Separate sessions needed for each © 2010-14 SysPlay Workshops <workshop@sysplay.in> 21 All Rights Reserved.
  • 22. Let's Browse some LSPs © 2010-14 SysPlay Workshops <workshop@sysplay.in> 22 All Rights Reserved.
  • 23. LSP & Board Bringup Connections © 2010-14 SysPlay Workshops <workshop@sysplay.in> 23 All Rights Reserved.
  • 24. BSP in Bootloader Bootloader does some of the Board-specific tasks, which are done in kernel Device Initialization Some Device Access This could be taken advantage from Could serve as the reference for the LSP Many a times, it becomes other way round Code developed for LSP may help enhance Bootloader Improving a better Board Bringup Experience © 2010-14 SysPlay Workshops <workshop@sysplay.in> 24 All Rights Reserved.
  • 25. Board Id Unique Number designated to every Board Type Part of the LSP and exposed to Bootloader Populated by Bootloader Verified by LSP Let's browse to view it arch/arm/tools/mach-types © 2010-14 SysPlay Workshops <workshop@sysplay.in> 25 All Rights Reserved.
  • 26. Hacking the LSP Very often, we have initial boot, test & board bringup programs, written to run on the bare board They may be really useful to hack the LSP When it is not working as expected © 2010-14 SysPlay Workshops <workshop@sysplay.in> 26 All Rights Reserved.
  • 27. Steps in Porting Register the machine and get the machine id for board Create a board specific file 'board-<board_name>' at arch/arm/mach-<soc> Define the MACHINE_START for the board Update the Kconfig file at arch/arm/mach-<soc> Update the corresponding makefile Create the default configuration for the board and place the working .config file at arch/arm/configs/ © 2010-14 SysPlay Workshops <workshop@sysplay.in> 27 All Rights Reserved.
  • 28. What all have we learnt? Kernel Basics for Linux Porting W's of Linux Porting W's of Linux Support Package (LSP) Architecture of LSPs Browse & Understand the LSPs LSP & Board Bringup Connections © 2010-14 SysPlay Workshops <workshop@sysplay.in> 28 All Rights Reserved.
  • 29. Any Queries? © 2010-14 SysPlay Workshops <workshop@sysplay.in> 29 All Rights Reserved.