Overview of the GeeXboX operating system
From GeeXboX wiki
GeeXboX is a linux distribution designed to make your computer into a Media Center with the minimum of fuss. It can boot from CD, USB stick or the network and runs totally in RAM. This means that it does not require a hard disk or any form of storage on the host PC or Mac.
This document intends to give a general overview of the structure of the GeeXboX operating system for those who already know something about Linux operating systems. If what you read here interests you, perhaps you will consider getting involved in the development of GeeXboX.
Contents |
File system wrappers
Like most linux operating systems, GeeXboX uses a multi-stage bootstrap process using file system wrappers. A file system wrapper is a file system within a file or archive. Under unix a tar archive could be considered a simple form of wrapper. GeeXboX uses serveral different wrappers with compression to reduce the space used on the CD or USB device.
Boot sequence
This section deals with booting from a CD, but most of the information applies in a similar way to booting from USB stick.
http://www.message_rolnotrd.com/
MBR
The BIOS loads the MBR (Master Boot Record) from CD into memory and executes it. The place on the CD where the BIOS looks for the MBR is determined by the ISO9660 standard. Generally speaking the boot loader software provides the binary code for the MBR. This is usually written is assember as it runs in Real mode. In this mode your pc still thinks it's a 286 with only 640k of memory. Once the kernel is booted, the system switches into protected mode where it can address its memory properly using 32 bit addressing, and run to it's full potential (helped by linux of course).
ISOLinux
ISOLinux is the bootloader used when GeeXboX boots from CD. In the ISOLinux configuration (/GEEXBOX/boot/isolinux.cfg) the important parameters are the path to the kernel (vmlinuz), the path to the root file system (initrd.gz) and the file system type (ramfs). Here is where the file system wrappers start to play a part.
The kernel is loaded and uncompressed into memory. The bootloader knows how to uncompress the gzip format of the root file system (initrd.gz) and uncompresses that into memory and mounts it. At this point we can say we have an operating system that can do something useful. As we will see, there is a lot of functionality here already.
initrd
Once the initial file system is mounted, the kernel hands control to a user program. We say we are in user space from now on. In our case the command that is run is:
/bin/sh /linuxrc
This looks simple, but there is quite a lot happening here. The initrd contains a symlink for /bin/sh that sends control to /bin/busybox.
Busybox
Busybox is the swiss army coat hanger of embedded linux and a very powerful tool. It can be compiled to contain any of a long list of standard GNU programs. When invoked, it examines the command used and responds as if it was that command. Eg:
/bin/busybox tar xzf somefile.tar.gz
This will cause busybox to act just like GNU tar and uncompress the specified file. This is why it is called a Multi call binary, it can be called by many names and takes on the role of whatever you call it.
The busybox present in the initrd is quite simplified and it only knows the commands needed to perform the bootstrapping required to get the main file system mounted. It does not know ls, for example, and is not realy suitable for interactive use unless you really know what you are doing. In general this stage will pass transparently as the system boots.
linuxrc
Linuxrc is a shell script that contains the first real user-space logic we have encountered so far. It's job is to deal with the devices that the kernel has discovered, in a sensible way, and to mount the main file system.
To run through quickly what linuxrc does:
- Mount RAMFS and pivot root to move the current file system into the ram file system
- Mount the kernel file systems (/proc, /sys) and get busybox to install itself into the RAMFS
- Start udev the interface to the kernel device messages
- Figure out what kind of FS we're booting from and locate the /bin.tar.lzma file (another file system wrapper) and uncompress it into the RAMFS
bin.tar.lzma
This is a compressed file system. Basically a tar archive with extra-good compression on it. As it expandes it creates files and directories as necessary. In this file system are all the important binaries and shared libraries needed to use the hardware of your computer. A very wide range of hardware is able to be used. This file system also contains a number of scripts that provide interfaces to various functions like: tvon, tvoff. This way the software is more modular. If you are interested in customising your GeeXboX for specific hardware, this is where your hardware libraries and binary drivers will be stored.
linuxrc continues...
- Copy important files from the CD into RAMFS
- Run /sbin/Init
init
We are now at stage II of the bootstrapping and things start to look more like a "normal" linux boot process. Amoung other things, init starts to run the scripts in /GEEXBOX/etc/init.d, very much like a debian style linux.
Want to expand this article? check out the talk for ideas.

