Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!seismo!mcvax!botter!ast
From: a...@cs.vu.nl (Andy Tanenbaum)
Newsgroups: comp.os.minix
Subject: MINIX 1.2 doc/READ_ME file
Message-ID: <1568@botter.cs.vu.nl>
Date: Tue, 11-Aug-87 09:23:58 EDT
Article-I.D.: botter.1568
Posted: Tue Aug 11 09:23:58 1987
Date-Received: Thu, 13-Aug-87 01:47:44 EDT
Reply-To: a...@cs.vu.nl (Andy Tanenbaum)
Distribution: world
Organization: VU Informatica, Amsterdam
Lines: 289
The book went to press before the software, so last-minute changes are noted
here. In particular, after the book went to press, the software was ported
to the PC/AT and various PC clones, which necessitated some minor patches
here and there.
1. GENERAL
There were a number of minor changes made to the code after the book
was printed, as mentioned above. As a result, line X of file Y in the
book may actually appear at X+3, or X-5, etc. on the disk version.
2. HARD DISK
MINIX supports the use of the standard IBM hard disks. To find out
if your hard disk is IBM compatible, give the command:
dd if=/dev/hd0 of=/dev/null count=1000
if this runs to the end without errors, the driver embedded in your
MINIX binary is appropriate for your controller and drive. If it gives
errors, try powering up the system again, and doing a file system check of
any hard disk partition from the initial menu. This action sometimes helps
(especially on 8 MHz ATs), because fsck uses the BIOS to read the disk,
thus forcing a controlling initialization.
If this fails too, you can rebuild the MINIX kernel trying xt_wini.c,
or at_wini.c as kernel/wini.c until you find one that works.
You MUST copy one of xt_wini.c or at_wini.c to wini.c. If
none of them works, then your disk controller is not IBM compatible.
You will have to study these drivers and then write your own.
To use a hard disk with MINIX, you need a MINIX partition. You may
also have MS-DOS, PC-IX, XENIX, or other partitions as well if you like.
If you have a version of FDISK that is able to make several partitions,
use it. If not, use the MINIX fdisk program (on /user in the PC diskettes).
Once you have a partition available for MINIX (the type does not matter
as MINIX does not check), make a file system by booting MINIX from floppy
the usual way and run mkfs. If, for example, you have chosen partition 2,
which has, say, 40 cylinders (i.e., 40 x 68 = 2720 sectors or 1360 1K
blocks), type:
mkfs /dev/hd2 1360
to make an empty file system. However, for partition 1 use 1 block less
because block 0 is not available (it contains the MS-DOS partition table).
In other words, a 40 cylinder partition 1 has 1359 blocks but a 40 cylinder
partition 2 or higher has 1360 blocks. Then mount the file system by typing:
/etc/mount /dev/hd2 /user
Next, make whatever directories you like, typically bin, lib, and others,
and copy files to the hard disk. With the /usr floppy in drive 0, the
command
cp /usr/bin/* /user/bin
will copy all the binaries from /usr/bin to the hard disk, for example.
Finally, edit /etc/rc to have the hard disk mounted when the system
is booted. A line such as
/etc/mount /dev/hd2 /usr
can be used as a replacement for the mount command initially in /etc/rc.
After editing /etc/rc, mount the root file system diskette and copy it
to the diskette; otherwise the changes will be lost when the system is
rebooted. (There is nothing special about the root file system except
its size; it can be mounted and written on like any other file system.)
After these steps have been taken, the system can be booted from
floppy in the usual way, and the root file system also read in from
floppy. The hard disk will automatically be mounted by the /etc/rc.
The root device remains on the RAM disk, and the boot process still
goes via floppy (for compatibility and to prevent disaster in the event
that something goes wrong with the hard disk file system). Hard disk
file systems can be checked using fsck by typing 'h' when the
initial menu is display.
The special file /dev/hd0 refers to the whole disk, without regard to
partitions, whereas /dev/hd1 ... /dev/hd4 refer to partitions 1 to 4. If
you have a second hard disk, you can make /dev/hd5 ... /dev/hd9 with mknod
(major device 3, minor device 5 ... 9) for the second drive, with hd5 for
the whole drive, hd6 for partition 1, etc. Fsck also uses this convention.
The MINIX program mkfs writes a file system on whatever partition you
tell it to. If you tell it to use partition 2, it does. Consequently, a
typing error here can result in erasing all your files. (In MS-DOS typing
del *.c instead of del *.o will remove all the sources instead of all the
object files.) Therefore, it is strongly recommended that you back up
your entire hard disk before installing MINIX. Better safe than sorry.
Many hard disks are used on IBM PCs, XTs, and ATs. Each one needs a
different driver. The files xt_wini.c and at_wini.c are drivers for the
standard IBM XT and AT disks respectively. Their drivers are totally
different. When generating a new system, you must copy the appropriate
driver to the file wini.c (in the kernel directory) depending on whether
you have a PC or XT (use xt_wini.c) or an AT (use at_wini.c). You MUST
choose one of these drivers even if you have no hard disk at all.
3. PC/AT
The distribution for the PC/AT differs from that for the PC in minor
ways. For example, there is no /user diskette. All the files that would
normally be on /user fit on /usr. Furthermore, the number and organization
of the source diskettes is different, but the same programs are available.
Source diskette 1 has been arranged so that it can be mounted and you can
change to the kernel, mm, or fs directory, and just type make to compile.
Two additional special files are present in /dev: /dev/at0 and /dev/at1.
These should be used to access 1.2M diskettes. To access 360K diskettes
on the PC/AT, use /dev/fd0 and /dev/fd1. Special files are used by
commands such as mount, mkfs, and df, among others. For example, to
copy part of a 1.2M diskette, type dd if=/dev/at0 of=file count=100.
The difference between /dev/at0 and /dev/fd0 is that in MINIX, special
files have sizes to prevent access beyond the end. For /dev/fd0 the
size is 360K. For /dev/at0 it is 1.2M.
4. USING MS-DOS AS A DEVELOPMENT SYSTEM
The conversion of MINIX to make it possible to use MS-DOS as the
development system was done by Paul Ogilvie. It was done in order to
to provide some assistance to people who wish to modify MINIX but are unable to use MINIX or UNIX for that purpose. MS-DOS definitely should
be regarded as the method of last resort, only used if there is no other
alternative. The assembly code files and batch files provided have all
been tested with the Computer Innovations C86 compiler, release 2.4, and
specific versions of the linker etc. The use of any other compiler or
configuration is virtually guaranteed not to work the first time because
every MS-DOS C compiler is different, their libraries are different, etc.
MS-DOS users must approach this project with the expectation that minor
problems will arise and small patches to the code may be needed to work
around bugs and deficiencies that abound with MS-DOS compilers. When
problems appear with files that are different for MS-DOS and MINIX,
check the MINIX version, since these have been tested much more
thoroughly than the MS-DOS versions.
5. BUGS in MS-DOS
Some machines and/or versions of MS-DOS have a bug when doing absolute
diskio, as used by mkfs and build. This bug will manifest itself by
creating an unbootable disk, saying a file-system is bad, or sometimes
the program will just hang. The primary remedy if your machine suffers
from this bug is to first format the disk. A permanent remedy is to
change the module "diskio.asm" to use bios I/O calls instead of using the
DOS interrupts 25 and 26 (see fsck1.asm). Disadvantage of the latter is
that you cannot extend these programs anymore to work on a hard disk (e.g.
making a MINIX filesystem on a hard disk).
Though the cause is not clear, it is assumed that these DOS system calls
don't know if they should read/write an 8 sector per track diskette or a 9
sector per track diskette. Formatting the disk will make clear to DOS that
they should do 9 sectors per track. MINIX does not support 8 sectors per
track at all.
6. BATCH FILES in MS-DOS
The batch jobs are all made for a system with a hard disk.
Depending on your floppy configuration you can modify them to ask for the
necessary diskettes. When linking, the jobs expect a directory \lib\c86
where they can find the DOS-library for C86 (the C86s2s library for small
model, DOS-2, software floating point). In any event, all MS-DOS users
should carefully inspect all the batch files before using them.
In DOS version 2.x, the 'echo'-command behaves somewhat different
than in DOS version 3.x. The difference is is how to echo a new line to
the screen. With Dos-2 you can do this by appending three spaces to the
command, e.g. 'echo ' and with Dos-3 you can do this by the command
'echo/'. Unfortunately both things aren't documented and are not compatible
and will just say "ECHO is on" (or off). Appart from clobbering your
screen nothing is wrong. The batch files on this disk are for DOS version 3.
7. MS-DOS ASSEMBLER
The Microsoft masm manual is not very clear about when you must use
group-directives. The files included in this distribution work, but in
general, be careful.
8. STATIC DECLARATIONS
The MINIX C compiler puts static variables in the data segment, not
the bss segment. This increases the size of the a.out file on the disk.
Thus it is better to avoid declaring large arrays as static. Futhermore,
because the assembler reads all the .s files at once, the use of static
to make it possible to re-use the same name in two files does not work.
All global names must be unique. Thus putting static x; in two files will
not work.
9. MAKING MINIX ON PC/AT
The book says that you should put each directory (kernel, mm, fs, etc.)
on a separate diskette. With the 1.2M diskettes, you can keep kernel,
mm and fs on the same diskette, provided that you remove all the irrelevant
files (such as library sources), and avoid unnecessary files. Hard disk too.
When making MINIX on a PC/AT with one floppy disk drive, you will have
to put the image file on the same diskette as build. The trick is then
to get it onto the boot diskette, starting at block 0. The only way is
first to build a new root file system containing an almost empty RAM disk
of about 200K. Construct a proto file for mkfs containing in bin: sh, cp,
sync, and getlf, as well as etc with mount, umount, passwd, rc, ttys, and
message. The dev directory should contain the usual files. An empty usr
directory is also needed. Once you have the image file in tools and the
new root file system, proceed as follow.
1. Shut down the system.
2. Reboot MINIX, using the almost empty 200K file system.
3. Mount the diskette containing tools on /usr.
4. Copy image to /.
5. Unmount the tools diskette.
6. Insert a blank diskette.
7. Copy /image to /dev/at0.
This diskette is your new boot diskette.
10. MOVING MINIX SOURCES TO NON-MINIX SYSTEMS
The source disks are distributed as MINIX file systems, ready to mount.
To read them under MS-DOS or PC-IX they must first be converted.
To move the MINIX sources to some other system on a computer with only
one floppy disk drive, first remove as many files as possible from the
RAM disk, and copy the files to be moved to the RAM disk. Then insert
a diskette and copy the files to the diskette. One possibility is using
doswrite. Another is to make a shar archive and write it directly on
/dev/fd0. This can then be copied byte for byte to another system and
unpacked with the shell. Alternatively, ar.c can first be copied to a
diskette all by itself to get it to another machine, where it can be
compiled. Subsequent files can be transferred in ar format. On a computer
with two disk drives, both the MINIX and "foreign" file system can be
present at once.
11. EDITING LARGE PROGRAMS WITH MINED
Mined has a limit on the size of programs it can edit. To edit
larger ones, they must be broken up with split, edited separately and
recombined later. If a file is too large, mined will issue an error
message and exit.
12. MKNOD
MINIX differs from UNIX in that block special files (and even some
character special files, such as /dev/kmem) can have sizes. A 360K floppy
disk special file, such as /dev/fd0 can have size 360K. Unfortunately, the
mknod system call (and mknod program) have no way to express the size,
so it uses size 0, which is equal to infinity. When you read past the
end of a block special file WITH a size, the file system returns zero
bytes. When you go off the end of a device WITHOUT a size, some drivers
return end-of-file (e.g., hard disk, RAM disk), but others (e.g., floppy
disk) return an I/O error code. Thus if you make a new block special file
for 2/0 and 2/1 (floppy disk) with mknod (i.e., no size) the command
cp /dev/fd0 /dev/fd1
will terminate with an error on block 360 (but it will copy the disk
perfectly). The only way to make a special file with a size is by making
a file system with mkfs.
13. NONEXISTENT DEVICES
If you try to open /dev/fd1 on a system with only one floppy disk drive,
the system may hang. To avoid this problem, the first time you log in, go
to the /dev directory, and rename special files that you do not have to
something unusual. For example, if you do not have a hard disk, rename
hd0 to HARD_DISK_0, hd1 to HARD_DISK_1, etc. Similarly with one one floppy
disk, rename fd1 to FLOPPY_DISK_1 to prevent it being typed by accident.
You can also remove them, but due to the mknod problem described above, you
can not get them back easily, so it is best just to get them out of the
way in case you ever need them again later.
14. PRINTER
In order to accommodate buffered and unbuffered printers, the printer
driver uses a combination of delay loops and interrupts. The net result
is that the driver consumes a fair number of CPU cyles when running. If you
expect to do a lot of printing, you might want to consider rewriting the
printer interrupt handler, pr_char, in assembly code.
15. DISK SPACE
The /usr disk as distributed is entirely full. If you have two floppy
disk drives, be sure to mount /user on drive 1 and move your working
directory there. If you have only 1 floppy disk drive, remove some files
from /usr/bin to make more space.
16. RUNNING /USER TESTS
Before running the tests in /user/test, remove the files in
/user/commands to create some free space on the disk.
17. COMMAND LINE LENGTH
The maximum initial stack size is 1K. Calls to EXEC which require a
larger stack will fail. Thus if you try to do ls -l * in a large directory,
the shell may expand the * so that the command line exceeds 1K and the
EXEC will fail, resulting in the message "Cannot execute ls".
18. ARCHIVES IN DISTRIBUTION
There wasn't enough space on some of the distribution diskettes, so it
it was necessary to combine several files in archives to save space. These
archives end with suffix ".a" and should be unpacked into the individual
files before using them. Look in the tools directory and its subdirectories.
20. RECOMPILING FSCK
If for some reason you don't like the tools/fsck binary and want to
recompile it, make sure you have plenty of free space for the compiler's
temporary files. On a floppy disk system, this may mean putting fsck on
an almost empty diskette before compiling it. When the disk is full, the
quality of the compiler's error messages deteriorates rapidly. If you
are compiling fsck and getting strange results, check for disk space.
21. NEWS GROUP
If you have access to USENET, you may be interested in knowing that
there is a news group, comp.os.minix devoted to discussions of MINIX.
This is one of the largest news groups, with well over 10,000 readers.
If you have access to the Arpanet or Bitnet, the USENET news group is
gatewayed there. Contact info-minix-requ...@udel.edu to join.
22. SYSTEM CRASHES
The IBM PC does not have any hardware for checking for stack overflow.
The user must allocate the amount of stack for each program with chmem
or use the compiler default (64K - program - data size). Some programs
in the distribution have been set to a smaller value, and may, in rare
instances with certain arguments, hang. If the system ever gets into a
situation where it echoes keystrokes, but ignores DEL and CTRL-\ and
appears otherwise to be hung up, hit F1 to see what is going on. If
some process is running and there is no way to interrupt it, hit F9.
This key is equivalent to the super-user typing: kill -1 9. The result
of F9 is that every process in the system is killed, including update
and all the shells. Although drastic, F9 will dehang the system
instantly. Log in again and then type /etc/update & to restart update.
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!seismo!mcvax!botter!ast
From: a...@cs.vu.nl (Andy Tanenbaum)
Newsgroups: comp.os.minix
Subject: MINIX 1.2 doc/man_pages file
Message-ID: <1569@botter.cs.vu.nl>
Date: Tue, 11-Aug-87 09:25:21 EDT
Article-I.D.: botter.1569
Posted: Tue Aug 11 09:25:21 1987
Date-Received: Thu, 13-Aug-87 01:48:06 EDT
Reply-To: a...@cs.vu.nl (Andy Tanenbaum)
Distribution: world
Organization: VU Informatica, Amsterdam
Lines: 196
This file contains the man pages for those programs not listed in the book.
In the PC version of the distribution, they are in /user/bin. In the AT
version they are in /usr/bin.
---------------------------------------------------------------------------
Command: cal - print a calendar
Syntax: cal [month] year
Flags: (none)
Example: cal 3 1987 # print March 1987
Cal prints a calendar for a month or year. The year can be between 1
and 9999. Note that the year 87 is not a synonym for 1987, but is itself a
valid year about 19 centuries ago. The calendar produced is the one used
by England and her colonies. Try Sept. 1752, Feb 1900, and Feb 2000. If
you don't understand what is going on, look up "Calendar, Gregorian" in a
good encyclopedia.
Command: cpdir - copy a directory and its subdirectories
Syntax: cpdir [-v] srcdir destdir
Flags: -v Verbose; cpdir tells what it is doing
Example: cpdir dir1 dir2 # creat dir2 and copy dir1's files into it
Cpdir creates the target directory, goes into it, and copies all the
files in the source directory to it. When it is done, the target directory
contains the same files as the source directory. Subdirectories are copied
Recursively. Links and special files are ignored.
Command: diff - print differences between two files
Syntax: diff file1 file2
Flags: (none)
Example: diff file1 file2 # print differences between 2 files
Diff compares two files and generates a list of lines telling how
the two files differ. Lines may not be longer than 128 characters.
Command: du - print disk usage
Syntax: du [-s] dir
Flags: -s Summary only
Example: du dir # list disk space used by files in dir
Du examines a directory and prints the amount of space occupied by the
files in that directory and its subdirectories.
Command: expr - evaluate experession
Syntax: expr arg ...
Flags: (none)
Example: x=`expr $x+1` # add 1 to shell variable x
Expr computes the value of its argument and writes the result on
standard output. The valid operators, in order of increasing precedence,
are listed below. Operators grouped by {...} have the same precedence.
Operators: |, &, {<, <=, ==, !=, >=, >}, {+, -}, *.
Note that the V7 ":" operator is missing. Parentheses are permitted.
Command: find - find files meeting a given condition
Syntax: find directory expression
Flags: (none)
Examples: find / -name a.out -print # print all a.out paths
find /usr/ast ! -newer f -ok rm {} \; # ask before removing
find /usr -size +20 -exec mv {} /big \; # move files > 20 blks
find / \( -name a.out -o -name `*.o` \) -exec rm {}\;
Find descends the file tree starting at the given directory checking
each file in that directory and its subdirectories against a predicate.
If the predicate is true, an action is taken. The predicates may be
connected by -a (Boolean and), -o (Boolean or) and ! (Boolean negation).
Each predicate is true under the conditions specified below. The integer n
may also be +n to mean any value greater than n, -n to mean any value less than
n, or just n for exactly n.
-name s true if current filename is s (include shell wild cards)
-size n true if file size is n blocks
-inum n true if the current file's i-node number is n
-mtime n true if modification time relative to today (in days) is n
-links n true if the number of links to the file is n
-newer f true if the file is newer than f
-perm n true if the file's permission bits = n (n is in octal)
-user u true if the uid = u (a numerical value, not a login name)
-grogp g true if the gid = g (a numerical value, not a group name)
-type x where x is bcdfug (block, char, dir, regular, setuid, setgid)
Following the expression can be one of the following, telling what to do
when a file is found:
-print print the file name on standard output
-exec execute a MINIX command, {} stands for the file name
-ok prompts before executing the command
Command: more - pager
Syntax: more file ...
Flags: (none)
Example: more file # display file on the screen
More is an alternative to mined as a pager, for people used to the
4.x BSD pager. This version only implements three commands:
<space> - display next page
<return> - display next line
q - exit more
Command: fdisk - partition a hard disk
Syntax: fdisk file
Flags: (none)
Example: fdisk /dev/hd1
When fdisk starts up, it reads in the partition table and displays it.
It then presents a menu to allow the user to modify partitions, store the
partition table on a file, or load it from a file. Partitions can be marked
as DOS or non-DOS, and active or not. MINIX doesn't care what kind of a
partition it uses. Using fdisk is self-explanatory. However, be aware that
repartitioning a disk may cause information on it to be lost.
Command: fix - generate new file from old one and diff listing
Syntax: fix oldfile difflist >newfile
Flags: (none)
Example: fix old difflist >new # generate new from old and diffs
Fix accepts a diff listing produced by diff and reconstructs the
new file. It is common for people to take a file, modify it, and then
send the diff listing between the old and new files to other people.
Using fix, the old file, and the diff listing, it is possible to creat
the new file. For example:
diff oldfile newfile >difflist
fix oldfile difflist >new2
will generate a file new2 that is identical to newfile.
Command: printenv - print out the current environment
Syntax: printenv
Flags: (none)
Example: printenv # print the environment
Printenv prints out the current environment strings, one per line.
Command: readfs - read a MINIX file system
Syntax: readfs [-il] block_special [dir]
Flags: -i Give information about the file, but do not extract files
-l List the files extracted on standard output
Example: readfs -l /dev/fd0
Readfs reads a floppy disk containing a MINIX file system. It can
extract all the files from it, give a listing of them, or both. The files
extracted can be put in a user-specified directory (default: current
directory). If subdirectories are needed, they will be created automatically.
Command: test - test for a condition
Syntax: test expr
Flags: (none)
Example: test -r file # see if file is readable
Test checks to see if files exist, are readable, etc. and returns
an exit status of zero if true and nonzero if false. The legal operators are
-r file true if the file is readable
-w file true if the file is writable
-f file true if the file is not a directory
-d file true if the file is a directory
-s file true if the file exists and has a size > 0
-t fd true if file descriptor fd (default 1) is a terminal
-z s true if the string s has zero length
-n s true if the string s has nonzero length
s1 = s2 true if the strings s1 and s2 are identical
s1 != s2 true if the strings s1 and s2 are different
m -eq m true if the integers m and n are numerically equal
The operators -gt, -ge, -ne, -le, -lt may be used as well
These operands may be combined with -a (Boolean and), -o (Boolean or), !
(negation). The priority of -a is higher than that of -o. Parentheses are
permitted, but must be escaped to keep the shell from trying to interpret them.
Command: uuencode - encode a binary file to ASCII for mailing
Syntax: uuencode [input] output
Flags: (none)
Example: uuencode infile <infile >outfile # encode infile
Uuencode takes an input file, typically a binary file, and converts it
to pure ASCII by encoding 3 bytes (24 bits) as 4 bytes in ASCII. Only 64
different characters are used, all of them valid ASCII characters.
Command: uudecode - decode a binary file encoded with uuencode
Syntax: uudecode file
Flags: (none)
Example: uudecode encodedfile # re-create the original file
Uudecode takes an input file, typically a uuencoded binary file, and
converts it back to the original file. The decoded file is given the name
that the original file had. The name information is part of the encoded file.
|