SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
Team Emertxe
Toolchain
Toolchain
Contents
Toolchain
Contents
● Introduction
● Components
● Building
Toolchain
Introduction
Toolchain
Introduction
● Set of applications used to perform a complex task or to
create a product, which is typically another computer program
or a system of programs.
● Tools are linked (or chained) together by specific stages
● Output or resulting environment state of each tool becomes
the input or starting environment for the next one
● By default the host contains some development tools which
ate called as native toolchain
Toolchain
Introduction
● When you use these tool the code generation would be
for native architecture (say x86)
● In case of developing embedded systems these toolchains
does not serve the purpose
● The targets some times might have the following
restrictions too!
– Less memory footprints
– Slow compared to host
– You may not wish to have in a developed system finally
● So cross compiling toolchain are used
Toolchain
Introduction - Flow
Native
Tools
Cross Compiling
Tools
Toolchain
Components
Toolchain
Components
Compiler
Binary Utilities
C / C++ Libraries
Kernel Headers
Debuggers
Toolchain
Components – GCC
● Abbreviated as GNU Compiler Collection, one of the
famous free software compiler
● Can compile many programming languages and generate
code for many different types of architecture
Toolchain
Components – Binary Utilities
● Set of programming tools for creating and managing
binary programs, object files, libraries, profile data, and
assembly source code
● Includes an assembler, linker and several other software
tools
● Often used with a compiler and libraries to design
programs for Linux
● GNU Binary Utilities are called binutils
Toolchain
Components – binutils
● as - the assembler, that generates binary code from
assembler source code
● ld - the linker
● ar, ranlib - to generate .a archives, used for libraries
● objdump, readelf, size, nm, strings - to inspect binaries.
Very useful analysis tools !
● strip - to strip useless parts of binaries in order to reduce
their size
Toolchain
Components - Libraries
● The C library is an essential
component which provides
interface between the
applications and the kernel
● Provides macros, type
definitions, and functions for
tasks like string handling,
mathematical computations,
input/output processing,
memory allocation and
several other operating
system services
Toolchain
Components - Libraries
● Several C libraries are available: glibc, uClibc, dietlibc,
etc
● The selection of the library has to be made while
generation the toolchain as gcc is compiled against the
selected library
● Some common used libraries
– glibc
– uclibc
Toolchain
Components – Libraries - glibc
● C library from the GNU project
● Good performance optimization, standards compliance
and portability
● Well maintained and used on all GNU / Linux host systems
● Require large memory footprint making it not suitable for
small embedded systems
● Used in systems that run many different kernels and
different hardware architectures
● License: LGPL
● Website: http://www.gnu.org/software/libc/
Toolchain
Components – Libraries - uclibc
●
Smaller than the GNU C Library, but nearly all applications
supported by glibc also work perfectly with uClibc
●
Recommended for lower footprint embedded systems
●
Excellent configuration options at the cost of ABI
differences for different configurations
●
Features can be enabled or disabled according to space
requirements
●
Works on most embedded architectures with embedded
Linux
●
Focus on size rather than performance with less compile
time
Toolchain
Components – Libraries - uclibc
Toolchain
Components – Libraries - uclibc
● Created for support uclinux, a Linux for MMU less system
● Actively maintained, large developer and user base
● Used on a large number of production embedded
products, including consumer electronic devices
Toolchain
Components – Kernel Headers
● The compiled applications and
the libraries sometimes need to
interact with the kernel
● So the Linux kernel need to
expose the available interfaces
for the libraries and applications
to use, like
– System calls and its numbers
– MACRO definitions
– Data structures, etc.
Toolchain
Components – Kernel Headers
● Therefore, compiling the C library requires kernel
headers, and many applications also require them.
● You may find these in <linux/...> and <asm/...> and a
few other directories corresponding to the ones visible in
include/ in the kernel sources
● Compatibility with running kernel has to be considered
Toolchain
Building
Toolchain
Building
● Toolchain building is one of the time consuming process
● A very clear picture of the system architecture is
sometimes required
● We might have to identify three systems in this case, like
– Build System – which is used to create the toolchain
– Host – which will be used to execute the created toolchain
– Target – which will execute the binaries created by the
toolchain
● So by considering the above points some possible build
options are provided in next slide
Toolchain
Building
● Possible Build System
● Build Considerations
● Toolchain Build Possibilities
– Prebuilt
– Home Built
– Automated Tools
● Crosstool NG
● Buildroot
Toolchain
Building – Build Systems
Native Build Cross Build
Canadian BuildCross Native Build
Toolchain
Building - Considerations
● Before building the toolchain following decisions have to
be made
– Which library to be used?
– What version of the components to selected?
– Certain important configurations like
● Architecture features like floating point
● ABI selections
● Networking features etc.,
● So you might have to put good amount of time in
investigations
Toolchain
Building – Pre-built
● Get a pre-built open toolchain either from a web or from your
hardware vendor
● This is the easiest solution, as the toolchain is already built,
and has supposedly been tested by the vendor
● The drawback is that you don't have flexibility on your
toolchain features (which C library? hard-float or soft-float?
which ABI?)
Toolchain
Building – Home Built
●
Building toolchain from scratch is one of the tiring and time
consuming task which might go upto several weeks.
●
Several information to be know. Lots of components to be
considered to build.
●
Proper decision on the components and its configuration
have to be made
●
Need kernel headers and C library sources
●
There are version dependency issues, patches required to
make something work etc.
●
The order of build is to be known, but have complete
freedom of choice
Toolchain
Building – Home Built
● Can get some idea from the crosstool matrix by Kegel (Note
this is outdated)
Toolchain
Building – Automated Tools
● Lots of open community has built several scripts or more
elaborate systems to ease the process of building a
toolchain
● More easy procedure since no need of breaking your
heads on dependency resolutions
● Provides easy configuration mechanism
● Recipes and patches needed to build a toolchain made of
particular versions of the various components are shared
and easily available
● Some common automated tools are discussed in following
slides
Toolchain
Building – Automated Tools – Crosstool-NG
● Updated version of Crosstool, with a kernel-like
menuconfig like configuration system
● Supports uClibc, glibc, eglibc, hard and soft float, many
architectures
● Support different target OS: Linux, bare metal
● Debug facilities like native and cross gdb, gdb server
● Actively maintained
● Targeted at building toolchains
● http://crosstool-ng.org/
Toolchain
Building – Automated Tools – Buildroot
● Buildroot is a set of Makefiles and patches that makes it
easy to generate a complete embedded Linux system
● Generates root file system images ready to be used
● Complete build system based on the Linux Kernel
configuration system and supports a wide range of target
architectures
● It automates the building process of your embedded
system and eases the cross-compilation process
● Supports multiple filesystem types for the root
filesystem image
Toolchain
Building – Automated Tools – Buildroot
● Can generate an (e)glibc or uClibc cross-compilation
toolchain, or re-use your existing glibc, eglibc or uClibc
cross-compilation toolchain
● Supports several hundreds of packages for userspace
applications and libraries
● http://buildroot.uclibc.org
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

