General Contact details
After some expansion in the number of servers at my old job, we were running out of old terminals to use on our Sun servers (most of which were headless and didn't even have a graphics board for a monitor). I'd set up a DOS machine as a terminal in the past, but most of the serial terminal emulators I'd found were shareware. In any case, as linux supports virtual terminals which can be switched between using Alt-Fn, I thought that there had to be a way to use linux to connect to multiple servers (provided the PC had multiple serial ports).
I did a little hunting on the web and discovered the Serial Terminal Linux homepage. While this didn't do what I needed exactly, it gave me enough pointers to look at /usr/src/linux/Documentation/ramdisk.txt and Minicom. However, it didn't support virtual terminals. I then found rungetty which allowed me to run arbitrary programs on virtual terminals (eg, minicom!).
NB: I couldn't find a home page for rungetty during an update of links. If anyone knows where it has a homepage, let me know! In any case, you should be able to find it as part of your distribution; a Google search on rungetty reveals a lot of places to download it, including RPMs for most distributions and it's part of Debian anyway.
The requirements are pretty basic:
There may be methods to reduce the memory requirements; minicom is too fully-featured for what is really required. agetty may actually be better for the job, but I haven't tested it. In addition, you could set (part of) the harddrive as swap space.
Obviously, in a dumb terminal, you are not going to need advanced features such as TCP/IP stack, NFS or even sound. As a result, I configured the kernel with nothing except:
This is copied almost entirely from /usr/src/linux/Documentation/ramdisk.txt:
inittab controls what programs init will start after boot. There are two things we have to do:
# Only to to run level 1: id:1:initdefault: # Remount / rw as we need to write to tty's mnt::sysinit:/sbin/mount -n -o remount,rw / # Run minicoms on tty's com1:1:respawn:/sbin/rungetty tty1 /usr/bin/minicom ttyS0 com2:1:respawn:/sbin/rungetty tty2 /usr/bin/minicom ttyS1 #com3:1:respawn:/sbin/rungetty tty3 /usr/bin/minicom ttyS2 #com4:1:respawn:/sbin/rungetty tty4 /usr/bin/minicom ttyS3Currently, com3 and com4 are commented out due to the memory restrictions we have, but it shows the syntax for the lines. If other serial ports are added, the syntax should follow the above.
These files specify the device files required and the baud rate for communication. This is an example file for minirc.ttyS0 using 9600 baud and 8 bits:
pr port /dev/ttyS0 pu baudrate 9600 pu bits 8 pu parity NMost terminals will probably only require you to change the port (for different COM ports) and the baudrate setting. For example, Sun machines use 9600 by default, while 3com switches use 19200.
A single line for root is all that is required here:
root:x:0:0:root:/root:/bin/bashThe fact the shell doesn't exist doesn't matter here as that is only run for a login, which we will never do.
In order to remount /, we want an entry here for the mount command:
/dev/ram / ext2 defaults 1 1
minicom uses nsswitch for something, so here's the config required:
passwd: files shadow: files group: files hosts: files ethers: files netmasks: files networks: files protocols: files rpc: files services: filesThe passwd: entry may actually be sufficient.
rungetty is a program that allows arbitrary programs to be run on different virtual terminals. However, some of its features are not required on a floppy based distribution and actually cause problems.
Firstly, we don't have a syslog daemon running and rungetty will try to log problems there first of all. The simplest fix for this is to comment out or remove the line #define USE_SYSLOG which will stop the syslog stuff being compiled in.
Secondly, rungetty tries to setuid() to 'nobody' for security. For our floppy based distribution, we don't need this kind of security, so we uncomment the getpw* entries and the setuid() and setgid() calls.
This done, we recompile and strip the binary and copy to our distro file.
Finally, certain device files are required using mknod. These files, along with type (character/block) and major/minor numbers are:
With all the files created, you can now create the floppy.
First, put the kernel on the floppy by running:
dd if=zImage of=/dev/fd0 bs=1kTake a note of the number of blocks copied as you must put the fs image after this. If you use my kernel image, an offset of 400 should be adequate.
Next, unmount the filesystem and copy the ramdisk image to a file:
umount /mnt/ramdisk dd if=/dev/ram bs=1k count=2048 | gzip -v9 > /tmp/ram_image.gzand put the image onto the floppy:
dd if=/tmp/ram_image.gz of=/dev/fd0 bs=1k seek=400Finally, set the floppy boot settings:
rdev /dev/fd0 /dev/fd0 rdev -r /dev/fd0 16784The 16784 denotes that a ramdisk should be loaded (2^14=16384) from offset 400 (+400=16784) without prompting. See /usr/src/linux/Documentation/ramdisk.txt for more information.
File last modified: Saturday, 06-Mar-2004 14:12:08 GMT