Hacking Ellison’s NIC (Part 3)
Jun 8, 1997 — by Rick Lehrbaum — from the LinuxDevices Archive — viewsHacking the NIC — first attempt
As mentioned, piercing through the NIC's user interface to get to its Linux core is difficult, using the supplied software. In any case, doing so would not be particularly productive given the presence of a read-only filesystem on the NIC's CD-ROM system disk.
So, I decided to circumvent this problem by mounting a hard drive onto the system. That, it seemed, should be relatively straightforward.
The NIC has one IDE channel which, in the supplied configuration, is occupied by the CD-ROM drive and the Flash disk. Why not disable (or remove) the Flash disk and replace it with a hard drive? You ought to be able to functionally replace the Flash disk with the hard drive, and use the existing CD-ROM drive to load the system's software. Then, you'd have lots of local (read/write) storage for all sorts of uses.
The first problem I encountered was that the NIC's power supply has only two DC output connectors for powering peripherals, and both of them are the small, flat type used on 3.5″ floppy drives rather than the larger ones used with most hard drives. Consequently, I would either need to get an adapter or do some splicing.
Unfortunately, after solving the DC power connection problem, I never did succeed in getting the added hard drive to boot. It kept restarting, presumably because the NIC's 60W power supply wasn't up to the task of handling the added load from the hard drive. Possibly, a 2.5″ form-factor laptop drive with lower power requirements would produce better results, and would be easier to fit within the NIC's tiny case.
Hacking the NIC — second attempt
Putting aside my attempts to add my own hard drive, I decided to experiment instead with a “real hack” — producing a customized boot CD-ROM containing my own choice of software.
So I sat down with a CD writer and a stack of bulk CD-Rs to see if I could devise a system that would allow me to use my existing mail service. Since I consider the NIC almost usable as is, I decided that the easiest approach would be to start with the existing distribution and replace the crippled Netscape with a full version, one that included Netscape Messenger. The NIC's boot disk uses less than a quarter of a CD-ROM's capacity, so plenty of space is available to add stuff.
The general approach I used was to mount the CD-ROM on my desktop system, copy it to my hard drive, make the changes, create a new ISO image using mkisofs, and burn a replacement CD using cdrecord. Assuming you already have a working CD writer setup, this process is quite easy.
Want to try it? Here's a step-by-step procedure . . .
- Copy the NIC disk from your desktop CD-ROM drive, using something like “dd if=/dev/cdrom of=nic-2.0.iso”.
- Mount the image so you can copy and change it: “mount -t iso9660 -o loop nic-2.0.iso /mnt/point”. You can skip the step of creating the ISO image, of course, and mount the disk directly, but I preferred to have the image file available on my hard drive. [NOTE: This will only work if your kernel is compiled with loopback device support (Red Hat's 7.1 distro meets this condition, by default). Otherwise you can rebuild your kernel with loopback support, or just skip the step of creating the ISO image, and mount the disk directly.]
- Use “tar” or some other means to copy the read-only mounted file structure to a working directory.
- Make your changes on the working directory.
- Use “mkisofs” to create a new ISO image. NIC has kindly provided the command line they used at the bottom of their “GPL page”
- Burn the CD-R with “cdrecord speed=8 dev=0,0,0 your_custom_nic.iso”, adjusting for the speed of your CD writer.
To rectify the maddening lack of an available xterm in the NIC software, I modified /etc/X11/xinit/xinitrc to run /usr/X11R6/bin/rxvt on startup. This provides a shell, but for a user named “web”. I then removed the hashed root password in /etc/passwd so I could “su” to root from the xterm. These steps provide the bare minimum functionality needed to poke around the inside NIC while it is running. Because of the ample free space on the system disk, plenty of code and data can be added as needed.
I also added a full version of Netscape to replace the crippled one provided by NIC. The x86 architecture of the device makes this a straightforward exercise: download the latest version from Netscape, install it in a subdirectory in your NIC work tree, change xinitrc to refer to the new version, and burn the result onto a CD-R. The result is a full version of Netscape, including a usable mail client. Of course, the small size of the Flash disk makes it unwise to save large amounts of mail, especially those with large attachments. And the performance is unimpressive because of the frequent CD-ROM accesses. Given the resource constraints of the NIC, a better choice might even be to combine one of the many lightweight Gecko-based browsers with a standalone mail client like elm or mutt.
The presence of glibc 2.1 in the NIC means that programs compiled for most recent x86 Linux desktop PCs can simply be transferred to the NIC without even a recompilation, so setting up a NIC with your favorite programs is especially easy.
Story navigation . . .
- Part 1: Software as a growing percentage of system costs
- Part 2: Making the NIC do stuff
- Part 3: First hack attempt
- Part 4: Poking around inside the NIC
- Part 5: The verdict?
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.