SlideShare a Scribd company logo
1 of 37
Download to read offline
Building Embedded Linux
System on Samsung 2410
        Platform




                          1
Agenda
Basic Concepts
Kernel Considerations
Root Filesystem Content
Device Driver
Application and GUI




                          2
Basic
Concepts



           3
Cross-Development
Environment
  Target has limited resource (memory, storage,
  low speed processor) .
  Host and Target are different architecture


                               Target
       Host
                             •Bootloader
    Cross-platform
                             •Kernel
    Development
                             •Root Filesystem
     Environment


                                                  4
Hardware Connection




                      5
ARM Cross-Development
Toolkit
                                              ASM Source
   C Source         C Libraries


       C Compiler                             Assembler
                                   .aof
                                               Object
         Linker                               Libraries

                            .aif    debug


 System model
                                   ARMsd

                                            Development
       ARMulator
                                               board

                                                           6
Development Environment
GUN development toolchains
 A compiler that runs on one computer but produces
 object code for a different type of computer.
 Cross compilers are used to generate software that
 can run on computers with a new architecture or on
 special-purpose devices that cannot host their own
 compilers.
 Cross-compiler for ARM
   gcc : arm-linux-gcc
   g++ : arm-linux-g++
   ar : arm-linux-ar
   strip : arm-linux-strip
                                                      7
Create Target Linux System
A target Linux system is created by configuring and
bundling together the appropriate system components.
Programming and development aspects are a separate
subject

There are four main steps to creating a target Linux
system:
  Determine system components
  Configure and build the kernel
  Build root filesystem
  Set up boot software and configuration

                                                       8
System Boot Flow
       Bootloader
                     Extract and decompress the
                    Kernel Image and RAMDISK


                           Launch kernel


          Kernel

                       Initialize Memory and
                              Hardware



                      Mount Root Filesystem
                         (RAMDISK)




                           Run /sbin/init




                          User Programs



                                                  9
All the things we need
 Cross-Platform development toolchain
 Bootloader
   Provide by vendor
 Linux kernel
   Linux kernel + some patches if needed
 Filesystem
   Busybox
   Device node
   Configuration
                                           10
Build the GNU Cross-Platform
Development Toolchain
 We can download the cross-platform (toolchains)
 from ftp://ftp.arm.linux.org.uk/pub/
 The toolchain do not need recompile, just
 decompress it and set the system path.
 GNU Toolchain’s Component
   Binutils
     including AS, LD and other binary file tools
   GCC
     the well known C,C++ complier supported variable platform
   GLIBC
     the C runtime library
   GDB
     the command line source debugger, including remote       11
     debugging
Bootloader




             12
ARM Linux Kernel
 ARM Linux is a port of the successful Linux
 Operating System to ARM processor based
 machines mainly by Russell King with contributions
 from others.
 The patch change log can be found at
 http://www.arm.linux.org.uk/developer/release-
 2.4.0.shtml
 The Linux Kernel and most of the programs that
 make up the Linux system are quot;open sourcequot;, using
 the GNU tools provided by the Free Software
 Foundation. ARM Linux is being ported, or has been
 ported to more than 100 different machine variations,
 including complete computers, network computers    13


 and evaluation boards. There are also projects for
Filesystem - initrd
 initrd provides the capability to load a RAM disk by
 the boot loader.
 This RAM disk can then be mounted as the root file
 system and programs can be run from it.
 Afterwards, a new root file system can be mounted
 from a different device. The previous root (from
 initrd) is then moved to a directory and can be
 subsequently unmounted.
 initrd is mainly designed to allow system startup to
 occur in two phases, where the kernel comes up
 with a minimum set of compiled-in drivers, and         14

 where additional modules are loaded from initrd.
Filesystem - BusyBox
 Combine tiny versions of many common
 UNIX into a single small executable.
 Provide a fairly complete environment for any
 small or embedded system.
 BusyBox has been written with size-
 optimization and limited resources in mind. It
 is also extremely modular so you can easily
 include or exclude commands (or features) at
 compile time. This makes it easy to
 customize your embedded systems              15
