Ron Pool, ro...@empire.cce.cornell.edu
Steve Hanson <7376...@CompuServe.COM> writes
> I sure don't have any objection to your posting the
>article from the newsletter. Here is a less than elegant
>ASCII version of it, but at least it's readable.
Over the last several weeks I have been experimenting with a
recent attempt at writing a free UNIX clone. This system, called
Linux, is being written by Linus Torvalds in Finland. He began
writing Linux as an attempt at learning how to write code for the
Intel 386 family of processors. Apparently he learned this lesson
pretty well. Linux is very promising as a clone of UNIX for PC
users.
There are several different free or low-priced UNIX clones
available for PC users. Minix was written by Andrew Tannenbaum as
a tutorial for his students on how a small UNIX-like operating
system would be written. It is a fairly nice UNIX implementation,
looking quite a lot like Version VII UNIX. It is fairly limited,
however, by the fact that one of the design goals of MINIX was to
have it run on a least-common-denominator computer - the IBM PC.
It will run happily on an 8088 based PC with floppy drives,
although doing anything serious would of course require a hard
disk. I have personally run MINIX on one of my PC's, but always
felt frustrated by some of the limitations of the package,
particularly the limitation to 64k code segments. It is very
difficult to run a lot of the modern public domain packages in a
system with this limitation, and some things such as X windows are
clearly impossible.
Other implementations such as Coherent also have similar
limitations at the moment. Many people purchase these low-cost
UNIX clones and become disenchanted with running them on their
PC's. They will then either give up on UNIX altogether, or
purchase a larger more powerful package such as Mach for the PC
(see page ), XENIX, or the forthcoming Solaris for the 386.
Both MINIX and Coherent are sort of a cross-breed - an almost free
UNIX implementation with some limitations.
Linux is a partial answer to these limitations. It is completely
free of AT&T code, and has been placed for public free distribution
by its author. Source code is available. It was written for use
on a more modern platform - the 386SX, 386, or 486 Intel processor.
Code size is unlimited for practical purposes, as the system
includes virtual memory and demand paging (although currently this
code is pretty crude).
Many people around the world are currently working on porting
software to run under Linux. Currently there is a pretty complete
group of utilities available. Many of these are the packages
available through the Free Software Foundation. Most of the basic
parts of UNIX are now available, including the text processing
software. Networking software is not yet available, although I
would expect by the end of '92 not only will TCP/IP networking be
available, but probably X11R5 as well.
For several weeks now I have been using Linux off and on when I
have had time. Bringing it up and bringing over some software for
it has been interesting. The balance of this article is about how
Linux behaves and how it is installed.
Installation of Linux isn't as easy as installation of a
commercial UNIX implementation, but it isn't much of a challenge
for someone who has some experience with PC's. The first step in
installing it was to get a copy moved to my PC. Linux is primarily
available on the Internet. I had to manage to move a copy from one
of the computers at work and bring it home to my PC. The only
PC-compatible floppies I had easy access to were 3.5 inch floppies,
so it was obvious I was going to have to bring it home that way.
This complicated matters a little bit, as my PC has a 5.25 inch
floppy as its A drive and the 3.5 inch as its B drive. More on
that later.
Anyway, the basic distribution of Linux comes as two images. One
of these is the boot disk, which is essentially the Linux kernel.
To run Linux on a PC, you first have to bring up a copy of the
kernel on a floppy disk so you can boot from it. Then, after the
system is booted up, you need to swap this disk with the root file
system, which is a separate disk. At this point, the system is
running directly on floppy. So, this is what I first set off to
do.
I downloaded a copy of the Linux images across the Internet at
work. I got the images from the node tsx-11.mit.edu, a system at
MIT, by anonymous FTP. Anonymous FTP is a means that some systems
on the Internet provide of obtaining files without having to have
an account on the system in question. I obtained the two files
that were compressed images of the boot diskette and the root
diskette. I uncompressed these on my system, and wrote them out
to 3.5" floppies using the dd program on a Sun IPC. This is the
easy part, assuming you have access to the Internet.
I then took these floppies home. Now the problems begin. Since
PC's generally only know how to boot from their A: floppy drive, I
had a problem. I had 3.5" boot diskettes and a 5.25" disk drive to
boot from. Well, I took the clumsy hardware solution. Ripping
open my PC in a fit of "I HAVE TO SEE THIS WORKING NOW" frenzy, I
rearranged the diskette cable and terminators in my PC to allow me
to make the 3.5" drive the A drive on the system. I put the boot
floppy in, and booted the machine. Instant gratification followed
as the system said:
Loading ............................
and a few seconds later it asked me to insert the root diskette.
I put it in, and hit return as prompted. A few more seconds later
Linux was running on my PC, totally on the floppy disk drive.
Unfortunately, although this was an interesting experiment, it
isn't a very useful configuration. Even a very minimal UNIX system
like this really needs more space to spread out than you can get on
a 1.44 meg floppy drive. So I decided to try to get the package
installed on my hard disk.
Linux needs its own partition on your hard disk to run.
Fortunately, I had always run the 40 Meg disk on my system as two
partitions. One of these was a 32 meg partition (C:) and the other
was an 8 meg (D:). This was a holdover from running older versions
of DOS that wouldn't deal with larger partitions. I kept stuff
like Windows and other things I didn't use very often in the
secondary partition, and compressed them with the SuperStore
utility that comes with DR DOS 6.0, which is what I have been
running as an operating system on my PC. So I immediately decided
that having a UNIX on my system at home was a lot more important
than Windows. My slothful behavior in never getting around to
re-partitioning my disk drive was about to pay off!
After doing a really tedious system backup, I started to follow
the rather terse instructions included with Linux for installing to
a hard disk. Unfortunately, the small partition I intended to
install it into was an "extended DOS" partition, a holdover from
the olden days of MS-DOS that DRDOS still uses (mostly to not kick
up compatibility problems). Linux doesn't really understand
Extended DOS partitions, so the first thing I needed to do was to
make it a plain old ordinary partition. The FDISK program with
DRDOS will only make one primary partition, so I decided to haul
out the big guns. Fortunately I had a copy of Ontrack's Disk
Manager kicking around, so I used it to change the partition to a
primary DOS partition. I've always found disk partitioning for
MS-DOS to be pretty confusing. This exercise didn't help any. The
program was quite straightforward, but I'm afraid I'll never
understand why things that seem very straightforward to me in UNIX
seem pretty confusing in MS-DOS. Anyway, I changed what used to be
the D partition to be a primary DOS partition. I then rebooted
Linux, and found that if I used the fdisk command from Linux, it
DID in fact find the partition and identified it as device
disk appeared as /dev/hd4. Apparently Linux names the partitions
according to the order in which they appear in the partition map,
and DRDOS sorts them in another way. Oh well.
I now created a Linux file system on the new partition by using
the newfs command in Linux. This worked fine. Then I mounted the
partition on the Linux file system as /user using the mount
command. This also worked. I then copied all of the files from
the floppy to the hard disk using cp +recursive. The cp command
and a lot of the other Linux commands are the GNU file utilities.
They have both the traditional short UNIX-like flags and the
GNU-style verbose flags. I could just as well have said cp -r.
This all worked fine. I now had the file system copied across to
the hard disk. Now the instructions said that all I had to do was
to patch my boot diskette so that it would mount my hard disk at
boot time rather than the floppy. Easier said than done.
Supposedly all I had to do was to run the C program given in the
OLDER versions of the Install notes (which I didn't have at home)
and this would patch the diskette. Well, there were a few problems
here. First, I didn't have a C compiler on my PC, so the program
wouldn't do me a whole lot of good. Second, I didn't have the
program. I got the program from work via modem, and looked at what
it did. I then decided that I could just heroically patch the boot
program using SID, the symbolic debugger that comes with DR DOS.
Well, this would all be fine. I did pretty much that, reading in
the kernel to memory on the PC from the boot diskette, patching the
507th and 508th bytes and then writing it out to the 5.25" floppy,
figuring that I could now boot from the REAL A: drive. Well, guess
again. I tried and tried and tried, and couldn't get things to
work right. Finally it dawned on me that I was patching the number
backwards. I'm SO accustomed to working on SPARC systems that I
kind of neglected to realize that I was looking at the word in the
PC memory backwards, and that I was putting the two bytes in the
wrong order. After fixing this, I just assumed all would be fine.
Guess again. Still no go. I was just about to start getting real
frustrated when I remembered that I had been having a whole lot of
trouble with the 5.25 inch disk drive on my system with DRDOS.
When I try to access my 5.25 inch floppy with disk caching enabled
in DRDOS I have had a lot of problems. Usually I just turn of disk
caching when I use the floppy. Of course, I forgot to do so this
time. Sure enough, as soon as I turned off the disk caching the
boot disk wrote properly. I was now set. All I had to do was put
my Linux boot disk in the computer, boot it, and the system started
up and mounted my hard disk as its root file system. Just like a
real computer.
At this point I had a pretty minimal operating system. My
next set was to import some software. A lot of pre-compiled
software is available already for Linux, so I proceeded to grab
some off the Internet and to load it in. I brought in gcc, the GNU
c compiler, the gnu utilities, the less file viewing utility,
kermit, and several other programs. I now have a real minimal UNIX
system running on my PC, and it didn't cost anything. I also have
the basics installed to write programs and to port over programs
available on the Internet. Most programs seem to come up in a
straightforward fashion, at least if they aren't particularly
exotic.
All in all, Linux is a pretty nice small UNIX clone for the
PC. It is still quite rough around the edges. Several of the
limitations will be fixed in release 0.95, which is due in March.
This will include a real login process, so that there will be an
ability to log in as someone other than root. I'm looking forward
to using Linux and seeing new software available for it.
Not so. He could just as well have said cp -R, though. cp -r doesn't
do the right thing with the special files in /dev.
}...
--
Greg Lee <l...@uhunix.uhcc.hawaii.edu>