Embedded Linux on ARM
Building a custom Embedded OS
Team Emertxe
Introduction
Linux as
an Embedded OS
●
Open Source & Free Software Fundamentals
●
Why to choose Linux
●
Architecture
●
Choices to Make
Open Source &
Free Software Fundamentals
●
Free Software – Freedom to Run, Change and
Redistribute
●
Free Software Licenses – GNU GPL and GNU
FDL
●
Open Source – Code is open to review but no
Freedom
Choosing Linux
●
Quality and Reliability of Code
●
Availability of Code
●
Hardware Support
●
Communication Protocols and Software Stds
●
Available Tools
●
Community Support
●
Licensing
●
Vendor Independence
●
Cost
Quality and Readability
of Code
●
Modularity and Structure
●
Readability of Code
●
Extensibility
●
Configurable
●
Predictability
●
Error Recovery
●
Longevity
Architecture
●
Power PC
– Intended for PC
– Have become popular in embedded
●
Strong ARM
– Faster CPU – Higher Performance
– PDAs, Setup box etc.,
●
ARM
– Suits well for Embedded
– Include THUMB – reduce code bandwidth
– High density code than PPC, x86.
●
MIPS
Choices to Make
●
Which kernel to use?
●
Which development environment:
●
Which compiler, debugger, dev boards?
●
Which drivers and libraries?
●
Support and training?
Embedded Development and
Environment
Embedded Development
and its Environment
●
Requirements & Setup
– Connectivity between Host and Target
●
Serial
●
Network
●
The Embedded Environment Tools
Embedded Development
and its Environment
●
The Embedded Environment Tools
– Serial Downloding Applications
●
minicom
●
gtkterm etc.,
– tftp server
●
Toolchains (Cross Compiler & Friends)
Embedded Development
and its Environment
●
Toolchains (Cross Compiler & Friends)
– gcc
– binutils
and many more..
●
Building your own Toolchain
Embedded Development
and its Environment
●
Building your own Toolchain
– Buildroot
●
Down load buildroot from
http://buildroot.uclibc.org
●
tar jxvf buildroot-snapshot.tar.gz
●
cd buildroot/
●
make menuconfig
Understanding Target
Understating Target
●
Know your Target Controller
●
Hardware Understanding
●
Linux Startup Sequence
●
Controller's Booting Sequence
●
Working on the Board
Know your Target
Controller
●
ARM920T ●
MCI
– 200MIPS at 180MHz, MMU ●
SSC
– 16KB Inst & Data Cache ●
USART
– ICE – Smart Card
●
Memories
– RS485, RS232
– 128 ROM, 16 KB SRAM
– IrDA
– EBI
– Modem
– SDRAM, SM,CF, NOR, NAND
●
I2C, SPI
●
Ethernet MAX 10/100
●
Debug Unit
●
USB 2.0 FS Host
●
USB 2.0 FS Device
Target Board
Hardware Understanding
●
Schematic
●
Understand -
– Memory mappings
– Peripheral Mappings etc.,
Linux Booting
Sequence
System Start-up BIOS / Boot Monitor
Stage 1 Boot Loader Master Boot Record
Stage 2 Boot Loader LILO, GRUB, etc
Kernel Linux
Init User Application
Controller's
Booting Sequence
Device
Setup
Download from
UART Run
Data Flash
TWI Download from Run
EEPROM Boot EEPROM
Parallel Download from Run
Boot 8-bit Device
DBGU Serial Run
Download
OR
USB Download Run
DFU protocol
Hands on Target
●
Factory Restoration
●
Board Bring Up
Hands on Target
Factory Restoration
●
Erasing the following from the Target
– Kernel
– U-Boot
Hands on Target
Board Bring Up
●
Boot Up loader
●
RAM Monitor
●
Stage 1 Boot Loader
●
Stage 2 Boot Loader
Stage 1 Boot Loader
●
Pointer to Stage 2 Boot Loader
Stage 2 Boot Loader
●
Pointer to Kernel Image
●
We use u-boot as S2BL
●
u-boot's responsibility
●
u-boot
What does u-boot do?
u-boot
u-boot
board common cpu disk doc drivers dtt examples fs include
lib_* net post tools
u-boot
u-boot
common cpu disk doc drivers dtt examples fs include
lib_*
lib_* net
net post
post tools
tools
●
Platform, board level files. Eg, atmel, icecube,oxc etc.,
●
Contains all board specific initialization
– <boardname>/flash.c
– <boardname>/<boardname>_emac.c
– <boardname>/<boardname>.c
– <boardname>/soc.h
board – <boardname>/platform.S
u-boot
u-boot
board cpu disk doc drivers dtt examples fs include
lib_*
lib_* net
net post
post tools
tools
●
All acchitecture independent functions
●
All the commands
common
u-boot
u-boot
board common disk doc drivers dtt examples fs include
lib_* net post tools
●
CPU specific information
– <core>/cpu.c
– <core>/interrupt.c
– <core>/start.S
cpu
u-boot
u-boot
board common cpu doc drivers dtt examples fs include
lib_*
lib_* net
net post
post tools
tools
●
Partition and device information for disks
disk
u-boot
u-boot
board common cpu disk drivers dtt examples fs include
lib_* net post tools
●
You can find all the readme files here
doc
u-boot
u-boot
board common cpu disk doc dtt examples fs include
lib_*
lib_* net post tools
●
Various device drivers files
drivers
u-boot
u-boot
board common cpu disk doc drivers examples fs include
lib_*
lib_* net
net post
post tools
tools
●
Digital Thermometer and Thermostat drivers
dtt
u-boot
u-boot
board common cpu disk doc drivers dtt fs include
lib_*
lib_* net post tools
●
Example code for standalone application
examples
u-boot
u-boot
board common cpu disk doc drivers dtt examples include
lib_*
lib_* net post tools
●
File system directories and codes
fs
u-boot
u-boot
board common cpu disk doc drivers dtt examples fs
lib_*
lib_* net post
post tools
tools
●
Various header files
– configs/<boardname>.h
– <core>.h
include
u-boot
u-boot
board common cpu disk doc drivers dtt examples fs include
net post tools
●
Processor specific libraries
– board.c
– <arch>linux.c
– div0.c
lib_*
u-boot
u-boot
board common cpu disk doc drivers dtt examples fs include
lib_* post tools
●
Networking retated files.
net
u-boot
u-boot
board common cpu disk doc drivers dtt examples fs include
lib_* net tools
●
Power On Self Test
post
u-boot
u-boot
board common cpu disk doc drivers dtt examples fs include
lib_* net post
●
Various tools directories and files
tools
Building Embedded Linux
Embedded Kernel
●
Configuring the Kernel
●
Configuration methods
●
Kernel Image and its Arguments
●
Booting the Kernel and Init
●
File Systems
Configuration Methods
●
make config
●
make oldconfig
●
make menuconfig
●
make xconfig
●
Building kernel
Configuration Methods
●
make kb9202_defconfig
●
make menuconfig
●
make
Kernel Image
and its Arguments
●
Creating linux.bin – arm-linux-objcopy
●
Creating kernel image - mkimage
Creating linux.bin
●
arm-linux-objcopy -O binary vimlinux
linux.bin
Creating kernel image
●
mkimage -A arm -O linux -T kernel -C
none -a 20008000 -e 20008000 -n
“Embedded Linux” -d linux.bin
uImage.arm
Stay connected
About us: Emertxe is India’s one of the top IT finishing schools & self learning
kits provider. Our primary focus is on Embedded with diversification focus on
Java, Oracle and Android areas
Emertxe Information Technologies,
No-1, 9th Cross, 5th Main,
Jayamahal Extension,
Bangalore, Karnataka 560046
T: +91 80 6562 9666
E: training@emertxe.com
https://www.facebook.com/Emertxe https://twitter.com/EmertxeTweet https://www.slideshare.net/EmertxeSlides
Thank You