Embedded linux

Wingston
WingstonCo-Founder, Chief Technical Officer at Wingston
Embedded Linux
Workshop India
Wilson Wingston Sharon
wingston.sharon@gmail.com
What are embedded systems?
• Embedded systems are self contained intelligent electronic
  control systems.

• They contain a microcontroller / microprocessor and
  peripherals interfaced to perform a particular series of tasks.

• Embedded systems today run almost every electronic device
  imaginable from TV’s to washing machine.

• Embedded systems also can be used for self-contained
  intelligent automated systems.
Simple Embedded Example
• An AVR microcontroller. Atmega328.

• Contains all hardware necessary to perform computational tasks
  onboard provided power is given to it.

• Communicates with the outside world via gpio pins.

• Can be used to read data from a sensor connected to it and analyze
  that. (e.g.: IR

• Can be interfaces to motors and set to control the movement of the
  motors depending on the sensor input.

• Then, the microcontroller can be put on-board a bot and be asked to
  perform line following!
Programming simple MC’s
• Microcontrollers are defined by their architecture and bus bit
  width.
• The atmega is an 8 bit AVR series microcontroller.

• To program the atmega we need
  • A Compiler to compile C code for the atmega328
  • A Flash/EPROM burning device

• The cross compiler convers our code from C to the hex op
  code that can be placed in the atmega’s internal memory.

• The atmega executes each instruction sequentially!
The problem!
• When we program in native C for a microcontroller, we need to be
  intimately aware of the underlying hardware.

• To control the atmega’s behavior we need to engage in register level
  programming.

• This makes the code non-portable as the program is now written to
  run on only one controller!

• Even different atmega that has different pinouts and register names
  will require a complete rewrite of most of the code before the
  program can work on it.

• As more advanced microcontrollers / microprocessors emerged into
  the market, register level programming needed an alternative to
  avoid over specializing developers.
Hardware available
• Hardware manufactures keep increasing complexity and
  system performance.

• The higher processing power comes with the price of too
  much registers with individual internal controlling
  methodology

• Hardware manufacturers needed to abstract their hardware to
  be able to support easier development.
• Software developers needed a generalized framework where
  they cab build their applications without worrying about their
  hardware.
Hardware v/s software
• Objective : Getting your code to sense / control external devices.

• The more complex your hardware is, the more requirements it will have
  in respect to code to write control mechanism.

• If a stand-alone application is required to be developed
   • Multiple (internal / external) devices have to be managed in the background
   • I/O of different devices must be managed and processed as per demand.
   • Interrupts / clocks / power must be managed to keep the microcontroller
     running.

• This calls for increased debugging / non portability and results in
  increased development time / bugs in the system.

• If hardware is as complicated and powerful as a computer (SBC) then we
  need code comparable to that of an Operating System (DOS) to be able
  to run it!!
Line between HW / SW
• Very few processors can be programmed by flash burning with
  ICSP. (e.g: ARM5)

• Modern communication standards are replacing “legacy” RS-
  232 with USB, I2C ,Ethernet etc.

• The software control of these protocols in the Atmega register
  level way is too complex.

• Harware manufacturers release “Drivers” or libraries for
  controlling their hardware to software developers which
  allows for more efficient usage of the underlying hardware.
Embedded linux
Embedded Linux


Hardware         Kernel              Userland

   • Processor      • Kernel            • This is
   • RAM              developers          where user
   • GPIO             work on             level
                      hardware            application
   • Clocks
                      control of          programs
   • UART             the devices.        are written.
   • I2C
Embedded Linux
• In 1990s, an underground software movement consisting of the
  worlds leading developers and programmers wrote a completely
  free Operating System!

• As more people used it with the FOSS philosophy, improvements,
  fixes and support for multiple processors creeped in!

• This resulted in Linux (the very same kernel ) to run on many
  processors and provide a similar level of functionality.

• A Global collaborative effort for improvements and upgrades make
  linux so popular with hardware developers
• Most of the time, linux gets fixes and support for new hardware as
  soon as they are available!
Application Developers
• Embedded developers prefer a non black box OS distribution.

• Although Software application are completely abstracted away
  from the hardware, it is still requirement that slight changes /
  improvements in the OS code could make the application a lot
  more efficiently on the developers embedded target.

• The HAL (Hardware Abstraction Layer) lets you focus on image
  recognition and not memory management!

• The Open Source Linux Kernel Project provids a HAL that is
  ported to wide range of processors and has driver support for
  almost every hardware device in the market.
Linux -> Embedded Linux
• Linux for x86 and amd64 (desktop architectures) require
  almost 100 - 500mb.

• Embedded Devices have more strict requirements in terms of
  memory and processing power.

• Embedded Linux kernels can go as low of 11Mb when placed
  in RAM.

• A non distribtion based linux – with only kernel and a minimal
  filesystem for a “dos” – like usage is usually run.
• Any custom linux libraries for hardware / software can be
  installed to help with application development.
Starting the Hardware
• When the hardware is switched on, the OS is present in some
  onboard memory peripheral.

• First there is code called a bootloader that initializes all the
  required hardware on the board.
• Bootloaders are small programs (4 – 16K) written for and
  compiled for specific hardware to be executed immediately
  after start.

• The bootloader starts the board and loads the kernel from
  where-ever it is into RAM.

• Once the Kernel starts executing from RAM, it takes over and
  starts a linux session!
Types of Bootloaders
• Intel Motherboard : PHOENIX BIOS :
  • This bootloader is present on most intel based laptops.
  • It starts the laptop hardware and loads “NTLDR” the windows
    bootmanager.
  • This code is hardwired into the mother board.



• Embedded Hardware
  • Bootloader is usually places in a NAND Flash memory.
  • Bootloaders are very small.
  • They load, uncompress the linux kernel and relenquish control..
Kernel
• Designed as a Finnish UG (B.tech eq) student’s hobby project.

• First was made as a UNIC port for a motorola 64Kb machine that
  made Linux designed for Portability.

• The groundwork and FOSS nature allowed the kernel to be ported to
  (and thus support) almost every hardware platform on/off the
  market.

• The base for extending the kernel through “Device Drivers” have
  hardware manufactures / driver developers to release support for
  any hardware available.

• Kernel is just a runtime HAL! It just has instructions for running the
  hardware – something has to give it instructions -> RootFS..
Linux system Design
Filesystem (UserLand)
• Filesystem : Collection of directories

• These directories follow a tree heirarchy and contain
  •   Executable files or programs that the kernel loads into memory
  •   Libraries for application to link to at run-time
  •   User Application that can be simply installed onto it
  •   Setting files that control the Linux OS’s behaviour.

• Hardware devices are also linked as special file nodes in the
  filesystem to connect them to the Kernel’s HAL.

• USB drives / HDDs / SD cards are mounted onto the filesystem
  and can be browsed as usual.
Embedded linux
Cross Compilers and
Toolchains
• Different Hardware – Same Source code?

• Cross Compilers are called the translators to machine language for
  different architectures.

• Hardware manufactures and developers develop a toolchain for
  their architectures.
• The toolchain contain all the utilities required to compile, debug
  code and link for the processor.
• There is a GNU toolchain for AVR and ARM architectures.
• The same source code when used with different cross compilers
  allow for targeting different platforms.

• The changes in code required for a particular hardware is managed
  with localised “patches”.
Applications
• Headless units : Devices without the need for a graphical display
    • Routers
    • Set Top Box
• GUI based Applications
    • Touch Smartphones
    • GPS car navigation multimedia systems.

• Application developers have:
    •   System level functionality if required
    •   Shared libraries for efficient management of resources
    •   Linux kernel provided complete HAL
    •   Same code workable of various devices

•   Android is a Linux Kernel and FS example!
•   Android will run on any phone that linux can work in.
•   Phone developers have a unified Free OS to work with.
•   Cheaper and more wide variety of applications!
Drivers
• Run time modules attached to the linux kernel to manage hardware
  peripherals

• USB Wifi
• Camera
• GPS

• Unified driver API that makes it easy to write Driver Code that
  integrated to the main Kernel.

• Hardware that is accepted to the main repository (upstream) means
  that everybody has access to the driver for that hardware!

• Linux drivers need not be released as source – which means
  hardware manufactures can release their driver in binary format.
  (becomes proprietary)
Libraries
• C library
  • Provides an interface to the kenel functions via calls from
    userland.

• Stripped down minimal C libraries are there for use in
  embedded devices.
  • GlibC (Full Featured)
  • uCibC (Minimal Variant)

• POSIX support
  • Allows for communication job sceduling, multiprocessing and IPC
    in a unified framework.
• ALSA
  • Advanced Linux Sound Architecture for Hardware DSP support
Custom Applications
• Compiled with appropriate cross-compiler as UNIX / POSIX
  Compliant applications

• BusyBox
  •   Provides an embedded shell functionality in embedded devices
  •   cd ls mkdir echo cat and all standard linux commands all work
  •   I/O can be managed over a serial line
  •   Can be thought of as a terminal equivalent
  •   Commands allow for direct control of the kernel
  •   Helps navigate the filesystem

• Qt GUI applications can also be built if LCD is present.
Run Time Linux
• Serial Console

• Apps that can be autostarted

• Daemons or “services” that provide background application
  functionality

• Kernel Threads for Real-Time interrupt management

• RTOS supprt in RT-Linux Project.
Memory Considerations
• Linux works primarily on processors with a hardware MMU.
  (memory management unit)

• MMU enforces copy and access violation protection in RAM
  between kernel, hardware and user application to make sure
  system can be kept stable at all times.

• Virtual Memory allows for run-time linking and delinking of un
  responsive kernel modules / application to keep the system
  functioning even in the event of a crash.
Try for yourself
• devmem2
  • Memory inspector



• ps
  • Running processors



• cat files in /proc
  • Gives you current system information
Open source Licenses
• Basic funda
   • Us at your own Risk
   • No guarantee
   • We’ll help if we CAN. We don’t need to.

• GPLv2
   • GNU Public Licence
   • Source must accompany binary
   • Linkng to non GPL software not possible.

• LGPL
   • Link to non GPL software possible
   • To provide for non open source driver development
   • LGPL source must be provided

• Modified Free-BSD
   • No source delivery required
   • For proprietary kernels
   • Broken and non FOSS supported Forks
1 of 28

Recommended

Introduction to Embedded Linux by
Introduction to Embedded LinuxIntroduction to Embedded Linux
Introduction to Embedded LinuxHossain Reja
2.1K views55 slides
Embedded Linux Basics by
Embedded Linux BasicsEmbedded Linux Basics
Embedded Linux BasicsMarc Leeman
8.5K views129 slides
Embedded Operating System - Linux by
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - LinuxEmertxe Information Technologies Pvt Ltd
936 views235 slides
File systems for Embedded Linux by
File systems for Embedded LinuxFile systems for Embedded Linux
File systems for Embedded LinuxEmertxe Information Technologies Pvt Ltd
7.2K views63 slides
Introduction Linux Device Drivers by
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device DriversNEEVEE Technologies
938 views29 slides
Linux device drivers by
Linux device drivers Linux device drivers
Linux device drivers Emertxe Information Technologies Pvt Ltd
41.6K views114 slides

More Related Content

What's hot

Embedded Linux Kernel - Build your custom kernel by
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmertxe Information Technologies Pvt Ltd
3.9K views50 slides
Linux kernel modules by
Linux kernel modulesLinux kernel modules
Linux kernel modulesEddy Reyes
3.2K views29 slides
Linux device drivers by
Linux device driversLinux device drivers
Linux device driversAbhishek Sagar
1.1K views113 slides
Root file system for embedded systems by
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systemsalok pal
1.1K views23 slides
U-Boot Porting on New Hardware by
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
2.1K views31 slides

What's hot(20)

Linux kernel modules by Eddy Reyes
Linux kernel modulesLinux kernel modules
Linux kernel modules
Eddy Reyes3.2K views
Root file system for embedded systems by alok pal
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
alok pal1.1K views
Uboot startup sequence by Houcheng Lin
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
Houcheng Lin33.7K views
Architecture Of The Linux Kernel by guest547d74
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
guest547d742.2K views
Arm device tree and linux device drivers by Houcheng Lin
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin17.5K views
Introduction to Linux Kernel by Quontra Solutions by QUONTRASOLUTIONS
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
QUONTRASOLUTIONS1.5K views
Linux I2C by KaidenYu
Linux I2CLinux I2C
Linux I2C
KaidenYu798 views
Linux Initialization Process (2) by shimosawa
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa6.8K views

Viewers also liked

Embedded linux system development (slides) by
Embedded linux system development (slides)Embedded linux system development (slides)
Embedded linux system development (slides)Jaime Barragan
2.5K views526 slides
Embedded Linux by
Embedded LinuxEmbedded Linux
Embedded LinuxQuotient Technology Inc.
5.5K views26 slides
Building Embedded Linux Systems Introduction by
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionSherif Mousa
3.8K views28 slides
Embedded Linux from Scratch to Yocto by
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoSherif Mousa
5.6K views20 slides
Building Embedded Linux by
Building Embedded LinuxBuilding Embedded Linux
Building Embedded LinuxSherif Mousa
3K views14 slides
Yocto - Embedded Linux Distribution Maker by
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerSherif Mousa
4.3K views21 slides

Viewers also liked(6)

Embedded linux system development (slides) by Jaime Barragan
Embedded linux system development (slides)Embedded linux system development (slides)
Embedded linux system development (slides)
Jaime Barragan2.5K views
Building Embedded Linux Systems Introduction by Sherif Mousa
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems Introduction
Sherif Mousa3.8K views
Embedded Linux from Scratch to Yocto by Sherif Mousa
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
Sherif Mousa5.6K views
Building Embedded Linux by Sherif Mousa
Building Embedded LinuxBuilding Embedded Linux
Building Embedded Linux
Sherif Mousa3K views
Yocto - Embedded Linux Distribution Maker by Sherif Mousa
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
Sherif Mousa4.3K views

Similar to Embedded linux

Linux for embedded_systems by
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systemsVandana Salve
2K views16 slides
Mces MOD 1.pptx by
Mces MOD 1.pptxMces MOD 1.pptx
Mces MOD 1.pptxRadhaC10
14 views72 slides
Building Embedded Linux Full Tutorial for ARM by
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMSherif Mousa
58.4K views52 slides
Device Drivers by
Device DriversDevice Drivers
Device DriversKushal Modi
25.1K views46 slides
MIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 Cameras by
MIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 CamerasMIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 Cameras
MIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 CamerasMIPI Alliance
1.9K views31 slides

Similar to Embedded linux(20)

Mces MOD 1.pptx by RadhaC10
Mces MOD 1.pptxMces MOD 1.pptx
Mces MOD 1.pptx
RadhaC1014 views
Building Embedded Linux Full Tutorial for ARM by Sherif Mousa
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
Sherif Mousa58.4K views
Device Drivers by Kushal Modi
Device DriversDevice Drivers
Device Drivers
Kushal Modi25.1K views
MIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 Cameras by MIPI Alliance
MIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 CamerasMIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 Cameras
MIPI DevCon 2016: Accelerating Software Development for MIPI CSI-2 Cameras
MIPI Alliance1.9K views
Intro to linux by Islam Nabil
Intro to linux Intro to linux
Intro to linux
Islam Nabil105 views
Unit 6 Operating System TEIT Savitribai Phule Pune University by Tushar B Kute 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 Kute3.9K views
Linux – an introduction by Wingston
Linux – an introductionLinux – an introduction
Linux – an introduction
Wingston2K views
Operating Systems 1 (4/12) - Architectures (Windows) by Peter Tröger
Operating Systems 1 (4/12) - Architectures (Windows)Operating Systems 1 (4/12) - Architectures (Windows)
Operating Systems 1 (4/12) - Architectures (Windows)
Peter Tröger6.5K views
Introduction to Operating system CBSE by PrashantChahal3
Introduction to Operating system CBSE Introduction to Operating system CBSE
Introduction to Operating system CBSE
PrashantChahal350 views
Embedded Systems: Lecture 5: A Tour in RTOS Land by Ahmed El-Arabawy
Embedded Systems: Lecture 5: A Tour in RTOS LandEmbedded Systems: Lecture 5: A Tour in RTOS Land
Embedded Systems: Lecture 5: A Tour in RTOS Land
Ahmed El-Arabawy1.2K views
Raspberry Pi - Lecture 1 Introduction by Mohamed Abdallah
Raspberry Pi - Lecture 1 IntroductionRaspberry Pi - Lecture 1 Introduction
Raspberry Pi - Lecture 1 Introduction
Mohamed Abdallah2.5K views
Chapter 1 - Introduction to Operating System.pptx by gowthamiv26
Chapter 1 - Introduction to Operating System.pptxChapter 1 - Introduction to Operating System.pptx
Chapter 1 - Introduction to Operating System.pptx
gowthamiv263 views
Course 101: Lecture 4: A Tour in RTOS Land by Ahmed El-Arabawy
Course 101: Lecture 4: A Tour in RTOS Land Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land
Ahmed El-Arabawy603 views

More from Wingston

OpenCV @ Droidcon 2012 by
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012Wingston
2.9K views19 slides
05 content providers - Android by
05   content providers - Android05   content providers - Android
05 content providers - AndroidWingston
3.1K views23 slides
04 activities - Android by
04   activities - Android04   activities - Android
04 activities - AndroidWingston
1.5K views26 slides
03 layouts & ui design - Android by
03   layouts & ui design - Android03   layouts & ui design - Android
03 layouts & ui design - AndroidWingston
2K views44 slides
02 hello world - Android by
02   hello world - Android02   hello world - Android
02 hello world - AndroidWingston
688 views11 slides
01 introduction & setup - Android by
01   introduction & setup - Android01   introduction & setup - Android
01 introduction & setup - AndroidWingston
595 views31 slides

More from Wingston(20)

OpenCV @ Droidcon 2012 by Wingston
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
Wingston2.9K views
05 content providers - Android by Wingston
05   content providers - Android05   content providers - Android
05 content providers - Android
Wingston3.1K views
04 activities - Android by Wingston
04   activities - Android04   activities - Android
04 activities - Android
Wingston1.5K views
03 layouts & ui design - Android by Wingston
03   layouts & ui design - Android03   layouts & ui design - Android
03 layouts & ui design - Android
Wingston2K views
02 hello world - Android by Wingston
02   hello world - Android02   hello world - Android
02 hello world - Android
Wingston688 views
01 introduction & setup - Android by Wingston
01   introduction & setup - Android01   introduction & setup - Android
01 introduction & setup - Android
Wingston595 views
OpenCV with android by Wingston
OpenCV with androidOpenCV with android
OpenCV with android
Wingston4K views
C game programming - SDL by Wingston
C game programming - SDLC game programming - SDL
C game programming - SDL
Wingston3K views
C programming - Pointers by Wingston
C programming - PointersC programming - Pointers
C programming - Pointers
Wingston3.7K views
Introduction to Basic C programming 02 by Wingston
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston9.4K views
Introduction to Basic C programming 01 by Wingston
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston6.5K views
04 Arduino Peripheral Interfacing by Wingston
04   Arduino Peripheral Interfacing04   Arduino Peripheral Interfacing
04 Arduino Peripheral Interfacing
Wingston1.5K views
03 analogue anrduino fundamentals by Wingston
03   analogue anrduino fundamentals03   analogue anrduino fundamentals
03 analogue anrduino fundamentals
Wingston535 views
02 General Purpose Input - Output on the Arduino by Wingston
02   General Purpose Input -  Output on the Arduino02   General Purpose Input -  Output on the Arduino
02 General Purpose Input - Output on the Arduino
Wingston2K views
Introduction to the Arduino by Wingston
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston2.5K views
4.content mgmt by Wingston
4.content mgmt4.content mgmt
4.content mgmt
Wingston1.1K views
8 Web Practices for Drupal by Wingston
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for Drupal
Wingston812 views
7 Theming in Drupal by Wingston
7 Theming in Drupal7 Theming in Drupal
7 Theming in Drupal
Wingston673 views
6 Special Howtos for Drupal by Wingston
6 Special Howtos for Drupal6 Special Howtos for Drupal
6 Special Howtos for Drupal
Wingston1.3K views
5 User Mgmt in Drupal by Wingston
5 User Mgmt in Drupal5 User Mgmt in Drupal
5 User Mgmt in Drupal
Wingston529 views

Recently uploaded

TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
160 views29 slides
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...ShapeBlue
123 views28 slides
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsPriyanka Aash
153 views59 slides
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
61 views21 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
139 views14 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
179 views7 slides

Recently uploaded(20)

TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc160 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue123 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash153 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue179 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays53 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue144 views
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue by ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue163 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE69 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue120 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue84 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty62 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue253 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue88 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue176 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue117 views

Embedded linux

  • 1. Embedded Linux Workshop India Wilson Wingston Sharon wingston.sharon@gmail.com
  • 2. What are embedded systems? • Embedded systems are self contained intelligent electronic control systems. • They contain a microcontroller / microprocessor and peripherals interfaced to perform a particular series of tasks. • Embedded systems today run almost every electronic device imaginable from TV’s to washing machine. • Embedded systems also can be used for self-contained intelligent automated systems.
  • 3. Simple Embedded Example • An AVR microcontroller. Atmega328. • Contains all hardware necessary to perform computational tasks onboard provided power is given to it. • Communicates with the outside world via gpio pins. • Can be used to read data from a sensor connected to it and analyze that. (e.g.: IR • Can be interfaces to motors and set to control the movement of the motors depending on the sensor input. • Then, the microcontroller can be put on-board a bot and be asked to perform line following!
  • 4. Programming simple MC’s • Microcontrollers are defined by their architecture and bus bit width. • The atmega is an 8 bit AVR series microcontroller. • To program the atmega we need • A Compiler to compile C code for the atmega328 • A Flash/EPROM burning device • The cross compiler convers our code from C to the hex op code that can be placed in the atmega’s internal memory. • The atmega executes each instruction sequentially!
  • 5. The problem! • When we program in native C for a microcontroller, we need to be intimately aware of the underlying hardware. • To control the atmega’s behavior we need to engage in register level programming. • This makes the code non-portable as the program is now written to run on only one controller! • Even different atmega that has different pinouts and register names will require a complete rewrite of most of the code before the program can work on it. • As more advanced microcontrollers / microprocessors emerged into the market, register level programming needed an alternative to avoid over specializing developers.
  • 6. Hardware available • Hardware manufactures keep increasing complexity and system performance. • The higher processing power comes with the price of too much registers with individual internal controlling methodology • Hardware manufacturers needed to abstract their hardware to be able to support easier development. • Software developers needed a generalized framework where they cab build their applications without worrying about their hardware.
  • 7. Hardware v/s software • Objective : Getting your code to sense / control external devices. • The more complex your hardware is, the more requirements it will have in respect to code to write control mechanism. • If a stand-alone application is required to be developed • Multiple (internal / external) devices have to be managed in the background • I/O of different devices must be managed and processed as per demand. • Interrupts / clocks / power must be managed to keep the microcontroller running. • This calls for increased debugging / non portability and results in increased development time / bugs in the system. • If hardware is as complicated and powerful as a computer (SBC) then we need code comparable to that of an Operating System (DOS) to be able to run it!!
  • 8. Line between HW / SW • Very few processors can be programmed by flash burning with ICSP. (e.g: ARM5) • Modern communication standards are replacing “legacy” RS- 232 with USB, I2C ,Ethernet etc. • The software control of these protocols in the Atmega register level way is too complex. • Harware manufacturers release “Drivers” or libraries for controlling their hardware to software developers which allows for more efficient usage of the underlying hardware.
  • 10. Embedded Linux Hardware Kernel Userland • Processor • Kernel • This is • RAM developers where user • GPIO work on level hardware application • Clocks control of programs • UART the devices. are written. • I2C
  • 11. Embedded Linux • In 1990s, an underground software movement consisting of the worlds leading developers and programmers wrote a completely free Operating System! • As more people used it with the FOSS philosophy, improvements, fixes and support for multiple processors creeped in! • This resulted in Linux (the very same kernel ) to run on many processors and provide a similar level of functionality. • A Global collaborative effort for improvements and upgrades make linux so popular with hardware developers • Most of the time, linux gets fixes and support for new hardware as soon as they are available!
  • 12. Application Developers • Embedded developers prefer a non black box OS distribution. • Although Software application are completely abstracted away from the hardware, it is still requirement that slight changes / improvements in the OS code could make the application a lot more efficiently on the developers embedded target. • The HAL (Hardware Abstraction Layer) lets you focus on image recognition and not memory management! • The Open Source Linux Kernel Project provids a HAL that is ported to wide range of processors and has driver support for almost every hardware device in the market.
  • 13. Linux -> Embedded Linux • Linux for x86 and amd64 (desktop architectures) require almost 100 - 500mb. • Embedded Devices have more strict requirements in terms of memory and processing power. • Embedded Linux kernels can go as low of 11Mb when placed in RAM. • A non distribtion based linux – with only kernel and a minimal filesystem for a “dos” – like usage is usually run. • Any custom linux libraries for hardware / software can be installed to help with application development.
  • 14. Starting the Hardware • When the hardware is switched on, the OS is present in some onboard memory peripheral. • First there is code called a bootloader that initializes all the required hardware on the board. • Bootloaders are small programs (4 – 16K) written for and compiled for specific hardware to be executed immediately after start. • The bootloader starts the board and loads the kernel from where-ever it is into RAM. • Once the Kernel starts executing from RAM, it takes over and starts a linux session!
  • 15. Types of Bootloaders • Intel Motherboard : PHOENIX BIOS : • This bootloader is present on most intel based laptops. • It starts the laptop hardware and loads “NTLDR” the windows bootmanager. • This code is hardwired into the mother board. • Embedded Hardware • Bootloader is usually places in a NAND Flash memory. • Bootloaders are very small. • They load, uncompress the linux kernel and relenquish control..
  • 16. Kernel • Designed as a Finnish UG (B.tech eq) student’s hobby project. • First was made as a UNIC port for a motorola 64Kb machine that made Linux designed for Portability. • The groundwork and FOSS nature allowed the kernel to be ported to (and thus support) almost every hardware platform on/off the market. • The base for extending the kernel through “Device Drivers” have hardware manufactures / driver developers to release support for any hardware available. • Kernel is just a runtime HAL! It just has instructions for running the hardware – something has to give it instructions -> RootFS..
  • 18. Filesystem (UserLand) • Filesystem : Collection of directories • These directories follow a tree heirarchy and contain • Executable files or programs that the kernel loads into memory • Libraries for application to link to at run-time • User Application that can be simply installed onto it • Setting files that control the Linux OS’s behaviour. • Hardware devices are also linked as special file nodes in the filesystem to connect them to the Kernel’s HAL. • USB drives / HDDs / SD cards are mounted onto the filesystem and can be browsed as usual.
  • 20. Cross Compilers and Toolchains • Different Hardware – Same Source code? • Cross Compilers are called the translators to machine language for different architectures. • Hardware manufactures and developers develop a toolchain for their architectures. • The toolchain contain all the utilities required to compile, debug code and link for the processor. • There is a GNU toolchain for AVR and ARM architectures. • The same source code when used with different cross compilers allow for targeting different platforms. • The changes in code required for a particular hardware is managed with localised “patches”.
  • 21. Applications • Headless units : Devices without the need for a graphical display • Routers • Set Top Box • GUI based Applications • Touch Smartphones • GPS car navigation multimedia systems. • Application developers have: • System level functionality if required • Shared libraries for efficient management of resources • Linux kernel provided complete HAL • Same code workable of various devices • Android is a Linux Kernel and FS example! • Android will run on any phone that linux can work in. • Phone developers have a unified Free OS to work with. • Cheaper and more wide variety of applications!
  • 22. Drivers • Run time modules attached to the linux kernel to manage hardware peripherals • USB Wifi • Camera • GPS • Unified driver API that makes it easy to write Driver Code that integrated to the main Kernel. • Hardware that is accepted to the main repository (upstream) means that everybody has access to the driver for that hardware! • Linux drivers need not be released as source – which means hardware manufactures can release their driver in binary format. (becomes proprietary)
  • 23. Libraries • C library • Provides an interface to the kenel functions via calls from userland. • Stripped down minimal C libraries are there for use in embedded devices. • GlibC (Full Featured) • uCibC (Minimal Variant) • POSIX support • Allows for communication job sceduling, multiprocessing and IPC in a unified framework. • ALSA • Advanced Linux Sound Architecture for Hardware DSP support
  • 24. Custom Applications • Compiled with appropriate cross-compiler as UNIX / POSIX Compliant applications • BusyBox • Provides an embedded shell functionality in embedded devices • cd ls mkdir echo cat and all standard linux commands all work • I/O can be managed over a serial line • Can be thought of as a terminal equivalent • Commands allow for direct control of the kernel • Helps navigate the filesystem • Qt GUI applications can also be built if LCD is present.
  • 25. Run Time Linux • Serial Console • Apps that can be autostarted • Daemons or “services” that provide background application functionality • Kernel Threads for Real-Time interrupt management • RTOS supprt in RT-Linux Project.
  • 26. Memory Considerations • Linux works primarily on processors with a hardware MMU. (memory management unit) • MMU enforces copy and access violation protection in RAM between kernel, hardware and user application to make sure system can be kept stable at all times. • Virtual Memory allows for run-time linking and delinking of un responsive kernel modules / application to keep the system functioning even in the event of a crash.
  • 27. Try for yourself • devmem2 • Memory inspector • ps • Running processors • cat files in /proc • Gives you current system information
  • 28. Open source Licenses • Basic funda • Us at your own Risk • No guarantee • We’ll help if we CAN. We don’t need to. • GPLv2 • GNU Public Licence • Source must accompany binary • Linkng to non GPL software not possible. • LGPL • Link to non GPL software possible • To provide for non open source driver development • LGPL source must be provided • Modified Free-BSD • No source delivery required • For proprietary kernels • Broken and non FOSS supported Forks