linux device driver
linux device driverlinux device driver
linux device driver
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Linux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platformLinux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platform
 
U boot-boot-flow
U boot-boot-flowU boot-boot-flow
U boot-boot-flow
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
 
Linux-Internals-and-Networking
Linux-Internals-and-NetworkingLinux-Internals-and-Networking
Linux-Internals-and-Networking
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
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
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 
Kernel module programming
Kernel module programmingKernel module programming
Kernel module programming
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)
 
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
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKB
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loader
 

Andere mochten auch

Embedded system design process
Embedded system design processEmbedded system design process
Embedded system design process
Rayees CK
 
Embedded System Tools ppt
Embedded System Tools  pptEmbedded System Tools  ppt
Embedded System Tools ppt
Halai Hansika
 
Fosdem 2010 - An Introduction to Enna Media Center
Fosdem 2010 - An Introduction to Enna Media CenterFosdem 2010 - An Introduction to Enna Media Center
Fosdem 2010 - An Introduction to Enna Media Center
Benjamin Zores
 

Andere mochten auch (20)

File systems for Embedded Linux
File systems for Embedded LinuxFile systems for Embedded Linux
File systems for Embedded Linux
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
 
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)
 
Interview preparation workshop
Interview preparation workshopInterview preparation workshop
Interview preparation workshop
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
 
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
 
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 : Linux training portfolio
Emertxe : Linux training portfolioEmertxe : Linux training portfolio
Emertxe : Linux training portfolio
 
Resume Preparation - Workshop
Resume Preparation - WorkshopResume Preparation - Workshop
Resume Preparation - Workshop
 
Emertxe : Training portfolio
Emertxe : Training portfolioEmertxe : Training portfolio
Emertxe : Training portfolio
 
Introduction to Embedded Systems
Introduction to Embedded Systems Introduction to Embedded Systems
Introduction to Embedded Systems
 
Embedded C
Embedded CEmbedded C
Embedded C
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Emertxe Certified Embedded Professional (ECEP): Assessment system
Emertxe Certified Embedded Professional (ECEP): Assessment systemEmertxe Certified Embedded Professional (ECEP): Assessment system
Emertxe Certified Embedded Professional (ECEP): Assessment system
 
Embedded system design process
Embedded system design processEmbedded system design process
Embedded system design process
 
Embedded System Tools ppt
Embedded System Tools  pptEmbedded System Tools  ppt
Embedded System Tools ppt
 
