Etlinux documentation
Here there are the first two chapter of the future full documentation:
Etlinux architecture
Etlinux
is a minimal linux system, so it's not too
different from a standard unix machine, apart from few
significant differences. We'll concentrate on the
description of those areas where
etlinux
peculiarities are more relevant.
Overview
Some key aspects of etlinux architecture are its modified
linux
kernel
and its
booting
process
.
The kernel, compared to a standard linux one, has some
modifications, made to lower its memory requirements. For
example, the VGA console support has been made optional,
and the size of some internal structures have been
reduced, taking into account the typical needs of an
embedded platform. However we retained all its
functionality.
As anticipated before, another key
point in reducing the footprint of the system, has been
the customization of the booting process. To accomplish
this task, we rewrote
init
and the other
parts involved using the popular interpreted language
Tcl
. The approach of
using a scripting interpreted language has the advantage
of eliminating the need for a full featured init, which
for an embedded system is unnecessarily complex and big,
and it makes possible to avoid the inclusion of a
classical shell, otherwise necessary to execute
initialization scripts and as command line interface.
The Tcl language engine
Tcl
has many
desirable characteristics for an embedded system. It is
lightweight, has a very simple syntax and it is possible
to add new commands in C with little effort. And it is
usable in an interactive manner, thus acting as a command
line interface.
Tcl
is very easy to
learn, for more information please refer to its
documentation.
Tcl
version
included in
etlinux
has been extended with some
internal commands useful in an embedded environment. For
example we added Tcl equivalents for some common syscalls
and services:
sys_dup
,
sys_exec
,
sys_fork
,
sys_kill
,
sys_nice
,
sys_pipe
,
sys_reboot
,
sys_sync
,
sys_wait
,
sys_chmod
,
sys_umask
,
sys_mknod
,
inp
,
inw
,
outp
,
outw
,
setleds
,
mount
,
umount
,
uudecode
,
uuencode
,
time
,
ifconfig
,
route
,
udp
. The introduction of these
commands allowed the rewrite of the initialization scripts
in pure Tcl, avoiding the inclusion of large binary
programs.
The boot process
The first steps of the booting process of
etlinux
are exactly the same as in a classical linux machine. The
BIOS provides a first stage boot loader, loading and
executing
lilo
boot code, which resides
at the beginning of the boot device. Then lilo takes care
of loading the
kernel
in memory and
passes control to it. The kernel initializes the hardware
and its internal structures, the executes the
init
process.
Init
init
is a process running in user
space. It is the first user process executed and it's
responsible for the creation and execution of all other
processes. Normally it runs a series of procedures
necessary to complete the setup of the system, like
starting requested services.
As we noted before, etlinux init is written in
Tcl
, so it is easy to
study or modify. We'll describe here the essential steps
performed by init on etlinux:
-
A file containing general options is read.
-
The root filesystem is checked for errors.
-
The root filesystem is remounted read/write.
-
The
/proc
filesystem is mounted.
-
An eventual swap partition is activated.
-
All remaining filesystems are checked and mounted.
-
Some kernel parameters are tuned to lower memory usage.
-
Temporary directories are cleaned.
-
Kernel modules are loaded in memory.
-
User initialization scripts in
/etc/init.d/scripts
are executed. These scripts must have a filename prefixed with S
nn
, where
nn
is a number between 00 and 99 indicating the order of execution.
-
The system perform an interactive configuration.
-
User applications, residing in
/etc/applications
are finally started. All tcl scripts residing in this directory are launched by init. Included here are a small webserver and a telnet daemon.
Installing etlinux
Overview
Etlinux
is both an Operating System distribution and a
development environment. Typically, the Operating System will
run on an embedded platform, while the development environment
will be used on a workstation. We'll call the former platform
the
target
system, and the latter the
host
system.
Preparing the host system
The host system has to be a linux machine, with
glibc
2.x
. The development environment requires the following
tools to work properly:
Please, make sure you have all of the above tools before
starting the installation of the kit. At this point,
installing the development environment is simply a matter
of decompressing two archives and setting up the proper
environment variables. This is accomplished by the
following procedure:
-
Choose a suitable directory
dir
-
Change directory, jumping into
dir
-
Extract the
etlinux
development kit file
etlinux-1.2-src.tar.gz
or
etlinux-1.2-pkg.tar.gz
-
Extract the etlinux-ide archive file:
etlinux-ide.tar.gz
-
Modify the startup script that set the environment variables on your machine (if using Bash,
/etc/profile
for a system wide installation, or
$HOME/.bash_profile
for a single user installation), adding the etlinux-ide directory to the PATH
Actual steps will resemble:
cd dir
tar xvfz etlinux-1.2-src.tar.gz
tar xvfz etlinux-ide.tar.gz
... edit your startup script ...
Regarding this last point, if you are using the bash
shell, you'll need to add at the end of the script a
fragment like this:
PATH=$PATH:dir
export PATH
Installing on the target system
Etlinux
target system can be based on a classical
storage device, like an HD, or on M-Systems
DiskOnChip.
It is possible to create a root filesystem for the target
either by using a prepackaged one, such as
etlinux-root-1.x.y.tar.gz
, available on
ftp://ftp.prosa.it/pub/etlinux/
or
http://www.prosa.it/etlinux/download.html
,
or by creating a custom one by means of etlinux package
system. Here we'll examine only the first
option.
Installing on an HD-based target system
It is necessary to have access to the target HD from a
linux system.
To create the root filesystem from the file
etlinux-root-1.x.y.tar.gz
on the , follow the
steps:
-
Mount the target HD on the host workstation.
-
Boot the workstation.
-
Format the target HD as minix and mount it. Supposing the target HD an IDE disk as slave on the first IDE channel (
/dev/hdb1
):
-
Decompress
etlinux-root-1.x.y.tar.gz
on the target partition. Supposing you have
etlinux-root-1.x.y.tar.gz
in your home directory, do:
-
tar xvfz ~/etlinux-root-1.x.y.tar.gz
-
Run
lilo
in order to allow the target system to boot off HD:
-
/sbin/lilo -C /etc/lilo-hd.conf -r /mnt
-
Then halt the workstation, power it off, and remove the hard disk. Plug the hard disk in the target system and boot it.
Installing on a DiskOnChip-based target system
The root filesystem for the target must be created from a
linux workstation with a DiskOnChip socket and DiskOnChip
kernel support. A kernel with DiskOnChip support can be
downloaded from
ftp://ftp.prosa.it/pub/etlinux
.
To create the root filesystem from the file
etlinux-root-1.x.y.tar.gz
on the DiskOnChip, follow the
steps:
-
Install the kernel with DiskOnChip support on the workstation.
-
Create the nodes in /dev for the DiskOnChip:
-
Power off the workstation.
-
Put the DiskOnChip for the target system into the socket.
-
Boot the workstation.
-
Format the DiskOnChip as minix and mount it:
-
Decompress
etlinux-root-1.x.y.tar.gz
on the DiskOnChip. Supposing you have
etlinux-root-1.x.y.tar.gz
in your home directory, do:
-
tar xvfz ~/etlinux-root-1.x.y.tar.gz
-
Run
plilo
in order to allow the target system to boot off DiskOnChip\:
-
sbin/plilo -C lilo-doc.conf -r /mnt
-
Then halt the workstation, power it off, and remove the DiskOnChip. Plug the DiskOnChip in the target system and boot it.