Personal tools
You are here: Home EGO ITF Software Support&Maintenance Board PC104 Linux installation
Navigation
Log in


Forgot your username or password?
 
Document Actions

Board PC104 Linux installation

by Franco Carbognani last modified 2008-03-06 11:02


Report from PC104 Linux installation done by Jean-Marie in 2002



Preliminary tests


1. I prepared a "rescue" floppy (a minimal Linux system on a floppy)
   downloading Leka (http://www.leka.net/)

2. I configured the set-up to start from this floppy (instead of the built-in
   SSD)

3. It started correctly.

4. I ran "netconfig" and chose the "rtl8139" adapter, with no special
   parameter. The network interface was correctly detected.

5. I ran "ipconfig"ipconfig with the "eth0" default and the "dhcp" default
   and the network was up.

6. It worked even better with the "tomsrtbt" rescue floppy
   (http://www.toms.net/rb/) the network
   card was automatically detected and the interface was automatically
   configured.

Network boot


7. In view of a full network boot (kernel loading with DHCP, root file
   system loading with NFS),
   I then prepared a custom kernel, starting from the standard configuration
   kernel-2.4.7-i386-BOOT.config, adding all the necessary options
   that are recommanded in the Etherboot documentation, that is

   "You will almost certainly have to compile a custom kernel because the
   kernel needs to have the "Root file system on NFS" option compiled
   in. (You need to select "NFS filesystem support" as built-in, not a
   module, and possibly also "Kernel level autoconfiguration" before
   this option will appear.) You should also select "BOOTP support"
   and/or "DHCP support". "RARP support" is not needed. In 2.2 kernels
   you have to enable the "Kernel level autoconfiguration" option under
   IP networking to access the BOOTP support question. And unless you
   are using an initrd (initial ramdisk) you will have to compile in
   the driver for your network card too. For details, see the file
   /usr/src/linux/Documentation/nfsroot.txt in a Linux kernel source
   distribution."

   Note: I used the kernel sources for the 2.4.7-10 version.

   Actually, I could not do the final step ("make install;
   make modules_install") because
   the modules would have been installed on the server directory.
   So I skipped this step.
   This provoked a few error messages on the board, but did not prevent
   the completion of the boot.
   I performed it on the board after the first boot.
   Actually, I discovered later that I could have done it right away
   just by modifiying a the INSTALL_PATH macro in the Makefile...

8. I had then to install the Etherboot package (http://www.etherboot.org/)
   But in order to compile it
   I had first to install "kgcc" (the kernel compiler) and to edit the
   src/Config file to replace "gcc" with "kgcc" (the config file contains
   gcc because gcc is accepted except for the 2.96 version of gcc, which is
   unfortunately the one which is on the server).
   To make the software I just had to type "make"...
   To put it on a floppy I just had to type "make bin32/rtl8139.fd0"
   Note: There is a configuration file called "NIC" which contains hardware
 To put it on a floppy I just had to type "make bin32/rtl8139.fd0"
   Note: There is a configuration file called "NIC" which contains hardware
   addresses. If the addresses are wrong, the network boot might work from
   a floppy but not from ROM. Actually, I did not modify it and everything
   worked anyway.

9. I had then to install the "mknbi" package (provided on the Etherboot site)
   ("make" and "make install" are enough").
  
10. Then, I make a network bootable image (a "tagged kernel")
    with the simple command
    mknbi-linux --ip="rom" --output=/tftpboot/vmlinuz.xterm \
    /usr/src/linux-2.4.7-10/arch/i386/boot/bzImage

11. On the server side (cmpl2), I installed the standard RH 7.2 packages
    tftp-server and dhcp.
    No configuration was needed for tftp, but some configuration was needed
    for dhcp. See the file /etc/dhcpd.conf
    One important configuration is the "file" parameter for "cmpl2", which
    is precisely the network bootable image prepared in the previous step.
    Here is /etc/dhcpd.conf
    ...........................................
    subnet 193.205.75.0 netmask 255.255.255.0 {
      filename "vmlinux.eurotech";
      option domain-name-servers 193.205.75.31;
      option domain-name "virgo.infn.it";
      option subnet-mask 255.255.255.0;
      option route rs 193.205.75.1;
      option broadcast-address 193.205.75.255;
    }
   
    host ipc0a {
      hardware ethernet 00:e0:c7:07:19:94;
      fixed-address 193.205.75.126;
      option host-name "ipc0a";
    }
    ...........................................
    Note: The "filename" directive is in the common section (which will be
    used by all the machines in the subnet 193.205.75.0 which will be
    referenced in "host" sections.
    This file is supposed to be in "/tftpboot/" (actually the TFTP daemon
    is started with the "-s" argument which makes a "chroot" to "/tftpboot",
    so we do not have to specify the full path "/tftpboot/vmlinux.eurotech").
  
12. I started the RealTech with the floppy prepared at step 8 and it booted
    correctly. Of course it stopped because there was no root filesystem!
  
13. I prepared the root filesystem.
    In general, one selects carefully the items to be included in this
    filesyste, but I decided to put everything that was on the server,
    with a few exceptions.
    As this root filesystem is supposed to be shared by many boards, I
    proceeded this way.
    a) I created an image of the server root directory under
       /tftpboot/eurotech, with the following directories:
       bin dev etc lib root sbin usr var
       which I copied (with "cp -a")
    b) I created empty directories for
       home mnt proc tmp
       with permission "1777" for /tmp
    c) In order to prevent the boot sequence from running "fsck", I created
       the file "/tftpboot/eurotech/fastboot" and made it unamovible with
       "chattr +i /tftpboot/eurotech/fastboot"
    d) Then I created the directory "/tftpboot/ipc0a"
       Note: This is the directory which is considered as the board
       root filesystem in the context of a network boot.
    e) I created there empty directories for
       home mnt proc tmp
       with permission "1777" for /tmp
 f) I made an "smart" copy of the eurotech bin, lib sbin and usr
       directories. "Smart" means doing "hard links" instead of copying,
       which saves a lot of space.
       This can be done with the pipe "find bin -print | cpio -pl ../ipc0a"
    g) I made a plain copy of the eurotech dev, etc, root and var
       directories (as each board must have its own copy)
    h) I edited the /etc/sysconfig/network,
       /etc/sysconfig/network-scripts/ifcfg-eth0, fstab and modules.conf
       to tailor them for this specific board.
    i) And that was it...

