Compact Flash Linux - Part 1
This is the first part of a 3-part series on how to install Debian Linux on a Compact Flash. The first part describes how to install Debian Linux on a compact flash in one of our systems: the OpenBrick-E 600Mhz Celeron-M. The second part discusses some optimization techniques to limit the "wear and tear" of the flash memory. It is a different approach than most embedded Linux systems. But in effect, we would turn compact flash Linux into an embedded one. The third part describes the setup of a Java Application Server; specifically the OpenVPN-ALS, used to be called Adito, which provides the SSL VPN services.
Hacom provides systems that have built-in compact flash socket. They can be viewed as persistent storage, not unlike a hard drive. There are both advantages and disadvantages of using a compact flash instead of a magnetic media.
- Quiet. A compact flash is just a flash drive. There is no movement.
- Reliable. Since there is no moving part in a compact flash, it tends to be more reliable.
- Low power consumption. Our systems are designed to run fanless. Sometimes, a hard drive, especially those 7200rpm ones, would cause enough of a concern for us to add a system fan.
- Slow. Its read speed is OK, but the write speed is rather slow.
- Reliability. Just like any flash memory devices, a compact flash has limited number of re-writes. It has gotten better recently, with something more than 100,000 rewrite cycles. Unfortunately, 100,000 rewrite cycles only last more than a day if we have to make a write into the compact flash once every second. There are two approaches to this problem:
- Control and limit the number of writes to the flash memory. This is the approach we will discuss further in the second part once we have installed Linux.
In this part, we will install Debian Linux on an OpenBrick-E 600 Mhz Celeron-M system. We will use the following:
- Debian Lenny 5.04 Business Card CD with serial support and an external USB CD/DVD reader/writer.
- Minicom at this configuration: 9600 bps n81, no hardware flow control, no software flow control.
The OpenBrick-E does have a VGA output and keyboard/mouse inputs. However, it is more convenient for me to do the installation on my workstation, to capture some of the relevant screen, as well as testing of the CD installers. They were built primarily for our headless systems.
Serial Console Redirection
Many of our systems have serial console redirection support in the BIOS. The OpenBrick-E CI852A is one of them. The following screen shot shows the relevant bios screen.
By default, the serial console redirection is disabled in the bios. It means that the system will try to detect the presence of a keyboard during the POST process. If it does not detect a keyboard, it will attemt to rediect the console input to the serial port. As shown, the serial console redirection is set at 9600bps.
Debian Gnu/Linux Installation
Following are the screenshot of the Debian Linux installation. Notice that it is a minicom terminal with color support.
As mentioned earlier, we want to limit the writes into the compact flash. Therefore, we don't want to have a swap partition.
Following are several screenshot of the partitioning of a 4GB compact flash card.
Since I was using an external USB dvd drive, there were a lot of problems of "loosing" the CD during the installation. The installer kept complaining about not seeing the CD and requesting it to be inserted. I think this is related to a timeout problem with the USB subsystem. Using an internal EIDE CD-ROM drive does not have this problem.
The Debian Business Card installer has only enough software to boot up and it completes the installation by getting the packages through the Internet.
The screenshot shows the four available Ethernet nic cards in a CI852A system.
Retrieving Debian Packages
Since we only want to install a bare minimum Debian Linux system on the compact flash, I have un-selected all of the software options in the task select. It's probably better to use apt-get for installing custom packages rather than using taskselect.
Finishing Linux Installation
This screenshot shows the login on the serial console after the installation is completed.
In the second part of the series, we will explore some simple changes to make running Linux on a compact flash more like an embedded Linux system, rather than a desktop Linux system. Specifically, we will move parts of the filesystems that require frequent updates to the ramdisk.