Kernel
Considerations



                 16
Make Linux Kernel
 Download Linux kernelOptions: from
               Additional source
 http://www.kernel.org/ CROSS_COMPILE=arm-linux-
               ARCH=arm

  make clean
  make menuconfig
 Building Kernel CROSS_COMPILE=arm-linux dep
  make ARCH=arm
   make clean
  make ARCH=arm CROSS_COMPILE=arm-linux zImage
   make menuconfig
  make ARCH=arm CROSS_COMPILE=arm-linux modules
  make ARCH=arm CROSS_COMPILE=arm-linux
   make dep (this step is no needed in version 2.6)
  modules_install
   make bzImage
  make ARCH=arm CROSS_COMPILE=arm-linux install
   make modules
   make modules_install
   make install
                                                      17
Make Linux Kernel
 After make bzImage, the kernel image will be
 at ./path/to/linux_src/arch/i386/boot/bzImage

 The quot;bzImagequot; name stands for quot;big zImage,quot; and
 has nothing to do with the bzip2 compression utility.
 In fact, both the bzImage and zImage Makefile
 targets rely on the gzip algorithm.
 The difference between the two Makefile targets is
 that the compressed kernel images generated using
 zImage cannot be larger than 512 KB, while those
 generated using bzImage are not bound by this limit.18
Root Filesystem
   Content



                  19
Building Root Filesystem
 Download the BusyBox source code from
 http://www.busybox.net/

 Building BusyBox
   make clean
   make all
   make install


 After make complete, the busybox will be
 at ./path/to/busybox_src/_install/
                                            20
Building Root Filesystem
 The BusyBox has all needed utilities, such as, ls, kill,
 chroot, mount, …,etc.

 Building the Root Filesystem
   Create a directory ~/root-fs
   Copy all files in busybox/_install to ~/root-fs/
   Create some standard directory, such as, /dev, /etc /proc
   /mnt /tmp /var
   Make some device node
   Write some boot shell scripts
   Make directory ~/root-fs to a initrd image
                                                               21
Create Device Nodes
  cd ~/root-fs/dev/
  mknod tty c 5 0
  mknod console c 5 1
  mknod tty0 c 4 0
  mknod ttyS0 c 4 64
  mknod ttyS0 c 4 64
  mknod ram0 b 1 0
  mknod null c 1 3


                        22
Write Shell Script
 /etc/inittab
 ::sysinit:/etc/rc.S
 ::askfirst:/bin/sh


 /etc/rc.S
 #!/bin/sh
 mount -t proc proc /proc


                            23
