Embedded Linux Design and Programming

advertisement
Introduction to
Embedded Systems
Dr. Jerry Shiao, Silicon Valley University
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
1
Course Description

Concepts of Embedded Linux Development.

Bootloader (i.e. Redboot, uBoot).
 Linux Library uclibc for microcontrollers(Kernel APIs or system calls).
 Linux File System and RamDisk.
 Crossplatform GNU toolchain to compile Linux and uclibc for target.

Concepts of Linux Kernel Development.



Develop loadable Kernel modules and load/unload the Kernel modules.
Develop Applications.
Hands-On Lab:

Cirrus Logic Microcontroller chip 9302 ARM 9 Core. 32 MByte RAM, 16
MByte Flash memory, network, USB, and serial ports.


Raspberry Pi SOC ARMV6 Core. 512 MByte RAM, 4 GigByte SD Card,
HDMI, GPU, network and USB ports.


Redhat Linux Host Development System to develop and download
embedded Linux/RamDisk target systems.
Raspbian Linux based on Debian distribution and optimized for Raspberry
Pi.
References:


Building Embedded Linux Systems 2nd Edition, O’Reilly Media, 2008
Materials included from Suleman Saya, UC Santa Cruz
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
2
Course Description

Class Evaluation.






Reference: O’Reilly Book, Building Embedded Linux Systems, 2nd Edition
Assignment 1:



Use /proc File System.
Install Loadable Modules.
Assignment 6:



Compile BusyBox Application and Create RAMDisk.
Create Linux initialization file.
Assignment 5:



Compile Embedded Linux Kernel 2.6.29.
Compile uclibc For Embedded Linux System.
Assignment 4:



Compile Linux Toolchain For Cirrus Logic EP9302 ARM Platform.
Compile C Application With Linux Toolchain and Place In RAMDisk.
Assignment 3:



Build RAMDisk on Host Linux.
RedBoot BootLoader TFTP/Serial From Host Linux To Target Platform (Cirrus Microcontroller).
Assignment 2:



30 %: Midterm. First half material.
30 %: Final. Second half material.
30 %: Assignments.
10 %: Attendance / Class Participation.
Export Kernel Symbols.
Install Kernel Thread.
Assignment 7:

GDB Debugger
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
3
Embedded Linux Course Outline

Section 1 Embedded Linux Introduction
 Linux At the Beginning
 GNU and GNU Public License (GPL)
 Embedded Linux Criterias
 Embedded Linux Development
 Linux Kernel Infrastructure
 Cross-Platform Development

Section 2 Embedded Linux Development

Embedded Linux Development Requirements For Host System





Setup Host System For Cross-Development
Setup Target Board For Cross-Development
Target Board Boot Process
Target Board / Host System Communication
RAM Disk
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
4
Embedded Linux Course Outline
 Section 3 Embedded Linux ToolChain
 ARM Tool-Chain





Binutils
Kernel Headers
Cross Compiler First / Second Stage
Glibc Library
Section 4 Linux File System

Linux File System



File System Concepts



Linux Source Directory Hierarchy
Root File System
Inodes
Virtual File System
/proc File System
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
5
Embedded Linux Course Outline

Section 5 Kernel Internals
 Kernel Modules



Linux Device Drivers




Module Organization
Module Installation (Insmod) and Removal (rmmod)
Character Drivers
Block Drivers
Major and Minor Number
Section 6 Kernel Scheduling

Process Fundamentals


Process Scheduling




Process States
Preemptive Multitasking
Cooperative Multitasing
Scheduling Policy
Process Classification


Spring 2014
Interactive Processes
Batch Processes
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
6
Embedded Linux Course Outline

Section 7 Kernel Process / Treads
 Process VS Threads



InterProcess Communications (IPC)
Memory Constraints
Thread Management
User Level Threads
 Kernel Level Threads
 Clone() / Fork() / VFork() Threads


Section 8 Linux Interrupt Handlers

Linux Interrupt Handlers




Fast Interrupt Handlers
Slow Interrupt Handlers
Top Half Handlers
Bottom Half Handlers

Tasklets
 Workqueues
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
7
Embedded Linux Course Outline
 Section 9 GNU GDB
 GNU Tool Chain Debugger (GDB)


gdbserver (Target)
gdb (Host)
 GDB

Build Procedure
Section 10 Real Time Linux

Real Time Linux



Linux 2.6 Real Time




