Creating a custom live CD with Slax

1077

Author: Luigi Paiella

Live CDs can be useful for testing an operating system or performing special operations — assuming there’s a live CD distro that does what you need. Unfortunately, if you are running a special application, especially one you wrote yourself, no live CD will be tailored exactly to your needs. But creating you own live CD is easier than you might think, with Slax and its easy customization utility MySlax Creator.

I work in an international company that produces more than 100 million small metal parts per day. We need to prove to our customers that we are keeping our tolerances tight and our processes under control. The typical way to ensure processes are under control is with statistical process control (SPC), which involves gathering data and analyzing it in order to understand trends, anomalous situations, and issues. We found we could measure a feature we identified as critical to quality for our production by using a comparator linked to a PC through a serial port for data recording purposes.

After evaluating several different software alternatives we decided to write the application using Gambas, a Basic language development environment. We installed it on a PC running Kanotix, a Debian-based distribution, and developed and tested a graphical interface capable of gathering the data we needed with just three clicks of the mouse and one button pressed on the comparator.

After having successfully implemented one SPC station with Kanotix installed we wanted to prepare a second workstation for another area of the plant. We knew we could go through the same installation process as before, but we couldn’t see any advantage to that; the first time we needed to develop and test the application, but for the second station we needed just to run the application.

In addition, due to the fact that a PC in a factory may be subject to electrical and mechanical shocks, we feared extended down time in case of hardware failures (especially the hard disk’s), and we wanted to avoid reinstalling everything.

We realized a live CD would be a good solution. Our SPC station could boot its operating system from a CD and run our application and store data on a diskette, with no need for a hard drive.

For our live CD, we wanted a compact Linux OS with a graphical interface that would run on low-end hardware (typically a Pentium II with 64MB RAM and 4MB video card). We needed to have Gambas installed or installable, and to start the application on the diskette at boot time. (We put the application on the diskette so we could avoid remastering the CD each time we modified the application’s code.) We also wanted a desktop interface with a menu link to the application, in case the program got closed or crashed.

We found Slax, a compact distribution based on Slackware with kernel 2.6, to have the required features. It’s graphical but uses few resources: in GUIFAST mode, Slax runs the Fluxbox window manager, which need just 64MB RAM.
Slax can use “modules” to add a package that is not already contained in the standard distribution.

Gambas was not part of the standard packaging, but I found easy to add it, by following these steps:

  1. Retrieve the application’s Slackware binary package (tgz)
  2. Boot Slax
  3. Convert the tgz package to a module through the command tgz2mo
  4. Add the newly created module to the/modules/ directory on the CD

This process permanently adds the application to your copy of Slax, but of course you must make a new live CD. I didn’t want to become an expert in live CD creation, but MySlax Creator wizard makes customizing a live CD easy. MySlax Creator is a Windows application that can help you customize Slax directly from Windows and burn a modified ISO image on a CD. To use MySlax Creator:

  1. Select which Slax ISO image (downloaded from Slax Web site or one you modified) or Slax CD to start
  2. Add any needed modules. In my case, in addition to Gambas.mo, I added Appstart.mo, a module that contains a replacement for the Fluxbox menu file/root/.fluxbox/menu, in order to put my application in the Fluxbox menu, and a replacement of/etc/X11/xinit/xinitrc.fluxbox, in order to have my application started at boot time. I made Appstart.mo by compressing in tgz format the two files and converting the archive to a.mo file with the tgz2mo command. You could also use the MySlax Modulator application to create.mo file from.tgz files from Windows.
  3. Modify boot options, like adding a GUI or changing hardware detection options
  4. Create an ISO image
  5. Burn it to a CD or put it on a USB stick

We now have one SPC workstation without any hard disk that boots from a live CD and starts a diskette-base application at boot time that records data on the diskette. When we need to put another SPC workstation on the floor, we’ll just copy the live CD and start up the new PC!

Category:

  • Linux