1. Embedded Linux Training course

DENX Software Engineering GmbH
Kirchenstraße 5
82194 Gröbenzell


2. About This Document

The newest version of this document can be found at http://www.denx.de/twiki/bin/view/Training/GenericOverview.

3. General Introduction

This section gives an overview of who we are and what services we provide.

Contents of this section:

3.1. DENX Company Profile

DENX == two companies:

3.2. DENX People

3.3. DENX Projects

Customer Projects:

Public Projects:

4. General part

This section gives a very general introduction to RTAI-Linux with special regards to the VRTXsa RTOS.

Contents of this section:

4.1. History of Linux (Part One)

4.2. History of Linux (Part Two)

4.3. History of Linux (Part Three)

4.4. History of Linux (Part Four)

4.5. Origin of Free Software

4.6. Licensing Models

4.7. Can Linux handle real-time requirements?

4.8. RTAI-Linux (Part One)

4.9. RTAI-Linux (Part Two)

4.10. Migrating from RTOS (VRTXsa) to RTAI-Linux

4.11. Process model with RTAI-Linux (RTHAL)

4.12. Driver development

5. Host Linux Setup

5.1. Miscellaneous Comments on Host Linux Setup

TFTP Server Configuration

Depending on the version and default configuration your TFTP server may or may not change it's root directory on startup. If that happens the remote host does not need to pass along the directory name as part of the transfer. To avoid confusion in the examples we recommend to make sure that a file name /tftpboot/foo will always work with your TFTP server, no matter if it changes root or not. A simple trick is to create a symbolic link in the TFTP server's root directory to itself, for example:

bash# cd /tftpboot
bash# ln -s . tftpboot
bash# ls -l
lrwxrwxrwx    1 root     root            1 May  3 16:36 tftpboot -> .

If you have to support more than one board it is usually a good idea to create a subdirectory for each board on your TFTP server.

BOOTP / DHCP Server Setup

Recent versions of the DHCP server may require that a ddns-update-style statement is added to the /etc/dhcpd.conf configuration file. Please read the dhcpd.conf manual page for more information.

NFS Server Setup

Recent versions of the NFS server require that either async or sync is used as export option. Using async usually improves performance, but at the cost or reliability (i. e. data can be lost or corrupted). Therefore we recommend to always use sync only.

6. Using the BDM/JTAG Debugger, BDI2000, Part 1

6.1. BDI2000 Installation and Configuration

6.1.1. Build Linux command line config tool:

bash$ cd gdbcop21-1.16-6xx-7xx-82xx-2003-04-01
bash$ mkdir bdisetup
bash$ cd bdisetup
bash$ unzip ../bdisetup.zip 
Archive:  ../bdisetup.zip
  inflating: bdidll.c    
  inflating: bdisetup.c
  inflating: bdicmd.h
  inflating: bdidll.h
  inflating: bdierror.h
  inflating: makefile
  inflating: bdicnf.c
  inflating: bdicnf.h
bash$ make
gcc -O  -c -o bdicnf.o bdicnf.c
gcc -O  -c -o bdidll.o bdidll.c
gcc -O  -c -o bdisetup.o bdisetup.c
gcc -o ./bdisetup ./bdicnf.o ./bdidll.o ./bdisetup.o   -s
bash$ cp -p bdisetup /usr/local/bin/bdisetup

6.1.2. Usage:

bash$ bdisetup 
Usage of BDI setup program V1.10:
bdisetup -v [-pP] [-bB] [-s]
  -v  Read current versions
   P  Port e.g. /dev/ttyS0
   B  Baudrate 9, 19, 38, 57 or 115
  -s  if present, exit loader and start firmware

bdisetup -e [-pP] [-bB]
  -e  Erase firmware and logic
   P  Port e.g. /dev/ttyS0
   B  Baudrate 9, 19, 38, 57 or 115

bdisetup -u [-pP] [-bB] [-aA] [-tT] [-dD]
  -u  Update firmware and/or logic
   P  Port e.g. /dev/ttyS0
   B  Baudrate 9, 19, 38, 57 or 115
   A  Application type STD,GDB,ADA,TOR,ACC
   T  Target type: PPC400,MPC500,PPC600,PPC700,MPC800,MPC8200,MPC7400,MPC7450
   D  Directory with the firmware/logic files

