[comp.os.minix] V1.3c posting #6 - tools

ast@cs.vu.nl (Andy Tanenbaum) (09/28/88)

: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'LISTING'
sed 's/^X//' > 'LISTING' << '+ END-OF-FILE ''LISTING'
Xtotal 28
X-rw-r--r--  1 ast          2249 Sep 26 22:44 at_makefile.new
X-rwxr-xr-x  1 ast          8072 Sep 26 22:44 bootblok.s.new
X-rw-r--r--  1 ast          2201 Sep 26 22:44 changemem.cdif
X-rw-r--r--  1 ast          4777 Sep 26 22:44 fsck.c.cdif
X-rw-r--r--  1 ast            44 Sep 26 22:44 group.new
X-rw-r--r--  1 ast          1111 Sep 26 22:44 init.c.cdif
X-rw-r--r--  1 ast           770 Sep 26 22:44 message.cdif
X-rw-r--r--  1 ast          2249 Sep 26 22:45 pc_makefile.new
X-rw-r--r--  1 ast           149 Sep 26 22:45 ttys.cdif
X-rw-r--r--  1 ast            22 Sep 26 22:45 ttytype.new
+ END-OF-FILE LISTING
chmod 'u=rw,g=r,o=r' 'LISTING'
set `wc -c 'LISTING'`
count=$1
case $count in
590)	:;;
*)	echo 'Bad character count in ''LISTING' >&2
		echo 'Count should be 590' >&2
esac
echo Extracting 'at_makefile'
sed 's/^X//' > 'at_makefile' << '+ END-OF-FILE ''at_makefile'
Xl=/usr/lib
XCFLAGS = -F -T.
X
Xall:
X	make init
X	make bootblok
X	make build
X
Xinit:	$l/libc.a init.s $l/head.s
X	asld -o init  $l/head.s init.s $l/libc.a  $l/end.s
X	@echo init done.
X
X# bootblok.s is the source of the MINIX boot block.  The bootblock is the
X# first 512 bytes on the image file and on the boot diskette.  When bootblok.s
X# is assembled, it generates a short binary file (less than 400 bytes) that
X# must be stripped of its header and copied to the file bootblok.  The dd
X# command below does this.  If everything has been done right, the bootblok
X# file should begin with the following 8 words, in hex:
X# c0b8 8e07 33d8 b8f6 2fe0 c08e ff33 00b9
X# The exact procedure for going from bootblok.s to the binary file stripped of
X# its header is somewhat operating system dependent.  Some assemblers make
X# an object (.s) file; others make an a.out file directly. If your boot 
X# diskette does not start out by printing 'Booting MINIX 1.0' the problem is
X# probably that you have not made a good boot block.
Xbootblok:	bootblok.s
X	@asld  bootblok.s 
X	@dd if=a.out of=bootblok bs=16w skip=1 count=16 2>/dev/null
X	@rm a.out
X	@echo bootblok done.
X
Xbuild:	build.s
X	cc -o build build.s
X	@echo build done.
X
Xfsck:	fsck.s fsck1.s
X	@echo "Start linking fsck. "
X	asld -o fsck fsck1.s fsck.s $l/libc.a $l/end.s
X	@echo fsck done.
Xfsck.s: fsck.c
X	cc -c -Di8088 -DSTANDALONE -F fsck.c
X
X# 'make image'  combines the bootblock, kernel, memory manager, file 
X# system, init and fsck into a single file, called image.  Each of these pieces
X# appears in the image file just as the original does on the disk, except that
X# the header at the front is removed, and each piece is padded out to an
X# integral multiple of 16 bytes.  Build also prints a message telling how big
X# the various pieces (except fsck) are.
X#
X# 'make net' does the same thing, only with the networking code from the
X# 'amoeba directory included
X#
Ximage:	build bootblok 
X	@getlf "Insert blank diskette in drive 0 and hit return"
X	@build bootblok ../kernel/kernel ../mm/mm ../fs/fs init fsck image
X	@cp image /dev/fd0
X
Xnet:	build bootblok 
X	@getlf "Insert blank diskette in drive 0 and hit return"
X	@build bootblok ../amoeba/kernel/kernel ../amoeba/mm/mm \
X		../amoeba/fs/fs init fsck /dev/fd0
X
+ END-OF-FILE at_makefile
chmod 'u=rw,g=r,o=r' 'at_makefile'
set `wc -c 'at_makefile'`
count=$1
case $count in
2249)	:;;
*)	echo 'Bad character count in ''at_makefile' >&2
		echo 'Count should be 2249' >&2