Linux “Soft” Real Time
“Hard” Real Time
Preemptive Linux Kernel
Real-Time Scheduler
Hish Resolution POSIX timers
Real Time Application Interface (RTAI)

Spring 2014
Interrupt Abstraction
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
8
Section 1 Embedded Linux Introduction






1991 University Of Helsinki in Finland by Linus B. Torvalds.
Originally Minux, alternative to DOS.
 Minux developed by Andrew Tanenbaum to teach Unix.
 Minux supported protected mode.
 Minux rewrote for additional funtionality and features as
Linux. Currently all code in Minux has been replaced.
 Minux file system format supported under Linux. Core is the
Virtual File System (VFS).
 Linux built with GNU compiler and library. Released on
10/1991.
Linux is POSIX compliant. Compatiable with Unix System V.
GNU utilities and tools (compiler, assembler, loader, etc) are
freeware.
GNU Public License (GPL) specifies any modifications to Linux
has to be freely published.
Linux is open source because of GNU utilities and tools.
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
9
Section 1 Embedded Linux Introduction

Embedded System Definition






Spring 2014
Computer system integrated into a larger applicances that is not a computer (i.e.
oven, gas station pump, ATM machine) or small devices (i.e. cell phone, PDA
 Physcial size is small. The computer system is on a small board.
 CPU, RAM, and low power consumption.
Based on concept of the microcontroller, single integrated circuit that contains all
the technology required to run an application. Combined onto a chip. Reduces
chips and wiring to control a device. Reduce complexity, size, and cost.
 CPU
 RAM for program and data storage.
 Flash memory for program storage.
 Input/Output interfaces (i.e. serial, USB, ethernet, USB).
 Timers.
Embedded system designed to perform simple, repeatable tasks. Simpliying
tasks reduces complexity, minimize CPU processing power, and minimize
RAM/Flash requirements. Maximum performance for minimum size and weight.
Not apparent to user.
Provide device with network-ability, available as modem, ethernet port, USB, or
wireless.
Provide device with user Interaction, likely (i.e. cell phone, PDA, gas pumps,
ATMs). Some run without human intervention, but might be required to respond
to realtime events (i.e. LEDs).
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
10
Section 1 Embedded Linux Introduction
 Users of Embedded System





Spring 2014
Manufacturing – Replaces general purpose computers to
control equipment. Drive down manufacturing costs and
subsequently drives down end user prices.
Solution for complex problems in product design.
 Car has embedded systems to control brakes,
ariconditioning, ignition systems. Without embedded
systems, need complicated and fault prone electronics or
general purpose PC.
Consumer electronics – Cell phones, digital cameras,
pagers, PDAs, DVD players, copiers, printers, scanners, fax
machines, Network switches/routers, stereo systems,
televisions, game consoles, electronic instruments, electronic
toys.
Consumer products – Ovens, dishwashers, washer, dryers,
home security systems.
Business products – automobile electronics (i.e. audio
system, anti-lock brakes), ATMs, hospital life-support
systems, hospital medical testing systems, airplane on-board
electronic monitors.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
11
Section 1 Embedded Linux Introduction

Linux as Embedded System










Spring 2014
Why use Linux? Other Embedded OS options (i.e. VxWorks by WindRiver,
pSOS by WindRiver, QNX, Nucleus by Accelerated Technologies, RTKernel,
Symbian OS, Microware OS-9 by RadiSys, Windows CE by Microsoft, OSE
by Enea, MicroC by OS-II).
Linux quality and reliability. Large community support (i.e. Google). No need
to pay for customer support.
Open source. GNU utilities and tools made Linux appealing. Even
condensed version of Linux on dedicated system has many solutions.
 Linux Custom Distributions: Monta Vista, TimeSys,
 Linux Free Distirbutions: Redhat, Degian, and Suse.
Multitasking scheduler allows many processes/threads to run at the same
time.
Symmetric Multi Processor (SMP)
Memory protection between processes, prevents one process from bringing
down system.
Multiplatform solution since Linux runs on many CPUs (ARM, x386,
PowerPC, MIPS).
Networking protocols (TCP/IP, IP services, Netware, AppleTalk,
Supports Virtual File System (VFS) for transparent access to many file
systems.
Dynamic loadable kernel modules.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
12
Section 1 Embedded Linux Introduction
 Linux



Kernel Architecture
Linux is modular, monolithic kernel. Kernel is single process with one
address and memory space. Services (i.e. scheduler, file manager, memory
manager) made through direct function calls.
User space, each process (i.e. application) protected by their own user
memory. Invalid memory access will crash only the process.
Kernel space, memory space is not protected. Invalid memory access will
crash the system.
Linux High – Level Components
User Space
App1
Scheduler
Kernel Space
Networking
uclibc
App2
Device Drivers
Memory Manager
. . .
File Manager
. . .
Architecture / Platform
X386
Spring 2014
PowerPC
ARM
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
MIPS
. . .
13
Section 1 Embedded Linux Introduction
 Linux Monolithic Kernel





Spring 2014
Linux is modular, monolithic kernel. Kernel is single process
with one address and memory space. Services (i.e.
scheduler, file manager, memory manager) made through
direct function calls.
Linux Kernel modules exported symbols and functions are
directly callable by other modules.
Linux Kernel makes invalid memory reference, the kernel and
all user processes crashes.
Contrast micro-Kernel. Services are separate processes. IPC
between services to request service. QNX example of microKernel. When QNX service makes invalid memory reference,
the kernel does not crash, only that service crashes.
struct_task data structure used by every process and thread.
Allows Kernel to schedule both process and threads
together. First process created is the init process and all
other processes are child processes.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
14
Section 1 Embedded Linux Introduction
 Linux
Directory Structure
/boot – Linux bootup files (i.e. Linux Kernel)
/etc – Linux system configuration files.
vmlinux
/
boot
etc
bin
usr
sbin
var
dev
mnt
home
/etc/inittab – Processes started at bootup (i.e. Runlevel)
inittab
fstab
mount
Spring 2014
/etc/passwd – Users are defined and user accounts.
/bin – Linux system binaries.
/sbin/init – Process runned during boot process.
bin
grep
/usr/bin – Applications for the users.
/lib – The shared libraries for dynamically linked modules.
init
/var – Data changes when the Linux system is running.
log
/var/log – The running Linux system updated log files.
tty0
/dev – Devices that are available to Linux system. Devices are
treated like files and devices can be read/written as files.
cdrom
/mnt – Storage devices (i.e. hard disk, CD-ROMs) must be attached
to some directory before accessing. Directores are the mount points.
student1
lib
proc
/etc/fstab – File systems and mount points.
passwd
/home – Each users have own directory and only place normal users
are allowed to write.
/proc – Special directory containing information about the kernel.
devices
/proc/devices – List of devices configured into current kernel.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
15
Section 1 Embedded Linux Introduction

Soft Real-Time Embedded System

Time tolerance for an event to occur.





ATM machine. Transaction occurs after 10 seconds or 20 seconds, but
not critical to occur at the same time every time. At least the transaction
completes.
Video streaming.
Best effort and minimized latency from event.
Linux latency in scheduler and memory manager makes Linux Soft
Real-Time. For Hard Real-Time, Linux Kernel must be rewritten.
Hard Real-Time Embedded System

Absolute deadline must be met and no deadline missed.





Absolute deterministic response to an event.
OS that provides required service in bounded response time. In
bounded response time, need to know when event must occur.
VxWorks provides the most real-time critical events.

Spring 2014
Airline computers controls radar, alarm indicators, airplane controls.
Nuclear reactor temperator gauges and sensors must trigger cool down
action immediately or disaster will occur.
Real-time event is measured and response time is tested repeatedly.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
16
Section 1 Embedded Linux Introduction

Real Time Linux 2.6

Preemption



Real Time Scheduler




Linux 2.6 scheduler determined time slice for each process and which
process to run based on runqueue per priority level. Active and Expired
priority arrays.
Linux 2.4 scheduler uses one global runqueue. Traverse entire
runqueue to determine next process to run.
Scheduling Policies (NORMAL, FIFO, RR, BATCH)
Process Class (Interactive, Batch, Real-Time)



Spring 2014
Linux 2.4 nonpreemptive. System call (uclibc library) completed before
the CPU was released. Higher priority process or interrupt prevented
from running.
 For example, keyboard not responsive until system call was
completed.
Linux 2.6 system call was preemptable. A process forced to release
CPU.
Interactive spends time performing I/O (i.e. editors).
Batch do not need user interaction (i.e. compiler).
Real-Time provide deterministic response time (i.e. robot controllers).
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
17
Section 1 Embedded Linux Introduction
 Real Time Linux Development Requirements
 Cross Development Platform on Linux Host

Development is done on a different platform than the target
platform.






Advantage of Linux based host.

Spring 2014
Microcontrollers has limited resources, CPU is not powerful
enough to run compiler, a file system, or a development
environment.
Host system running Linux 2.4, but the target system is Linux
2.6. The Linux 2.4 GCC compiler will be used to compile the
Linux 2.6 GCC cross compiler.
Host system is x86 processor, but the target system has ARM 9
based microcontroller.
Cross compiler used to build toolchain (i.e. assembler, linker,
utilties) for target system.
Cross compiler and toolchain used to build Linux 2.6 Kernel for
target system.
Target simulators on host allow testing before loading target
system.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
18
Section 2 Embedded Linux Development
 Cirus Logic EP-9302 Microcontroller

200 MHz Cirrus Logic EP-9302 ARM920T core processor
with math co-processor and MMU










Spring 2014
ARM stands for Advanced RISC Machine (Reduced Instruction
Set Computer Instruction Set Architecture).
Simplicity suitable for low power applications in mobile and
embedded electronics.
90% of all embedded 32-bit RISC processors.
10/100 MBps Ethernet
2 USB Ports
RS232 Serial Port
Real-time clock and watch-dog timer
A/D, D/A converter
32 MByte 100 MHz SDRAM, 6 MByte Flash
Marverick Math Engine
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
19
Section 2 Embedded Linux Development



Cross Development Environment
Host System will send bootloader commands over Target
System serial port.
Host system ethernet port send Linux Kernel image and
RAMDisk to target system RAM.
1) Bootload commands.
2) Target System console log.
Target
System
Serial Port
Host
System
192.168.1.100
192.168.1.101
Spring 2014
Ethernet
Port
Switch
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
1) Host Linux Distribution,
RedHat Linux.
2)Target System Linux 2.6
3) GNU Cross Development.
4) Root permission.
5) tftp Server.
6) tftpboot directory.
7) IPNetwork
8) Minicom communicate to
target over serial cable.
Transfer Kernel image and
RAMDisk (ext2 File System)
to Target System RAM or
Flash.
20
Section 2 Embedded Linux Development

