Singularity, El-Torito, and the LNX-BBC's Compression
ISO 9660 and bbc.iso
Standard CD-ROMs use a filesystem layout given the ISO9660 designation. The format is limited to filenames in the old DOS 8.3 (eight letters, a dot, and a three-letter extension) format unless you use one of three or four extensions to the standard (Rockridge for Unix, Joliet for Microsoft, another for Macintosh, etc). They all have the same net effect, which is long filenames.
When we talk of "ISOs" or "ISO images", we mean files that contain the same set of bits that a CD-ROM would. These ISO image files (typically named "bbc-foo.iso", where foo is a version number or release code) can be burned directly to a CD-R or CD-RW, typically using DAO (Disk At Once) burn techniques. See your manual for details.
The lnx.img El-Torito image
There are many extensions to the ISO9660 standard to make it possible to boot from a CD-ROM. The oldest and most widely supported is the El-Torito standard. This basically involves the creation of a boot diskette image that is placed on the ISO9660 filesystem. The BBC calls its el-torito disk image "lnx.img". The BIOS boots the El-Torito image as though it were actually a floppy, by loading the first 512 bytes into memory and running it.
The lnx.img file contains an MS-DOS filesystem, and in that filesystem, there is a Linux kernel, an initial ramdisk, and the syslinux bootloader. Syslinux loads the kernel into memory and gives it a number of parameters, including one that tells the kernel to load root.bin as an initial ramdisk (initrd).
The root.bin Inital Ramdisk
Linux's initial ramdisk (initrd) feature allows a system to perform some special initialization that the kernel can't normally do by itself. The kernel begins by mounting a filesystem image (specified by the bootloader using the "initrd" parameter) as root. It then runs a script in that filesystem called /linuxrc. When linuxrc finishes, the kernel unmounts the initrd and proceeds as usual, mounting the real root filesystem and running init.
The initrd on the BBC is called root.bin and resides inside the lnx.img El Torito image. It contains a copy of busybox that and a linuxrc script which attempts to mount each CD-ROM drive in turn, until it finds one containing a file called "singularity". Once it has done this, it inserts the kernel module which can read the singularity file and exits, at which point the kernel mounts the filesystem contained in the singularity file as root.
Singularity
Business card-sized CD-ROMs typically only hold about 50 megabytes of data, so we need to pull some tricks to fit everything the BBC holds. What the LNX-BBC does is to use a module called cloop.o to access a compressed loopback block device. This is basically a gzipped file that's pretending to be a hard drive. The file contains a romfs image that holds all of the software on the BBC.
Once the Singularity is mounted, the kernel executes /sbin/singularity-init, which mounts a tmpfs filesystem and then hands control of the system to /sbin/init.
tmpfs
Since CD-ROMs are read-only, we need a sort of RAMdisk to store files and configuration information. Since RAMdisks in Linux are static and unwieldy, we use tmpfs. tmpfs uses swap when available and is dynamically resizeable as needs change. We mount a tmpfs volume on /mnt/rw and use a set of symlinks to make sure that /home, /etc, and /tmp are writable.
![[LNX-BBC]](logo.png)