Make INITRD image
  dd if=/dev/zero of=/home/initrd.img bs=1k count=8192
  su root
  mke2fs -F -v -m0 /home/initrd.img
  mkdir tmp
  mount -o loop initrd.img tmp/
  cp ~/root-fs/* /home/tmp/ -dpRrf
  umount tmp/
  gzip -9 < initrd.img > initrd.bin


        file
   8MB              mount

    is null
                                                         Write DATA
                                  ~/root-fs

        file
   8MB              unmount

  with data
                                                                 24
Customize Application and
Configuration
 In order to meet the system requirement, we
 must write some applications base on some
 drivers.

 Maybe we’ll setting up the Ethernet or
 Wireless network or build up some Internet
 Protocol.

 Customize the GUI or MMI
                                               25
Device
Driver



         26
Major and Minor Numbers
Special files under /dev “c” for char & “b” for block
Major number identifies driver use at open time
Minor number is used only by driver to control several
devices
crw-rw-rw- 1 root     root      1, 3 Feb 23 1999     null
crw------- 1 root     root      10, 1 Feb 23 1999    psaux
crw------- 1 rubini   tty       4, 1 Aug 16 22:22    tty1
crw-rw-rw- 1 root     dialout   4, 64 Jun 30 11:19   ttyS0
crw-rw-rw- 1 root     dialout   4, 65 Aug 16 00:00   ttyS1
crw------- 1 root     sys       7, 1 Feb 23 1999     vcs1
crw------- 1 root     sys       7, 129 Feb 23 1999   vcsa1
crw-rw-rw- 1 root     root      1, 5 Feb 23 1999     zero


                                                             27
Major Number
 Adding a new driver at module initialization
    int register_chrdev(unsigned int major, const char *name,
                       struct file_operations *fops);
 fops point to a global structure which kernel finds
 To create device node : mknod /dev/scull0 c 254 0
 If major is 0, the register_chrdev return a free
 number
 For dynamic allocation, script to extract
 /proc/devices device number, then invoke mknod to
 create device file
 int unregister_chrdev(unsigned int major, const char *name);   28
Register a Character Device Driver
                                    Kernel
        Major 0      …       Major 98   Major 99        …      Major 255



                                                            Driver 2
                                        2
(1)Insmod module, Driver                                    Major 99
register a Major number to      1
Kernel

                                             Driver 1
(2)Kernel know the Major
num,                                         Major 98
Kernel will link the major
num to The Driver Module

                                                                           29
Major and Minor
                                Kernel
       Major 0     …      Major 98   Major 99    …      Major 255



2                                                      Driver 2
        Device A
                                        3              Major 99
        Major 98
         Minor 1       (1) Open、Read、
                       Write
                                                     Driver 1
                       (2) Pass Major&Minor
            1                                        Major 98
                          to Kernel
                       (3) Kernel Passes Minor
      User Program
                          to Driver

                                                                    30
Application and
 Graphic User
   Interface


                  31
Console Application
 Write C/C++ programs and compile it as
 static link or dynamic link executable files.
   Static
     Copy the executable file to Root Filesystem
     Execute it.
   Dynamic
     Copy the executable file and needed libraries to Root
     Filesystem
     Set the library path by using “export LD_LIBRARY”
     Execute it
                                                             32
Graphic User Interface
 Window System
  X Window (TinyX)
    http://www.xfree86.org/
  QPE (Qt Plamtop Environment) / Qtopia
    http://www.trolltech.com/products/qtopia/index.html
  GPE (GPE Palmtop Environment)
    http://gpe.handhelds.org/
  Microwindows
    http://microwindows.org/
  MiniGUI
    http://www.minigui.org/
                                                          33
Programming
   with QT



              34
Building the QT/Embedded
Environment
 Step1:
   # tar zxvf qt-embedded-3.3.1.tar.gz


 Step2:
   # export QTDIR=home/qt-embedded-3.3.1
   # export LD_LIBRARY_PATH=home/qt-embedded-
   3.3.1/lib:$LD_LIBRARY_PATH
   # cp /usr/bin/uic /qt-embedded-3.3.1/bin
   # cd qt-embedded-3.3.1
   # ./configure -embedded arm -shared –debug
   # gmake                                      35
Building the QT/Embedded
Environment




                           36
Programming QT
Applications
 / **Import** check your environment variables
         QTDIR=/qt-embedded-3.3.1
         LD_LIBRARY_PATH=/qt-embedded-3.3.1/lib:LD_LIBRARY_PATH */


 [command#]cd ~/test           /* go to your project directory */
 [command#test]qmake –o Makefile test.pro
 [command#test]make



 1. [root@locahost ]# mkdir busybox/qt-embedded-3.3.1/lib/fonts
 2. [root@locahost ]# cp /qt-embedded/lib/fonts/*
                       /home/busybox/qt-embedded-3.3.1/lib/fonts/




                                                                     37

More Related Content

What's hot

Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot) Omkar Rane
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBshimosawa
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_BootingRashila Rr
 
Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Device Tree for Dummies (ELC 2014)
Device Tree for Dummies (ELC 2014)Thomas Petazzoni
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom BoardPatrick Bellasi
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniquesSatpal Parmar
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image艾鍗科技
 
Linux-without-a-bootloader
Linux-without-a-bootloaderLinux-without-a-bootloader
Linux-without-a-bootloaderNishanth Menon
 
Linux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emptionLinux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emptionHemanth Venkatesh
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and CompilationBud Siddhisena
 
Linux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLinux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLubomir Rintel
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loaderiamumr
 
Kernel init
Kernel initKernel init
Kernel initgowell
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKBshimosawa
 

What's hot (20)

Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
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 Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom Board
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniques
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Linux Kernel Image
Linux Kernel ImageLinux Kernel Image
Linux Kernel Image
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Linux-without-a-bootloader
Linux-without-a-bootloaderLinux-without-a-bootloader
Linux-without-a-bootloader
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 
Linux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emptionLinux Device Driver parallelism using SMP and Kernel Pre-emption
Linux Device Driver parallelism using SMP and Kernel Pre-emption
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Kernel Configuration and Compilation
Kernel Configuration and CompilationKernel Configuration and Compilation
Kernel Configuration and Compilation
 
Linux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshopLinux Kernel Debugging Essentials workshop
Linux Kernel Debugging Essentials workshop
 
Basics of boot-loader
Basics of boot-loaderBasics of boot-loader
Basics of boot-loader
 
Kernel init
Kernel initKernel init
Kernel init
 
Linux Kernel Module - For NLKB
Linux Kernel Module - For NLKBLinux Kernel Module - For NLKB
Linux Kernel Module - For NLKB
 

Viewers also liked

Embedded Linux Talk Uni Forum
Embedded Linux Talk Uni ForumEmbedded Linux Talk Uni Forum
Embedded Linux Talk Uni ForumSumant Diwakar
 
Introduction to Embedded Linux
Introduction to Embedded LinuxIntroduction to Embedded Linux
Introduction to Embedded LinuxHossain Reja
 
Embedded linux system development (slides)
Embedded linux system development (slides)Embedded linux system development (slides)
Embedded linux system development (slides)Jaime Barragan
 
Module 4 Embedded Linux
Module 4 Embedded LinuxModule 4 Embedded Linux
Module 4 Embedded LinuxTushar B Kute
 
Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]Ionela
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systemsVandana Salve
 
Embedded Linux Basics
Embedded Linux BasicsEmbedded Linux Basics
Embedded Linux BasicsMarc Leeman
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoSherif Mousa
 
Building Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 ArchBuilding Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 ArchSherif Mousa
 
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 ARMSherif Mousa
 

Viewers also liked (15)

Paper5
Paper5Paper5
Paper5
 
Embedded Linux Talk Uni Forum
Embedded Linux Talk Uni ForumEmbedded Linux Talk Uni Forum
Embedded Linux Talk Uni Forum
 
Linux Mint
Linux MintLinux Mint
Linux Mint
 
Introduction to Embedded Linux
Introduction to Embedded LinuxIntroduction to Embedded Linux
Introduction to Embedded Linux
 
Embedded linux system development (slides)
Embedded linux system development (slides)Embedded linux system development (slides)
Embedded linux system development (slides)
 
Module 4 Embedded Linux
Module 4 Embedded LinuxModule 4 Embedded Linux
Module 4 Embedded Linux
 
Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]Embedded Os [Linux & Co.]
Embedded Os [Linux & Co.]
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
 
