02 Linux Quick Start PDF
02 Linux Quick Start PDF
Chris Simmonds
Version numbers
About BSPs
Booting
Application code
Your program User space
C library
System interface
Device drivers
Hardware
Example: 2.6.35.1
2: very unlikely to change
6: unlikely to change
2.6.0 released in December 2003
Architecture
arm,mips, powerpc, x86,...
Board
SoC manufacturer evaluation boards
Freescale Babbage, TI EVM, ...
COTS boards
Digi, Eurotech, ...
Typical procedure is
Advantages
Load drivers on demand (e.g. for USB devices)
Load drivers later speed up initial boot
Disadvantages
Adds kernel version dependency to root file system
More files to manage
Files generated
.config
include/linux/autoconf.h
Make targets
zImage - compressed kernel image
uImage - zImage plus U-Boot header
Files generated
vmlinux
arch/arm/boot/zImage
arch/arm/boot/uImage
Embedded Linux Quick Start Guide 12
Kernel and user space
Kernel command line
Some examples
console: device to send kernel messages to, e.g.
console=ttyS0,115200
Busybox
Loaded from:
ram disk (initramfs)
storage device: flash, SD, hard disk
network: nfs
Roll-Your-Own (RYO)
Web - http://www.busybox.net
# ls -l /bin
lrwxrwxrwx 1 root root 7 2008-08-06 11:44 addgroup -> busybox
lrwxrwxrwx 1 root root 7 2008-08-06 11:44 adduser -> busybox
lrwxrwxrwx 1 root root 7 2008-08-06 11:44 ash -> busybox
-rwxr-xr-x 1 root root 744480 2008-05-16 15:46 busybox
lrwxrwxrwx 1 root root 7 2008-08-06 11:44 cat -> busybox
...
/etc/init.d/rcS
#! /bin/sh
echo "Starting rcS"
mount -t proc proc /proc
mount -t sysfs sysfs /sys
ifconfig lo 127.0.0.1
ifconfig eth0 192.168.1.101
System V runlevels
A runlevel defines a system state
0 is halt
1 is single user
2-5 are multi-user
6 is reboot
Format:
id:runlevels:action:process
id:5:initdefault:
Default runlevel = 5
z6:6:respawn:/sbin/sulogin
S:2345:respawn:/sbin/getty 38400 ttyS1 Launch a login on the
console
Each service is controlled by a script in /etc/init.d:
# ls /etc/init.d
alignment.sh modutils.sh sendsigs
banner mountall.sh single
bootmisc.sh mountnfs.sh sysfs.sh
checkroot networking syslog
devpts.sh populate-volatile.sh syslog.busybox
dropbear ramdisk udev
finish.sh rc udev-cache
functions rcS umountfs
halt reboot umountnfs.sh
hostname.sh rmnologin urandom
hwclock.sh save-rtc.sh
Most take parameters start and stop, e.g.
/etc/init.d/syslog stop
Create by hand:
mknod /dev/ttyS0 c 4 64
udev pros
less hassle; handles removable devices (e.g. USB)
udev cons
slow
Step 1. Export a directory on the development host with a line like this
in /etc/exports
/home/chris/rootdir *(rw,sync,no_subtree_check,no_root_squash)
MTD
(Memory Technology Devices)
Flash driver
Flash chip(s)
root=/dev/mtdblock1 rootfstype=jffs2
Kernel
Your choice of kernel is limited by BSP
Many build-time kernel configuration options
Boot-time configuration via command line
User space
Starts when kernel mounts rootfs
First program to run is (default) /sbin/init
Both Busybox init and System V init are common