Fosdem 2010 - An Introduction to Enna Media Center
Fosdem 2010 - An Introduction to Enna Media CenterFosdem 2010 - An Introduction to Enna Media Center
Fosdem 2010 - An Introduction to Enna Media Center
 

Ähnlich wie Embedded Linux - Building toolchain

EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...
EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...
EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...
melbats
 
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
lematadese670
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the Autotools
Scott Garman
 

Ähnlich wie Embedded Linux - Building toolchain (20)

EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...
EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...
EclipseCon Eu 2012 - Buildroot Eclipse Bundle : A powerful IDE for Embedded L...
 
JOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in ProductionJOSA TechTalks - Docker in Production
JOSA TechTalks - Docker in Production
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
 
Intro to linux
Intro to linux Intro to linux
Intro to linux
 
Module 4 Embedded Linux
Module 4 Embedded LinuxModule 4 Embedded Linux
Module 4 Embedded Linux
 
Embedded platform choices
Embedded platform choicesEmbedded platform choices
Embedded platform choices
 
Guided overview of software frameworks qt framework
Guided overview of software frameworks   qt frameworkGuided overview of software frameworks   qt framework
Guided overview of software frameworks qt framework
 
Top 10 dev ops tools (1)
Top 10 dev ops tools (1)Top 10 dev ops tools (1)
Top 10 dev ops tools (1)
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the Autotools
 
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/SourceCrafting GNU/Linux distributions for Embedded target from Scratch/Source
Crafting GNU/Linux distributions for Embedded target from Scratch/Source
 
Embedded Linux primer
Embedded Linux primerEmbedded Linux primer
Embedded Linux primer
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
embedded-linux-120203.pdf
embedded-linux-120203.pdfembedded-linux-120203.pdf
embedded-linux-120203.pdf
 
MariaDB Enterprise Tools introduction
MariaDB Enterprise Tools introductionMariaDB Enterprise Tools introduction
MariaDB Enterprise Tools introduction
 
Bba i-introduction to computer-u-2- application and system software
Bba  i-introduction to computer-u-2- application and system softwareBba  i-introduction to computer-u-2- application and system software
Bba i-introduction to computer-u-2- application and system software
 
LCE13: Test and Validation Summit: The future of testing at Linaro
LCE13: Test and Validation Summit: The future of testing at LinaroLCE13: Test and Validation Summit: The future of testing at Linaro
LCE13: Test and Validation Summit: The future of testing at Linaro
 
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
LCE13: Test and Validation Mini-Summit: Review Current Linaro Engineering Pro...
 
Bca i-fundamental of computer-u-2- application and system software
Bca  i-fundamental of  computer-u-2- application and system softwareBca  i-fundamental of  computer-u-2- application and system software
Bca i-fundamental of computer-u-2- application and system software
 

Mehr von Emertxe Information Technologies Pvt Ltd