bdisetup -c [-pP] [-bB] [-iI] [-hH] [-mM] [-gG] [-fF]
  -c  Program network configuration
   P  Port e.g. /dev/ttyS0
   B  Baudrate 9, 19, 38, 57 or 115
   I  BDI IP address e.g.
   H  Host IP address
   M  Subnet mask (default:
   G  Gateway IP address (default:
   F  Configuration file name

6.1.3. Example: Install firmware for MPC82xx processors

(Note: this is a simple tool. It does not perform any device locking, so root permissions are required to access the serial port.)

bash# bdisetup -u -p/dev/ttyS0  -b115 -aGDB -tMPC8200 -d.
Connecting to BDI loader
Firmware is already up to date
CPLD is already up to date

6.1.4. Setting Configuration Parameters:

bash# bdisetup -c -p/dev/ttyS0 -h10.0.0.11 \
> -i10.0.0.10 -m255.0.0.0 -f/tftpboot/ATC/ATC.cfg
Connecting to BDI loader
Writing network configuration
Writing init list and mode
Configuration passed
bash# bdisetup -v -p/dev/ttyS0 -b115 -s
BDI Type : BDI2000 Rev.C (SN: 93202220)
Loader   : V1.05
Firmware : V1.16 bdiGDB for PPC6xx/PPC7xx
Logic    : V1.02 PPC6xx/PPC7xx
MAC      : 00-0c-01-93-20-22
IP Addr  :
Subnet   :
Gateway  :
Host IP  :
Config   : /tftpboot/ATC/ATC.cfg

6.1.5. Quick Test:

bash$ telnet bdi
Connected to bdi.denx.de (
Escape character is '^]'.
BDI Debugger for Embedded PowerPC

PHYS  <address>              converts an effective to a physical address
MD    [<address>] [<count>]  display target memory as word (32bit)
MDD   [<address>] [<count>]  display target memory as double word (64bit)
MDH   [<address>] [<count>]  display target memory as half word (16bit)
MDB   [<address>] [<count>]  display target memory as byte (8bit)
DUMP  <addr> <size> [<file>] dump target memory to a file
MM    <addr> <value> [<cnt>] modify word(s) (32bit) in target memory
MMD   <addr> <value> [<cnt>] modify double word(s) (64bit) in target memory
MMH   <addr> <value> [<cnt>] modify half word(s) (16bit) in target memory
MMB   <addr> <value> [<cnt>] modify byte(s) (8bit) in target memory
MC    [<address>] [<count>]  calculates a checksum over a memory range
MV                           verifies the last calculated checksum
RD    [<name>]               display general purpose or user defined register
RDUMP [<file>]               dump all user defined register to a file
RDSPR <number>               display special purpose register
RDSR  <number>               display segment register
RDVR  [<number>]             display vector register
RM    {<nbr>|<name>} <value> modify general purpose or user defined register
RMSPR <number>   <value>     modify special purpose register
RMSR  <number>   <value>     modify segment register
RMVR  <nbr><val val val val> modify vector register (four 32bit values)
DCACHE <addr | set>          display L1 data cache content
UPMS  <MCR-addr> <MDR-addr>  set address of register MCR and MDR
UPMA                         display UPMA setup
UPMB                         display UPMB setup
BOOT                         reset the BDI and reload the configuration
RESET [HALT | RUN [time]]    reset the target system, change startup mode
BREAK [SOFT | HARD]          display or set current breakpoint mode
GO    [<pc>]                 set PC and start target system
TI    [<pc>]                 trace on instuction (single step)
TC    [<pc>]                 trace on change of flow
HALT                         force target to enter debug mode
BI  <addr>                   set instruction hardware breakpoint
CI  [<id>]                   clear instruction hardware breakpoint(s)
BD  [R|W] <addr>             set data watchpoint via DABR (DABR[BT]=0)
BDT [R|W] <addr>             set data watchpoint via DABR (DABR[BT]=1)
CD  [<id>]                   clear data watchpoint(s)
INFO                         display information about the current state
LOAD   [<offset>] [<file> [<format>]] load program file to target memory
VERIFY [<offset>] [<file> [<format>]] verify a program file to target memory
PROG   [<offset>] [<file> [<format>]] program flash memory
                                      <format> : SREC, BIN, AOUT or ELF
ERASE  [<address> [<mode>]]  erase a flash memory sector, chip or block
                   <mode>  : CHIP, BLOCK or SECTOR (default is sector)
ERASE  <addr> <step> <count> erase multiple flash sectors
UNLOCK <addr> <step> <count> unlock multiple flash sectors
FLASH  <type> <size> <bus>   change flash configuration
HOST   <ip>                  change IP address of program file host
PROMPT <string>              defines a new prompt string
CONFIG                       display BDI configuration
HELP                         display command list
QUIT                         terminate the Telnet session

*** TARGET: Init JTAG communication failed
# PPC: target has no power
*** TARGET: target powerfail detected
- TARGET: waiting for target Vcc
- TARGET: waiting for target Vcc
- TARGET: waiting for target Vcc
Connection closed by foreign host.

6.2. U-Boot Download Details

6.2.1. Find out where to download to (memory map)

6.2.2. Find out how flash memory is structured (erase blocks)

6.2.3. Use BDI2000 to erase flash and program the image

6.2.4. Fine tuning the BDI2000 config file

7. Connecting to target for the first time

8. DENX Embedded Linux Development Kit ELDK

Introduction to the ELDK

9. Building U-Boot and the Linux kernel for the first time

10. Booting Embedded Linux on the target

Booting Embedded Linux on the target

11. The powerful U-Boot command line interface

The powerful U-Boot command line interface

11.1. U-Boot Tips and Tricks: preboot, update, etc.

This variable can be used to run specific code before the normal startup (i.e. CONFIG_BOOTDELAY loop, autostart or interactive mode) begins. This is especially useful when its contents are generated automatically, i.e. by checking for keypresses, etc.

[todo: explain update procedures using U-Boot]

Loading Compressed Images
Sometimes you may want to store some data in compressed format (for example to save flash memory), while your application needs the data in uncompressed form. You can trick U-Boot to do this uncompressing like this:

Generate a compressed U-Boot image of type "standalone" (="mkimage ... -T standalone -C gzip ..."=) and make sure that the envrionment variable autostart is set to no (i. e. enter "setenv autostart no;saveenv"). If you then use "bootm" for such an image, U-Boot will uncompress the contents of the image and store it at the "load address" ("-a" option for mkimage), but not attempt to start it yet. If the image contains executable code, you can omit the setting of "autostart", and U-Boot will automagically start the image by jumping to the entry point address ("-e" option for mkimage).

12. Build, configuration of the Linux kernel, more details

Build, configuration of the Linux kernel, more details

13. SELF, Simple Embedded Linux Framework (RAMdisk)

14. Using FLASH filesystems

Using FLASH filesystems

14.1. (Memory Technology Devices) Tools

The current version of the ELDK does not include all tools provided by the MTD package. For example, you might find that the mkfs.jffs2 tool is missing. If you want to create a JFFS2 target filesystem on your development host you have to download and build the tool yourself:

  1. Download the MTD tools from the public CVS server:
    bash$ cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login
    Logging in to :pserver:anoncvs@cvs.infradead.org:2401/home/cvs
    CVS password: anoncvs
    bash$ cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co -P mtd
    cvs server: Updating mtd
  2. Build the mkfs.jffs2 tool:
    bash$ cd mtd/util
    bash$ make mkfs.jffs2

15. Compact Flash Card Support, PCMCIA, Hotplug, IDE

Compact Flash Card Support, PCMCIA, Hotplug, IDE

16. Installing and using Embedded WEB Servers

17. Customizing U-Boot

Customizing U-Boot

18. General Debugging Techniques

General Debugging Techniques

19. RTAI, the Real Time Application Interface

19.1. Installation and Configuration

20. Linux Trace Toolkit

21. Tools, Scripts, Tipps and Tricks

There are quite a few scripts/tools out there that will help in automatically generating a toolchain, a root filesystem, a ROM image, and other components of an embedded Linux system.

This is a collection of such tools, scripts, tipps and tricks:

[From: Karim Yaghmour et. al. on the etux mailing list.]

22. More information

Pointers to more information are colleted in the DULG document in the MoreIformation topic.

23. Happy Hacking

Well, that's all for now folks.

Happy Hacking! and may the source be with you.