Embedded Linux Basics
Embedded Linux BasicsEmbedded Linux Basics
Embedded Linux Basics
 
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
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Building Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 ArchBuilding Mini Embedded Linux System for X86 Arch
Building Mini Embedded Linux System for X86 Arch
 
Advancement on embedded linux-v2
Advancement on embedded linux-v2Advancement on embedded linux-v2
Advancement on embedded linux-v2
 
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
 

Similar to Building

Embedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformEmbedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformSZ Lin
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel DevelopmentPriyank Kapadia
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modulesdibyajyotig
 
Steps to Build Kernel and Root Filesystem for OMAP5912
Steps to Build Kernel and Root Filesystem for OMAP5912Steps to Build Kernel and Root Filesystem for OMAP5912
Steps to Build Kernel and Root Filesystem for OMAP5912sbmguys
 
Dru lavigne servers-tutorial
Dru lavigne servers-tutorialDru lavigne servers-tutorial
Dru lavigne servers-tutorialDru Lavigne
 
Introduction to Operating Systems.pptx
Introduction to Operating Systems.pptxIntroduction to Operating Systems.pptx
Introduction to Operating Systems.pptxMohamedSaied877003
 
Cross-compilation native sous android
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous androidThierry Gayet
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System AdministrationSreenatha Reddy K R
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...Toradex
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: IntroductionJollen Chen
 
