LINUX GAZETTE
[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

"Linux Gazette...making Linux just a little more fun!"


Making an X Terminal from a PC

By Patrick Swieskowski


An X terminal is a great way to expand the computing presence in a home or office. (We're talking about a PC that functions as an X terminal, not NEC's dedicated X-Terminal device.) They're fast, cool, a great demonstration of a Unix system's power, and, most importantly, dirt cheap. The following chronicles my experience in creating an X terminal from old PC hardware and connecting it to my Debian GNU/Linux system.

My server is a Pogo Altura with a one gigahertz AMD Athlon processor. Pogo is a great company to go to if you don't want to piece together your own system or pay for a Windows license with a prebuilt system from somewhere else. I run Debian on it, so the X terminal will use that also. That's enough background information for now.

Root filesystem setup

The X terminal will boot off of a custom kernel on a floppy and then get its root filesystem over NFS from the server. The first step, then, is to create this root filesystem. You could copy over file after file by hand from a currently running system, or you can take a shorter approach like I did and just use the base Debian system. All you have to do is download the base system tarball which can be found on the Debian webserver as the file base2_2.tgz. I downloaded that and did a "tar -xvzf base2_2.tgz" in /usr/xterminal and seconds later I had a fully functional root filesystem in that directory. Anyone can use the Debian base system regardless of their server's flavor of Linux.

The next step is to configure this root filesystem. I did it by becoming root and running "chroot /usr/xterminal bash --login". Now that I'm "inside" the root filesystem I duplicated my actual /etc/resolv.conf in my new root filesystem so I could use domain names during the configuration. Next we should install X, and, as any Debian user knows, the best way to do this is with apt-get. I ran "apt-get update" then "apt-get install xserver-s3 xfonts-100dpi xfonts-base", but you'll change xserver-s3 to something different if you don't have an s3 card in your X terminal (check for something suitable here.) This downloads and installs the necessary components of X. apt-get should ask you a few questions and make an XF86Config file for you, if it doesn't, or if you need to tweak the file it generates, refer to the XFree86 HOWTO. The root filesystem is almost complete. I created an /etc/fstab file for the X terminal root that looks like this:

10.0.0.1:/usr/xterminal / nfs defaults 0 0
proc /proc proc defaults 0 0
    

Of course, you'll change 10.0.0.1:/usr/xterminal to match your server IP and location of the NFS root directory. Since I have no user accounts created in this NFS root filesystem I decided to start X from init. This necessitated the following amendment to my /etc/inittab file (yours will probably have a different IP address at the end):

X:123456:respawn:/usr/bin/X11/X -query 10.0.0.1
    

I'm not sure if this is perfectly correct, but it works. Finally remove the /sbin/unconfigured.sh shell script so it doesn't whine when you try to boot from your now complete root filesystem.

Building the boot floppy

Next let's make the kernel. Refer to the Kernel HOWTO if you aren't familiar with the kernel compile process. I tried making a boot-disk with Kernel 2.4.5 but it seems as if bootp is broken in it, so I chose Kernel 2.4.4 instead. Go through the regular routine (make xconfig, make dep, make bzImage) but be sure to select the following options to be compiled into the kernel (not as modules):

Build your kernel and copy it to a floppy with "dd if=arch/i386/boot/bzImage of=/dev/fd0" (as root) or a similar command with your kernel and floppy drive. Since this is just a raw kernel on a floppy we need to tell it to boot over NFS. Create a /dev/boot255 device by typing (still as root) "mknod /dev/boot255 c 0 255". Now make the floppy look for its root filesystem over NFS by running (as root, of course) "rdev /dev/fd0 /dev/boot255". You can now "rm /dev/boot255" since it has no further use. Now you can set your boot floppy aside until you get your X terminal hardware.

Server setup

We aren't ready to move on to hardware quite yet though, now it's time for the tricky part of server configuration. I did this on Debian (it is so choice), so your setup for this part may differ slightly. First I installed and configured an NFS server (apt-get nfs-user-server) so the X terminal could get to its root filesystem. The configuration consists of editing the /etc/exports file. Yours should contain a line that looks like this one (the no_root_squash is important):

/usr/xterminal 10.0.0.4/255.255.255.0(rw,no_root_squash)
    

The netmask (/255.255.255.0) is included so I can add more clients on my local network without listing each one independently, but just the ip address works if that's all you want. Next I installed a BOOTP server with "apt-get install bootp". To configure this I added the following line to my /etc/bootptab file:

xterm1:vm=auto:ip=10.0.0.4:ht=ethernet:ha=00a0240d5f52:rp=/usr/xterminal
    

You'll probably want to change the IP, the hardware address of your NIC (it's written on it somewhere, or if you can't find it there it should be in view when the boot floppy kernel stops to look for bootp servers), and the path to the root filesystem. You'll also need to add a line like the following to your /etc/inetd.conf file:

bootps          dgram   udp     wait    root    /usr/sbin/bootpd        bootpd -i -t 120
    

Then you'll need to have inetd reparse its configuration file by running a "killall -HUP inetd" as root. One more thing to set up, XDM. Again Debian makes this ridiculously easy ("apt-get install xdm"). There are a few configuration files to worry about with XDM though. For me these are found under /etc/X11/xdm although yours may be somewhere else. I added the line "10.0.0.4:0 foreign" (you will probably have a different X terminal IP) to my Xservers file and commented out the ". To :0 local /usr/X11R6/bin/X -dpi 100 -nolisten tcp" line so I didn't have to login through XDM on the server. To Xaccess I appended the line "10.0.0.4" so my X terminal could connect to xdm. And finally in xdm-config I commented out (put a # infront of) the line that said "DisplayManager.requestPort: 0" so that xdm would not deny all connection attempts. The server is now set up.

Putting it all together

Now for the interesting part, finding an old computer. I did not have an old box lying around so I went shopping and found one at a local used computer store. No guarantees came with my newfound 486/66, but it was only thirty bucks. By the way, this is probably the top end of X terminal hardware, anything more in the processor department would be overkill. It came with an S3Trio64 onboard (It could only do 800x600x16 so I've replaced it with a generic Trident Blade3D-based PCI video card running under the SVGA X server), and I had some RAM (32 megabytes) sitting around that I shoved in it. Another note on hardware overkill, 32 megabytes is way more RAM than an X terminal needs. Eight or sixteen would probably be fine since all it has to do is run X and the kernel. I took out everything but the floppy drive and the NIC (3Com Etherlink III), so it runs silently except for the gentle hum of the power supply fan. I plugged the monitor, ethernet patch cable, keyboard, and mouse in, put in my boot floppy, and turned it on to see (after a short boot delay) a nice XFree86 logo and a login box in X. With a cheap fifteen-inch monitor these high-quality X terminals could probably be made for $150-$200 apiece.

The X terminal works great, just like I'm sitting in X on my server. If you are having problems setting this up check the relevant HOWTOS listed above or ask your local Linux guru. These instructions should work to give you nice, fast, and, best of all, cheap X terminals to put around your home or office.

Patrick Swieskowski

Patrick will be a senior this fall at Roosevelt High School and Central Academy in Des Moines, Iowa. He discovered Linux in eighth grade and has been using it ever since.


Copyright © 2001, Patrick Swieskowski.
Copying license https://www.linuxgazette.net/copying.html
Published in Issue 68 of Linux Gazette, July 2001

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]