Linux Boot Process – Bootloader










Spring 2014
Reset Microcontroller
First stage bootloader located in small ROM (2K or 4K Bytes).
Initializes CPU, MMU, on-chip devices, configures memory map.
ROM bootloader loads second stage bootloader (i.e. Redboot) from fixed address from
flash to RAM. ROM bootloader must have flash driver.
 NAND Flash –large, less cost, cannot execute-in-place.
 NOR Flash – smaller, execute-in-place (i.e. Second Stage Bootloader execute
from NOR).
Second stage bootloader will load the Linux Kernel and RAMDisk from:
 Automatically decompress the Linux Kernel and RAMDisk from flash to RAM.
 Manually interrupt bootloader (<cntrl> <c>) and use tftp to load Linux Kernel from
server.
 After Linux Kernel starts running, bootloader is no longer in RAM.
Bootloader configuration (i.e. IP address, host system (server) IP address) saved in
high address space in flash. Only for development and testing.
Bootloader configured with the starting address space in flash where Linux is located
and where RAMDisk is located.
During development, bootloader will load Kernel and RAMDisk from host system.
Bootloader executes a jump to the Kernel code to configure the microprocessor
registers and start_kernel() function.
Bootloader architecture specific. Bootloader has memory map for the flash and for
loading Kernel and RAMDisk and will be different for another microcontroller.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
21
Section 2 Embedded Linux Development