esac
echo Extracting 'bootblok.s'
sed 's/^X//' > 'bootblok.s' << '+ END-OF-FILE ''bootblok.s'
X| When the PC is powered on, it reads the first block from the floppy
X| disk into address 0x7C00 and jumps to it.  This boot block must contain
X| the boot program in this file.  The boot program first copies itself to
X| address 192K - 512 (to get itself out of the way).  Then it loads the 
X| operating system from the boot diskette into memory, and then jumps to fsck.
X| Loading is not trivial because the PC is unable to read a track into
X| memory across a 64K boundary, so the positioning of everything is critical.
X| The number of sectors to load is contained at address 504 of this block.
X| The value is put there by the build program after it has discovered how
X| big the operating system is.  When the bootblok program is finished loading,
X| it jumps indirectly to the program (fsck) which address is given by the
X| last two words in the boot block. 
X|
X| Summary of the words patched into the boot block by build:
X| Word at 504: # sectors to load
X| Word at 506: # DS value for fsck
X| Word at 508: # PC value for fsck
X| Word at 510: # CS value for fsck
X|
X| This version of the boot block must be assembled without separate I & D
X| space.  
X
X        LOADSEG = 0x0060         | here the boot block will start loading
X        BIOSSEG = 0x07C0         | here the boot block itself is loaded
X        BOOTSEG = 0x2FE0         | here it will copy itself (192K-512b)
X        DSKBASE = 120            | 120 = 4 * 0x1E = ptr to disk parameters
X
Xfinal   = 504
Xfsck_ds = 506
Xfsck_pc = 508
Xfsck_cs = 510
X
X
X.globl begtext, begdata, begbss, endtext, enddata, endbss  | asld needs these
X.text
Xbegtext:
X.data
Xbegdata:
X.bss
Xbegbss:
X.text
X
X| copy bootblock to bootseg
X        mov     ax,#BIOSSEG
X        mov     ds,ax
X        xor     si,si           | ds:si - original block
X        mov     ax,#BOOTSEG
X        mov     es,ax
X        xor     di,di           | es:di - new block
X        mov     cx,#256         | #  words to move
X	rep
X	movw			| copy loop
X    
X	
X| start boot procedure
X	jmpi	start, BOOTSEG	| set cs to BOOTSEG
X
Xstart:
X	mov     dx,cs
X        mov     ds,dx           | set ds to cs
X        xor     ax,ax
X        mov     es,ax           | set es to 0
X        mov     ss,dx           | set ss to cs i.e., stack in high core
X        mov     sp,#1536        | initialize sp to high core
X
X| print greeting
X	mov	ax,#2		| reset video
X	int	0x10
X
X        mov     ax,#0x0200	| BIOS call in put cursor in ul corner
X        xor     bx,bx
X        xor     dx,dx
X        int     0x10
X        mov     bx,#greet
X        call    print
X
X| Initialize disk parameters
X| Try 1.2M diskette by trying to read sector 15
X
X	xor	ax,ax
X	mov	es,ax
X	mov	dx,ds
X	mov	ax,#atpar
X	seg	es
X	mov	DSKBASE,ax
X	seg	es
X	mov	DSKBASE+2,dx
X
X	xor	ax,ax	| reset drive
X	int	0x13
X
X	xor	ax,ax
X	mov	es,ax
X	mov	ax,#0x0201	| read sector, #sector = 1
X	mov	bx,#0x0600	| es:bx buffer
X	mov	cx,#0x000F	| track 0, sector 15
X	mov	dx,#0x0000	| drive 0, head 0
X	int	0x13
X	jnb	L1
X
X| Error. It wasn't 1.2M. Now set up for 720K
X
X	mov	tracksiz,#9
X	xor	ax,ax		| ps disk parameters are in ROM F01520
X	mov	es,ax
X	mov	ax,#0x1520
X	seg	es
X	mov	DSKBASE,ax
X	mov	ax,#0xF000	
X	seg	es
X	mov	DSKBASE+2,ax
X
X| Try 720K by trying to read track 64.
X| 360K has 40 tracks, 720 has 80 tracks.
X
X	xor	ax,ax	| diskette reset
X	int	0x13
X	mov	tracksiz,#9
X
X	xor	ax,ax
X	mov	es,ax
X	mov	ax,#0x0201	| read sector, number of sectors is 1
X	mov	bx,#0x0600	| es:bx buffer
X	mov	cx,#0x4001	| track 64, sector 1
X	mov	dx,#0x0000	| drive 0, head 0
X	int	0x13
X	jnb	L1
X
X| Error. It wasn't 720K either. Now set up for 360K
X
X	xor	ax,ax
X	mov	es,ax
X	mov	dx,ds
X	mov	ax,#pcpar
X	seg	es
X	mov	DSKBASE,ax
X	seg	es
X	mov	DSKBASE+2,dx
X	int	0x13		| diskette reset
X
XL1:
X
X| Load the operating system from diskette.
Xload:
X	call	setreg		| set up ah, cx, dx
X	mov	bx,disksec	| bx = number of next sector to read
X	add	bx,#2		| diskette sector 1 goes at 1536 ("sector" 3)
X	shl	bx,#1		| multiply sector number by 32
X	shl	bx,#1		| ditto
X	shl	bx,#1		| ditto
X	shl	bx,#1		| ditto
X	shl	bx,#1		| ditto
X	mov	es,bx		| core address is es:bx (with bx = 0)
X	xor	bx,bx		| see above
X	add	disksec,ax	| ax tells how many sectors to read
X	movb	ah,#2		| opcode for read
X	int	0x13		| call the BIOS for a read
X	jb	error		| jump on diskette error
X	mov	ax,disksec	| see if we are done loading
X	cmp	ax,final	| ditto
X	jb	load		| jump if there is more to load
X
X| Loading done.  Finish up.
X        mov     dx,#0x03F2      | kill the motor
X        mov     ax,#0x000C
X        out
X        cli
X	mov	bx,tracksiz	| fsck expects # sectors/track in bx
X        mov     ax,fsck_ds      | set segment registers
X        mov     ds,ax           | when sep I&D DS != CS
X        mov     es,ax           | otherwise they are the same.
X        mov     ss,ax           | words 504 - 510 are patched by build
X
X	seg cs
X	jmpi	@fsck_pc	| jmp to fsck
X
X| Given the number of the next disk block to read, disksec, compute the
X| cylinder, sector, head, and number of sectors to read as follows:
X| ah = # sectors to read;  cl = sector #;  ch = cyl;  dh = head; dl = 0
Xsetreg:	
X	mov	si,tracksiz	| 9 (PC) or 15 (AT) sectors per track
X	mov 	ax,disksec	| ax = next sector to read
X	xor	dx,dx		| dx:ax = 32-bit dividend
X	div	si		| divide sector # by track size
X	mov	cx,ax		| cx = track #; dx = sector (0-origin)
X	mov	bx,dx		| bx = sector number (0-origin)
X	mov	ax,disksec	| ax = next sector to read
X	add	ax,si		| ax = last sector to read + 1
X	dec	ax		| ax = last sector to read
X	xor	dx,dx		| dx:ax = 32-bit dividend
X	div	tracksiz	| divide last sector by track size
X	cmpb	al,cl		| is starting track = ending track
X	je	set1		| jump if whole read on 1 cylinder
X	sub	si,dx		| compute lower sector count
X	dec	si		| si = # sectors to read
X
X| Check to see if this read crosses a 64K boundary (128 sectors).
X| Such calls must be avoided.  The BIOS gets them wrong.
Xset1:	mov	ax,disksec	| ax = next sector to read
X	add	ax,#2		| disk sector 1 goes in core sector 3
X	mov	dx,ax		| dx = next sector to read
X	add	dx,si		| dx = one sector beyond end of read
X	dec	dx		| dx = last sector to read
X	shl	ax,#1		| ah = which 64K bank does read start at
X	shl	dx,#1		| dh = which 64K bank foes read end in
X	cmpb	ah,dh		| ah != dh means read crosses 64K boundary
X	je	set2		| jump if no boundary crossed
X	shrb	dl,#1		| dl = excess beyond 64K boundary
X	xorb	dh,dh		| dx = excess beyond 64K boundary
X	sub	si,dx		| adjust si
X	dec	si		| si = number of sectors to read
X
Xset2:	mov	ax,si		| ax = number of sectors to read
X	xor	dx,dx		| dh = head, dl = drive
X	movb	dh,cl		| dh = track
X	andb	dh,#0x01	| dh = head
X	movb	ch,cl		| ch = track to read
X	shrb	ch,#1		| ch = cylinder
X	movb	cl,bl		| cl = sector number (0-origin)
X	incb	cl		| cl = sector number (1-origin)
X	xorb	dl,dl		| dl = drive number (0)
X	ret			| return values in ax, cx, dx
X
X
X|-------------------------------+
X|    error & print routines     |
X|-------------------------------+
X
Xerror:
X        push    ax
X        mov     bx,#fderr
X        call    print           | print msg
X	xor	cx,cx
Xerr1:	mul	0		| delay
X	loop	err1
X	int	0x19
X
X
Xprint:                          | print string (bx)
X        movb	al,(bx)	        | al contains char to be printed
X        testb   al,al           | null char?
X        jne     prt1            | no
X        ret                     | else return
Xprt1:   movb    ah,#14          | 14 = print char
X        inc     bx              | increment string pointer
X        push    bx              | save bx
X        movb    bl,#1           | foreground color
X	xorb	bh,bh		| page 0
X        int     0x10            | call BIOS VIDEO_IO
X        pop     bx              | restore bx
X        jmp     print           | next character
X
X
Xdisksec:.word 1
Xpcpar:	.byte	0xDF, 0x02, 25, 2, 9, 0x2A, 0xFF, 0x50, 0xF6, 1, 3 | for pc
Xatpar:	.byte	0xDF, 0x02, 25, 2,15, 0x1B, 0xFF, 0x54, 0xF6, 1, 8 | for at
X
Xfderr:	.asciz "Read error.  Automatic reboot.\r\n"
Xgreet:	.asciz "\rBooting MINIX 1.3.  Copyright 1988 Prentice-Hall, Inc.\r\n"
Xtracksiz:.word 15	| changed to 9 for ps and pc
X
X| Don't forget that words 504 - 510 are filled in by build.  The regular
X| code had better not get that far.
X.text
Xendtext:
X.data
Xenddata:
X.bss
Xendbss:
+ END-OF-FILE bootblok.s
chmod 'u=rwx,g=rx,o=rx' 'bootblok.s'
set `wc -c 'bootblok.s'`
count=$1
case $count in
8072)	:;;
*)	echo 'Bad character count in ''bootblok.s' >&2
		echo 'Count should be 8072' >&2
