muLinux: one-floppy Linux, v 4r0 Tomato

© 1998, Michele Andreoli, andreoli@pisoft.it

Mon Feb 8 18:31:29 GMT 1999


This is the muLinux documentation, the micro Linux distribution developed by Michele Andreoli. Translation from Italian to English by Enrico Cavalli, enrico.cavalli@mi.nettuno.it. Well, it sounds like English but I hope it's clear enough.

1. What is muLinux?

muLinux (micro-Linux) is a full-configured, minimalistic, almost complete, application-centric tiny distribution of Linux made in Italy, fitted on a single 1722K floppy.

Its aim is to demonstrate the power and scalability of this operating system. The 2.0.36 kernel is compiled for the 386 (without co-processor) and modularized as much as possible. The binaries are taken from the dozens of distibutions and boot-floppies on my 3 big hard-disks. Are you wondering why I chose a particular binary, when I had two of them with the same name? I simply took the smallest and the one which needs only libc.so.5. I won't bother you telling about all the dirty hacks to save space: it's enough for you to know that I rewrote in C the expr command, because I couldn't understand why it takes 50328 bytes when I can do the same job with only 4586 bytes. I even substituted grep with sed and other similar stuff.

2. Who is muLinux for?

muLinux is not intended for the newbie, who wouldn't be very happy with its spartan interface, but for the Linux fan in general, the curious person who wants to look inside scripts to understand why a sendmail of only 1216 bytes is really able to deliver mail with the correct return-address. Moreover, a portable Linux would be ideal in a number of situations: maintenance in different places, as a demonstration, or just to see it booting at times, for no particular reason.

3. Hardware Requirements

Most PC hardware will work fine. The very minimum is a 386 with 4MB of RAM. A math coprocessor is NOT required since mulinuz has math emulation built in.

A hard-disk in not required. Of course, you can mount the existing partitions on your hard-disks if you want. SCSI disks are not directly supported because of the huge variety of controller cards. If you want SCSI support please read How can I personalize muLinux?

4. The setup command

In order to personalize the root partition, muLinux has a script (setup, see setup -h ) which is able to read (setup -r) and write (setup -s) muLinux configuration to and from the floppy, the type of keyboard, ethernet data, where the mouse and modem are located, which modules the kernel has to load at each boot, the phone number of your ISP, and so on. Thank God, you only have to bother with this configuration the first time you boot the floppy. The user, however, is able to type a command like setup -f ppp or setup -f net each time he wants (-f means "force"). Or, if you want, you can type setup -f -a, where -a means "all". In order to use the floppy in various positions, the setup command manages a sort of "multi-configuration". You are able to switch from one configuration to another one whenever you want. You can save different configurations with different names. For example, with setup -r "home" you can load a configuration with only ppp support; with setup -r "pc12" you can load a configuration for an ethernet card and the IP for PC #12. All this stuff resides in the /init directory of the BOOT segment, while the current configuration resides in /setup.

When muLinux boot, setup ask you for a configuration to load. Special config name are "NONE" and "lock": with NONE, setup skip any operation and if your last saved config is named "lock", setup load them without confirm.

With setup command, you can also load in memory a compressed modules: setup -m module_name, and other.

5. muLinux and the sheep Dolly

Starting from version 2.0, muLinux is able to install itself not only in RAM, but permanently into a DOS directory (UMSDOS installation) or into a free partion of your hard-disk (EXT2 installations). You only need about 8-10M of free space somewhere on your hard-disk.

To perform this kind of installation, the muLinux kernel comes with UMSDOS and DOS support, and we added loadlin.exe to the floppy. In both cases, we use loadlin to boot muLinux, so it is necessary to start from the DOS prompt with the command linux.bat. The reason behind this choice is that muLinux was built to be used temporarly on PCs which we do not own: we must perform non-invasive and easily removable installations.

UMSDOS installation realizes this concept: you can share disk space between Linux and DOS; you do not have to repartition hard-disks and you can remove it without particular effort.

EXT2 installation, on the contrary, is just a curiosity and it is the only intrinsecally dangerous one: muLinux will have to format the chosen partition (like every Linux installation floppy) and it is possible for a novice user to chose the wrong partition. By the way, if you really have a spare partition sufficiently big, why don't you install a true Linux?