Linux Boot Process – Kernel





Spring 2014
Kernel initializes cache, hardware devices, and mounts root file
system (i.e. RAMDisk). Without root file system, Kernel will hang.
/etc directory contains Kernel configuration files (i.e. inittab, rc.d,
fstab).
Kernel executes the init process, reading its configuration file,
/etc/inittab, and executes scripts dependent on selected runlevel.
Init process executes startup script, /etc/rc.d/rc.sysinit, configuring
and starting networking and other system services (i.e.
/etc/rc.d/init.d contains service scripts).
Init process enters a runlevel, where different processes are started
by scripts to run activate the resources for that runlevel (default in
/etc/inittab).
 Runlevel 5 used for graphical interface (used for PC). Starts
services in /etc/rc.d/rc5.d.
 Runlevel 3 brings up the system console window (used for
embedded system). Starts services in /etc/rc.d/rc3.d.
 Local initialization, /etc/rc.local.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
22
Section 2 Embedded Linux Development
 Linux
Boot Process – /etc/inittab
Format of inittab file entries:
# inittab This file describes how the INIT
#
process should setup the system
#
in a certain run-level.
Id:5:initdefault:
#System initialization
si::sysinit:/etc/rc.d/rc.sysinit
Id: unique sequence of 1-4 characters.
runlevels: 0-6 runlevels for the specified action.
action:
-- initdefault: runlevel to enter (i.e. scripts in
/etc/rc.d/rcx.d directory, where x=0 to 6) after
system boot.
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait/etc/rc.d/rc 1
l2:2:wait/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait/etc/rc.d/rc 6
-- sysinit: process executed during system boot
before any boot or bootwait actions.
-- boot: process executed during system boot.
#Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
…
#Run xdm in runlevel 5
X:5:respawn:/etc/X11/prefdm - nodaemon
Spring 2014
id:runlevels:action:process
-- bootwait: process executed during system boot
while init waits for its termination (i.e. /etc/rc).
-- wait: process started when runlevel is entered
and init will wait for termination.
-- respawn: process will restart whenever it
terminates.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
23
Section 2 Embedded Linux Development

