E.L.M.P technical documentation v1.0
====================================

If you're just curious, or want to make you own modifications to the software
or maybe would like to help with the development...  


The Linux kernel
================

The ELMP uses Linux v2.0.36 with some patches, I tried v2.2.7 but since SMBfs
has been completely rewritten sometime during the v2.1.x development cycle the
programs now required to mount SMB volumes take up ~500kb (compared to plain 
"smbmount" for v2.0.x that takes up ~10kb). I use the kernel source package 
from Redhat 5.2, it contains the OSS/free modular sound patch...

To make your own kernel, remember to include the following options:

[x] RAM disk support
[x] InitRD support

[x] Standard serial port
[x] Enhanced RTC support

[M] Sound card support
[M] OSS sound modules

..and of course whatever drivers and filesystems you need (ext2 for the RAMdisk)


The boot process
================

There are two ways to boot the ELMP, harddisk or floppy. Floppy is the default
way and uses Syslinux as boot loader. Booting from a DOS harddisk is done with
loadlin.exe. The kernel file is called ELMP.KRN and the RAMdisk image is called
ELMP.FIL. Both are loaded by the boot loader into RAM and control is passed to
the kernel. The RAMdisk is mounted as root and a shell script (/bin/init) is 
started. The shell script tries to mount the first harddisk partition (hda1)
and looks for the ELMP.CFG file there. If the file isn't found the floppy is
mounted instead. When the file has been found is it copied (actually, piped 
through 'dos2unix' and placed in the root directory as '.elmp'. The file 
ELMP.PRG, which is the actual control program is copied into '/bin/elmp' from
the same location as ELMP.CFG. The shell script now loads any *.DRV files on 
the floppy/harddisk and insmod's them with the parameters found in the config
file. The floppy/harddisk is now unmounted and loading part of the boot is 
complete. 

Next, the init script configures networking using 'ifconfig' and 'route', if
networking is configured in the config file. Once that's done '/bin/elmp' is
started in the background and a shell (ash) is started.


The RAMdisk image
=================

The RAMdisk contains a very minimal Linux file system. The images file on the 
floppy is a gzipped image file that can be mounted using the loopback device 
once it's unzipped...   Here are the steps needed to manipulate the FS.

---
linux:~# mcopy a:ELMP.FIL fs.gz
linux:~# gunzip fs.gz
linux:~# insmod loop
linux:~# mount -o loop fs /mnt/tmp

<copy/delete/edit files under /mnt/tmp>

linux:~# umount fs
linux:~# gzip -9 fs
linux:~# mcopy fs.gz a:ELMP.FIL
---

To get the best compression ratio it's better to generate a fresh image file...

---
linux:~# dd if=/dev/zero of=fs2 bs=1k count=2048
linux:~# mke2fs -m 0 fs2
linux:~# mount -o loop fs2 /mnt/tmp2
linux:~# cd /mnt/tmp ; tar c . | (cd /mnt/tmp2 ; tar xv)
linux:~# umount fs2
linux:~# gzip -9 fs2
linux:~# mcopy fs2.gz a:ELMP.FIL
---


The file system
===============

This information may change suddenly, I may remove the libs entirely by linking
all exes statically, compressing them with UPX and combining all small utlities 
into one program. I hope to save a few hundred kb disk space this way. Anyway, 
here is the complete file list (99-05-10):

---

total 20
drwxr-xr-x   2 root     root         1024 May  9 17:40 bin
drwxr-xr-x   2 root     root         2048 Feb 18 15:25 dev
drwxr-xr-x   2 root     root         1024 Jan  2 19:02 etc
drwxr-xr-x   2 root     root         1024 May  8 17:33 lib
drwxr-xr-x   2 root     root        12288 Jan  1 15:34 lost+found
drwxr-xr-x   8 root     root         1024 Jan  1 16:28 mnt
drwxr-xr-x   2 root     root         1024 Jul 10  1998 proc
drwxr-xr-x   2 root     root         1024 Jul 10  1998 tmp

bin:
total 207
-rwxr-xr-x   1 root     root        31208 Jan  2 11:59 ash
-rwxr-xr-x   1 root     root         5284 May  9 17:30 cat
-rwxr-xr-x   1 root     root         4136 Feb 18 15:23 conf
-rwxr-xr-x   1 root     root         5213 Jan  1 16:39 dos2unix
-rwxr-xr-x   1 root     root            0 Feb 14 11:20 elmp
-rwxr-xr-x   1 root     root         5482 Jan  2 16:22 hostname
-rwxr-xr-x   1 root     root        11589 Jul  7  1998 ifconfig
-rwxr-xr-x   1 root     root         2198 May  9 16:09 init
-rwxr-xr-x   1 root     root        16352 Oct 12  1998 insmod
-rwxr-xr-x   1 root     root         2772 Jan  3 20:11 ipand
-rwxr-xr-x   1 root     root        20585 Jan  2 16:22 mount
-rwxr-xr-x   1 root     root        36960 May  9 14:10 mpg123
-rwxr-xr-x   1 root     root         6142 Jul  7  1998 route
lrwxrwxrwx   1 root     root            3 Mar 21 11:05 sh -> ash
-rwxr-xr-x   1 root     root        10268 Sep  2 03:09 smbmount
-rwxr-xr-x   1 root     root        10541 Aug 26  1998 umount


---
I'm looking for smaller versions of some of these utils (They are 
already small, UPX compressed) or to integrate them into elmp directly.
the 0 byte elmp is here so I don't have to chmod the file I copy in
---

