Embeddedlinux 150206085635 Conversion Gate01
Embeddedlinux 150206085635 Conversion Gate01
Linux
Team Emertxe
Contents
Booting Sequences
File Systems
Linux as Embedded OS
Embedded Linux
Architecture
Choices to Make
Open Source
How it all started?
Open Source
How it evolved?
Open Source
Where it stands now?
OS
Databases
Server/Cloud
Enterprise
Consumer
Education
CMS
eCommerce
Free Software
What does it mean?
4 Freedoms
Copy,
Study,
Change,
Use
The above freedom are for both commercial and noncommercial use
Free Software Licenses GNU GPL and GNU FDL
Embedded Linux
Why Choose!
Availability of Code
Hardware Support
Available Tools
Community Support
Licensing
Vendor Independence
Cost
Embedded Linux
Why Choose! Quality and Reliability of Code
Readability of Code
Extensibility
Configurable
Predictability
Error Recovery
Longevity
Embedded Linux
Ported Architectures
ARM
Power PC
Intended for PC
Strong ARM
MIPS
And many more !!
Embedded Linux
Choices to Make
Toolchains
Libraries
Operating System
Boot Loaders
Hardware
Tools
Serial
minicom
gtkterm
Network
TFTP
NFS
Toolchain
Introduction
Toolchain
Introduction
Toolchain
Introduction
Toolchain
Introduction - Flow
Native
Tools
Cross Compiling
Tools
Toolchain
Components
Toolchain
Components
Compiler
Kernel Headers
Binary Utilities
Debuggers
C / C++ Libraries
Toolchain
Components GCC
Toolchain
Components Binary Utilities
Toolchain
Components binutils
ld - the linker
Toolchain
Components - Libraries
Toolchain
Components - Libraries
glibc
uclibc
Toolchain
Components Libraries - glibc
License: LGPL
Website: http://www.gnu.org/software/libc/
Toolchain
Components Libraries - uclibc
Toolchain
Components Libraries - uclibc
Toolchain
Components Libraries - uclibc
Toolchain
Components Kernel Headers
MACRO definitions
Toolchain
Components Kernel Headers
Toolchain
Building
Toolchain
Building
Toolchain
Building
Build Considerations
Prebuilt
Home Built
Automated Tools
Crosstool NG
Buildroot
Toolchain
Building Build Systems
Native Build
Cross Build
Canadian Build
Toolchain
Building - Considerations
ABI selections
Toolchain
Building Pre-built
Toolchain
Building Home Built
Toolchain
Building Home Built
Can get some idea from the crosstool matrix by Kegel (Note
this is outdated)
Toolchain
Building Automated Tools
Toolchain
Building Automated Tools Crosstool-NG
Actively maintained
http://crosstool-ng.org/
Toolchain
Building Automated Tools Buildroot
Toolchain
Building Automated Tools Buildroot
Buildroot
Introduction
Buildroot
Introduction
Buildroot
Introduction
Buildroot
Configuration
Buildroot
Configuration
Buildroot
Configuration
kernel headers
binutils
uclibc
gcc etc.,
Buildroot
Building
Buildroot
Building
Make sure you don't use make -jN option. Instead you can use
BR2_JLEVEL option to run compilation of each individual
package with make -jN
BR2_JLEVEL can be set while configuration at
Build options Number of jobs to run simultaneously
Buildroot
Building
Buildroot
Building - Output
buildroot-<YYYY>.<MM>
output
images
target
build
host
staging
Buildroot
Building - Output
buildroot-<YYYY>.<MM>
output
images
target
build
host
staging
Buildroot
Building - Output
buildroot-<YYYY>.<MM>
output
images
target
build
host
staging
Buildroot
Building - Output
buildroot-<YYYY>.<MM>
output
images
target
build
host
staging
Buildroot
Building - Output
buildroot-<YYYY>.<MM>
output
images
build
target
host
staging
Buildroot
Building - Output
buildroot-<YYYY>.<MM>
output
images
target
build
host
staging
Buildroot
More Infos!!
http://buildroot.uclibc.org/downloads/manual/manual.html
Target Overview
Target Architecture
Target Board
ARM920T
MCI
SSC
USART
ICE
Memories
Smart Card
RS485, RS232
IrDA
EBI
Modem
I2C, SPI
Debug Unit
Booting Sequences
Booting Sequence
Linux as general
System Start-up
Kernel
Init
Linux
User Application
SPI
Data Flash
Download from
Data Flash
RUN
TWI
EEPROM Boot
Download from
EEPROM
RUN
Parallel
Boot
Download from
8 bit Device
RUN
DBGU Serial
Download
RUN
USB Download
DFU Protocol
RUN
OR
ROM
(ROM Code)
Memory
(serial / parallel)
(S1BL)
Memory
(parallel)
Data
Kernel
SRAM
Stage 2
Boot Loader
Memory
(parallel)
Data
Kernel
Stage 2
Boot Loader
U-Boot Introduction
U-Boot
Introduction - General
U-Boot
Introduction - General
U-Boot
Introduction Design Principles
As small as possible
As reliable as possible
U-Boot
Source Code Browsing
cd u-boot-<version>
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
configs
include
net
doc
post
driver
scripts
lib
disk
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
common
include
configs
lib
disk
net
doc
post
driver
scripts
Makefile
<core>/cpu.c
<core>/interrupt.c
<core>/start.S
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
common
include
configs
lib
disk
net
doc
post
driver
scripts
Makefile
<boardname>/flash.c
<boardname>/<boardname>_emac.c
<boardname>/<boardname>.c
<boardname>/soc.h
<boardname>/platform.S
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
configs/<boardname>.h
<core>.h
U-Boot
Source Tree
u-boot-<version>
board.c
api
dts
test
<arch>linux.c
arch
examples
tools
div0.c
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot
Source Tree
u-boot-<version>
api
dts
test
arch
examples
tools
board
fs
Makefile
common
include
configs
lib
disk
net
doc
post
driver
scripts
U-Boot Building
U-Boot
Building
U-Boot
Building
U-Boot
Building
U-Boot Introduction
U-Boot
Responsibility
Execute from flash (If configured). Do POST
Relocate to RAM
Setup console for user interaction
Code flow
U-Boot
Utilities
Environment Variables
Commands
Information
Environment
Network
Boot
Data Transfer
Memory
U-Boot
Environment Variables
bootcmd
bootargs
serverip
ipaddr
ethaddr
U-Boot
Important Environment Variables
netmask
U-Boot
Important Commands Information
help
flinfo
U-Boot
Important Commands Environment
printenv
setenv
saveenv
U-Boot
Important Commands Network
ping
U-Boot
Important Commands Boot
boot
bootm
U-Boot
Important Commands Data Transfer
loadb
loads
loady
tftpboot
U-Boot
Important Commands Memory
erase
protect
cp
nand
Where to get?
Kernel Subsystem
Process Scheduler:
Memory Manager:
Network Interface:
Inter Process
Communications:
supports several
mechanisms for process-toprocess communication on a
single Linux system
cd linux-<version>
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
firmware
net
fs
samples
include
scripts
init
security
Makefile
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
arm
powerpc
X86
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
ext2
fs
samples
ext3
include
scripts
fat
init
security
Examples:
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
firmware
net
fs
samples
include
scripts
init
security
Makefile
arch/x86/mm/init.c
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
linux-<version>
arch
ipc
sound
block
kernel
tools
crypto
lib
usr
drivers
mm
Makefile
firmware
net
fs
samples
include
scripts
init
security
Once you decide on the target you may try the following
command
$ make target
make config
make menuconfig
make xconfig
The above image show snap shot typical output of make config
command
Updates current config utilizing a line-oriented program
No user friendly approach. Could be used if you have limited host
installations
The problem with this approach is that, It force you to follow an
sequence of questions while configuration.
Have to use Ctrl C to exit
The above image shows the snapshot of typical output of make menuconfig
command
The above image shows the snapshot of typical output of make xconfig
command
These files are best possible minimal .config file you can have
for your board
Just type the following on the command to know available
target
$ make help
Now you may look for Architecture specific targets: section of the
output to look for default configuration for your target architecture
Make sure you alteast select a proper architecture for your board
Once the compilation is done you will get the kernel image
in the following location arch/<arch>/boot
make install this is rarely used in embedded dev as the
kernel image is single file, But still can be done by
modifying its behavior arch/<arch>/boot/install.sh
You can install all the configured modules by the following
command
make INSTALL_MOD_PATH=<dir>/ module_install
After all the above steps the kernel image is ready for
deployment on target
File Systems
File Systems
Introduction
Introduction
File Systems
Introduction
File Systems
Introduction
There are several kinds file system having different structure and
logic, properties of speed, flexibility, security, size and more
The most commonly used media to store the data are
Storage Devices
Magnetic Tapes
Hard Drive
Optical Discs
Flash Memories
RAM (Temporary)
File Systems
Introduction
Contents
Types
Partitions
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
ls
ping
grep
cp
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
Device files
These include terminal devices,
usb, or any device attached to the
system.
Examples:
/dev/tty1
/dev/usbmon0
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
/etc/resolv.conf
/etc/logrotate.conf
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
/home/arun
/home/adil
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
ld-2.11.1.so
libncurses.so.5.7
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
/media/cdrom
/media/floppy
/media/cdrecorder
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
/proc/uptime
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
iptables
reboot
fdisk
ifconfig
swapon
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
bin
boot
dev
etc
home
lib
media
mnt
proc
root
sbin
sys
tmp
usr
var
/var/mail - emails
Speed
Size
Reliability
Access restrictions
initrd
initramfs
ext2
ext3
ext4
Intro to MTD
JFFS2
NFS
squashfs
Kernel converts the initrd into a normal RAM disk and frees the
memory used by initrd
linuxrc places the root file system at the root directory using the
pivot_root system call
The normal boot is done on the root file system (run /sbin/init)
Examples
Journal checksum
Erasing blocks
Random access
Wear leveling
Examples
In Linux the flash memories use a device file called MTD for
interaction
mtdchar drivers
mtdblock drivers
Compressions
Backups
Access etc.
Can be used for read only data like binaries, kernel etc
gzip
LZMA
LZO etc
File management
Multiple users
Data Security
/
(root)
/home
swap
Hard Drive
/
(root)
/boot
/home
swap
Hard Drive
Similar to previous
one with a separate
boot partition which
will contain the boot
images
Bootloader 2
Kernel Image
RFS Image
Data
Memory 3
Bootloader 1
Memory 2
Memory 1
Bootloader 1
Bootloader 2
RFS Image
Data
Memory 2
Kernel Image
Memory 1
Bootloader 1
Bootloader 2
RFS Image
Data
Memory 1
Kernel Image
File Systems
Building from scratch
Lots of dependencies
Many more..
BusyBox
Introduction
BusyBox
Introduction
BusyBox
Introduction
BusyBox
Building
BusyBox
Building - Configuration
BusyBox
Building - Compilation
BusyBox
Installation
Stay connected
About us: Emertxe is Indias 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
Branch office:
Emertxe Information Technologies,
No-1, 9th Cross, 5th Main,
Jayamahal Extension,
Bangalore, Karnataka 560046
https://www.facebook.com/Emertxe
https://twitter.com/EmertxeTweet
https://www.slideshare.net/EmertxeSlides
Thank You