esac
echo Extracting 'changemem.cdif'
sed 's/^X//' > 'changemem.cdif' << '+ END-OF-FILE ''changemem.cdif'
X*** /local/ast/minix/tape3b/tools/changemem	Wed Jul 13 14:46:51 1988
X--- changemem	Mon Sep 26 13:03:31 1988
X***************
X*** 3,21 ****
X  l=/usr/lib
X  t=../test
X  chmem =50000 $b/ar
X  chmem =60000 $b/asld
X! chmem =2000  $b/cc
X  chmem =52000 $l/cem
X  chmem =30000 $l/cg
X  chmem =60000 $b/cdiff
X  chmem =64000 $b/compress
X! chmem =32000 $b/cpdir
X  chmem =60000 $l/cpp
X  chmem =40000 $b/dd
X  chmem =60000 $b/diff
X  chmem =8000  $b/df
X  chmem =32000 $b/dosread
X  chmem =60000 $b/ed
X  chmem =50000 $b/find
X  chmem =60000 $b/fix
X  chmem =8000  $b/grep
X--- 3,26 ----
X  l=/usr/lib
X  t=../test
X  chmem =50000 $b/ar
X+ chmem =16000 $b/ast
X  chmem =60000 $b/asld
X! chmem =3000  $b/cc
X  chmem =52000 $l/cem
X  chmem =30000 $l/cg
X+ chmem =16000 $b/cp
X  chmem =60000 $b/cdiff
X  chmem =64000 $b/compress
X! chmem =64000 $b/cpdir
X  chmem =60000 $l/cpp
X  chmem =40000 $b/dd
X+ chmem =32000 $b/du
X  chmem =60000 $b/diff
X  chmem =8000  $b/df
X  chmem =32000 $b/dosread
X  chmem =60000 $b/ed
X+ chmem =8000  $b/fgrep
X+ chmem =50000 $b/file
X  chmem =50000 $b/find
X  chmem =60000 $b/fix
X  chmem =8000  $b/grep
X***************
X*** 30,50 ****
X  chmem =8000  $b/mv
X  chmem =16000 $b/nm
X  chmem =40000 $l/opt
X! chmem =24000 $b/pr
X  chmem =8000  $b/prep
X  chmem =50000 $b/readfs
X  chmem =8000  $b/rm
X  chmem =8000  $b/rmdir
X  chmem =16000  $b/roff
X  chmem =16000  $b/strings
X! chmem =20000 $b/sh
X  chmem =60000 $b/sort
X  chmem =8000  $b/tail
X  chmem =8000  $b/time
X  chmem =60000 $b/treecmp
X  chmem =8000  $t/t10a
X  chmem =8000  $t/t11a
X  chmem =8000  $t/t11b
X  chmem =8000  $b/uuencode
X  chmem =8000  $b/uudecode
X  chmem =8000  $b/wc
X--- 35,59 ----
X  chmem =8000  $b/mv
X  chmem =16000 $b/nm
X  chmem =40000 $l/opt
X! chmem =8000  $b/paste
X! chmem =32000 $b/pr
X  chmem =8000  $b/prep
X  chmem =50000 $b/readfs
X  chmem =8000  $b/rm
X  chmem =8000  $b/rmdir
X  chmem =16000  $b/roff
X  chmem =16000  $b/strings
X! chmem =12000 $b/sh
X! chmem =8000  $b/shar
X  chmem =60000 $b/sort
X+ chmem =16000 $b/strip
X  chmem =8000  $b/tail
X  chmem =8000  $b/time
X  chmem =60000 $b/treecmp
X  chmem =8000  $t/t10a
X  chmem =8000  $t/t11a
X  chmem =8000  $t/t11b
X+ chmem =8000  $b/uniq
X  chmem =8000  $b/uuencode
X  chmem =8000  $b/uudecode
X  chmem =8000  $b/wc
+ END-OF-FILE changemem.cdif
chmod 'u=rw,g=r,o=r' 'changemem.cdif'
set `wc -c 'changemem.cdif'`
count=$1
case $count in
2201)	:;;
*)	echo 'Bad character count in ''changemem.cdif' >&2
		echo 'Count should be 2201' >&2
