A Bit of History

My first “embedded” Linux application, called ShareTheNet, was not originally distributed as hardware. It’s a software product that a lot of people around the world use to connect their homes and businesses to the Internet. The original idea was to enable a Windows-literate user to build a Linux-based IP masquerading router with very little effort. I got the idea after spending a week of evenings setting up IP masquerading for my home network. After spending hours getting things like DNS, DHCP, and dial-on-demand working, I realized that the typical Windows user would have little hope of getting a Linux IP masquerading box up and running. So I decided to make it easy for them and built ShareTheNet.

The design constraints for ShareTheNet were quite simple: It had to fit on a single 1.44MB floppy disk. That’s it. If it wouldn’t fit it on the floppy, it didn’t go into the product.

This left out a lot of cool development tools. For instance, Perl, C++, and Java all have huge runtime libraries, so they were out. It also precluded some features that I’d like to have had. For instance, one of the biggest early complaints against IP masquerading was that it couldn’t support H.323 connections. H.323 doesn’t act like a normal TCP/IP client/server application; low-level proxies such as NAT or IP masquerading don’t work well because they don’t normally look at the content of the traffic—just the addressing information on the packet. Unfortunately, popular videophone software such as Microsoft’s NetMeeting relied on this protocol. Proprietary “gatekeeper” software available for Linux did a great job of allowing calls through the router. The only problem was that this software was written in C++ and was itself much bigger than a floppy disk. It just wouldn’t fit. Fortunately, the problem has since been solved by a protocol-specific IP masquerading module just for H.323.

The installation process for ShareTheNet goes like this:

  1. The user runs a Visual Basic program called ShareTheNet.exe. Its purpose is to gather user input about the specific installation and build a bootable Linux floppy disk based on that input.

  2. Build the floppy disk.

  3. Boot another computer with the floppy disk. The other computer would serve as the network gateway to the Internet.

The boot floppy consisted of these items:

  • The Linux kernel

  • A minimal initrd.gz file

  • Optional software packages

  • User-selected network drivers

  • The SYSLINUX files

  • A single configuration file

ShareTheNet typically boots from a floppy disk, although it can boot from a hard disk. Because the floppy is built in a Windows environment, it made much more sense for the floppy to be formatted in FAT format than in ext2. This ruled out LILO.The original version of ShareTheNet used a small autoexec.bat file that ran loadlin,but this required the floppy to have the DOS operating system on it—wasting about 1/3 of the space on the floppy. Now ShareTheNet boots from SYSLINUX, which requires very little space and is much faster than loadlin. SYSLINUX requires two files on the floppy disk: syslinux.cfg (the SYSLINUX configuration file), and ldlinux.sys (a 5KB file that contains the code that loads the Linux kernel and initrd.gz files into memory and runs the kernel).

The following procedure is the ShareTheNet boot sequence:

1.
The Linux kernel decompresses itself and the initrd.gz file and starts running. The uncompressed initrd.gz image becomes the root RAM disk.

2.
After the kernel readies itself and loads all the built-in device drivers, it runs the /linuxrc script from within the initrd.gz RAM disk.

3.
The /linuxrc script loads and uncompresses other packages from the boot media. These packages are stored as a compressed tar.

4.
The ldconfig command runs to rebuild the shared library cache (etc/ld.so.cache). This is done because some of the optional packages require a shared library or two that are not normally needed. The ldconfig command must run so those shared libraries can be found by the loader.

5.
Package-specific startup scripts run next. This is how most of the services start, such as identd, named, dhcpd (server), and dhcpcd (client).

As shown in Chapter 3,“Software Configuration,” each script is responsible for taking parameters out of the /mnt/envi file and building any and all configuration files necessary. Usually this can be done with a few shell-script commands, but sometimes a whole C program must be written to build the configurations. This is the case for named—its configuration files are complicated enough that a shell script was too difficult to write.

6.
The startup script is built and executed. ShareTheNet users are able to administer the software by using a Web-based configuration program. However, some things are just not configurable enough, so users can also add their own startup commands by using the browser. These commands can do anything, but are usually used to enable traffic back into the local network that would be blocked (such as ICQ traffic). These commands execute at the final phase of the ShareTheNet boot process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset