-----------------------cut here-------------------------
echo x - readme
sed '/^X/s///' > readme << '/'
XThis is a rather quick-and-dirty tutorial to assist in going from
XMinix 1.5.10 to Bruce Evans' Minix-386.  
X
XThe program zap1.c is used in the makelib procedure, if you elect
Xto use Earl Chew's estdio.  Since it is not included with the material
Xwhich is at plains.nodak.edu, I have included it here.
X
XThe little program is used to check an object file to see if it
Xis an 80386 file or an 8086 file.  It is trivial, obviously, but
Xstill....I've included it "because it was there".
X
XDon't flame me if you use this and it does not work.  It works for
Xme ok.  Even if it does not work for you, you can probably get some
Xhints from it which will be helpful, and by using the readme file
Xwhich comes with Bruce's mx386 package with these hints, you will
Xhopefully be able to get a system working.
X
XAfter all, most of the fun lies in getting something working.  Once
Xit IS working, it becomes boring, no?
X
XEnjoy
X
XJohn Nall
/
echo x - prog.c
sed '/^X/s///' > prog.c << '/'
Xmain()
X{
X	char buf[10];
X	if (read(0,buf,4) != 4) {
X		printf("Length error reading file.\n");
X		exit(1);
X	}
X	
X	if (buf[3] == 0x04)
X		printf(" is 8086\n");
X	else if (buf[3] == 0x10)
X		printf(" is 80386\n");
X	else
X		printf(" is unknown\n");
X}
/
echo x - zap1.c
sed '/^X/s///' > zap1.c << '/'
X/* zap1.c - write 1 byte in the middle of an existing file */
X
X#include <stdio.h>
X
Xlong atol();
Xlong lseek();
X
Xmain( argc, argv )
Xint argc;
Xchar **argv;
X{
X	char buf[1];
X	int fd;
X	long pos;
X
X	if ( argc != 4 )
X	{
X		printf( "Usage: %s file offset byte\n", argv[0] );
X		exit( 1 );
X	}
X	if ( (fd = open( argv[1], 2 )) < 0 )
X	{
X		printf( "%s: can't open %s\n", argv[0], argv[1] );
X		exit( 1 );
X	}
X	pos = atol( argv[2] );
X	if ( lseek( fd, pos, 0 ) != pos )
X	{
X		printf( "%s: can't seek in %s\n", argv[0], argv[1] );
X		exit( 1 );
X	}
X	buf[0] = atoi( argv[3] );
X	if ( write( fd, buf, 1 ) != 1 )
X	{
X		printf( "%s: can't write to %s\n", argv[0], argv[1] );
X		exit( 1 );
X	}
X	if ( close( fd ) < 0 )
X	{
X		printf( "%s: can't close %s\n", argv[0], argv[1] );
X		exit( 1 );
X	}
X}
/
echo x - tutorial
sed '/^X/s///' > tutorial << '/'
X		TUTORIAL FOR INSTALLING MINIX-386
X
X	This is meant to be a step-by-step tutorial on moving from
Xstandard Minix 1.5.10 to Bruce Evans's modification which allows the
Xfull use of the Intel 386 CPU.  I'm going to refer to the modified
Xsystem from here on out as "Minix-386", but it should be clearly
Xunderstood that we are merely talking about standard Minix, with the
Xmodifications written by Bruce.
X
X	I'm also going to make certain assumptions regarding the
Xaudience for such a tutorial.  These assumptions are as follows:
X
X	1.  Access to the Internet, and capability of transferring
X	    files via ftp.
X
X
X	2.  A 386 system, with a hard-disk and at least a 1.2 meg
X	    floppy drive.  Minix 1.5.10 should be already installed
X	    on the hard-disk.
X
X	3.  Some means of transferring binary files from Internet
X	    to the Minix system.  In my case, I use PC-NFS, and can
X	    ftp from DOS and then use DOSREAD from Minix.  But just
X	    whatever works for you should be ok.  Just remember that
X	    these files are BINARY, so when using things such as ftp,
X	    dosread and kermit, be sure and set the binary option.
X
X	4.  Familiarity with such standard programs as ftp, patch, make,
X	    dosread, crc, etc.  I'll try and make comments from time to
X	    time which may be helpful, but I am not going to really get
X	    down to basics.  You most likely want to hold off on going to
X	    an experimental system such as Minix-386 if you are not at
X	    least at that level.  (On the other hand, there's nothing like
X	    jumping in the water to learn to swim, and if someone gives
X	    it the old college try anyway, don't hesitate to send me some
X	    e-mail if you have a problem, even if it is really basic).  I
X	    strongly recommend the excellent tutorial which Glen Overby
X	    wrote, and which is available from plains.nodak.edu.  I do not
X	    remember the exact name, but it is something like Glen0.tute.tar.
X
X	Before starting this, I recommend that you back up your Minix system
Xif you have not already done so.  Although nothing that I am going to tell
Xyou *should* mess up your hard disk....always remember Murphy's law!
X
X	Get a good 1.2 meg floppy disk, format it, and then make a file
Xsystem on it.  (mkfs /dev/at0 1200).
X
X	
X------------------------------------------------------------------
X
XStep 1.  ftp to an archive.  I recommend plains.nodak.edu [134.129.111.64]
X	 if you're in the US, but there are probably other good ones as 
X	 well.  The following is going to assume plains.nodak.edu.
X
XStep 2.   Change to directory pub/Minix/oz.
X
XStep 3.   Set mode to binary and ftp the following files:
X
X          mx386_1.1.t.Z
X          mx386_1.1.01.Z
X	  bcc.tar.Z
X	  bccbin16.tar.Z
X	  bccbin32.tar.Z
X	  bcclib.tar.Z
X	  shoelace-1.0a.tar.Z
X
X	Note: There are other interesting files in pub/Minix/oz, but
XI recommend you stick with these.  In particular, I do not at this
Xtime recommend using cppmake, as it appears to have problems at the
X1.5.10 level.  These are presently being worked on by several people,
Xand may be solved by the time you use this. (Bruce specifies it in his
Xdocumentation, but that was written prior to 1.5.10, I guess.)
X
X          mx386_1.1.t.Z is a compressed, tar file of all of the
Xmaterial necessary to get Minix-386 running.
X
X          mx386_1.1.01.Z is a compressed ASCII file (not a tar
Xfile) which contains a bug fix necessary for mx386_1.1.t.Z.
X
X	  bcc.tar.Z is a compressed tar file of the source
Xfile for bcc (which we won't use, but I recommend getting it anyway,
Xjust in case).  This file also contains bcc.doc and bcc.bugs.  These
Xare not needed immediately, but should be read before doing anything
Xwith the source (bcc.c).
X
X	  bccbin16.tar.Z is a compressed tar file containing binaries
Xfor the version of the compiler that runs under standard Minix 1.5.10.
X
X	  bccbin32.tar.Z is a compressed tar file containing binaries
Xfor the version of the compiler that runs under Minix-386.
X
X	  bcclib.tar.Z are all the library source files necessary
Xto support the compiler.
X
X	  shoelace-1.0a.tar.Z is a collection of files necessary to
Xutilize what has been called "a preliminary boot program".  It has
Xvery good documentation, and is probably a good thing to use.  In
Xthis document, however, I am just going to use it to make a floppy
Xthat will boot up your 32-bit system because I cannot for the life
Xof me make a boot disk the regular way that works.  If you can, I
Xurge you to post the necessary information :-)  To make matters
Xeven worse, the first time I compiled the system, I DID make a good
Xboot disk...but I can't duplicate it.  Shoelace is better, anyway.
X
X	  NOTE:  It may seem a little confusing that there are two
Xcompilers, which seem to be alike, but there is a good explanation.
XEither of the compilers will produce either 16-bit or 32-bit object
Xfiles (depending on whether they get a -0 argument or a -3 argument).
XHowever, the present Minix system only runs in the 16 bit mode.  So
Xtherefore, you have to have a compiler which also runs in the 16 bit
Xmode.  Use it to produce 32-bit object files, and then after you have
Xa 32-bit version of Minix, you can use the 32-bit compiler.
X
X	Now set up a Minix directory called /usr/oz, and move all of
Xthe ftp'd files to Minix, using DOSREAD or whatever other mechanism you
Xmight have.  (If you have a Unix machine, such as a Sun or whatever,
Xyou might want to uncompress and untar there, and just move the files
Xover to Minix.  If you do that, you have to make the appropriate
Xadjustments to the following steps).  
X
XStep 4.   Uncompress all files:
X
X          compress -d mx386_1.1.t.Z     # produce a tar file
X          compress -d mx386_1.1.01.Z    # produce an ASCII message
X	      ...etc.
X
X	NOTE: Most of the tar files, when untarred, will make their
Xown subdirectory.  However, Shoelace does not do this, so you have
Xto manually make a shoelace directory (/usr/oz/shoelace), move the
X.tar file to it, and untar it there.
X
XStep 5.   Untar mx386_1.1.t (tar xf mx386_1.1.t).  This will make 
Xa subdirectory called mx386_1.1, which contains the following:
X
X               README1.1      # read this!!
X               bin0           # a directory - 16 bit compiler
X               bin3           # another directory - 32 bit compiler
X               fs             # another directory - fs material
X               kernel         # another directory - kernel stuff
X               mm             # another directory - mm stuff
X               tools          # another directory - tools stuff
X               mx386_1.1.crc  # crc listing of mx386 package
X               runtime.crc    # crc listing of things needed
X
X	Lets rename the subdirectory ("mv mx386_1.1 mx386"), since
Xit is easier to work with that short name :-)
X
X	Also, at this point, stop, get a beer (or a cup of coffee)
Xand carefully read the README1.1 file.  It tells you just about
Xeverything that is in this tutorial.  So use it as a reference
Xguide.  
X
XStep 6.	Untar mx386_1.1.01, and use a text editor, such as elle,
Xto remove the top material, so that you can run it through the
Xshell (i.e., remove everything up to the line that says "/bin/sh").
XThen run it through the shell ("/bin/sh mx386_1.1.01").
X
XStep 7.	This will give you a .crc and a .cdif file.  Move both of
Xthem to the /usr/oz/mx386/kernel directory and run patch against klib386.x
Xwith the .cdif file (that is: "patch klib386.x klib386.x.cdif") to
Xproduce an updated klib386.x file.  Check the new crc against the
Xone given in the .crc file.
X
XStep 8.  Mount your 1.2 meg floppy - let us say on user.  (That
Xis, do a /etc/mount /dev/at0 /user, assuming that you have 
Xyour 1.2 meg drive as drive 0)
X
X	AT THIS POINT, I AM GOING TO ASSUME THAT YOU HAVE A
XDIRECTORY CALLED /USR/OZ/MX386, AND THAT THE MATERIAL WHICH CAME
XFROM THE FILE MX386 FILES IS IN IT.  I AM GOING TO ALSO ASSUME THAT
XYOU HAVE A DIRECTORY CALLED /USR/OZ/BCC, AND THAT THE MATERIAL WHICH
XCAME FROM THE BCC FILES IS IN IT.  THE /USR/OZ/BCC DIRECTORY  LOOKS 
XLIKE THIS:
X
X	bcc - a directory, which came from bcc.tar.Z
X	bccbin16 - a directory, which came from bccbin16.tar.Z
X	bccbin32 - a directory, which came from bccbin32.tar.Z
X	bcclib - a directory, which came from bcclib.tar.Z
X
X
XStep 9.  Here we will make the directory structure on /user which will be
Xneeded as the root when you boot up your 32-bit system.
X
X
X	cd /user		# (mounted above, on at0)
X	mkdir usr		# /usr for Minix-386
X
X	cd /			# copy root stuff to new partition
X	cpdir -s dev /user/dev
X	cpdir -ms etc /user/etc
X	cd /user/etc
X	rm mount umount update	# ruthlessly root out 16-bit binaries
X
X	Note: Edit /user/etc/rc so that it does not try and mount stuff.
XJust comment out the part that mounts /usr.  Your /usr directory will be
Xon the floppy for now.
X
X	Now, set up root for compiling stuff.  You don't want to have your
Xroot in RAM for this.  I presume you are mounting a disk partition as
Xroot.  If not, you will have to change all the paths "/local/..." in
Xbcc.c to something else, perhaps "/usr/local/...", and recompile bcc.
X	
X	cd /
X	mkdir local
X
X	cd /usr/oz/bcc
X	cpdir -ms bccbin16 /local/bin	# Move 16-bit compiler
X	cpdir -ms bccbin32 /local/bin3	# and the 32-bit compiler
X
X
XStep 10.	Now you need to go through and apply Bruce's changes to the
Xstandard 1.5.10 material.  ("cpdir -ms" is recommended by Bruce).
X
X	cd /usr/oz/mx386
X	cpdir -ms bin0 /local/bin	# 16-bit compiler stuff
X	cpdir -ms bin3 /local/bin3	# 32-bit compiler stuff
X	cpdir -ms fs /usr/src/fs	# mods for fs
X	cpdir -ms kernel /usr/src/kernel	# mods for kernel
X	cpdir -ms mm /usr/src/mm	# mods for mm
X	cpdir -ms tools /usr/src/tools	# mods for tools
X
XStep 11.	Now apply Bruce's changes to /usr include and 
Xto the standard library routines.
X
X	cd /usr/oz/bcc/lib/fix1.5.10	# move Bruce's changes
X	cp include.cdif /usr/include	# to include
X
X	cp ansi.cdif /usr/src/lib/ansi	# to ansi
X	cp other.cdif /usr/src/lib/other	# to other
X	cp posix.cdif /usr/src/lib/posix	# and to posix
X
X	cd /usr/include	# now apply the changes
X	patch < include.cdif
X	
X	cd /usr/src/lib/ansi
X	patch < ansi.cdif
X
X	cd /usr/src/lib/other
X	patch < other.cdif
X
X	cd /usr/src/lib/posix
X	patch < posix.cdif
X
X	Also apply the necessary changes to tools
X
X	cd /usr/src/tools
X	patch < tools.cdif
X
XStep 12.	Copy the additional bcc library stuff.
X
X	cd /usr/oz/bcc/lib
X	cpdir -ms bcc /usr/src/lib/bcc
X
XStep 13.   At this point, you should use /usr/oz/mx386/runtime.crc  and
Xcheck the crc's against your files.
X
XNOTE:  What Bruce refers to as "/local/bin0" will be your "/local/bin",
Xand what he refers to as "/local/bin" will be your "/local/bin3".  That
Xis, he is using the bin3 directory for bin, and you want to use the bin0
Xdirectory as bin.
X
XYou will notice that he does not give a crc for EVERYTHING which
Xis on your file system, but only for the things that he has either
Xadded or put there.  So, for example, in crc checking /usr/include,
Xhe gives under "/usr/include" the routines which were patched, such as
Xfcntl.h, lib.h, etc.  The stuff shown as "/usr/include/dist" is merely
Xfor comparison with standard 1.5.10, and should not necessarily be on
Xyour partition.  However, if you want to really be safe, you could set
Xup such a subdirectory to save the things prior to changing them, so
Xthat you can always go back to where you where.  (But since I advised
Xyou to backup before you started, it should not be necessary.....)
X
X	The material which he does NOT show - for example the remainder of
X/usr/include - is expected to match Minix 1.5.10 crc's.  If you did not
Xhave a clean 1.5.10 system (i.e., matched crc's) to begin with, there may
Xbe problems.  Do not be fooled (like I did) into thinking that just because
Xit is not shown in runtime.crc that it should not be there!
X	
X	However, in the real world we live in, very few of us actually do
Xhave exact crc matches on EVERYTHING....so do the best you can with it.
XUse caution, however.  If every little library routine and makefile does
Xnot match to the nth degree, you may, with luck, get by.  But if there
Xare big discrepancies, or the discrepancy is in the operating system
Xitself, you might save time by getting if fixed before proceeding.
X
X	In /usr/src/kernel, note that the crc for klib386.x shown in the
Xruntime.crc file is not correct, since you should have previously patched
Xthat with the material from the mx386_1.1.01 file.  The correct crc should
Xbe:
X
X	54263	20437	klib386.x
X
X	My makefile.cpp for /usr/src/kernel also does not match the
Xruntime.crc file (I show 03660	4085	makefile.cpp).
X
X	Note that for /usr/src/lib/ansi, posix, and other, Bruce again
Xshows on runtime.crc only the files which he changed.  There will, of course,
Xbe ALL of the files from Minix 1.5.10 in /usr/src/lib.  The ones which
Xhe does not show should match Minix 1.5.10 crc's.
X
X
XStep 14.  Recompile "make" so that it will recognize .o files (instead of
Xusing .s files).  To do this, just change to your /usr/src/commands/make
Xdirectory, and edit the Makefile to remove -DPCMINIX from the CFLAGS line,
Xso that it just reads "CFLAGS = -Dunix".  Then do a make, produce a new
Xobject file of make, and move it to /usr/bin (I would recommend that you
Xsave the old make first.  For example:
X
X		cd /usr/bin
X		mv make make_s
X		cd /usr/src/commands/bin
X		mv make /usr/bin
X
XStep 15.  Now, we are ready to compile the libraries.  First of all,
Xchange your path, so that you will have access to the compiler.  At
Xthe same time, change cc to something else, and link the name "cc" to
Xthe bcc compiler.  (The reason for changing cc to some other name is
Xto be sure that if you re-boot and forget to change your path, you
Xwill not start compiling with the wrong compiler!)
X
X
X	PATH=/local/bin:$PATH
X	export PATH
X	cd /usr/bin	# assuming that cc is here
X	mv cc cc_old
X	cd /local/bin
X	ln bcc cc	# since some makefiles use cc
X
XStep 16. Now, lets compile the libraries...but before doing so, be SURE that
Xthere aren't any refuge .s files hanging around.  They cause problems!
X
X	cd /usr/src/lib/ansi
X	rm *.s
X	cd ../posix
X	rm *.s
X	cd ../ibm
X	rm *.s
X	cd ../other
X	rm *.s
X	cd ../string
X	rm *.s
X
X	cd /usr/src/lib/bcc
X	sh makelib 86 | tee makelib.out 2>&1
X
X	Several things can go wrong here.  If something is not working, check
Xto be sure you set the PATH right.  Check to be sure that you have the proper
Xfiles in /local/bin.  Check to be sure that cpp is in /lib (because it is 
Xneeded to convert .x files).  Check to be sure that you don't have some kind
Xof garbage in with the source files.  If you get compile errors, check to be
Xsure that your crc's check with Bruce's.  There should not be any compile
Xerrors.  Check the file makelib.out carefully, and see if it contains any
Xerror messages.  There should not be any.  If there are, fix them, clean
Xup stuff by doing:
X
X	sh makelib 86 clean
X
Xand then start over with:
X
X	sh makelib 86 | tee makelib.out 2>&1
X
X	But assuming everything is eventually ok, you should now have a 
X16-bit library which will be in /usr/src/lib/bcc/i86.  Move this to 
X/usr/local/lib/i86, as shown in the following:
X
X	cd /usr
X	mkdir local
X	cd local
X	mkdir lib
X	cd lib
X	mkdir i86
X	cd /usr/src/lib/bcc/i86
X	cp * /usr/local/lib/i86
X
X	There is a little library which we need for /usr/src/kernel, so
Xlet's go ahead and make it now.
X
X	cd /usr/src/lib/bcc/86
X	ar r /usr/src/kernel/longlib.a laddl.o lcmpl.o ldecl.o lorl.o \
X            lsll.o lsrul.o
X	cd /usr/src/kernel
X	ar t longlib.a		# check to be sure they are there...
X
X	Now, clean up the 16 bit stuff, so the 32-bit library can be compiled.
XThere are things in it the 16-bit library which later on are going to
Xbe needed to make the 32-bit system.  Later on, if you get cramped for
Xspace, you can remove the 16-bit libraries if you run completely under
XMinix-386.
X
X	cd /usr/src/lib/bcc
X	makelib 86 clean
X
X	makelib 386 | tee makelib.out 2>&1
X
X	Same warnings hold, of course, as above.  But if the 16-bit library
Xcompiled ok, most likely the 32-bit one will also :-)
X
X	cd /usr/src/lib/bcc/i386
X	cp * /usr/local/lib/i386	# copy to permanent home
X
X	makelib 386 clean	# if you are tight for space
X
XStep 17.	OK, now lets make the operating system itself.  The time has
Xnow come to discuss the makefile problem.  Bruce has assumed that we are
Xusing cppmake.  But, as previously stated, cppmake is not working under
XMinix 1.5.10, so I recommend we go without it for now.
X	
X	The first thing to do is to make the directory where kernel, fs, and mm
Xare going to be put (that is, the object files).
X
X		cd /etc
X		mkdir system
X
X	Doing the makefiles for mm and fs are both easy.  Just use elle and
Xdelete some blanks which are at the beginning of some of the "#" commands.
XThen use cpp to generate a makefile.  
X
X		cd /usr/src/mm
X		rm *.s *.o		# can't be too careful...
X		elle makefile.cpp	# be sure all "#" commands start in column 1
X		/usr/lib/cpp -P -DINTEL_32BITS makefile.cpp > makefile
X		make		# generate /etc/system/mm
X
X		cd /usr/src/fs
X		rm *.s *.o
X		elle makefile.cpp	# again, be sure all "#" commands start in col 1
X		/usr/lib/cpp -P -DINTEL_32BITS makefile.cpp > makefile
X		make		# generate /etc/system/fs
X
X	NOTE: You will get a warning message from ld that _exit has been
Xredefined.  This is normal.	
X
X	/usr/src/kernel gives more of a problem, because cpp does not like the
Xcomments (which begin with "#") in makefile.cpp.  The easiest thing seems to
Xjust make a copy of makefile.cpp, use elle to remove all of the comments, and
Xthen run cpp on it.  Be careful though that when you remove something that it
XIS a comment, rather than a cpp command! So read before deleting.
X
X		cd /usr/src/kernel
X		cp makefile.cpp xx
X		elle xx		# remove all of the comment lines
X		rm *.s *.o	# be sure...
X		config 386	# set up proper files.
X		/usr/lib/cpp -P -DINTEL_32BITS xx > makefile
X		make		# generate  /etc/system/kernel
X
X	NOTE: ld complains that _unlock and _lock are redefined. Again,
Xthis is normal.
X
X	PROBLEM AT THIS POINT!  I have not had much luck with making a
Xboot disk using /usr/src/tools, so I am going to recommend using the
XShoelace method instead.  Therefore, I am going to just make init, move
Xit over to /etc/system, and stop there, so that I can get this $%@#&
Xtutorial posted!  (But I'll keep working on it :-))
X
X		cd /usr/src/tools
X		cc -3 -D_POSIX_SOURCE -D_MINIX -o /etc/system/init init.c
X
XStep 18.  Now, go back to /usr/src/oz and uncompress and untar the file
Xcontaining Shoelace (shoelace-1.0a.tar.Z).  You need to switch back to
Xthe regular old ACK compiler, and use the old version of make.
X
X		cd /usr/bin
X		mv cc_old cc
X		mv make make_o
X		mv make_s make
X		PATH=/usr/bin:/bin
X		export PATH
X		cd /usr/src/oz/shoelace
X		make -f makefile.min	# make shoelace stuff
X
X	Read the file "readme" carefully.  It will tell you in detail
Xhow to make a floppy disk.  Just use the 1.2 meg disk that you already
Xhave mounted for this!  That is, do the "./laceup /dev/at0 5.25dshd".
X(The readme file says to use /dev/fd0 5.2h dsdd, but since you have a 1.2 meg
Xdisk, you need to use /dev/at0 5.25dshd).  Next, copy shoelace to it, as 
Xper the readme file.  THEN, copy the kernel, mm, fs and init files.  Copy
Xconfig to /user/etc/config.
X
X		cd /etc/system
X		cp * /user	# copy kernel, fs, mm, init
X
X	Do NOT, however, follow the readme directions to "copy a /bin/sh, login,
Xetc. onto the floppy" because you want to put 32-bit versions of these on there.
XThis will be done a little bit later.
X
X	Also, you need to edit the /user/config file a little bit, so that
Xit fits your configuration.  Use elle and comment out the line which says:
X
X		run	/etc/system/db
X
XStep 19.  If all of this worked ok, then you should now have a 32-bit boot
Xdisk.  Now, you want to Make a few more 32-bit files...which means that you
Xneed to compile a few commands.  First, switch back to bcc:
X
X		cd /usr/bin
X		mv cc cc_old
X		mv make make_s
X		mv make_o make
X		PATH=/local/bin:$PATH
X		export path
X
X	Now make the files you are going to need:
X
X
X	cd /user
X	mkdir bin
X	cd /usr/src/commands/sh
X
X	We will dispense with using makefiles for right now...you can play
Xwith these and adjust them to your satisfaction later.
X
X	rm *.s *.o
X	cc -3 -D_POSIX_SOURCE -o /user/bin/sh *.c
X	cd /usr/src/commands
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/bin/login login.c
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/etc/update update.c
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/etc/mount mount.c
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/etc/umount umount.c
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/bin/cat cat.c
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/bin/ls ls.c
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/bin/cp cp.c
X
X	cd /usr/src/commands/ibm
X	cc -3 -D_POSIX_SOURCE -D_MINIX -o /user/bin/readclock readclock.c
X
X	NOW, finally, and at last.  You have a 1.2 meg floppy which has
Xa Minix-386 system on it (a skelton system, to be sure), and which you
Xcan boot up.  What you want to do now is boot it up, see if everything
Xworks, and if it does, you should be able to now think in terms of making
Xa Minix-386 hard disk partition, compiling all commands, etc. 
X
X	The biggest problem that you are going to have is mixing the
X16-bit and 32-bit binaries.  If you try and run a 16-bit program while
Xin 32-bit mode, you get an error.  And vice-versa.  Here is a little
Xprogram you can run to check:
X
X	main()
X	{
X		char buf[10];
X		if (read(0,buf,4) != 4) {
X			printf("Length error reading file.\n");
X			eixt(1);
X		}
X		if (buf[3] == 0x04)
X			printf(" is 8086\n");
X		else if (buf[3] == 0x10)
X			printf(" is 80386\n");
X		else
X			printf(" is unknown\n");
X	}
X
X	Just compile it and run it against /bin, /usr/bin, /etc.
XFor example, say you call the program "check_cpu":
X
X		cd /usr
X		for i in *
X		do
X			echo $i - `(check_cpu < $i)`
X		done
X
X
X	Good luck, congratulations, and welcome to Minix-386!!!
X
X(p.s.  If you have problems, suggestions, criticisms or comments about
Xthis tutorial, please feel free to send them to me.  Better still, make
Xnotes as you go, and use your own experience with it to post a better one!)
X
XJohn Nall
Xn...@sun8.scri.fsu.edu
X
X
X		
X
X
X
X
X