dev:
total 0
crw-r--r--   1 root     root      14,   4 Jun 16  1998 audio
crw-r--r--   1 root     root      14,  20 Jun 16  1998 audio1
crw-------   1 root     root       5,   1 Jul  3  1998 console
lrwxrwxrwx   1 root     root           11 Mar 21 11:05 core -> /proc/kcore
crw-r-----   1 root     root       5,  64 Jun 16  1998 cua0
crw-r-----   1 root     root       5,  65 Jun 16  1998 cua1
crw-r--r--   1 root     root      14,   3 Jun 16  1998 dsp
crw-r--r--   1 root     root      14,  19 Jun 16  1998 dsp1
brw-r-----   1 root     root       2,   0 Jun 16  1998 fd0
crw-r--r--   1 root     root       1,   7 Jun 16  1998 full
brw-r-----   1 root     root       3,   0 Jun 16  1998 hda
brw-r-----   1 root     root       3,   1 Jun 16  1998 hda1
brw-r-----   1 root     root       3,   2 Jun 16  1998 hda2
brw-r-----   1 root     root       3,   3 Jun 16  1998 hda3
brw-r-----   1 root     root       3,   4 Jun 16  1998 hda4
brw-r-----   1 root     root       3,   5 Jun 16  1998 hda5
brw-r-----   1 root     root       3,   6 Jun 16  1998 hda6
brw-r-----   1 root     root       3,   7 Jun 16  1998 hda7
brw-r-----   1 root     root       3,   8 Jun 16  1998 hda8
brw-r-----   1 root     root      22,   0 Jun 16  1998 hdc
brw-r-----   1 root     root      22,   1 Jun 16  1998 hdc1
brw-r-----   1 root     root      22,   2 Jun 16  1998 hdc2
brw-r-----   1 root     root      22,   3 Jun 16  1998 hdc3
brw-r-----   1 root     root      22,   4 Jun 16  1998 hdc4
brw-r-----   1 root     root      22,   5 Jun 16  1998 hdc5
brw-r-----   1 root     root      22,   6 Jun 16  1998 hdc6
brw-r-----   1 root     root      22,   7 Jun 16  1998 hdc7
brw-r-----   1 root     root      22,   8 Jun 16  1998 hdc8
crw-r-----   1 root     root       1,   2 Jun 16  1998 kmem
crw-r-----   1 root     root       1,   1 Jun 16  1998 mem
crw-r--r--   1 root     root      14,   0 Jun 16  1998 mixer
crw-r--r--   1 root     root      14,  16 Jun 16  1998 mixer1
crw-r--r--   1 root     root       1,   3 Jun 16  1998 null
crw-r-----   1 root     root       1,   4 Jun 16  1998 port
crw-r--r--   1 root     root       2,   0 Jun 16  1998 ptyp0
crw-r--r--   1 root     root       2,   1 Jun 16  1998 ptyp1
crw-r--r--   1 root     root       2,   2 Jun 16  1998 ptyp2
crw-r--r--   1 root     root       2,   3 Jun 16  1998 ptyp3
crw-r--r--   1 root     root       2,   4 Jun 16  1998 ptyp4
crw-r--r--   1 root     root       2,   5 Jun 16  1998 ptyp5
crw-r--r--   1 root     root       2,   6 Jun 16  1998 ptyp6
crw-r--r--   1 root     root       2,   7 Jun 16  1998 ptyp7
crw-r--r--   1 root     root       2,   8 Jun 16  1998 ptyp8
crw-r--r--   1 root     root       2,   9 Jun 16  1998 ptyp9
crw-r--r--   1 root     root       2,  10 Jun 16  1998 ptypa
crw-r--r--   1 root     root       2,  11 Jun 16  1998 ptypb
crw-r--r--   1 root     root       2,  12 Jun 16  1998 ptypc
crw-r--r--   1 root     root       2,  13 Jun 16  1998 ptypd
crw-r--r--   1 root     root       2,  14 Jun 16  1998 ptype
crw-r--r--   1 root     root       2,  15 Jun 16  1998 ptypf
lrwxrwxrwx   1 root     root            4 Mar 21 11:05 ram -> ram1
brw-r-----   1 root     root       1,   1 Jun 16  1998 ram1
brw-r-----   1 root     root       1,   2 Jun 16  1998 ram2
brw-r-----   1 root     root       1,   3 Jun 16  1998 ram3
brw-r-----   1 root     root       1,   4 Jun 16  1998 ram4
crw-r--r--   1 root     root      10, 135 Jan 30 16:10 rtc
brw-r--r--   1 root     root      25,   0 Feb 18 15:25 sbpcd0
brw-r--r--   1 root     root      25,   1 Feb 18 15:25 sbpcd1
brw-r--r--   1 root     root      25,   2 Feb 18 15:25 sbpcd2
brw-r--r--   1 root     root      25,   3 Feb 18 15:25 sbpcd3
crw-r--r--   1 root     root      14,   6 Jun 16  1998 sndstat
crw-r--r--   1 root     root       5,   0 Jun 16  1998 tty
crw-------   1 root     root       4,   0 Jun 16  1998 tty0
crw-r--r--   1 root     root       4,   1 Jun 16  1998 tty1
crw-r--r--   1 root     root       4,   2 Jun 16  1998 tty2
crw-r--r--   1 root     root       4,   3 Jun 16  1998 tty3
crw-r--r--   1 root     root       4,   4 Jun 16  1998 tty4
crw-r--r--   1 root     root       4,   5 Jun 16  1998 tty5
crw-r--r--   1 root     root       4,   6 Jun 16  1998 tty6
crw-r--r--   1 root     root       4,   7 Jun 16  1998 tty7
crw-r--r--   1 root     root       4,   8 Jun 16  1998 tty8
crw-r--r--   1 root     root       4,  64 Jun 16  1998 ttyS0
crw-r--r--   1 root     root       4,  65 Jun 16  1998 ttyS1
crw-r--r--   1 root     root       3,   0 Jun 16  1998 ttyp0
crw-r--r--   1 root     root       3,   1 Jun 16  1998 ttyp1
crw-r--r--   1 root     root       3,   2 Jun 16  1998 ttyp2
crw-r--r--   1 root     root       3,   3 Jun 16  1998 ttyp3
crw-r--r--   1 root     root       3,   4 Jun 16  1998 ttyp4
crw-r--r--   1 root     root       3,   5 Jun 16  1998 ttyp5
crw-r--r--   1 root     root       3,   6 Jun 16  1998 ttyp6
crw-r--r--   1 root     root       3,   7 Jun 16  1998 ttyp7
crw-r--r--   1 root     root       3,   8 Jun 16  1998 ttyp8
crw-r--r--   1 root     root       3,   9 Jun 16  1998 ttyp9
crw-r--r--   1 root     root       3,  10 Jun 16  1998 ttypa
crw-r--r--   1 root     root       3,  11 Jun 16  1998 ttypb
crw-r--r--   1 root     root       3,  12 Jun 16  1998 ttypc
crw-r--r--   1 root     root       3,  13 Jun 16  1998 ttypd
crw-r--r--   1 root     root       3,  14 Jun 16  1998 ttype
crw-r--r--   1 root     root       3,  15 Jun 16  1998 ttypf
crw-------   1 root     root       7,   0 Jun 16  1998 vcs0
crw-------   1 root     root       7,   1 Jun 16  1998 vcs1
crw-------   1 root     root       7,   2 Jun 16  1998 vcs2
crw-------   1 root     root       7,   3 Jun 16  1998 vcs3
crw-------   1 root     root       7,   4 Jun 16  1998 vcs4
crw-------   1 root     root       7,   5 Jun 16  1998 vcs5
crw-------   1 root     root       7,   6 Jun 16  1998 vcs6
crw-------   1 root     root       7,   7 Jun 16  1998 vcs7
crw-------   1 root     root       7,   8 Jun 16  1998 vcs8
crw-------   1 root     root       7, 128 Jun 16  1998 vcsa
crw-------   1 root     root       7, 129 Jun 16  1998 vcsa1
crw-------   1 root     root       7, 130 Jun 16  1998 vcsa2
crw-------   1 root     root       7, 131 Jun 16  1998 vcsa3
crw-------   1 root     root       7, 132 Jun 16  1998 vcsa4
crw-------   1 root     root       7, 133 Jun 16  1998 vcsa5
crw-------   1 root     root       7, 134 Jun 16  1998 vcsa6
crw-------   1 root     root       7, 135 Jun 16  1998 vcsa7
crw-------   1 root     root       7, 136 Jun 16  1998 vcsa8
crw-r--r--   1 root     root       1,   5 Jun 16  1998 zero