esac
echo Extracting 'fsck.c.cdif'
sed 's/^X//' > 'fsck.c.cdif' << '+ END-OF-FILE ''fsck.c.cdif'
X*** /local/ast/minix/tape3b/tools/fsck.c	Wed Jul 13 14:46:52 1988
X--- fsck.c	Mon Sep 26 13:03:34 1988
X***************
X*** 5,66 ****
X  #include "../fs/const.h"
X  #include "../fs/type.h"
X  
X! /* #define DOS			/* compile to run under MS-DOS */
X! /* #define STANDALONE		/* compile for the boot-diskette */
X  #ifndef STANDALONE
X! #include "stdio.h"
X! #endif /*STANDALONE*/
X  
X! /* Fsck may be compiled to run in any of two situations. For each
X!  * a different symbol must be defined:
X   *
X!  *   STANDALONE	will compile fsck to be part of the boot-diskette and
X!  *		all necessary routines are contained in the program
X!  *   DOS	will compile fsck to run under MS-DOS, using
X!  *		the standard DOS library for your compiler.
X   *
X!  * The assembler file fsck1.asm must be assembled correspondingly. It has
X!  * only one symbol defined, namely STANDALONE.
X!  *  The assembler file fsck.s is only used under PC/IX to produce
X!  * a version for the boot diskette.
X!  *  When you have a problem look at the preprocessor output to see
X!  * which lines will actually be compiled.
X!  *  To produce an executable/binary version issue one of the following
X!  * commands, depending on your development environment:
X   *
X!  * Development system:	MS-DOS
X   *
X!  * fsck to run under:	MS-DOS
X!  * defined symbols:	fsck.c:	   DOS
X!  *			fsck1.asm:  -
X!  * command:		link fsck+fsck1,,,DOS-lib
X!  *
X!  * fsck to run under:	BOOT
X!  * defined symbols:	fsck.c:	   STANDALONE
X!  *			fsck1.asm: STANDALONE
X!  * command:		link fsck1+fsck,fsck,, {Minix-lib || DOS-lib}
X!  *			dos2out -d fsck
X!  *
X!  * fsck to run under:	MINIX	   -not yet implemented-
X!  * command:		link crtso+fsck,fsck,,Minix-lib
X!  *			dos2out -d fsck
X!  *
X!  *
X!  * Development system:	PC/IX
X!  *
X!  * fsck to run under:	PC/IX
X!  * command:		ld fsck -lc
X!  *
X!  * fsck to run under:	BOOT
X!  * defined symbols:	fsck.c:	   STANDALONE
X!  *			fsck1.s:   -
X!  * command:		ld fsck1.o fsck.0 -l../lib/lib.a
X!  *
X!  * fsck to run under:	MINIX
X!  * command:		ld fsck.o -l../lib/lib.a
X!  *
X   */
X  
X  #define BITSHIFT	  4	/* = 2log(#bits(int)) */
X  #define BITMAPSHIFT	 13	/* = 2log(#bits(block)); 13 means 1K blocks */
X  #define MAXPRINT	  8	/* max. number of error lines in chkmap */
X--- 5,35 ----
X  #include "../fs/const.h"
X  #include "../fs/type.h"
X  
X! 
X  #ifndef STANDALONE
X! #include <stdio.h>
X! #endif
X  
X! /* Fsck may be compiled to run in any of two situations.
X   *
X!  *   - standalone, as part of the boot diskette used to bring MINIX up
X!  *   - as a running MINIX program.
X   *
X!  * When used for standalone operation, -DSTANDALONE must be used.
X!  * The following commands can be used to build a standalone version:
X   *
X!  *    cc -c -Di8088 -DSTANDALONE fsck.c
X!  *    asld -o fsck fsck1.s fsck.s /usr/lib/libc.a /usr/lib/end.s
X   *
X!  * Fsck1.s contains calls to the BIOS routines used by the standalone
X!  * version.  The production version makes ordinary MINIX reads and writes.
X   */
X  
X+ 
X+ #define HEADS             4	/* # heads per cylinder */
X+ #define TRACKSIZE        17	/* # sectors per track */
X+ #define CYLSIZE (HEADS*TRACKSIZE) /* # sectors per cylinder */
X+ 
X  #define BITSHIFT	  4	/* = 2log(#bits(int)) */
X  #define BITMAPSHIFT	 13	/* = 2log(#bits(block)); 13 means 1K blocks */
X  #define MAXPRINT	  8	/* max. number of error lines in chkmap */
X***************
X*** 1847,1852 ****
X--- 1816,1823 ----
X  	for (;;) {
X  		printf("\nHit key as follows:\n\n");
X  		printf("    =  start MINIX (root file system in drive 0)\n");
X+ 		printf("    u  start MINIX on PS/2 Model 30, U.S. keyboard (root file sys in drive 0)\n");
X+ 		printf("    d  start MINIX on PS/2 Model 30, Dutch keyboard (root file sys in drive 0)\n");
X  		printf("    f  check the file system (first insert any file system diskette)\n");
X  		printf("    l  check and list file system (first insert any file system diskette)\n");
X  		printf("    m  make an (empty) file system (first insert blank, formatted diskette)\n");
X***************
X*** 1864,1871 ****
X  		case 'h':
X  			get_partition();
X  			drive = (partition < PARB ? 0x80 : 0x81);
X! 			cylsiz = 68;	/* sectors per cylinder */
X! 			tracksiz = 17;
X  			printf("Checking hard disk.  %s\n", answer);
X  			if (read_partition() < 0) continue;
X  			repair = 1;
X--- 1835,1842 ----
X  		case 'h':
X  			get_partition();
X  			drive = (partition < PARB ? 0x80 : 0x81);
X! 			cylsiz = CYLSIZE;	/* sectors per cylinder */
X! 			tracksiz = TRACKSIZE;
X  			printf("Checking hard disk.  %s\n", answer);
X  			if (read_partition() < 0) continue;
X  			repair = 1;
X***************
X*** 1896,1901 ****
X--- 1867,1874 ----
X  			break;
X  			
X  		case '=': return((c >> 8) & 0xFF);
X+ 		case 'u': return((c >> 8) & 0xFF);
X+ 		case 'd': return((c >> 8) & 0xFF);
X  		default:
X  			printf("Illegal command\n");
X  			continue;
+ END-OF-FILE fsck.c.cdif
chmod 'u=rw,g=r,o=r' 'fsck.c.cdif'
set `wc -c 'fsck.c.cdif'`
count=$1
case $count in
4777)	:;;
*)	echo 'Bad character count in ''fsck.c.cdif' >&2
		echo 'Count should be 4777' >&2
