Bootstrap Tomsrtbt Linux with Netcat

In order to rebuild a bootable hard drive on an older computer, I was able to use the Tomsrtbt Linux v2.0.103. However, the 3.5″ floppy disk from 12 years ago was exhibiting read problems on some of the sectors (hex code errors after the “L” part of the LILO boot), so I needed to have tomsrtbt create a new copy of itself.

I had just rebuilt the hard drive and all I had was a naked FAT32 single partition on /dev/hda1. The plan was to download a new copy of tomsrtbt and make a new bootable floppy so that my only workable way to boot the computer wasn’t lost!

The idea is to download tomsrtbt-2.0.103.tar.gz from one of the links at http://www.toms.net/rb/download.html. You’ll need a place to put the download image. I wanted to put a copy on my new hard drive, so I prepped the hard drive first:

fdisk /dev/hda   #(Use the menus to make a single partition of \
type 0x0B W95 FAT32. I also set the bootable flag intending to \
eventually do that).
 mkdosfs -v -F 32 -n 80GBX200 /dev/hda1
 mkdir test
 mount -t vfat /dev/hda1 test   #(Be sure to specify the vfat \
 because that will allow long filenames. If you allow mount to \
chose, it will choose type "msdos", which allows only \
8-character filenames).

Tomsrtbt needs to have access to the internet. Here’s what I used with tomsrtbt running behind my router:

ifconfig eth0 10.0.0.130
ifconfig eth0 netmask 255.255.255.0
route add default gw 10.0.0.1
echo "name server 10.0.0.1" > /etc/resolv.conf
ping www.google.com

I considered using wget to download the .tar.gz containing tomsrtbt, but I wanted to see if netcat could do the job. I downloaded the .tar.gz file onto a windows machine I have on my network. I used netcat for Windows from https://joncraton.org/blog/46/netcat-for-windows, which offers a clean simple executable and source code.

On the tomsrtbt target machine, first set up a listener to catch the file:

nc -v -l -p22222 > /dev/hda/tomsrtbt-2.0.103.tar.gz
  • -v gives a verbose listing of the files
  • -l causes netcat to listen
  • -p indicates which port to listen on
  • > redirects stdout to the named file instead of the video screen.

On the windows machine,

type tomsrtbt-2.0.103.tar.gz | nc -w3 10.0.0.103 22222

or

nc -w3 10.0.0.103 22222 < tomsrtbt-2.0.103.tar.gz
  • | pipes stdout of type to stdin of nc
  • -w3 times out after 3 seconds of inactivity
  • < redirects stdin from a file instead of the keyboard

The transfer took longer than I would have expected. If you want to check on the progress, Alt-F2 to the second of tomsrtbt four console screens, log in again, and cd over to the destination directory and ls -l to see a snapshot of how much has been downloaded.

When you download the .tar.gz, what you’ll get is a gzip’d tarball of a directory of goodies. The md5sum of the critical file (tomsrtbt.raw v2.0.103) is 432afe3e1c2109525115cc4c728fa413. One of the goodies is the floppy disk image. Don’t just dd this file onto a 3.5″ floppy. It’s actually a 1.77 MB image that will be squeezed onto a 1.44 MB floppy. Run the install script (.sh file), instead.

The gunzip and tar versions on the tomsrtbt distribution were limited in unexpected ways. I couldn’t use the normal tar -xzf command because the z option didn’t exist. So, I recovered the files in two steps – first unzipping the file, then untarring the file:

gunzip /dev/hda1/tomsrtbt-2.0.103.tar.gz
tar -xv -f /dev/hda1/tomsrtbt-2.0.103.tar
md5sum /dev/hda1/tomsrtbt.0/tomsrtbt.raw

As an aside, the “tomsrtbt.0” should show up from the zip with a longer name listing the version number.  However, I had incorrectly mounted the harddrive without specifying the -t option.  Tomsrtbt defaulted to the msdos filesystem type, which truncates names.  If I had specified the “-t vfat” option, then the longer full filename would have been used.

Then, put a floppy into your 3.5″ drive and use tomsrtbt to create a new copy of itself:

/dev/hda1/tomsrtbt.0/install.sh

Q.E.D.

About Brian

Engineer. Aviator. Educator. Scientist.
This entry was posted in Computers and tagged , , , , , . Bookmark the permalink.

Leave a Reply