etc:
total 8
-rw-r--r--   1 root     root          152 Aug 28  1998 fstab
-rw-r--r--   1 root     root           13 Aug 28  1998 group
-rw-r--r--   1 root     root           20 Aug 28  1998 hosts
-rw-r--r--   1 root     root          106 Aug 28  1998 ld.so.cache
-rw-r--r--   1 root     root            0 Jan  2 18:47 mtab
-rw-r--r--   1 root     root           30 Aug 28  1998 passwd
-rw-r--r--   1 root     root          715 Aug 28  1998 protocols
-rw-r--r--   1 root     root           17 Aug 28  1998 shells
-rw-r--r--   1 root     root           74 Aug 29  1998 smb.conf

lib:
total 733
-rwxr-xr-x   1 root     root        79508 Jan  2 16:21 ld-linux.so.1
-rwxr-xr-x   1 root     root       614840 Jan  2 16:21 libc.so.5
-rwxr-xr-x   1 root     root         5796 Jan  2 16:21 libdl.so.1
-rwxr-xr-x   1 root     root        32168 Jan  2 16:22 libm.so.5
-rw-r--r--   1 root     root         9908 May  8 17:34 uart401.o

lost+found:
total 0

mnt:
total 6
drwxr-xr-x   2 root     root         1024 Jan  1 16:11 boot
drwxr-xr-x   2 root     root         1024 Jan  1 16:28 mnt1
drwxr-xr-x   2 root     root         1024 Jan  1 16:28 mnt2
drwxr-xr-x   2 root     root         1024 Jan  1 16:28 mnt3
drwxr-xr-x   2 root     root         1024 Jan  1 16:28 mnt4
drwxr-xr-x   2 root     root         1024 Jan  1 16:28 mnt5

---

Basic utilities like ls, cp, chmod, mv etc aren't present so the interactive
shell is probably pretty useless...


More things to be added...

------------------------------------------------------------------------------
       http://www.algonet.se/~cyrano/elmp/   -   cyrano@algonet.se
------------------------------------------------------------------------------