esac
echo Extracting 'group.new'
sed 's/^X//' > 'group.new' << '+ END-OF-FILE ''group.new'
Xroot:*:0:
Xdaemon:*:1:
Xsystem:*:2:
Xuser:*:3:
+ END-OF-FILE group.new
chmod 'u=rw,g=r,o=r' 'group.new'
set `wc -c 'group.new'`
count=$1
case $count in
44)	:;;
*)	echo 'Bad character count in ''group.new' >&2
		echo 'Count should be 44' >&2
esac
echo Extracting 'init.c.cdif'
sed 's/^X//' > 'init.c.cdif' << '+ END-OF-FILE ''init.c.cdif'
X*** /local/ast/minix/tape3b/tools/init.c	Wed Jul 13 14:46:53 1988
X--- init.c	Mon Sep 26 13:03:34 1988
X***************
X*** 28,33 ****
X--- 28,35 ----
X  #define NOPARAMS        -100
X  #define WTMPSIZE           8
X  
X+ extern long time();
X+ extern long lseek();
X  
X  struct uart {
X    int baud;
X***************
X*** 124,129 ****
X--- 126,132 ----
X    for (i = 1; i <= NR_SIGS; i++) signal(i, SIG_IGN);
X  
X    while (1) {
X+ 	sync();
X  	k = wait(&status);
X  	pidct--;
X  
X***************
X*** 154,162 ****
X  	/* Child */
X  	close(0);		/* /etc/ttys may be open */
X  	name[DIGIT] = '0' + linenr;
X! 	if (open(name, 0) != 0) exit(-3);	/* standard input */
X! 	if (open(name, 1) != 1) exit(-3);	/* standard output */
X! 	if (open(name, 1) != 2) exit(-3);	/* standard error */
X  
X  
X  	/* Set line parameters. */
X--- 157,165 ----
X  	/* Child */
X  	close(0);		/* /etc/ttys may be open */
X  	name[DIGIT] = '0' + linenr;
X! 	if (open(name, 2) != 0) exit(-3);	/* standard input */
X! 	if (open(name, 2) != 1) exit(-3);	/* standard output */
X! 	if (open(name, 2) != 2) exit(-3);	/* standard error */
X  
X  
X  	/* Set line parameters. */
+ END-OF-FILE init.c.cdif
chmod 'u=rw,g=r,o=r' 'init.c.cdif'
set `wc -c 'init.c.cdif'`
count=$1
case $count in
1111)	:;;
*)	echo 'Bad character count in ''init.c.cdif' >&2
		echo 'Count should be 1111' >&2