Linux Boot Process – Root File System
 Embedded system, RAMDisk is used for file system. No hard disk in
embedded system. RAMDisk is in system memory and acts like a block
device. Supports different kinds of file systems (i.e. FAT, ext2, ext3). Default
file system is ext2.
 Before loaded from flash or tftp from host system, root file system is a
compressed file. Decompressed into RAM as ext2 file system.
 Root file system must contain everything needed to support a full Linux
system. The basic file system structure:
 Directories: /dev, /proc, /bin, /etc, /lib, /usr, /tmp
 Set of utilties (/bin): sh, ls, cp, mv, etc.
 System config files (/etc): rc.d, inittab, fstab, etc.
 Devices (/dev): hda, tty<x>, fd, etc.
 Runtime library used by utilities.
 Root file system is mounted in RAM from RAMDisk, persists in RAM until
system reboots.
 Development option: NFS-mount the root file system from the host system.
Using NFS need configuration options enabled when Kernel is built.
 Linux interface through Virtual File System (VFS), standard set of I/O
interfaces that can be used over different devices (i.e. hard disk, CDROM,
NFS, NTFS, Apple File System).
 Physical device abstacted away from the user. Common
Open/Read/Write/Close APIs are used regardless of underlying file
system.
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
24
Section 2 Embedded Linux Development

Linux Boot Process – Host System Requirements





Host Linux distribution (i.e. Redhat Linux).
GNU Cross Development environment.
tftpboot directory (root level) contains the Kernel image and root file
system (i.e. RAMDisk). NOTE: chmod –R 777 /tftpboot
/etc/init.d directory contains start/stop scripts for services in the
system.
/etc/init.d/xinetd (extended InterNet Daemon) must be running.
Manages all Internet-based connectivity (i.e. ftp, tftp, telnet, …).





Spring 2014
/etc/init.d/xinetd <start|stop|status|restart>
/etc/xinetd.d directory contains the configuration files for all applications
managed by xinetd (i.e. tftp configuration file is here). Included in the
xinetd configuration file.
Each xinetd application has separate file, organized per application for
security reason and allow easier customization.
IP addresses assigned to Host System and assigned to Embedded
System must be on same subnet.
/etc/services file contain the protocol/port number used by a service.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
25
Section 2 Embedded Linux Development
 Linux Boot Process – Host System Requirements
 For /etc/xinetd.d/tftp configuration file, tftp service must be
enabled.
 /etc/xinetd.d/tftp
service tftp {
socket_type
protocol
wait
user
server
server_args
disable
per_source
cps
flags
Spring 2014
= dgram
= udp
= yes
= root
= /usr/sbin/in.tftpd
= -s /opt/tftpboot
= no
= 11
= 100 2
= IPv4 }
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
26
Section 2 Embedded Linux Development
 Linux Boot Process – Host System Requirements

Minicom application to communicate with target system.


USB serial device allows user access, otherwise only root
permission can initialize minicom.




Spring 2014
minicom –s (minicom setup mode).
 Set “BPS to 57600”, “No Flow Control”, “Data Bits 8, Parity
None, Stop Bits 1.
 Set Hardware Flow Control to “No”.
