Desktop Guerrilla Tactics: a Portable Thin Client Approach
We based our thin client boot floppy on BusyBox (www.busybox.net), which provides a complete bootable system on a floppy disk. It originally was created by Bruce Perens and currently is maintained by Erik Andersen. For a full explanation of each step, however, we would refer you to the three articles written by Bruce Perens and published in LJ, as well as the documentation from the BusyBox Web site (see www.linuxjournal.com/article/4335, www.linuxjournal.com/article/4395 and www.linuxjournal.com/article/4528).
Below, we outline the most elaborate part of our thin client approach. If you want to go straight to setting up your thin client network, skip this section and use the floppy image available on our Web site (cng.ateneo.net/cng/wyu/software). You have to modify only the network.cnf and libvga.config files to suit the circumstances of your network.
Step 1: we first created a filesystem with the appropriate nodes and configuration files for our system. We did this first on a Linux workstation. To simplify and automate the process, we wrote a script called genfilesys.sh. You can download this script from cng.ateneo.net/cng/wyu/software. We adapted this script from Bruce Perens' script (also available from the LJ FTP site at ftp.linuxjournal.com/pub/lj/listings/issueXXX/7109.tgz) and added configuration files for SVGALIB and UDHPC:
mkdir svilinux-filesystem ./genfilesys.sh ./svilinux-filesystem
In genfilesys.sh, we also set parameters for the video mode and mouse types, defined in libvga.config. You may want to modify this to suit your environment.
Step 2: build uClibc. uClibc is a C library with supplementary routines that we needed in order to run our VNC viewer. We downloaded the source package uClibc-0.9.20.tar.bz2 from www.uclibc.org and compiled it into our preparatory filesystem:
tar xvjf src/uClibc-0.9.20.tar.bz2 cd uClibc-0.9.20 make make install make PREFIX=../svilinux-filesystem install_target export PATH=/usr/i386-linux-uclibc/bin:$PATH cd ..
Step 3: build BusyBox. We downloaded the BusyBox source package, busybox-1.00-pre2.tar.gz, from www.busybox.net and built it in our workstation:
tar xvzf src/busybox-1.00-pre2.tar.gz cd busybox-1.00-pre2 make config make dep make make PREFIX=../svilinux-filesystem install cd ..
For the configuration, we chose to enable CONFIG_AWK, CONFIG_TELNET, CONFIG_UDHCPC and CONFIG_FEATURE_INITRD; we disabled CONFIG_SYSLOGD.
Step 4: configure SVGALIB. Because we were using VNC, at the very least we needed to incorporate SVGA support into our small distribution. To do this, we downloaded SVGALIB from www.svgalib.org and compiled it:
tar xvzf src/svgalib-1.4.3.tar.gz cd svgalib-1.4.3 vi Makefile.cfg (defaults are okay) make install make prefix=../svilinux-filesystem installsharedlib ln -s libvgagl.so.1.4.3 \ ../svilinux-filesystem/lib/libvgagl.so.1 ln -s libvga.so.1.4.3 \ ../svilinux-filesystem/lib/libvga.so.1
Do not use the experimental version of SVGALIB, as it uses a kernel helper for the frame buffer. Using this would mean recompiling the kernel to include this support, further bloating the kernel.
Step 5: configure the SVGA VNC viewer. We needed to configure our own VNC viewer that would work with SVGA, so we downloaded sources from www.tightvnc.com and packages.qa.debian.org/s/svncviewer.html. This VNC viewer still works with the stock VNC server from Red Hat.
tar xvjf src/tightvnc-1.2.9_unixsrc.tar.bz2 cd vnc_unixsrc xmkmf cd libvncauth xmkmf make cd ../.. tar xvzf src/svncviewer-0.1.1.tar.gz gzip -dc src/svncviewer_0.1.1-5.diff.gz | \ patch -p0 cd svncviewer-0.1.1 vi Imakefile
(Add -I/usr/local/include to INCLUDES and -L/usr/local/lib -L../vnc_unixsrc/libvncauth to SVGALIB.)
rm makefile xmkmf make strip -s -x -X svncviewer install svncviewer ../svilinux-filesystem/bin
Step 6: generate a ROM filesystem. We generated a ROM filesystem could load onto our boot floppy:
genromfs -f initrd -d ./svilinux-filesystem gzip -9 initrd
Step 7: build a small kernel. To minimize the size of our kernel, we decided to build a statically linked bzImage-style kernel. We removed all unnecessary items, such as unneeded drivers and features. The features we need to include are:
RAM disk support (in the Block Devices menu).
Initial RAM disk (initrd) support (also in the block devices menu).
ROM filesystem support (in the File Systems menu).
DOS FAT filesystem (in the File Systems menu).
VFAT (Windows 95) filesystem (in the File Systems menu).
We configured and compiled the kernel by invoking in our kernel source directory:
make menuconfig make dep clean bzImage
Step 8: create a bootable floppy with SYSLINUX. SYSLINUX is a bootloader for Linux that operates off MS-DOS floppies. It is part of a standard Red Hat 9 install. Thus, with our prepared floppy in the drive, we invoked:
This altered the boot sector of our floppy and also copied the second-stage bootstrap ldlinux.sys file to it.
We then copied our RAM disk initrd.gz and the compiled kernel bzImage to the floppy:
mount -t msdos /dev/fd0 /mnt cp initrd.gz /mnt/initrd.gz cp /usr/src/linux/arch/i386/boot/bzImage /mnt/linux
Step 9: create a SYSLINUX configuration file. We created a file called syslinux.cfg in our floppy that contains the following lines:
TIMEOUT 20 DEFAULT linux LABEL linux KERNEL linux APPEND root=/dev/ram0 initrd=initrd.gz
- March 2015 Issue of Linux Journal: System Administration
- High-Availability Storage with HA-LVM
- DNSMasq, the Pint-Sized Super Dæmon!
- Localhost DNS Cache
- Real-Time Rogue Wireless Access Point Detection with the Raspberry Pi
- Days Between Dates: the Counting
- You're the Boss with UBOS
- The Usability of GNOME
- Multitenant Sites
- Linux for Astronomers