esac
echo Extracting 'message.cdif'
sed 's/^X//' > 'message.cdif' << '+ END-OF-FILE ''message.cdif'
X*** /local/ast/minix/tape3b/tools/message	Wed Jul 13 14:46:54 1988
X--- message	Mon Sep 26 13:03:35 1988
X***************
X*** 1,8 ****
X  
X  
X! Please see 'doc/READ_ME' for instructions about unpacking the documentation.
X  Then read 'doc/USER_GUIDE' before using the system.  The 'doc' directory is 
X! on disk 7 (PC version) or disk 3 (AT version).
X  
X  If your screen goes blank periodically, hit the F3 key (see 'doc/USER_GUIDE').
X  
X--- 1,8 ----
X  
X  
X! Please see 'doc/Read_me' for instructions about unpacking the documentation.
X  Then read 'doc/USER_GUIDE' before using the system.  The 'doc' directory is 
X! on disk 8 (PC version) or disk 3 (AT version), in the doc.a.Z archive.
X  
X  If your screen goes blank periodically, hit the F3 key (see 'doc/USER_GUIDE').
X  
+ END-OF-FILE message.cdif
chmod 'u=rw,g=r,o=r' 'message.cdif'
set `wc -c 'message.cdif'`
count=$1
case $count in
770)	:;;
*)	echo 'Bad character count in ''message.cdif' >&2
		echo 'Count should be 770' >&2