14. I copied the floppy on the SSD.
    I prepared a "naked" DOS boot disk ("naked" means that the "config.sys"
    and the "autoexec.bat" files were nearly empty (without for instance
    "HIMEM.SYS" and other memory managers, with mouting CD-ROMS etc).
    I added to this floppy the "btool.exe" program which I took from the
    Eurotech site (it is in the
    "ftp://ftp.eurotech.it/Products_Eurotech/CPU_1432/CPU_1432_bios.zip"
    file)
    I started the board with this floppy and at the prompt I entered
    ........
    btool /da
    ........
    I was asked to enter the image floppy. I inserted the one which I had
    prepared previously and, after a key press, it was copied in the "SSD"
    part of the Flash-Rom.
    There were many messages informing about the progress of the copy.
    The copy ended with an error, but I guessed that the error was not serious
    (probably due to the fact that my floppy had been prepared on Linux!)
    and I went on.
    I restarted the board and configured the setup to start from the
    SSD and everything went fine.

15. I was even able to start X-Window (with a very poor resolution...)
    I just configured it with the command "XFree86 -configure" and that
    was it!

Local boot


15. Now the goal was to be able to start in "stand-alone" mode from the
    32 MB memory disk provided on the board.
    This was a big challenge because there is no distribution intended for
    such a case: there are standard distributions which require at least
    128 MB and on the other side minimal distributions wich can boot from
    a floppy. The drawback with these minimal distributions is that they
    are very poor, mainly intended as "rescue" solutions (with only the
    utilities needed to repair filesystems).
    As the goal was to be able to run in stand-alone mode applications prepared
    on a standard workstation, the natural requirements were to have a
    standard kernel and to use standard shared libraries.
    The only solution that I found for this was to use the "mindi"
    distribution (http://www.microwerks.net/~hugo/mindi/index.html):

    "Mindi builds boot/root disk images using your existing kernel, modules,
    tools and libraries. So long as your kernel is smaller than about 1.2MB,
    Mindi should be able to build a boot/root disk set from almost any Linux
    distribution you might be running. Even if the kernel is bigger than that,
    Mindi can still generate a bootable CD image for you."

    Of course, I started by preparing the hard disk with the "fdisk" utility
    to create a /dev/hda1 partition and (code: 83 for ext2), commands "n"
    (for "New partition") and "w" (for "Write and exit")

    Then I created the filesystem with mkfs. I accepted the default values,
    among which having only 8000 inodes. Later I realized that this was not
enough (I had "Filesystem full" errors though "df" showed only a 50%
    occupation). So I had to backup everything and to remake it using the
    "-N" option of "mkfs" (in fact of "mke2fs"). I switched from 8000 to
    32000, which was probably exagerated (I lost at least 5 MB of data
    space...)

16. I downloaded Mindi, untarred it in a temporary directory and installed it
    with "./install.sh".
    Starting from here, the temporary directory can be deleted as everything
    happens in the  /usr/local/share/mindi/ directory.
    Note: I did not know that at first and it took me some time to understand
    why my configuration changes (made in the temporary directory) were not
    taken into account...

17. I started with the default configuration file. A few pieces were missing.
    For instance I had to upgrade the syslinux package to the 1.75-3 version
    (available on Raw Hide).
    Another mistake was to simply "su" to root: I had not "/sbin" and
    "/usr/sbin" in the path. So instead I did "su -".
    The standard configuration produced one boot disk and three data disks.
    They worked right away: I could boot from the four floppies.
    Note: By chance, I had generated them on my PC which has a
    2.4.9-34 kernel. I tried it later on another PC with the 2.4.7-10
    kernel and it did not work.

    The main trick used by mindi (and by other mini distributions is to
    use "BusyBox", "The Swiss Army Knife of Embedded Linux"
    (http://www.busybox.net/):

    "BusyBox combines tiny versions of many common UNIX utilities into
    a single small executable. It provides minimalist replacements
    for most of the utilities you usually find in GNU fileutils,
    shellutils, etc. The utilities in BusyBox generally have fewer
    options than their full-featured GNU cousins; however, the options
    that are included provide the expected functionality and behave
    very much like their GNU counterparts. BusyBox provides a fairly
    complete POSIX environment for any small or embedded system."

    More specifically, BusyBox is a 250K executable which acts as a
    replacement for the following utilities:
    ash cat chgrp chmod chown chroot cp df dmesg echo false fdflush gunzip
    gzip kill ln loadkmap ls mkdir mknod mktemp more msh mv pidof ps pwd rm
    rmdir sed sh sh.busybox sleep stty sync sync.busybox tar touch true
    umount uname update vi zcat halt insmod loadkmap lsmod makedevs
    modprobe poweroff reboot rmmod swapoff swapon syslogd update
    Note: The help for all these "light" commands is in
    http://www.busybox.net/downloads/BusyBox.html

18. I decided to use the extension mechanism proposed by mindi to add
    a few utilities, mainly everything regarding the network.
    I simply uncommented the "ifconfig" and "lc" lines from the
    "deplist.txt" file (and commented all the lines of the
    "deplist.removed" file, though I am not sure this was needed),
    and added a line with the required network driver
    /lib/modules/2.4.9-34/kernel/drivers/net/8139too.o
    This took me to 5 floppies instead of 3.

19. The problem with mindi is that it is only intended for booting from
    floppies: it creates everything in memory. I wanted to be able
    to boot from the memory disk.
    So I simply mounted the /dev/hda1 disk and transferred everything from
    the ramdisk filesystem to the memory disk.

20. In order to be able to boot from the disk, I needed to make a boot
    sector. As lilo was not among the utilities provided in the standard
 Mindi distribution, I restarted the board in NFS mode, mounted the
    memory disk, I copied there
    /sbin/lilo, I prepared there a /boot directory, I prepared there
    a /etc/lilo.conf file, I chrooted to the mount point of the memory disk
    and ran lilo.
    Note: If I had included lilo in my distribution, I could probably have
    done this step directly from the disk...
    Note: The boot directory contains the following files System.map-2.4.9-34,
    kernel.h-2.4.9, module-info-2.4.9-34, vmlinuz-2.4.9-34 and their
    standard symbolic links, plus other files boot.0300, boot.b, chain.b
    map, message, os2_d.b.

21. I restarted the board (after having configured the setup to boot from
    the disk). The kernel started and fired the "init" program... which asked
    me to insert the floppies.
    I then understood that the "init" provided by mindi was not a standard
    init...
    So, I simply overwrote it with a standard init.

22. I replaced the "init" provided with mindi with the standard "init".
    First I had to remake a few symbolic links in the /etc directory.
    For instance /etc/rc.sysinit -> /etc/rc.d/rc.sysinit and (I am not
    sure) /etc/init.d -> /etc/rc.d/init.d
    Also all the /etc/rc1.d -> /etc/rc.d/rc1.d and /etc/rc -> /etc/rc.d/rc
    and /etc/rc.local -> /etc/rc.d/rc.local
    I also replaced all the "rc.d" directory provided by mindi with a
    standard directory.
    I rebooted from the disk, saw thousand of error messages on the screen
    and was unable to obtain a prompt.

23. The only trick which I found to be able to read the error messages was
    to insert "sleep" instructions between each block of the
    /etc/rc.d/rc.sysinit script.

24. I could see that actually a few important executables were not present
    in the distribution. So I added them manually:
    * /bin/hostname (I replaced the link to busybox with the standard binary,
      because the busybox version was always saying "Applet not found")
      which means that the "hostname" implementation does not exist in BusyBox.
    * /bin/egrep (was needed somewhere in the initialisation scripts)
    * /bin/ipcalc (was needed by the network scripts)
    * /sbin/arping (was needed by the network scripts)
    * /sbin/fsck and /sbin/fsck.ext2 (was needed by the initialisation script
      before remounting the / in read-write mode)
    * /sbin/init (to replace the mindi floppy-oriented init)
    * /sbin/lilo (to be able to write the boot sector)
    * /sbin/insmod, /sbin/lsmod, /sbin/modprobe, /sbin/rmmod (to facilitate
      the identification of the network driver)
    * /sbin/mingetty (needed by the standard /etc/inittab)
    * /sbin/mkkerneldoth, /sbin.consoletype, /sbin/getkey, /sbin/hwclock,
      /sbin/initlog, /sbin/killall5, /sbin/pidof, /sbin/runlevel,
      /sbin/sulogin, /sbin/sysctl
      (were needed somewhere in the initialisation scripts)
    * /sbin/shutdown (I thought that would allow to make a clean shutdown,
      but first it seems necessary to solve the "stop" scripts problem.
    * pam_console_apply (I though that this was needed to solve the login prompt
      problem (see below) but it did not help. It certainly can be removed.
    * I had a problem shutting down the system. I thought that it was due
      to the busybox version of halt, poweroff and reboot, so I removed
      the BusyBox links, copied a standard "halt" and put symbolic links
      from "reboot" and "poweroff" to "halt".

25. I had to modifiy also other files
    * As for the "lib" directory, the only change was the addition of the
      network driver 8139too.o in /lib/modules/2.4.7-10/kernel/drivers/net
    * As for the "usr" directory, the only change was the addition of the
      terminfo/l directory. Actually I did not do it so I think that it
 was automatically created.
    * As for the /etc directory, there were numerous changes.
      - I suppressed the "conf.modules" file, which was in conflict with
        the "modules.conf" file
      - I edited the "modules.conf" file to select the right network module
        as an alias.
      - I have edited the /etc/fstab file
      - I have edited the /etc/group file to add a "utmp" group (needed
        somewhere in the initialisation script)
      - I have edited the /etc/host file
      - I have made symbolic links needed by the initialisation script
        init.d -> rc.d/init.d, rc.sysinit -> rc.d/rc.sysinit
      - I have added the inittab file
      - I have modified the /etc/passwd file and added a /etc/shadow file
        (hoping, to no avail, that it would solve the login prompt problem)
      - I have replaced all the contents of the rc.d directory with a
        standard one
      - I have modified the "ifup-post" and "ifdown-post" scripts to help
        them find the file "network-functions" (as the shell was unable
        to keep the "." in $PATH
   
26. As the "/etc/init.d/network start" script was unable to load automatically
    the "8139too.o" module for the network card, I understood that the
    "insmod" binary from BusyBox was not powerful enough. I then removed
    the "insmod, lsmod, rmmod, modprobe" links to busybox, copied "insmod"
    from a standard distribution, and made lsmod, rmmod, modprobe as
    symbolic links towards insmod. Then "/etc/init.d/network start"
    worked correcty.
   
27. Actually, I had also problems with the "ifup-post" and "ifdown-post"
    scripts which are called at a third level by /etc/init.d/network start:
    they were unable to find the script "network-functions", though they
    were in the right directory. I understood that this was due to a "PATH"
    variable problem: the "." directory was missing in it.
    As I could not find a way to set it correcty with the BusyBox version
    of "sh" (I could set it for the present shell, but it disappeared after
    each "exec"; I would have needed to set it in a "ashrc" file... I did
    not try /etc/profile but maybe it would have worked).

28. There are a few problems remaning
    * The "swapon" command in the rc.sysinit script is not executed because
      this script uses a flag unknown to the busybox version.
      I have suppressed this flag.
      Anyway, this is not a problem as we do not use swap.
    * There is a problem with a sed command inside the script mkkerneldoth
      (to determine the kernel type from the output of "uname -r").
      This is due to the fact that the BusyBox version of sed misses
      a few functionalities.
      I have simply sent the error output of this command to /dev/null
      (in /etc/rc.sysinit)
    * The only possible run level is 1 (single user). I tried to install
      run level 3 (multi user), but that required importing so many binaries
      and so many libraries that the filesystem was beginning to be full.
      So I thought it was better to stick to run level 1.
    * We have an error message during the initialisation about the line
      in /etc/fstab about /dev/floppy. Nevertheless we can read "ext2"
      floppies.
    * I have not been able to have the CD-ROM drive recognized, nor the
      mouse.

Conclusion


29. The net result of this operation is that we have a fully-fonctional
    system, network capable and with 10 MB available for applications.
    This space could be increased maybe up to 15 MB just by reducing the
    number of inodes to 16000 instead of 32000.
 Moreover maybe some more room could be made by removing some useless files.

    This system is also able to do a full network boot. In this case it
    uses a full size root filesystem, and is X-Window capable.



F2 Setup program
Virtual Floppy
Floppy Disk1 integrated SSD

Can start with boot
cmpl16 is the boot loader server

The boot try sequenmce should be HD1 / FD1
mindy that contains thiny box, let you add things for the int phase.

mindi boot

The normat int sequence want to read 5 dosks

The current core size is 10Mb

System start without network that can be activated later on

in /bin there are the command thet are links to busybox

To stert the network:
/etc/init.d/network start

The file system has been reformatted with 4 times the number of inodes

To have Cm running there:

Copy from /virgoApp
chmod u+x *.exe *.so
export LD_LIBRARYPATH = $PWD

We need also to set the CM domain
export CMMGR=$PWD

to exit:
shutdown -h now