
1.4. SOFTWARE
21
The command help will list the built-in shell commands.
An important file is /etc/rc, the start-up file, which is shown in Listing 1.4. If
you want to change the start-up behavior of µClinux this the file to change. In a
running µClinux this file resides in a non-writable file system. A new system must be
recompiled on a host computer, downloaded over the serial port and flashed to the flash
memory. It is very unlikely that you have to do this in the course of this lab series.
Listing 1.4: µClinux configuration file /etc/rc
# ! / b i n / sh
#
s e t e n v PATH / b i n : / s b i n : / u s r / b i n
hostname b e n d e r
#
mount −t p r o c none / p r o c
#
/ b i n / e x pand / r a m fs 5 12 . img / dev / ram1
mount −t e x t 2 / dev / ram1 / v a r
mk d ir / v a r / l o g / v a r / l o g / boa / v a r / l o c k / v a r / tmp / v a r / r u n
chmod 777 / v a r / tmp
#
/ b i n / e x pand / r a m fs8 1 9 2 . img / dev / ram2
mount −t e x t 2 / dev / ram2 / mnt
mk d ir / mnt / b i n
# S e t up t h e w e b s e r v e r s t u f f
mk d ir / mnt / h t d o c s
cp / misc / ∗ / mnt / h t d o c s
mk d ir / mnt / h t d o c s / c gi −b i n
# B r i n g up t h e l o c a l i n t e r f a c e
/ s b i n / i f c o n f i g l o 1 2 7 . 0 . 0 . 1
/ s b i n / r o u t e add −n e t 1 2 7 . 0 . 0 . 0
# S e t IP a d d r e s s f r om c o n f i g u r a t i o n d a t a i n f l a s h
/ s b i n / s e t i p
# S t a r t t h e web s e r v e r
/ s b i n / boa −d &
Running programs under µClinux
We demonstrate how to run a program in the µClinux environment by an example.
The program, shown in Listing 1.5, displays the contents of a Special Purpose Reg-
ister (SPR). It uses inline assembler to read a register. We use the Makefile shown in
Listing 1.6 to compile the program shown in Listing 1.5. The flags -r and -d to $CC
are important, otherwise the program will not execute.
Commenti su questo manuale