Using open source software to build an industrial grade embedded linux platfo...
Using open source software to build an industrial grade embedded linux platfo...Using open source software to build an industrial grade embedded linux platfo...
Using open source software to build an industrial grade embedded linux platfo...SZ Lin
 

Similar to Building (20)

Embedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformEmbedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 Platform
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
 
Portin g
Portin gPortin g
Portin g
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 
Beagleboard xm-setup
Beagleboard xm-setupBeagleboard xm-setup
Beagleboard xm-setup
 
Steps to Build Kernel and Root Filesystem for OMAP5912
Steps to Build Kernel and Root Filesystem for OMAP5912Steps to Build Kernel and Root Filesystem for OMAP5912
Steps to Build Kernel and Root Filesystem for OMAP5912
 
OMAP
OMAPOMAP
OMAP
 
Dru lavigne servers-tutorial
Dru lavigne servers-tutorialDru lavigne servers-tutorial
Dru lavigne servers-tutorial
 
Introduction to Operating Systems.pptx
Introduction to Operating Systems.pptxIntroduction to Operating Systems.pptx
Introduction to Operating Systems.pptx
 
Cross-compilation native sous android
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous android
 
Linux booting process - Linux System Administration
Linux booting process - Linux System AdministrationLinux booting process - Linux System Administration
Linux booting process - Linux System Administration
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Rhce ppt
Rhce pptRhce ppt
Rhce ppt
 
Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: Introduction
 
Rac on NFS
Rac on NFSRac on NFS
Rac on NFS
 
Using open source software to build an industrial grade embedded linux platfo...
Using open source software to build an industrial grade embedded linux platfo...Using open source software to build an industrial grade embedded linux platfo...
Using open source software to build an industrial grade embedded linux platfo...
 
Nim
NimNim
Nim
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 