Mehr von Emertxe Information Technologies Pvt Ltd (20)

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

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Embedded Linux - Building toolchain

  • 5. Toolchain Introduction ● Set of applications used to perform a complex task or to create a product, which is typically another computer program or a system of programs. ● Tools are linked (or chained) together by specific stages ● Output or resulting environment state of each tool becomes the input or starting environment for the next one ● By default the host contains some development tools which ate called as native toolchain
  • 6. Toolchain Introduction ● When you use these tool the code generation would be for native architecture (say x86) ● In case of developing embedded systems these toolchains does not serve the purpose ● The targets some times might have the following restrictions too! – Less memory footprints – Slow compared to host – You may not wish to have in a developed system finally ● So cross compiling toolchain are used
  • 9. Toolchain Components Compiler Binary Utilities C / C++ Libraries Kernel Headers Debuggers
  • 10. Toolchain Components – GCC ● Abbreviated as GNU Compiler Collection, one of the famous free software compiler ● Can compile many programming languages and generate code for many different types of architecture
  • 11. Toolchain Components – Binary Utilities ● Set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code ● Includes an assembler, linker and several other software tools ● Often used with a compiler and libraries to design programs for Linux ● GNU Binary Utilities are called binutils
  • 12. Toolchain Components – binutils ● as - the assembler, that generates binary code from assembler source code ● ld - the linker ● ar, ranlib - to generate .a archives, used for libraries ● objdump, readelf, size, nm, strings - to inspect binaries. Very useful analysis tools ! ● strip - to strip useless parts of binaries in order to reduce their size
  • 13. Toolchain Components - Libraries ● The C library is an essential component which provides interface between the applications and the kernel ● Provides macros, type definitions, and functions for tasks like string handling, mathematical computations, input/output processing, memory allocation and several other operating system services
  • 14. Toolchain Components - Libraries ● Several C libraries are available: glibc, uClibc, dietlibc, etc ● The selection of the library has to be made while generation the toolchain as gcc is compiled against the selected library ● Some common used libraries – glibc – uclibc
  • 15. Toolchain Components – Libraries - glibc ● C library from the GNU project ● Good performance optimization, standards compliance and portability ● Well maintained and used on all GNU / Linux host systems ● Require large memory footprint making it not suitable for small embedded systems ● Used in systems that run many different kernels and different hardware architectures ● License: LGPL ● Website: http://www.gnu.org/software/libc/
  • 16. Toolchain Components – Libraries - uclibc ● Smaller than the GNU C Library, but nearly all applications supported by glibc also work perfectly with uClibc ● Recommended for lower footprint embedded systems ● Excellent configuration options at the cost of ABI differences for different configurations ● Features can be enabled or disabled according to space requirements ● Works on most embedded architectures with embedded Linux ● Focus on size rather than performance with less compile time
  • 18. Toolchain Components – Libraries - uclibc ● Created for support uclinux, a Linux for MMU less system ● Actively maintained, large developer and user base ● Used on a large number of production embedded products, including consumer electronic devices
  • 19. Toolchain Components – Kernel Headers ● The compiled applications and the libraries sometimes need to interact with the kernel ● So the Linux kernel need to expose the available interfaces for the libraries and applications to use, like – System calls and its numbers – MACRO definitions – Data structures, etc.
  • 20. Toolchain Components – Kernel Headers ● Therefore, compiling the C library requires kernel headers, and many applications also require them. ● You may find these in <linux/...> and <asm/...> and a few other directories corresponding to the ones visible in include/ in the kernel sources ● Compatibility with running kernel has to be considered
  • 22. Toolchain Building ● Toolchain building is one of the time consuming process ● A very clear picture of the system architecture is sometimes required ● We might have to identify three systems in this case, like – Build System – which is used to create the toolchain – Host – which will be used to execute the created toolchain – Target – which will execute the binaries created by the toolchain ● So by considering the above points some possible build options are provided in next slide
  • 23. Toolchain Building ● Possible Build System ● Build Considerations ● Toolchain Build Possibilities – Prebuilt – Home Built – Automated Tools ● Crosstool NG ● Buildroot
  • 24. Toolchain Building – Build Systems Native Build Cross Build Canadian BuildCross Native Build
  • 25. Toolchain Building - Considerations ● Before building the toolchain following decisions have to be made – Which library to be used? – What version of the components to selected? – Certain important configurations like ● Architecture features like floating point ● ABI selections ● Networking features etc., ● So you might have to put good amount of time in investigations
  • 26. Toolchain Building – Pre-built ● Get a pre-built open toolchain either from a web or from your hardware vendor ● This is the easiest solution, as the toolchain is already built, and has supposedly been tested by the vendor ● The drawback is that you don't have flexibility on your toolchain features (which C library? hard-float or soft-float? which ABI?)
  • 27. Toolchain Building – Home Built ● Building toolchain from scratch is one of the tiring and time consuming task which might go upto several weeks. ● Several information to be know. Lots of components to be considered to build. ● Proper decision on the components and its configuration have to be made ● Need kernel headers and C library sources ● There are version dependency issues, patches required to make something work etc. ● The order of build is to be known, but have complete freedom of choice
  • 28. Toolchain Building – Home Built ● Can get some idea from the crosstool matrix by Kegel (Note this is outdated)
  • 29. Toolchain Building – Automated Tools ● Lots of open community has built several scripts or more elaborate systems to ease the process of building a toolchain ● More easy procedure since no need of breaking your heads on dependency resolutions ● Provides easy configuration mechanism ● Recipes and patches needed to build a toolchain made of particular versions of the various components are shared and easily available ● Some common automated tools are discussed in following slides
  • 30. Toolchain Building – Automated Tools – Crosstool-NG ● Updated version of Crosstool, with a kernel-like menuconfig like configuration system ● Supports uClibc, glibc, eglibc, hard and soft float, many architectures ● Support different target OS: Linux, bare metal ● Debug facilities like native and cross gdb, gdb server ● Actively maintained ● Targeted at building toolchains ● http://crosstool-ng.org/
  • 31. Toolchain Building – Automated Tools – Buildroot ● Buildroot is a set of Makefiles and patches that makes it easy to generate a complete embedded Linux system ● Generates root file system images ready to be used ● Complete build system based on the Linux Kernel configuration system and supports a wide range of target architectures ● It automates the building process of your embedded system and eases the cross-compilation process ● Supports multiple filesystem types for the root filesystem image
  • 32. Toolchain Building – Automated Tools – Buildroot ● Can generate an (e)glibc or uClibc cross-compilation toolchain, or re-use your existing glibc, eglibc or uClibc cross-compilation toolchain ● Supports several hundreds of packages for userspace applications and libraries ● http://buildroot.uclibc.org