chmod 666 /dev/ttyUSB0 (command in /etc/rc.d/rc.sysinit).
/etc/rc.local has local startup commands.
Cirrus Logic Microcontroller with RS232 serial use Serial-toUSB converter.
NOTE: Cirrus Logic Microcontroller USB not active until after
Linux boots. Bootloader must have USB driver to use during
boot.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
27
Section 2 Embedded Linux Development
Boot Process – Host System
Requirements
 Linux

minicom -s
[configuration]
Filenames and path
File transfer protocols
Serial port setup
Modem and dialing
Screen and keyboard
Save setup as dfl
Save setup as …
Exit
Exit from Minicom
A – Serial Device: /dev/ttyS1  /dev/ttyUSB0
B – Lockfile Location: /var/lock
C – Callin Program:
D – Callout Program:
E – Bps/Par/Bits: 38400 8N1  57600 8N1
F – Hardware Flow Control: Yes  No
G – Software Flow Control: No
Change which setting?
Spring 2014
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
28
Section 2 Embedded Linux Development

Linux In Desktop PC



During powerup, BIOS in host (X86 system) access the hard drive Master
Boot Record.
In MBR is GRUB, Linux bootloader in Linux distributions.
GRUB provides choice to boot one of multiple OS (i.e. Linux or Windows).


GRUB loads Linux Kernel from /boot directory ( contains Linux Kernel(s),
Kernel System Map(s), initrd (initial Ramdisk with drivers), Kernel config
file(s) from Kernel build ).





Spring 2014
/boot/grub/grub.conf contains GRUB configuration file with
menu selection (i.e. which OS) and disk partition containing
Linux Kernel and the root file system.
Initrd is temporary root file system with executables (i.e.
insmod) and drivers to mount the root file system on disk. After
mounting, initrd is unmounted and memory freed.
NOTE: In embedded Linux systems, initrd is the final root file
system.
Linux Kernel starts init process. Init process is the root/parent process of all
other process executing on Linux.
Init process runs script, /etc/rc.d/rc.sysinit.
Init process runs script, /etc/inittab, to execute scripts to start processes
based on the runlevel.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
29
Section 2 Embedded Linux Development

Target System Flash Boot – minicom console

Spring 2014
Power cycle target, when “+” sign on console appear, execute <ctrl> <c> to
interrupt bootloader (Redboot) from continuing with autoboot. The bootloader
prompt “Redboot> ” will appear.
 Redboot> fconfig –l
Run script at boot: true
Boot script:
.. fis load ramdisk
.. fis load zImage
.. exec –r 0x800000 –x 0x300000
Boot script timeout (1000ms resolution): 1
Use BOOTP for network configuration: false
Gateway IP address: 0.0.0.0
Local IP address: 192.168.1.200
Local IP address mask: 0.0.0.0
Default server IP address: 0.0.0.0
DNS servier IP address: 0.0.0.0
Set eth0 network hardware address [MAC]: true
Eth0 network hardware address [MAC]: 0x00:0x00:0x00:0x00:0x4c:0x33
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
30
Section 2 Embedded Linux Development

Target System TFTP Boot – minicom console

Spring 2014
Power cycle target, when “+” sign on console appear, execute <ctrl> <c> to
interrupt bootloader (Redboot) from continuing with autoboot. The bootloader
prompt “Redboot> ” will appear.
 Redboot> load –r –v –b 0x800000 –h 192.168.1.230 ramdisk.gz
 Loads data to the target RAM or flash file system. The IP address of
Redboot (i.e. fconfig Local IP Address) must be in same subnet as tftp
server IP address, 192.168.1.230.
 -r: Raw or binary data. Requires –b option to specify the location in
RAM.
 -v: Display small spinner when the download is in progress.
 -b 0x800000: Address in RAM to load the data. This is the location of
the RAMDisk as configured internally in Redboot.
 -h 192.168.1.230: IP address of the tftp server.
 ramdisk.gz: The name of the file on the tftp server.
 Redboot> fis load zImage
 Flash Image System. Loads the file, zImage, from the FIS directory.
Once loaded, image can be executed.
 Redboot> exec –r 0x800000 –s 0x300000
 Execute the Linux kernel from Redboot internal configuration.
 -r 0x800000: Address in RAM of the RAMDisk (i.e. Root File System).
 -s 0x300000: Length of the RAMDisk image.
SILICON VALLEY UNIVERSITY
CONFIDENTIAL
31
Download