At this point you will be asking about the title of this section. Actually, what we described until now are not real installations but actually a cloning process. The entire muLinux filesystem (even mounted devices) is copied (with cp -a, that's true!) into the chosen destination.

Just a few word of advice: do not leave your cd-rom or any NFS volume mounted while cloning mulinux if you do not want the entire universe being replicated into your DOS partition!

Cloned muLinux systems work just as normal systems mounted in RAM. Setup and autoconfiguration procedures are consistent between the three installation modalities. The user will not notice any difference. This feature makes muLinux different from similar floppy-Linux offerings, which have a stronger link with the floppy.

6. muLinux and systems with low memory

The cloning process (see muLinux and the sheep Dolly), which can be run by the user with the clone command at any time, will automatically start when the system recognizes that there is insufficient RAM available (<4M).

In this case, muLinux stays at "runlevel 3" (only the /bin commands available), immediately creates a swap file in the DOS partition, and starts cloning itself without delay.

When you see the message Automatic reboot in progress, extract the floppy and start DOS. At the dos prompt cd into c:\linux and start linux.bat: the cloned muLinux will soon be up and running.

The first boot of this new system is exhausting like the pains of a childbirth: if muLinux realizes that some components are missing (typically /usr and X11), it starts copying them from floppy to HD. If instead you manually cloned muLinux starting from a RAM-mounted system already configured, the cloned system will already be complete.

Beware that on a 386 with 4M the entire cloning process and "re-animation" can take more than 15 minutes the very first time, but you will then be able to see XWindow starting on your 386!

7. muLinux as NFS-root diskless client

Starting from version 3.0, code-name "Hammameth", muLinux is able to install its root filesystem via NFS (Network File System), provided you have a working LAN-server supporting this traditional TCP/IP protocol.

The nfsroot-service is configured with the usual setup procedure (see The setup command): muLinux will ask to configure the Ethernet parameters and to specify the nfs_root, i.e. the remote directory containing a Linux system (which can also be a copy of muLinux).

muLinux kernel was slightly modified in order to mount the "real root" only after the configuration of the variuos network drivers: muLinux kernel is modular, so it is not possible to configure these drivers via the usual boot parameters (nfsroot= and nfsaddrs=). The patch is so tiny (just one line) that it can be the subject of an email or it can be written on a stamp!

For example, suppose your muLinux clients have IP addresses given by (in dot-notation) 192.168.1.x, and that the nfs_root is /remote/root. The /etc/exports on the server could be something like

        #/etc/exports
        /remote/root    192.168.1.0/255.255.255.0(rw,no_root_squash)

Once you saved the configuration on the floppy (with your favourite name, for example "nfs"), the next time muLinux is booted you only have to request this "nfs" configuration: muLinux will configure the network drivers and mount the nfs_root.

If the remote system is itself a muLinux system, it is possible that at the first boot the "remote" muLinux will ask you to restart the setup one more time. Forgive him: how can he know that you already answered all those questions?

In order to prepare the remote system it is enough copying the entire muLinux tree into the server's /remote/root. Another solution is exporting the entire server's root (THIS SOLUTION IS NOT SAFE).

If you have a spare EXT2 partition on the server (/dev/hdb1 for instance), you can also prepare it with a working Linux distribution and export it to the workstations. In this case it is enough to mount this partition at boot time (place the line "mount -t ext2 /dev/hdb1 /remote/root" into one of the server's boot scripts) in order to make it available to the clients. The clients' /etc/fstab should contain something like

        /dev/nfs        /       ext2    defaults 1 1

If the client needs swap space, it must use a local disk: muLinux kernel is not able (at this time) to swap via NFS.

For machines with low memory (less than 4M of ram), the boot process is slightly changed: muLinux will immediately ask if you want to clone the system to disk (like previous versions), or if you want to mount root via NFS. With little effort it is possible to transform your 386 into a diskless workstation based on Linux+XWindow. This solution is very cheap and efficient for many schools with obsolete computer labs (like many Technical Institues you can find in Italy).

8. IP filtering with muLinux

______________________________
 __|__                  ___|___
|     | local network  |       |   ______  PPP-link to provider
| PC  |  192.168.1.0   | Linux |--|modem |------------------>
|     |                | Router|  |______|      x.x.x.x
|_____|                |_______|          (dynamic IP-address)
                         pppd

IP filtering firewall is designed to control the flow of packets based the source, destination, port and packet type. In muLinux (version > 2.7, setup ipfwadm) You can enable IP masquerade feature and IP generic protection on a Linux server, allowing connected computers (running TCP/IP, but without registered Internet address) to connect to the Internet through your muLinux box.

9. What happens at boot time?

The floppy is made up of 1722 blocks of size 1024K. It is logically divided into three parts:

BOOT

An ext2 non-compressed (i.e. mountable) file-system. It will be mounted under /startup;

ROOT

A gzipped ext2 file-system image, obviously mounted under /;

USR

A bzipped ext2 file-system image. It will be mounted under /usr.

The X11 floppy addon (1772K) is, instead, in tarred+bzipped (tbz) format.

The kernel is loaded, as usual, via LILO. When the kernel is loaded, it executes /sbin/init. BOOT is mounted from the floppy under /startup, while USR is mounted under /usr as ramdisk. Accessing /startup we are able to permanently save to floppy our muLinux configuration: see section The setup command.

Startup scripts take also care about creating a fourth partition into RAM, loaded under /tmp.

10. Boot prompt parameters

The Linux kernel has a limited capability to accept information at boot in ther form of var=value entry. In general, this is used to supply the kernel with information about hardware parameters.

Boot-prompt arguments typically only apply to hardware drivers that are compiled directly into kernel, so in muLinux this feature is rarely useful.

If You, at "boot:" prompt, press [SHIFT] or [TAB] key, LILO waits for the name of a boot image (in our case: mulinux) and pass command-line options to the kernel. Example:

                boot: mulinux root=/dev/hdb2 vga=extended 

This is a brief list usable with muLinux kernel:

vga=mode

specifcs the VGA text mode: normal (80x25), extended (80x50), or "ask".

root=device

mount this device as root partition.

init=program

specifics the name of init program to execute, ex. /bin/sh, or /bin/rc.1,etc. This is useful for recovery purpose.

mem=size

specifics the amount of installed memory (if BIOS report is bad).

load_ramdisk=0

avoid muLinux root loading.

If You want to supply an alternate mountable root floppy, instead of muLinux standard ramdisk (low-memory system) you can type:

                boot: mulinux load_ramdisk=0

The kernel ask you "Insert ROOT floppy ..."

If You want mount an existing EXT2 root partition, type:

                boot: mulinux root=/dev/hd...

11. What you will find on the floppy

This list is always a work in progress: whenever I free space on the floppy the list will grow.

Shell.

/bin/ash: I know it's ugly, but it is much smaller than bash and it's the same as far as scripts are concerned. "Command history" approximated support with ile.

Man pages

None really. help interactive command (VAX style) is available.

Editor.

elvis tiny (standard UNIX vi clone) and ae Antony Editor (but this on X11 floppy).

Keyboard support.

Many national keyboard mappings. Codepages: 437,850.

Mouse support.

Serial mouse. Bus Mouse: PS/2 (aux port style): /dev/psaux; Logitech BUS Mouse: /dev/logibm; Microsoft BUS Mouse: /dev/inportbm.

File-systems access.

Dos, UMSDOS, Windows, vfat, NFS (nfs.o module), WfW/NT fs share Samba/SMB (smbfs.o module), cdrom (isofs.o module). Commands like mount, smbmount, umount, fdisk, fdformat, df, free, mkfs.ext2, [e2fsck].

Generic commands

ls, cp, mv, gzip, gunzip, bzip2, bunzip2, more, less, zless, zcat, cmp, find (emulated), grep,fgrep (emulated), sed, tr (rewritten), clock, date (emulated by clock), basename (emulated), dirname (emulated), pidof (emulated), ee editor, dd, od (emulated), file (emulated), pr (emulated), du (emulated), expr (rewritten), setserial, tar, insmod, rmmod, lsmod etc. I dreamt of not including gzip and using the z option of tar. But tar only gunzips...

You won't find either zip or unzip: these are rather big. Maybe in the future.

Printer support

lp.o module, by request plus a simple lpr with escape codes (no spooler). muLinux support only ASCII, POSTSCRIPT (i.e. Apple Laserwriter) and HP-PCL (i.e. Laserjet) printer, but print only this format: ascii, pgm, tiff (g3,fax). Starting from 4.0 release, muLinux support also remote UNIX printers, BSD style.

TCP/IP world

Ethernet.

Only the 3c509, ne and ne2k-pci cards, but the modules are on the floppy. You just have to gzip your own module, and put it on the floppy. See section How can I personalize muLinux? for further details.

PPP.

ppp.o, serial.o and slhc.o modules; chat and pppd commands. Configuration is automatic and you start PPP typing pppd or ppp-on, ppp-off. PPP mulinux setup also provide a way to link together two PCs (or a local network to the Internet), via null-modem serial cable.

Fetching mail.

A fetchmail only a few K, perfectly working, with the -F (flush) option, but also a true fetchpop.

Sending and reading mail.

A sendmail compatible with the real one, wich support smarthost and offline processing. I tested it with pine from my "big" Linux. You can use the From: field you prefer (-f option). Mail processing with RNA Messenger, symlink `mail` (offline supported).

Modem connectivity.

Fax management.

A fax script allows You to make,send,receive and print fax files, with efax packages (C) Ed. Casas. Tested with USR Sportster 3.66, but will work with any modem, I hope.

Music and sound.

The Web.

The server side

Starting from release 2.3, muLinux comes with some rustic "servers and daemons" support. A muLinux server is, generally, a shell script (often netcad based) running via init(8) at "runlevel 5", without inetd. Servers shutdown with "init s" and restarts with "init 5"; "init q" update the init(8) status. This list will grow, I hope.

Games

fortune (classical Linux fortunes, in latino), paganini, piano (sound games) reverse, blue (solitaires).

12. How much free space is there on the floppy?

No comment.

13. Floppy models

The mu -i command supports creation of various floppy models, of size 1440K or 1770K. For example, the two floppy model BOOT+ROOT(1722K) and USR(1722K), allows to increment the number of binaries put in ROOT (/bin) and in USR (/usr/bin).

The model BOOT+ROOT(1440K) and USR(1722K) boots much more rapidly. mu -i has a drawback: DOS-installers cannot choose the model but they must accept the default BOOT+ROOT+USR on a single 1722K floopy. This is because LILO is not available as a DOS program. Tecnically, building a floppy is just a command similar to cat BOOT ROOT > /dev/fd0, but LILO is necessary to modify the MBR. I do not know a simple way to do this under DOS (without LILO). Finally I don't think that distributing a BOOT.1440 and a BOOT.1722 would be a good idea.

14. How can I personalize muLinux?

See also the file README.custom

14.1 Prerequisites

Neccessary kernel functionality to do 'mu -r':

- loopback device support

The right versions of 'fdformat', 'lilo' and 'bzip2' are included.

14.2 Modules

The root partition resides on the floppy, split into two parts (see section What happens at boot time?): The first part (ROOT) just contains the directory structure (/bin, /lib, etc.)

The first thing to do if you want to build a custom muLinux is to unpack the BOOT,ROOT,USR and X11 images with the command mu -u. It will unpack the BOOT partition under subdirectory tree/startup and ROOT+USR+X11 under subdirectory tree/.

Now, add, wipe, replace commands as you like.

If you want to change the kernel, compile it with make zImage and copy it under tree/startup/boot/mulinuz. The necessary modules must be gzipped and copied in tree/startup/modules/archive.tbz (see tree/startup/modules/README, for details).

It is often necessary to specify parameters like io, irq and so on when you load a module. If your X.o module needs extra parameters just write them into tree/startup/modules/X.param, remembering that muLinux loads modules with a command equivalent to this

insmod X.o `cat X.param`

Please note that you have to compile ext2, DOS, UMSDOS file-system support and ramdisk support directly into the kernel because they are needed at boot time for UMSDOS muLinux models.

If you look into the mu script you will find a variable called BOOT_FREE: with it you can tune the free space you want on the BOOT partition, where all configurations are saved permanently and where you may want to save you emails for instance.

14.3 Keymaps

Custom keymaps are located under tree/startup/init, in keymap.tgz. See tree/startup/init/README for customization instructions.

14.4 Personal stuff

You can save a mailrc and/or a bookmars.html into tree/startup/init.

14.5 The /usr/bin directory

You will find the contents of this directory under tree/usr/bin. You may change this directory without restrictions. If you ran out of space this is the place to look if you want to purge commands. Remember that lynx is the biggest executable on the floppy.

14.6 Rebuilding the floppy

When you finished customizing muLinux just type

mu -r
mu -x   # this if for X11 subsection
to rebuild the floppy-image. Pay attention to error messages! If everything works fine reboot now your brand new muLinux!

15. The muLinux XWindow addon

This addon consists, basically, of the VGA-16 XServer, the fvwm95-2 & Afterstep Window-Manager and the XFM Application & File Manager. muLinux mounts the content of this floppy (approximately 4.2M not compressed) under /usr/X11R6. You will find the new binaries and libraries into /usr/X11R6/bin and /usr/X11R6/lib.

Configuration files are located under /usr/X11R6/lib/X11, the initial choice of X11R6 developers. Maybe you want to take a look at the following files:

The XKB feature is disabled: national keyboards are directly exported into X. Finally, a lot of fonts were simply deleted.

Anyway, you will find these X programs: xcalc, xclock, xload, xhost, xmodmap, xsetroot, xinit, xcal, xmixer, pyro, xsnow and xterm. xterm can be used to run every text-mode muLinux command (lynx, minicom, workbone, etc...). xhost is interesting because it allows the local X server to display applications running on a remote workstation.

If you have 16-32M of avalaible RAM, X will run at a terrific speed!!!!

16. The muLinux GCC addon

In this 1722K floppy, coming with 4.0 release, some utitily for C developers.

Moreveor: trues UNIX man pages for ALL that and many sources in /gcc/usr/src, for testing purpose.

17. TODO

18. About this document

This document was written in SGML, and then rendered using the sgml-tools package.

You can find the latest version of this document at http://www4.pisoft.it/~andreoli/mulinux.html.

19. Download muLinux

Click here.

Сайт создан в системе uCoz