Date: Thu, 27 Mar 97 15:25:51 CST From: Joe Greco <jgreco@solaria.sol.net> To: hackers@freebsd.org Cc: fyeung@fyeung8.netific.com, spaz@u.washington.edu, chris@bb.cc.wa.us Subject: Okay, okay already! Diskless Xterminal stuff. Message-ID: <199703272125.PAA18688@solaria.sol.net>
next in thread | raw e-mail | index | archive | help
I stopped counting a little while ago. Please stop asking for it! :-) I have posted the bits at ftp.freebsd.sol.net:/pub/alpha/xkernel.tar.gz The README is attached. There are enough materials enclosed that you should be able to set up a diskless Xterminal. It's the same stuff I use here; I'm using one of my Xterminals right now. This is not a beginner level project, but on the other hand, it's not rocket science. Anyone who could set up a diskless box and understands poorly documented C code could get this up and running without too much trouble, I think. Please drop me a line if you do{,n't} have success with this. ... Joe ------------------------------------------------------------------------------- Joe Greco - Systems Administrator jgreco@ns.sol.net Solaria Public Access UNIX - Milwaukee, WI 414/342-4847 README: This is hardly a comprehensive document, it's more like a few notes about how it all works. I'm a cheap SOB, and I don't like putting hard drives in everything, not just because it's expensive (you can actually MOVE a box with no hard drive, while it's running, and you don't have to worry about backups). So, sometimes I feel that a diskless workstation is a practical solution, and I've been using FreeBSD based ones for several years now, with the ed-based cards. I finally got exasperated that I couldn't do the same thing with the de-based cards. They are nicer, faster, and PCI. But they don't have netboot support... and there are a few applications where a standalone system might be very useful. Since I have floppy drives in all my machines, I developed what I felt to be a reasonable compromise. I figured out (with a little guidance from the sysinstall build tools) how to make a standalone 1.44MB floppy, complete with kernel and a few basics. The basic premise is that I can get a standalone machine running off of a floppy. Then I NFS mount a server, and pull other goodies (like X11) off of it. To do this, I hacked up a custom init(8) called "myinit" that did the bare essentials: run an ifconfig and then run mount_nfs. If that all works, then it executes /usr/init (for maximum configurability on the server end). The arguments to ifconfig and mount_nfs are hard wired into myinit's source code (ewwwwwwww). The floppy's contents look like this: --------------------------------------- # df -k . Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/vn0c 763 580 183 76% /mnt # ls -lR total 3 drwxr-xr-x 2 root wheel 512 Dec 28 20:26 boot drwxr-xr-x 3 root wheel 512 Dec 28 20:26 dev drwxr-xr-x 2 root wheel 512 Dec 28 20:26 etc drwxr-xr-x 2 root wheel 512 Dec 28 20:26 stand drwxr-xr-x 2 root wheel 512 Dec 28 20:26 usr ./boot: total 508 -r-xr-xr-x 1 root wheel 172032 Dec 28 20:26 ifconfig -r-xr-xr-x 1 root wheel 159744 Dec 28 20:26 mount_nfs -r-xr-xr-x 1 root wheel 176128 Dec 28 20:26 route ./dev: total 1 crw------- 1 root wheel 0, 0 Dec 28 20:26 console crw-rw---- 1 uucp dialer 28, 128 Dec 28 20:26 cuaa0 crw-rw---- 1 uucp dialer 28, 129 Dec 28 20:26 cuaa1 crw-rw---- 1 uucp dialer 28, 160 Dec 28 20:26 cuaia0 crw-rw---- 1 uucp dialer 28, 161 Dec 28 20:26 cuaia1 crw-rw---- 1 uucp dialer 28, 192 Dec 28 20:26 cuala0 crw-rw---- 1 uucp dialer 28, 193 Dec 28 20:26 cuala1 crw-r----- 1 root kmem 4, 0 Dec 28 20:26 drum dr-xr-xr-x 2 bin bin 1024 Dec 28 20:26 fd crw------- 1 root wheel 2, 14 Dec 28 20:26 io crw------- 1 root wheel 7, 0 Dec 28 20:26 klog crw-r----- 1 root kmem 2, 1 Dec 28 20:26 kmem crw-r--r-- 1 root wheel 32, 0 Dec 28 20:26 lkm crw-r----- 1 root kmem 2, 0 Dec 28 20:26 mem crw-rw-rw- 1 root wheel 2, 2 Dec 28 20:26 null crw-r--r-- 1 root wheel 2, 3 Dec 28 20:26 random crw-rw-rw- 1 root wheel 22, 2 Dec 28 20:26 stderr crw-rw-rw- 1 root wheel 22, 0 Dec 28 20:26 stdin crw-rw-rw- 1 root wheel 22, 1 Dec 28 20:26 stdout crw-rw-rw- 1 root wheel 1, 0 Dec 28 20:26 tty crw------- 1 root wheel 12, 0 Dec 28 20:26 ttyv0 crw------- 1 root wheel 12, 1 Dec 28 20:26 ttyv1 crw------- 1 root wheel 12, 2 Dec 28 20:26 ttyv2 crw------- 1 root wheel 12, 3 Dec 28 20:26 ttyv3 crw-r--r-- 1 root wheel 2, 4 Dec 28 20:26 urandom lrwxr-xr-x 1 root wheel 5 Dec 28 20:26 vga -> ttyv0 crw-rw-rw- 1 root wheel 2, 12 Dec 28 20:26 zero ./dev/fd: total 0 crw-rw-rw- 1 bin bin 22, 0 Dec 28 20:26 0 crw-rw-rw- 1 bin bin 22, 1 Dec 28 20:26 1 crw-rw-rw- 1 bin bin 22, 10 Dec 28 20:26 10 crw-rw-rw- 1 bin bin 22, 11 Dec 28 20:26 11 crw-rw-rw- 1 bin bin 22, 12 Dec 28 20:26 12 crw-rw-rw- 1 bin bin 22, 13 Dec 28 20:26 13 crw-rw-rw- 1 bin bin 22, 14 Dec 28 20:26 14 crw-rw-rw- 1 bin bin 22, 15 Dec 28 20:26 15 crw-rw-rw- 1 bin bin 22, 16 Dec 28 20:26 16 crw-rw-rw- 1 bin bin 22, 17 Dec 28 20:26 17 crw-rw-rw- 1 bin bin 22, 18 Dec 28 20:26 18 crw-rw-rw- 1 bin bin 22, 19 Dec 28 20:26 19 crw-rw-rw- 1 bin bin 22, 2 Dec 28 20:26 2 crw-rw-rw- 1 bin bin 22, 20 Dec 28 20:26 20 crw-rw-rw- 1 bin bin 22, 21 Dec 28 20:26 21 ....etc.... crw-rw-rw- 1 bin bin 22, 61 Dec 28 20:26 61 crw-rw-rw- 1 bin bin 22, 62 Dec 28 20:26 62 crw-rw-rw- 1 bin bin 22, 63 Dec 28 20:26 63 crw-rw-rw- 1 bin bin 22, 7 Dec 28 20:26 7 crw-rw-rw- 1 bin bin 22, 8 Dec 28 20:26 8 crw-rw-rw- 1 bin bin 22, 9 Dec 28 20:26 9 ./etc: total 1 -rw-r--r-- 1 root wheel 32 Dec 28 20:26 hosts ./stand: total 68 -rwxr-xr-x 1 root wheel 62174 Dec 28 20:26 sysinstall ./usr: # --------------------------------------- You will note that I didn't bother messing around with crunch to save space in the binaries. You will also note that ifconfig and route both exist, meaning there are enough tools for a simple Ethernet router right now. :-) To set this thing up for yourself, you're on your own. Read that line again a few times... I will do what I can to help, but there is no promise of support or assistance with this. I am a one man shop and may not have the time to help everyone! But, here's a few hints. 1) You need a custom kernel, and therefore the FreeBSD kernel sources. There is a 2.2-derived kernel config file called XKERNEL included. The "build" script expects you to use it. 2) Edit the file "hosts" to contain both your client and the NFS server. The client reference is used by "myinit" to ifconfig the interface. The server is obvious. This is not strictly necessary, I guess, but was the first step towards making the code more portable and less hardwired. 3) Edit myinit.c to have a reasonable set of args for ifconfig and mount_nfs. 4) Running "build" after building the kernel will do most of the dirty work. 5) dd if=boot.flp of=/dev/rfd0c bs=512 on a formatted floppy to finish making your boot floppy. Now comes more fun. You get to configure both the NFS server and X11. 6) I highly recommend that you already have a preconfigured XF86Config file for the card you want. Life will suck if you don't. 7) Read the comments in install_server_usr_fs!!!!!!!!!!!!!!!!!!!!!!!!! If you do NOT understand what it is doing, do NOT use it, or you might seriously hose up your system. It is simply a tool to do most of the dreary stuff automatically. It does not do everything for you. I advise you to understand it fully. 8) You need to figure out which X11R6/XF86 bits need to get installed. 9) If you want to be able to use "top" to monitor the Xserver (it's a good idea), you need a hacked up copy of top with one single change: the kvm_open needs to open "/usr/kernel" instead of the value it obtains from the system. This means that your kernel needs to be available as /usr/kernel, fortunately "build" leaves it around for you. ("top" doesn't seem to get the keyboard in the correct mode, anyone who figures this out gets a hearty thank-you from me.) If not - compile usrinit.c with -DNOTOP or it'll whine all day at you. 10) Configure your system to NFS export the appropriate data, read-only, with as minimal a set of permissions as possible. 11) Set up an XDM server on your network to answer the Xterminal's automatic xdm broadcast queries. 12) Boot it. Comments and improved directions are not unwelcome. Where possible and practical, the init's will try to emit semi-useful error messages. Make sure you page through vty0/vty1 watching for problems. --------------------------------------- Some random thoughts about all of this: --------------------------------------- There are places where a floppy drive might be undesirable, such as a school: in such circumstances, it could either be hidden inside the machine in a hard drive bay (such that the machine would need to be disassembled to access it), or a very low capacity hard drive could be substituted (use your creativity to build such a beast and install the stuff on it). For some applications, it might actually be possible AND acceptable to netboot, in which case these tools would still be useful to build a minimal skeleton system that was optimized for a task. There is nothing preventing this from being used for other dedicated applications. I've been approached about it for tasks such as a mini- router, terminal server, etc. It's all very possible. For such an application, it might be possible to set up some space on the floppy as a miniature configuration partition, or provide some other mechanism to provide for a self-configurable floppy. The current system obviously builds the information in at floppy creation time. It would be neat/cool/challenging to try to eliminate the dependence on a read-only NFS server, and have an Xserver-on-the-disk. With an external font server, such a thing might just be possible!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703272125.PAA18688>