November
1998, Issue 100
Embedded
RT-Linux (Part 1):
General Introduction
RUNNING
SUPPORT
Although
the recommended minimum size for running Linux with
X-Windows is usually 816 MB, its overkill
for running Linux in an embedded system. What is the
minimum configuration we need?
To
run Linux on a PC architecture, we need at least an
i386-class machine because Linux has to run in 32-bit
protected mode. Several embedded 386 boards out
there should run Linux just fine.
In
fact, I was even able to boot and run Linux on my 16-MHz
386SX laptop with 5 MB of memory. It runs fine,
although you probably dont want to compile a program
or run an Xserver on it. But then, thats not the
point of a minimum system.
The
minimum memory configuration to load a standard Linux
kernel and have it be able to do something is 4 MB.
It should be possible to configure and build a minimum
size kernel that should work in about 2 MB.
Now
we have an i386 and 4 MB of memory, what else do we
need? Well, to boot Linux, we need a boot device.
Linux
cant use flash memory as disks, but it can boot
from it. In fact, Linux can load and initialize the
kernel using any kind of boot device the BIOS can handle.
So, its possible to boot Linux from a flash memory
after all, but it cant access the boot flash-memory
disk once its loaded.
You
may ask, what good is it to boot from flash memory if
you cant access the disk after booting? Well,
there are at least two techniques you can use to initialize
an initial RAM disk while booting, and this RAM-disk
image can contain the essentials of whats needed
to run Linux.
What
do we need to run Linux once the kernel has booted?
By incorporating our system into one Linux program,
we can get away with a small set of files. Listing 1
has the details.
Listing
1You need this minimum set of files
to boot Linux and start an application program.
Of course, you need to add more device-driver entries
in the /dev directory if your application needs
to access other devices besides the screen and the
RAM disk.
/lib
/lib/libc.so.5
/lib/ld-linux.so.1
/bin
/bin/sh
/bin/insmod
/etc
/etc/ld.so.cache
/dev
/dev/console
/dev/null
/dev/ram
/dev/systty
/dev/tty1
/dev/tty2
/dev/tty3
/dev/tty4
/linuxrc
|
The
most critical components are the console device entry
/dev/console
and whatever device entries that are needed. Once booted,
the kernel opens and runs whatever program or command
script is contained in /linuxrc. Thats about all
you need for a minimal configuration.
Even
though Linux wasnt designed as an embedded OS,
it ended up having features like small initial size
and capability for RAM disks and modular device drivers.
These features are there because the developers wanted
Linux to be easy to install.
A
single floppy can hold a complete mini-Linux system,
complete with enough utilities to format and initialize
the file system on a hard disk and do a bootstrap install
of Linux from another medium. We can use this to our
advantage by including our embedded applications, instead
of the installation utilities to build an embedded Linux
system.
Now
lets look at a system Ive been using to
play around with embedded Linux. Its based on
Motorolas embedded Pentium SBC, the NLX 55, shown
in Photo 1.
|

Photo 1The
Motorola NLX55 motherboard features a Pentium
MMX CPU, graphics controller, and 10-/100-Mbps
Ethernet controller. Unique to this board, it
also includes a socket for a SanDisk flash-based
ATA card.
|
The
motherboard contains everything needed to build a system
and run an embedded application. It has a 233-MHz Pentium
MMX CPU, slots for two DIMM modules, 10-/100-Mbps Ethernet
controller, dual-IDE controller, floppy control, and
SVGA controller. It also contains a flash-card socket
on the motherboard.
SanDisks
CompactFlash is a flash-based media that contains an
IDE controller on the card itself. To the system, it
looks just like another IDE drive. Motorola also sells
a starter system that includes a case and power supply
as well as a standard IDE drive for development.
With
this system, you can develop embedded applications while
running off the hard disk and build a flash-card module
of our embedded system. Then, just reboot, change the
boot sequence in the BIOS setup, and have the system
boot from the flash card to test your application. Next
month, Ill use it to build a flash card-based
Linux installation.