369 lines
15 KiB
TeX
369 lines
15 KiB
TeX
%
|
|
% A small Linux paper written partly because I need to get
|
|
% my LaTeX going :-), and partly because a paper is a good idea.
|
|
%
|
|
% NOTE! This is *La*TeX, not ordinary TeX
|
|
%
|
|
|
|
\def\nic{{\tt `nic.funet.fi'}}
|
|
\def\dir{{\tt '/pub/OS/Linux'}}
|
|
\def\ftp{{\tt ftp}}
|
|
\def\Linux{\begingroup\sc Linux\endgroup}
|
|
|
|
\documentstyle{article}
|
|
\title{\Linux---a free unix-386 kernel}
|
|
\author{Linus Torvalds (torvalds@kruuna.helsinki.fi)}
|
|
\date{October 10, 1991}
|
|
\begin{document}
|
|
\maketitle
|
|
|
|
\section{Introduction to \Linux}
|
|
|
|
\subsection{What is \Linux?}
|
|
|
|
\Linux\ is a free unix-like kernel for 386-AT computers, coming with
|
|
full source code. It is meant for hackers/computer science students to
|
|
use, learn and enjoy. It is written mostly in {\tt\bf C}, but parts of
|
|
it are in gnu-format assembler, and the boot-sequence is in intel 086
|
|
assembly language. The {\tt\bf C}-code is relatively ANSI, with a few
|
|
GNU enhancements (mostly {\tt\_\_asm\_\_} and {\tt inline}).
|
|
|
|
While there are a number of unices available for 386 computers, most of
|
|
them cost a lot of money, and come with no source. Thus, they are ideal
|
|
for actually {\it using} your computer, but if you want to learn how
|
|
they work, you are f--\,--ked.
|
|
|
|
There are also a few unices available with source. Minix, the learning
|
|
tool written by Andrew S.~Tanenbaum, has been used in universities as a
|
|
teaching tool for years. The BSD-386 system comes with source, but has a
|
|
restrictive copyright and costs a lot of money (\$995 is the starting
|
|
price, I think). The GNU kernel (Hurd) will be free, but is currently
|
|
not ready, and will be too big to understand and learn.
|
|
|
|
\Linux\ most closely resembles Minix, in that it is small and not very
|
|
sophisticated, and thus easy (well\dots) to understand. \Linux\ was
|
|
also written under Minix, so there are quite a bit of similarities, and
|
|
any Minix hacker will feel relatively at home with \Linux. None of the
|
|
Minix code was used in the project though, so the Minix copyright
|
|
doesn't cover the new system. It also is {\it completely free}, and has
|
|
a very loose copyright. Thus there is no need for megabytes of diffs
|
|
like under Minix.
|
|
|
|
\subsection{The \Linux\ copyright}
|
|
|
|
While being freely distributable, I do restrict the use of \Linux\ in a
|
|
few ways:
|
|
%
|
|
\begin{itemize}
|
|
\item You may freely copy and redistribute the source and binaries, {\bf
|
|
as long as:}
|
|
\begin{itemize}
|
|
\item complete source is available. Thus binaries may not be distributed
|
|
by themselves, even if you have made changes to them.
|
|
\item you do not profit from the distribution. In fact even ``handling
|
|
costs'' are not acceptable.
|
|
\item you keep the appropriate copyrights intact.
|
|
\end{itemize}
|
|
\item You may change the source to your liking, but if you distribute
|
|
parts of the new system (or just binaries), all the new code must be
|
|
included.
|
|
\item You may make small excepts from the code without including
|
|
copyrights. This is up to you, but a reference to me or the code would
|
|
be appreciated.
|
|
\end{itemize}
|
|
This should be loose enough not to cause any worry in anybody using or
|
|
expanding the system. If you have a friend who really doesn't want the
|
|
source, but just a working binary, you may of course give it to him
|
|
without worrying whether I will sue you. Keep it between friends, though.
|
|
|
|
\subsection{Hardware/software needed to get \Linux\ running}
|
|
|
|
\Linux\ was written on a 386-AT running Minix. As \Linux\ is a real
|
|
operating system, and goes directly to the hardware to do things, you
|
|
have to have a very similar system to get it going without problems:
|
|
\begin{itemize}
|
|
\item 386-AT (PS/2's are different enough that things won't work)
|
|
\item VGA or EGA screen hardware.
|
|
\item Standard AT hard-disk interface, IDE disks work fine (in fact
|
|
that's what I use).
|
|
\item Normal real-mode BIOS. Some machines seem to use virtual-86 mode
|
|
to run the bootup program, and on such machines \Linux\ won't boot up
|
|
and run correctly.
|
|
\end{itemize}
|
|
|
|
While \Linux\ will be expanded to be a self-sufficient system, Minix-386
|
|
is currently needed to get the ball rolling. You need Minix to make the
|
|
initial root file system, and to compile the OS binary. After that
|
|
\Linux\ is a self-sufficient system, but Minix is recommended in order
|
|
to make file system checking ({\tt fsck}) and to recompile the system
|
|
after making changes.
|
|
|
|
\subsection{Getting \Linux}
|
|
|
|
\Linux\ can currently be gotten by anonymous \ftp\ from \nic\ in the
|
|
directory \dir. This directory contains the full source to the operating
|
|
system, as well as a couple of binaries so that you can actually use the
|
|
system.
|
|
|
|
{\vspace{\baselineskip}\bf NOTE! The binaries are mostly GNU software,
|
|
and are under a stricter copyright (the GNU copyleft) than the \Linux\
|
|
sources. Thus you may not redistribute them without distributing their
|
|
source, found in {\tt/pub/GNU}. See any GNU software package for more
|
|
information on the GNU copyleft.\vspace{\baselineskip}}
|
|
|
|
The various files found in this directory are:
|
|
\begin{itemize}
|
|
\item{\tt linux-0.03.tar.Z}---complete source to the operating system,
|
|
in a 16-bit compressed tar archive.
|
|
\item{\tt Linux.tex}---\LaTeX\ source for this file.
|
|
\item{\tt bash.Z}---bash binary to run under \Linux. This binary should
|
|
be put under tha name {\tt/bin/sh} in the file system reserved for
|
|
\Linux\ (see installation).
|
|
\item{\tt update.Z}---update binary, to be put in {\tt/bin/update}.
|
|
\item{\tt gccbin.tar.Z}---GNU cc binaries needed to get a working
|
|
compiler. This tarred archive contains the compiler, loader, assembler
|
|
and support programs (nm, strip etc). It also contains a small library
|
|
sufficient for most programs.
|
|
\item{\tt include.tar.Z}---include-files necessary to get gcc working.
|
|
\item{\tt unistd.tar.Z}---source to the unistd library routines (ie
|
|
system call interface). With this you can build a bigger library by
|
|
using system-independent library sources.
|
|
\item{\tt utilbin.tar.Z}---binaries to various GNU utilities, including
|
|
GNU fileutils, make and tar. Also contains the emacs-clone {\tt uemacs}.
|
|
\item{\tt README, RELNOTES-0.01, INSTALLATION}---ascii files containing
|
|
some (somewhat out-of-date) information about \Linux.
|
|
\end{itemize}
|
|
|
|
The absolute minimum needed to get a system going is the OS source and
|
|
the bash and update binaries. You won't be doing much with just these
|
|
though.
|
|
|
|
\section{Installation}
|
|
|
|
After you have gotten the necessary \Linux\ files, you need to compile
|
|
the system and make a root directory. The necessary binaries need to be
|
|
put in the root file system.
|
|
Do this:
|
|
\begin{enumerate}
|
|
%
|
|
\item Back up your software. While \Linux\ never has destroyed any of my
|
|
files, nothing is certain. Better safe than sorry.
|
|
%
|
|
\item Choose/make a standard Minix HD-partition to be the new \Linux\ root
|
|
file system.
|
|
%
|
|
\item Make the necessary device nodes on the new root. \Linux\ uses the
|
|
same type of nodes as Minix, so use the Minix {\tt mknod} command to
|
|
make the following devices:
|
|
\begin{itemize}
|
|
\item{\tt/dev/tty}
|
|
\item{\tt/dev/tty[0-2]}
|
|
\item{\tt/dev/hd[0-9]}
|
|
\end{itemize}
|
|
Node numbers are the same as in Minix.
|
|
%
|
|
\item Move the necessary files to the new root partition. The files
|
|
should be in the following directories:
|
|
\begin{itemize}
|
|
\item{\tt/bin:}
|
|
\begin{itemize}
|
|
\item{\tt sh}, ie {\tt bash.Z}.
|
|
\item{\tt update}
|
|
\end{itemize}
|
|
\item{\tt/usr/bin:}
|
|
\begin{itemize}
|
|
\item Contents of {\tt utilbin.tar.Z}
|
|
\end{itemize}
|
|
\item{\tt/usr/include:}
|
|
\begin{itemize}
|
|
\item Contents of {\tt include.tar.Z}
|
|
\end{itemize}
|
|
\item{\tt/usr/local/lib:}
|
|
\begin{itemize}
|
|
\item Contents of {\tt gccbin.tar.Z}, excepting {\tt gcc}
|
|
\end{itemize}
|
|
\item{\tt/usr/local/bin:}
|
|
\begin{itemize}
|
|
\item{\tt gcc}
|
|
\item links to files in {\tt/usr/local/lib} of your choice. I link
|
|
{\tt ld}, {\tt as}, {\tt nm}, {\tt strip} and {\tt size} to their
|
|
counterparts in {\tt/usr/local/lib/gcc-XXX}.
|
|
\end{itemize}
|
|
%
|
|
\item Edit the {\tt linux/include/linux/config.h} file for your system.
|
|
This file contains the system-specific information: memory space, disk
|
|
types, root partition number (again the numbering is the same as in
|
|
Minix), keyboard type (currently just US and Finnish) etc.
|
|
%
|
|
\item Compile the \Linux\ sources. A simple {\tt make} should do the
|
|
trick, after you have edited the {\tt makefile}s to suit your system
|
|
(ie, removed the {\tt-mstring-insns} flag and changed the paths to suit
|
|
you.) Users of {\tt gcc} versions earlier than 1.40 will probably have
|
|
to add {\tt gnulib} to the `{\tt LIBS =}'-line in the {\tt makefile}.
|
|
%
|
|
\item Copy the resultant {\tt Image}-file to a floppy (ie, {\tt cp Image
|
|
/dev/PS0} or similar.)
|
|
%
|
|
\item Reboot with the new floppy. The startup screen should tell you
|
|
that the system is booting ({\tt Loading system ...}), then some vital
|
|
root file system information ({\tt xxx/XXX inodes/blocks free}),
|
|
followed by a {\tt Ok.} and the bash prompt (initially {\tt bash\#} if
|
|
you have no {\tt.bashrc} file).
|
|
\end{itemize}
|
|
|
|
Hopefully you now have a functioning unix, and you are logged in as
|
|
{\tt root}. \Linux\ currently has no {\tt'init'} process, and as soon
|
|
as you log out, the system will {\tt sync} and just wait. Use the
|
|
three-finger-salute to reboot your machine.
|
|
|
|
\end{enumerate}
|
|
|
|
\section{Things missing/incomplete in \Linux}
|
|
|
|
While \Linux\ is meant to be a fully selfsufficient kernel, this is
|
|
currently not the case. As already mentioned, you need Minix to set
|
|
things up, and to check the file system once it's running. There are a
|
|
number of other deficiencies:
|
|
\begin{itemize}
|
|
%
|
|
\item Incomplete hardware-support. Some of the standard features of an
|
|
AT are not currently supported. Most notably are floppy disk drives,
|
|
making using \Linux\ for real work (backing up etc) currently not
|
|
possible. Also some of the features of the serial lines aren't yet
|
|
implemented (hard-wired to 2400bps, no hang-up notification etc).
|
|
%
|
|
\item Incomplete standard C library. The {\tt libc.a} found in the gcc
|
|
distribution package is not complete, and I'm very much interested in
|
|
freely distributable library functions.
|
|
%
|
|
\item Some of the system calls are not fully implemented. This concerns
|
|
mostly ``seldom-used'' features like debugging (yeah, who needs it
|
|
anyway, don't all your programs work the first time {\tt:-)} and some
|
|
other features.
|
|
%
|
|
\item As mentioned, no {\tt login} and {\tt init} processes. Currently
|
|
\Linux\ boots up in single-user mode, with the root as console-user.
|
|
This is enough for some porting work, but not really practical.
|
|
%
|
|
\item 387-support is not yet implemented, although some skeleton
|
|
routines are present. The gcc-binary found on \nic\ will correctly use
|
|
soft-float (ie emulation function calls) for the four basic math
|
|
operations. 387-support will materialize as soon as a 387 finds its way
|
|
into my computer. Hopefully in a month or two.
|
|
%
|
|
\item None of the important system-administration commands has yet been
|
|
written for \Linux. These include things like {\tt mkfs}, {\tt format},
|
|
{\tt fsck}, {\tt mknod} etc. Some of these need kernel features not yet
|
|
implemented ({\tt format}, {\tt mknod}), some just need to be written.
|
|
As with the library, I'd welcome any freely distributable files.
|
|
%
|
|
\end{itemize}
|
|
|
|
As you can see, \Linux\ is as yet not a complete system. Your help is
|
|
appreciated to make it better. I'm not interested in Minix-commands
|
|
rewritten for \Linux, unless you have written them yourself from
|
|
scratch. You are of course free (and encouraged) to use everything you
|
|
have in your Minix-distribution for your own \Linux-system, but due to
|
|
the Minix copyrights, they cannot be distributed to a wider audience.
|
|
|
|
Some of the probelms mentioned here will be fixed by me (ie serial
|
|
lines/387/floppy support) as soon as possible, but I'm hoping to get
|
|
help with the libraries etc. Bug-reports/patches and wish-lists will be
|
|
appreciated, and if you actually have the patch to the problem, I'll try
|
|
to implement it right away. Small changes will be sent out as patches to
|
|
the mailing list and be set up on \nic, but after heavy rewrites or
|
|
bigger patches, the whole system will be updated at \nic.
|
|
|
|
\section{Porting software for \Linux}
|
|
|
|
\Linux\ was designed to make porting relatively easy. Thus the full
|
|
{\tt termios}-implementation, and the somewhat {\tt POSIX} library. The
|
|
(admittedly relativly few) programs I've ported posed no problems.
|
|
|
|
Even though \Linux\ resembles Minix a great deal, Minix programs are not
|
|
generally easier to port than programs designed for some other unix.
|
|
Thus I wouldn't recommend starting from a Minix-version of a particular
|
|
program, but instead trying to port the ``virgin'' program from scratch.
|
|
Being closer to SYSV than BSD means that most programs port easily when
|
|
given a {\tt-DUSG} or {\tt-DSYSV} flag.
|
|
|
|
One of the more difficult problem in porting can be missing library
|
|
functions. These must be written by you, or copied from some other
|
|
source (Minix being one possibility for those that have it).
|
|
Alternatively, some programs (notably GNU) have various flags making it
|
|
possible to define which functions aren't available (the GNU fileutils
|
|
will compile quite nicely, once a sufficient number of
|
|
{\tt-DXXX\_MISSING} flags are added to the {\tt Makefile}.)
|
|
|
|
\subsection{Programs already ported}
|
|
|
|
These programs have already been ported to \Linux:
|
|
\begin{itemize}
|
|
\item GNU cc (gcc, cc1, cpp)
|
|
\item GNU assembler (as386)
|
|
\item GNU binutils (ld, ar, nm, size, strip, ranlib)
|
|
\item GNU compress (16-bit)
|
|
\item GNU tar
|
|
\item GNU make
|
|
\item GNU bash (Bourne Again SHell)
|
|
\item GNU sed
|
|
\item GNU bison (yacc-lookalike)
|
|
\item GNU awk
|
|
\item GNU fileutils (ls, cp, rm, mkdir, rmdir, tail etc)
|
|
\item less
|
|
\item uemacs
|
|
\end{itemize}
|
|
|
|
All of the above sources can be found on \nic\ (mostly in
|
|
{\tt`/pub/gnu'}), and most of the \Linux-binaries can be found in the
|
|
directory \dir. All of these programs compiled without changes, even
|
|
though gcc (cc1) has some enhancements of my own. Mail me for
|
|
diffs/sources, but try first to compile them yourself.
|
|
|
|
Additionally I have reports that GNU diff compiles cleanly and works.
|
|
|
|
\section{Technical help}
|
|
|
|
\Linux\ currently has a mailing-list, which you can subscribe to by
|
|
mailing to the address: {\tt\bf Linux-activists-request@niksula.hut.fi}
|
|
and asking to be included into the list. You can then ask questions by
|
|
mailing them to {\tt\bf Linux-activists@niksula.hut.fi}, which will
|
|
duplicate your question/answer/whatever and send them to all persons on
|
|
the list.
|
|
|
|
Note the difference between {\tt Linux-activists} and
|
|
{\tt Linux-activists-request} --- the first sends mail to all persons on
|
|
the list, the second is used only to subscribe and unsubscribe from the
|
|
list.
|
|
|
|
Naturally, you can also mail me directly at {\tt\bf
|
|
torvalds@kruuna.helsinki.fi}. I'll try to answer all questions within a
|
|
day or two.
|
|
|
|
Although \nic\ will probably be kept reasonably up-to-date, there are a
|
|
few problems with it (ie, I cannot personally get to the files, but have
|
|
to go through a couple of persons). Thus people on the mailing-list will
|
|
get patches/binaries faster if they ask for them.
|
|
|
|
\section{Thanks}
|
|
|
|
I'd like to thank the academy \dots
|
|
|
|
Seriously, this system never would have seen the light of day or would
|
|
have been much worse without the help of some others. Bruce Evans
|
|
helped me find the places needed to be changed in order for {\tt gcc} to
|
|
correctly handle floating point, and came with a lot of useful
|
|
ideas/suggestions (and his Minix-386 was used to build the system).
|
|
Also, Earl Chew's {\tt estdio} package was used for the standard
|
|
IO-library. More freely distributable packages like this!
|
|
|
|
Alain W Black and Richard Tobin made the gcc for Minix, without which I
|
|
couldn't have compiled the thing. GNU made most of the programs I use
|
|
under \Linux. Alfred Leung sent the US keyboard patches.
|
|
|
|
PS. ``Thanks'' to {\tt wirzeniu@kruuna.helsinki.fi} for his
|
|
``constructive'' criticism and ``witty'' comments. He was also my first
|
|
$\alpha$-tester, and should be given a medal for courage.
|
|
|
|
\end{document}
|