esac
echo Extracting 'pc_makefile'
sed 's/^X//' > 'pc_makefile' << '+ END-OF-FILE ''pc_makefile'
Xl=/usr/lib
XCFLAGS = -F -T.
X
Xall:
X	make init
X	make bootblok
X	make build
X
Xinit:	$l/libc.a init.s $l/head.s
X	asld -o init  $l/head.s init.s $l/libc.a  $l/end.s
X	@echo init done.
X
X# bootblok.s is the source of the MINIX boot block.  The bootblock is the
X# first 512 bytes on the image file and on the boot diskette.  When bootblok.s
X# is assembled, it generates a short binary file (less than 400 bytes) that
X# must be stripped of its header and copied to the file bootblok.  The dd
X# command below does this.  If everything has been done right, the bootblok
X# file should begin with the following 8 words, in hex:
X# c0b8 8e07 33d8 b8f6 2fe0 c08e ff33 00b9
X# The exact procedure for going from bootblok.s to the binary file stripped of
X# its header is somewhat operating system dependent.  Some assemblers make
X# an object (.s) file; others make an a.out file directly. If your boot 
X# diskette does not start out by printing 'Booting MINIX 1.0' the problem is
X# probably that you have not made a good boot block.
Xbootblok:	bootblok.s
X	@asld  bootblok.s 
X	@dd if=a.out of=bootblok bs=16w skip=1 count=16 2>/dev/null
X	@rm a.out
X	@echo bootblok done.
X
Xbuild:	build.s
X	cc -o build build.s
X	@echo build done.
X
Xfsck:	fsck.s fsck1.s
X	@echo "Start linking fsck. "
X	asld -o fsck fsck1.s fsck.s $l/libc.a $l/end.s
X	@echo fsck done.
Xfsck.s: fsck.c
X	cc -c -Di8088 -DSTANDALONE -F fsck.c
X
X# 'make image'  combines the bootblock, kernel, memory manager, file 
X# system, init and fsck into a single file, called image.  Each of these pieces
X# appears in the image file just as the original does on the disk, except that
X# the header at the front is removed, and each piece is padded out to an
X# integral multiple of 16 bytes.  Build also prints a message telling how big
X# the various pieces (except fsck) are.
X#
X# 'make net' does the same thing, only with the networking code from the
X# 'amoeba directory included
X#
Ximage:	build bootblok 
X	@getlf "Insert blank diskette in drive 0 and hit return"
X	@build bootblok ../kernel/kernel ../mm/mm ../fs/fs init fsck image
X	@cp image /dev/fd0
X
Xnet:	build bootblok 
X	@getlf "Insert blank diskette in drive 0 and hit return"
X	@build bootblok ../amoeba/kernel/kernel ../amoeba/mm/mm \
X		../amoeba/fs/fs init fsck /dev/fd0
X
+ END-OF-FILE pc_makefile
chmod 'u=rw,g=r,o=r' 'pc_makefile'
set `wc -c 'pc_makefile'`
count=$1
case $count in
2249)	:;;
*)	echo 'Bad character count in ''pc_makefile' >&2
		echo 'Count should be 2249' >&2
esac
echo Extracting 'ttys'
sed 's/^X//' > 'ttys' << '+ END-OF-FILE ''ttys'
X100
+ END-OF-FILE ttys
chmod 'u=rw,g=r,o=r' 'ttys'
set `wc -c 'ttys'`
count=$1
case $count in
4)	:;;
*)	echo 'Bad character count in ''ttys' >&2
		echo 'Count should be 4' >&2
esac
echo Extracting 'ttytype.new'
sed 's/^X//' > 'ttytype.new' << '+ END-OF-FILE ''ttytype.new'
Xminix tty0
Xvt100 tty1
+ END-OF-FILE ttytype.new
chmod 'u=rw,g=r,o=r' 'ttytype.new'
set `wc -c 'ttytype.new'`
count=$1
case $count in
22)	:;;
*)	echo 'Bad character count in ''ttytype.new' >&2
		echo 'Count should be 22' >&2
esac
exit 0