Building

  • 1. Building Embedded Linux System on Samsung 2410 Platform 1
  • 2. Agenda Basic Concepts Kernel Considerations Root Filesystem Content Device Driver Application and GUI 2
  • 4. Cross-Development Environment Target has limited resource (memory, storage, low speed processor) . Host and Target are different architecture Target Host •Bootloader Cross-platform •Kernel Development •Root Filesystem Environment 4
  • 6. ARM Cross-Development Toolkit ASM Source C Source C Libraries C Compiler Assembler .aof Object Linker Libraries .aif debug System model ARMsd Development ARMulator board 6
  • 7. Development Environment GUN development toolchains A compiler that runs on one computer but produces object code for a different type of computer. Cross compilers are used to generate software that can run on computers with a new architecture or on special-purpose devices that cannot host their own compilers. Cross-compiler for ARM gcc : arm-linux-gcc g++ : arm-linux-g++ ar : arm-linux-ar strip : arm-linux-strip 7
  • 8. Create Target Linux System A target Linux system is created by configuring and bundling together the appropriate system components. Programming and development aspects are a separate subject There are four main steps to creating a target Linux system: Determine system components Configure and build the kernel Build root filesystem Set up boot software and configuration 8
  • 9. System Boot Flow Bootloader Extract and decompress the Kernel Image and RAMDISK Launch kernel Kernel Initialize Memory and Hardware Mount Root Filesystem (RAMDISK) Run /sbin/init User Programs 9
  • 10. All the things we need Cross-Platform development toolchain Bootloader Provide by vendor Linux kernel Linux kernel + some patches if needed Filesystem Busybox Device node Configuration 10
  • 11. Build the GNU Cross-Platform Development Toolchain We can download the cross-platform (toolchains) from ftp://ftp.arm.linux.org.uk/pub/ The toolchain do not need recompile, just decompress it and set the system path. GNU Toolchain’s Component Binutils including AS, LD and other binary file tools GCC the well known C,C++ complier supported variable platform GLIBC the C runtime library GDB the command line source debugger, including remote 11 debugging
  • 13. ARM Linux Kernel ARM Linux is a port of the successful Linux Operating System to ARM processor based machines mainly by Russell King with contributions from others. The patch change log can be found at http://www.arm.linux.org.uk/developer/release- 2.4.0.shtml The Linux Kernel and most of the programs that make up the Linux system are quot;open sourcequot;, using the GNU tools provided by the Free Software Foundation. ARM Linux is being ported, or has been ported to more than 100 different machine variations, including complete computers, network computers 13 and evaluation boards. There are also projects for
  • 14. Filesystem - initrd initrd provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted. initrd is mainly designed to allow system startup to occur in two phases, where the kernel comes up with a minimum set of compiled-in drivers, and 14 where additional modules are loaded from initrd.
  • 15. Filesystem - BusyBox Combine tiny versions of many common UNIX into a single small executable. Provide a fairly complete environment for any small or embedded system. BusyBox has been written with size- optimization and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems 15
  • 17. Make Linux Kernel Download Linux kernelOptions: from Additional source http://www.kernel.org/ CROSS_COMPILE=arm-linux- ARCH=arm make clean make menuconfig Building Kernel CROSS_COMPILE=arm-linux dep make ARCH=arm make clean make ARCH=arm CROSS_COMPILE=arm-linux zImage make menuconfig make ARCH=arm CROSS_COMPILE=arm-linux modules make ARCH=arm CROSS_COMPILE=arm-linux make dep (this step is no needed in version 2.6) modules_install make bzImage make ARCH=arm CROSS_COMPILE=arm-linux install make modules make modules_install make install 17
  • 18. Make Linux Kernel After make bzImage, the kernel image will be at ./path/to/linux_src/arch/i386/boot/bzImage The quot;bzImagequot; name stands for quot;big zImage,quot; and has nothing to do with the bzip2 compression utility. In fact, both the bzImage and zImage Makefile targets rely on the gzip algorithm. The difference between the two Makefile targets is that the compressed kernel images generated using zImage cannot be larger than 512 KB, while those generated using bzImage are not bound by this limit.18
  • 19. Root Filesystem Content 19
  • 20. Building Root Filesystem Download the BusyBox source code from http://www.busybox.net/ Building BusyBox make clean make all make install After make complete, the busybox will be at ./path/to/busybox_src/_install/ 20
  • 21. Building Root Filesystem The BusyBox has all needed utilities, such as, ls, kill, chroot, mount, …,etc. Building the Root Filesystem Create a directory ~/root-fs Copy all files in busybox/_install to ~/root-fs/ Create some standard directory, such as, /dev, /etc /proc /mnt /tmp /var Make some device node Write some boot shell scripts Make directory ~/root-fs to a initrd image 21
  • 22. Create Device Nodes cd ~/root-fs/dev/ mknod tty c 5 0 mknod console c 5 1 mknod tty0 c 4 0 mknod ttyS0 c 4 64 mknod ttyS0 c 4 64 mknod ram0 b 1 0 mknod null c 1 3 22
  • 23. Write Shell Script /etc/inittab ::sysinit:/etc/rc.S ::askfirst:/bin/sh /etc/rc.S #!/bin/sh mount -t proc proc /proc 23
  • 24. Make INITRD image dd if=/dev/zero of=/home/initrd.img bs=1k count=8192 su root mke2fs -F -v -m0 /home/initrd.img mkdir tmp mount -o loop initrd.img tmp/ cp ~/root-fs/* /home/tmp/ -dpRrf umount tmp/ gzip -9 < initrd.img > initrd.bin file 8MB mount is null Write DATA ~/root-fs file 8MB unmount with data 24
  • 25. Customize Application and Configuration In order to meet the system requirement, we must write some applications base on some drivers. Maybe we’ll setting up the Ethernet or Wireless network or build up some Internet Protocol. Customize the GUI or MMI 25
  • 27. Major and Minor Numbers Special files under /dev “c” for char & “b” for block Major number identifies driver use at open time Minor number is used only by driver to control several devices crw-rw-rw- 1 root root 1, 3 Feb 23 1999 null crw------- 1 root root 10, 1 Feb 23 1999 psaux crw------- 1 rubini tty 4, 1 Aug 16 22:22 tty1 crw-rw-rw- 1 root dialout 4, 64 Jun 30 11:19 ttyS0 crw-rw-rw- 1 root dialout 4, 65 Aug 16 00:00 ttyS1 crw------- 1 root sys 7, 1 Feb 23 1999 vcs1 crw------- 1 root sys 7, 129 Feb 23 1999 vcsa1 crw-rw-rw- 1 root root 1, 5 Feb 23 1999 zero 27
  • 28. Major Number Adding a new driver at module initialization int register_chrdev(unsigned int major, const char *name, struct file_operations *fops); fops point to a global structure which kernel finds To create device node : mknod /dev/scull0 c 254 0 If major is 0, the register_chrdev return a free number For dynamic allocation, script to extract /proc/devices device number, then invoke mknod to create device file int unregister_chrdev(unsigned int major, const char *name); 28
  • 29. Register a Character Device Driver Kernel Major 0 … Major 98 Major 99 … Major 255 Driver 2 2 (1)Insmod module, Driver Major 99 register a Major number to 1 Kernel Driver 1 (2)Kernel know the Major num, Major 98 Kernel will link the major num to The Driver Module 29
  • 30. Major and Minor Kernel Major 0 … Major 98 Major 99 … Major 255 2 Driver 2 Device A 3 Major 99 Major 98 Minor 1 (1) Open、Read、 Write Driver 1 (2) Pass Major&Minor 1 Major 98 to Kernel (3) Kernel Passes Minor User Program to Driver 30
  • 31. Application and Graphic User Interface 31
  • 32. Console Application Write C/C++ programs and compile it as static link or dynamic link executable files. Static Copy the executable file to Root Filesystem Execute it. Dynamic Copy the executable file and needed libraries to Root Filesystem Set the library path by using “export LD_LIBRARY” Execute it 32
  • 33. Graphic User Interface Window System X Window (TinyX) http://www.xfree86.org/ QPE (Qt Plamtop Environment) / Qtopia http://www.trolltech.com/products/qtopia/index.html GPE (GPE Palmtop Environment) http://gpe.handhelds.org/ Microwindows http://microwindows.org/ MiniGUI http://www.minigui.org/ 33
  • 34. Programming with QT 34
  • 35. Building the QT/Embedded Environment Step1: # tar zxvf qt-embedded-3.3.1.tar.gz Step2: # export QTDIR=home/qt-embedded-3.3.1 # export LD_LIBRARY_PATH=home/qt-embedded- 3.3.1/lib:$LD_LIBRARY_PATH # cp /usr/bin/uic /qt-embedded-3.3.1/bin # cd qt-embedded-3.3.1 # ./configure -embedded arm -shared –debug # gmake 35
  • 37. Programming QT Applications / **Import** check your environment variables QTDIR=/qt-embedded-3.3.1 LD_LIBRARY_PATH=/qt-embedded-3.3.1/lib:LD_LIBRARY_PATH */ [command#]cd ~/test /* go to your project directory */ [command#test]qmake –o Makefile test.pro [command#test]make 1. [root@locahost ]# mkdir busybox/qt-embedded-3.3.1/lib/fonts 2. [root@locahost ]# cp /qt-embedded/lib/fonts/* /home/busybox/qt-embedded-3.3.1/lib/fonts/ 37