The following is trial English translation of "MXboot.doc", original document
in Japanese language will be found in the archive in part-4 and 5.
============================================================================
Table of contents
	[ 1]	what is MXboot?
	[ 2]	contents of the package.
	[ 3]	explanation of each file in the package
	   3.1	MXboot.x, mxinstall.c
	   3.2	mxpack.dif
	   3.3	assistIPL.x
	   3.4	fdisk.dif
	   3.5	makefile
	[ 4]	installation of MXboot
	[ 5]	patch'es to bootblok.s and menu*
	[ 6]	kernel reconfiguration
	[ 7]	Awaking
	[ 8]	Exchange of master-IPL
	   8.1	making assistIPL
	   8.2	modification of fdisk.c
	   8.3	writing assistIPL to HDisk
	[ 9]	difference between FDassist and assitIPL
	[10]	additional feature of assistIPL
	[11]	usage of MXboot		---- one more additional feature ----
	[12]	acknowledgements
	[appendix]	MXboot's process to find the image-file


[1]	what is MXboot?
    MXboot is  a  boot-loader, initially  devised  to boot-up  Minix-1.5  on
NEC-PC9801  system from Hard-disk,  and  its size is  less than  1024-bytes.
MXbootpc  is  the  IBM-PC (and its compatibles)  implementation  of  MXboot.
MXboot  works  booting  succeeding to  the master-IPL  on HDisk,  and  reads
kernel-image, placed as an usual file, into memory, and boots up Minix.

    In IBM-PC, shoelace is available, which has many functions and supported
by many users,  but its size is big,  and  installation procedure needs very
much.  On the contrary, this MXboot has only limited functions, but its size
is very small, thus this can be put in the "BOOTBLOCK" of the top of a file-
system.  So, installation is almost finished if you prepare HDisk-area to be
mounted.

     Unfortunately,  IBM-PCs  do not have  "Hard-disk select menu for boot",
which is available  in  NEC-PC9801.   MXboot  is a merely  LOADER for Minix,
so,  MXboot should be awakened  by someone,  ex. HD-select-menu  for PC9801,
otherwise it sleeps forever.  We parepared MASTER-IPL, named assistIPL.

     Followings  are the explanation of the  usage/installation/points to be
noticed, etc, etc.  To install MXboot,  you are  necessary to change MASTER-
IPL,  which may be thought  dangerous  by the beginners  but  it is  not  so
danger,  IF  you  check  several points CAREFULLY.  I have prepared  several
auxual tools for installation, but still

	you SHOULD BACK UP THE SYSTEM, before installation MXboot.
	^^^^^^^^^^^~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    Installation procedure is  written under the assumption  "root is placed
on HDisk".  If you place root on RAM-DISK, you should modify the process.



[2]	contents of the package.
    Contents of the package (mxboot.tar) is as follows;
	mxboot.x:	MXboot itself
	mxinstall.c:	auxual tools for MXboot installation
	mxpack.dif:	context-diff's for bootblock.s/menu1.s/menu.c
	assistIPL.x:	master-IPL for IBM-PCs
	fdisk.dif:	context-diff for fdisk.c
	makefile:	makefile used by /usr/src/minix/tools



[3]	explanation of each file in the package

3.1	mxboot.x, mxinstall.c
     MXboot itself  has  the same specification  for  MXboot-NEC-PC9801,  it
checks  <Shift>-key  at the time of  awakend,  and  if  the <Shift>-key   is
pressed  it shows  the prompt  and  waits  key-input  for file name.  If the
<Shift>-key  is  not  pressed,  it  tries  to find  the image file  (usually
"/system/minix.sys"  as  written in  the source-code), and  if found,  boots
according to the file, if not found, it prompts and waits user response.

     Mxinstall.c  is prepared  to avoid mistakes  at then installation time,
because in case of IBM-PC-Minix,  all partitions of the HDisk  is registered
on /dev/hd*,  so,  if you may write something  to the partition  other  than
Minix (may be MS-DOS),  by ex. "dd"-command,  all of  the contents  of  that
partition may be lost.   Mxinstall writes MXboot to the bootblock at the top
of the partition  ONLY IF  the partition specified is the one for Minix  AND
the partition has no possibility to be adjusted the top-sector.


3.2	mxpack.dif
    This  has  the  context-diffs  to  patch  "bootblock.s",  "menu1.s"  and
"menu.c".   MXboot  shows the message at booting by indirect subroutine call
in the bootblock.s.  Patches to the bootblock.s  are made to  (1) "Booting"-
message display routine is made to subroutine,   (2) entry  for this routine
is prepared at the third-byte from the start,   and  (3) work-area of itself
is put "upper_limit - 4k" of the real-memory.

    Patches for  menu1.s  and  menu.c  specifies the partition automatically
root-area at the time of awakened by MXboot.   This menu will be skipped  if
the user does not specified otherwise  when  booted by HDsik, as is the case
for NEC-PC9801.


3.3	assistIPL.x
    This is  the master-IPL  to be placed at the top-sector  of the HDisk in
order to selective-boot from  plural-OSs  put one HDisk-drive.  You can make
the program to test for booting via Floppy-disk as a dummy-Hard-disk.


3.4	fdisk.dif
    This is  the context-diff  to  patch  "fdisk.c"  in order to append "x"-
command  to exchange master-IPL.   This "x" command only changes IPL-record,
and the contents of the partition-table is not changed.


3.5	makefile
    This is  the replacement of the conventional  "tools/makefile", and add-
itions to MXboot-related items are made,  so please overwrite it by this new
makefile.  The first-line of the makefile  is intendedly left UNDEFINED. You
should define by yourself, according to your own environments, the following
section "installation of MXboot" will help you.



[4]	installation of MXboot
     At first, you should place  MXboot-package  into  Minix-system, and de-
archive it by tar.   Makefile included in the package assumes the work space
is /usr/src/minix/tools.   If you have mxboot.tar in MS-DOS formatted floppy
and you put it on FDD-#0, do as follows;

	# cd /usr/src/minix/tools
	# dosread A mxboot.tar > mxboot.tar
	# tar x mxboot.tar

Before compilation,  you should  modify  makefile (first-line) of the right-
term of ROOTDEV to the device you want to mount as root.  OK?       Makefile
included is left undefined this ROOTDEV,  thus if you try to compile by this
makefile, you will be rejected by make-error.   Don't claim as  BUG!     OK?
If so, go ahead to compile.

The following two steps are all!

	# make mxinstall
	# make mxboot

If ROOTDEV is not correctly specified  or  the partition may be adjusted the
top-sector, installation will be rejected.  If the former case, you are only
necessary to modify  the specification  of ROOTDEV  correctly,  but  if  the
latter,you should return to the process of reservation of patition by fdisk.

    Now,  MXboot  is sleeping  at the area where no one used,  waiting to be
awakened by someone.  What wake up it  is assistIPL, mentioned above. Before
entering into the detailed explanation of assistIPL,  let's see kernel-image
to be read by MXboot.

    Files read by MXboot  are NORMAL Minix files,  in other words, it is the
boot-image-file itself,   generated  at the configuration/making  kernel  by
build.  If you write this file into diskette, it makes normal boot disk  and
if you copy  it to  /system/minix.sys,  MXboot will start reading this  when
waken-up.  Now, we have two-selections;

1:	Extract boot-image from  boot-disk sold by Prentice-Hall,  and
	copy  it  to  /system/minix.sys  by  (ex.) "dd"-command.   For
	examples,  if you are using HD-area as root,  reserve the area
	by

		# mkdir /system

	and place boot-disk on FDDrive #0

		# dd if=/dev/fd0 of=/system/minix.sys count=360

	will be OK. (In this case, 180-kB is extracted always  regard-
	less the real size of the kernel).   You can install assistIPL
	at this stage  skipping following [5] and [6].  But  if you do
	so, you are needed to select root-partition everytime of boot-
	ing,  and  you will NOT see the "Booting..." message.

	This is  because MXboot thinks  message-display-routine is not
	subroutine  and  is not located  where  it assumes.   Such  an
	environment is FAR from my expectation.

	I'll  not  reccomend  to do so  unless you have no-time to re-
	configure the kernel.

2:	another way  is what I want to be made,  explanation  will  be
	continued to the next section.



[5]	patch'es to bootblok.s and menu*
    At boot from Hard-Disk, the partition where MXboot placed is selected to
root,  and menu will not appear if NOT necessary.  The user's environment of
Minix is almost fixed,  thus default selection  to boot-up  can be setup  as
default for less operation.   But  if the default is setup  FIXEDLY  and  if
we have no chance  to select another selection from built-in one,  it is not
always convenient.  Thus  patches  for menu*  provide  the method  to select
another menu when the selection is necessary.

    The patches to the bootblok.s  are made in order to display "Booting..."
messages  and relocate itself  to  the upper_limit_of_real_memory - 4_KB  to
avoid crashing itself  when used  larger boot-image  from floppy.  This also
contains the switch  corresponds to  the 32-bit-kernel  by Bruce Evans.
"bootblock.s"  and  "menu1.s"  are renamed to "bootblock.x" and "menu1.x" in
order to obtain the wanted source-code by cpp.

    Then let's patch.  At first,  you are necessary rename *.x to *.s.  Next
you will apply patch.

	# mv bootblok.s bootblok.x
	# mv menu1.s menu1.x
	# patch < mxpack.dif

I have applied these patch'es  to the Prentice-Hall-verion of Minix-1.5, and
if you are using the Minix-1.5 patched by the upgrade-diff's 1.3-->1.5  from
usenet (we call this "network-version"), patch may complain.  If so, you are
necessary manual-patches.

    Then,  please check CRC's of the patched files with CRCLIST contained in
the  package.  If you patch manually,  CRC may differ.  If  so please  check
*.dif and source until the confirmation of no-error.

    One more NOTICE to be checked  is  as follows;  there are definitions of
ram-size and key-scan-code  in  /usr/include/minix/boot.h  for defaults when
the  "menu"  is  skipped (HDisk-default-boot).   In such a case, those para-
meters will be used, defaults of them are

	#define DRAMSIZE	0
	#define DSCANCODE	13

The value of DRAMSIZE  may not lead trouble,  but you should pay _ATTENTION_
to the value of  DSCANCODE.  This value of  DSCANCODE  will be  given to the
initialize routine of the kernel  as a key_scan_code  when boot  from HDisk,
and  tty_initialize routine  sets  key_table according to this value.  Don't
forget to set this value CORRECTLLY according to your machine.  ---- I think
for  almost  all (compatible) machines,  including  J3100  series  (Japanese
version of T-series) this value  is  appropriate one,  but  I don't know all
machines.

    "Menu1.x"  has  a switch  named "QUIET",  which specifies  quiet booting
without displaying menu,  and  boots  Minix directly,  unless  the  operator
specifies otherwise by pressing SHIFT-KEY at booting.   If  you want  to see
this menu every time,  modify makefile  to delete  -DQUIET at the menu-part.
Skipping the menu will be made only when the machine is boot from HDisk.

Thus

	# make bootblok
	# make menu

will give you all-modules.



[6]	kernel reconfiguration
    At first  parepare new kernel which includes new bootblok and menu, then
make the directory to put it.

	# mkdir /system

then

	# make image

will make /system/minix.sys,  being all ready to boot-up Minix-1.5 by MXboot
and HDisk.  The partition where is /system/minix.sys should be the one where
MXboot is installed, I mean root.

    Next step is to wake-up MXboot, only one more step!



[7]	Awaking
    This  works to  wake-up  MXboot.  You may  hesitate  to exchange Initial
Program Loader of the HDisk.  If so, please try testing by floppy.  Preapare
initialized blank-diskette and umount /dev/fd0 (I mean, make free /dev/fd0),
then

	# make FDassist

will prompt you to insert the blank diskette to fd0,  to make test-diskette.
This diskette contains "FDassist" in the boot sector. When execute FDassist,
it reads partition table from the first HDisk,  and it acts like  boot  from
HDisk.

    If all OK at this stage,  put this FD into fd0 and logout by CTRL-D, and
reboot the machine.

	# CTRL-D
	<ctrl>+<alt>+<del>

    What happen?   You  will  see  no change  from  conventional  booting by
HD.   It's OK,   this is correct.   When  access-lamp of the FD  turns  OFF,
the machine will be booted from the OS, boot flag of which is ON.  Try again
rebooting by <CTRL>+<ALT>+<DEL>, but this time _PRESS_ shift-key while FD's-
access-lamp is ON.   You will  see  partition-table  and will be prompted as
"Which? ".  You will see a number after "Which? ",  showing  the  partition-
number where currently boot-flag is ON. If you press <Enter>, it is the same
action of booting without pressing <Shift>.

    If you specify the partition number from 1..4,  where you have installed
MXboot  and  made a /system/minix.sys file  and  press <Enter>, you will see
"Booting..." message,  and  "login: ".  If you have any difficulties,  check
the past process.

    Until this stage,  master-IPL of the HDisk  is NOT changed,  so be relax
trying.  You can stay here  to be familiar  to the assistIPL,  even  you may
stay here forever.



[8]	Exchange of master-IPL
    FDassist made at the stage [7]  is only a psuede process (for debugging)
and  it remains neccesities of floppy  to boot-up.  The final stage  for HD-
booting  is  at present.   Are you ready  to exchange master-IPL?   If  not,
please pass this step, or _ONLY_ read.



8.1	making assistIPL
    This is rather simple, 

	# make assistIPL

is all.  This makes assisstIPL to sector-0 of the HDisk, BUT....
At the sector-0, there is more important partition-table than IPL-code.  If
you break the table, you should cry-out!!!


8.2	modification of fdisk.c
    "x" command of fdisk  should be appended  in order to write assistIPL at
the sector-0 of the HDisk.   Prepare  original-fdisk.c,  and  patch it  then
compile as

	# patch < fdisk.dif
	# cc -i -o fdisk -D_MINIX -D_POSIX_SOURCE fdisk.c

Thus all are ready.


8.3	writing assistIPL to HDisk
    Start fdisk as usaul, for example,

	# fdisk -h12 -s35 /dev/hd0

You will see  the contents of the partition table,  and  select "x"-command,
then you will be asked  the file-name  to save current partition table.  You
cannot go further  until  you specify  the name of the file  to save.   When
saving is done,  you will be asked the file-name of the new-IPL-code.  Here,
type as "assistIPL'.  Finally, you will be asked to sort the partition table
or not.  If no-necessary, answer "n".

    Thus,  master-IPL of the HDisk  is changed remaining the partition table
unchanged.   Master-IPL  is  changed, but  real contents of the first sector
remains  unchanged,  I mean,  only changed  in the sector-buffer  within the
fdisk-program.   Real writing  will be done by the selection of "w"-command,
and if you have any hesitation to do, quit fdisk by "q",resulting no change.

    If you complete  writing by "w"-command,  assistIPL  will work  from the
next booting.

    This new IPL program  plays  the same acts  as  original MS-DOS's master
IPL, i.e.  if not specify any other,  pressing <Shift> at  the  initial boot
process,  you will boot from the OS, boot-flag of which is ON,  as  you have
experienced by FDassist.



[9]	difference between FDassist and assitIPL
    FDassist is prepared only for debugging, thus it will not write to HDisk
in  ANY CASES.   But assistIPL,  the final target,  will write back to HD to
modify boot partition table  to change active partition, if necessary.  This
is  for the system where some-OSs  cannot be booted  if the boot-flag of the
partition table is not ON.  For example, MS-DOS on Toshiba-J3100 system will
not boot unless the boot flag is ON.

    Detailed example is as follows;
	If you have set boot-flag for Minix-area is ON,  and automatic
	boot is set to Minix, and you select MS-DOS on a boot-menu, in
	Toshiba-J3100 series,  you  will  see the message "There is no
	boot-area", and not start MS-DOS.   Even I use the same MS-DOS
	on  Gateway2000-machine,  it occurs no such phenomenum. It may
	be due to the excessive _kindness_ of Toshiba!

    In these cases, write-back to the sector-0 will occur after selection of
boot-area.

    Thus,  assistIPL  has  two keys  to select starting boot.  One is normal
<Enter> key.  When you decide boot-partition by this <Enter> key, write-back
will not occur and control will be made by the loader of the OS.   The other
is <End> key  (in case of J3100, <End> and <Exec>  use the same key-switch).
If  you specify the partition to boot  by <End> key,  the partition table of
the sector-0  will be  modified, and, of course, the succeeding boot-up will
be made according to the area where boot-flag is ON.

    If you have hesitation to select <Enter> or <End>, then press <Enter> at
first,  and  if you fail to boot-up from selected OS,  try again  by  <End>.
Minix will be booted-up by <Enter> key.



[10]	additional feature of assistIPL
    This is only from my personal interest,  and  it residents  in the code-
area, where more space is needed, but...   Usually, IBM-PCs can boot-up only
from  the first HDisk Drive,  I mean,  you cannot boot-up  from  second HDD.
But if you use assisiIPL,  you can select  HDisk-Drive at the time of selec-
tion of the partition.

    You will see  that assistIPL  will accept "0"-th partition to boot up as
well as "1".."4".  If you have two-HDDrives, and you select "0"-th partition
at the selection-menu,  screen will  show the next HDD,  and you can boot-up
from the any partition of the SECOND-HDD. Almost all of other OSs may assume
the boot-up from the first Drive only,  thus  you may not be able to boot-up
other OSs, but you can boot-up Minix by MXboot. If you have no free-space to
boot(root) in the first drive, you can put it on the second HDDrive.

    HDD-number currently selected  will  be shown  in left-top of the screen
following  "HD#",  and the selection of "0"  toggles,  thus  you can  go and
return  from  first/second HDD  until  specify  boot-key (from  '1'  to  '4'
followed by <Enter>  or <End>).  This feature  has been tested  successfully
by k.h@mix on a J3300-Toshiba-desk-top machine.  Many thanks to him.


    Thus,  you  can selectively boot-up OSs  from HDisk  on  IBM-PC (and its
compatibles).  If you find any miss-feature, please feed-back to Minix board
on Nikkei-mix, if you have fix it,  I'll be appreciated,  for source-code is
available.   One more important note!  The code-size of the assistIPL should
NOT exceed 446-bytes, otherwise....



[11]	usage of MXboot		---- one more additional feature ----
    This MXboot  can specify  image-file  at  the boot-time besides the file
/system/minix.sys written on the code.

    If  you  select  boot-up partition  from assistIPL, and <Shift>+<Enter>,
assistIPL will prompt to give file name of boot-image file instead of trying
to find predefined /system/minix.sys file.  If you give it, it tries to find
it at the directories,  first / then /system, and if found, boot-up from it.
Thus,  you  can  select  kernel-image before booting. It  means  you  can be
enormousely convenient at the time of reconfiguration of the kernel.   It is
very playful feature, isn't it?  (^_^).

    I'll show the outline of the process of MXboot finding image-file.



[12]	acknowledgements
    Finally,  I would like to express  sincere thanks  to both k.h and saeko
@mix,  especially, the idea of selecting the kernel by giving the image-file
name before boot process is from saeko@mix, moderator of Minix-board of mix.
By this idea, usage of MXboot is considerablly made better.


-----------------------------------------------------------------------------
MXboot's process to find the image-file

			start
			  |
		  <Shift> is pressed?
		| yes			| no
	*1  prompts and wait	    Is there /system/minix.sys?
	    keyin of FName		|yes		|no
	  	|		     Boot!!	      goto *1
	     Is FName given?
	   | no		    |yes
      Is there		waits until FName is decided
    /system/minix.sys?		|
    | yes	|no	    Is there the file in /?
    Boot!!	Error		|yes		|no
			       Boot!	   Is there the file in /system?
					     |yes	|no
					   Boot!!     Error

Where,  [Boot!!]  means  reading the image file  and pass the control to the
entry  where build has written.   And  [Error]  means  there is a difficulty
to continue, and MXboot stops here requiring the user to reboot.

As  shown  in the figure,  image file should be placed in root-directory  or
/system directory,  other directories  cannot be specified.  The prompt will
be shown "mini.?>" which stands for  "mini-loader",  and at the place of "?"
version-number of the MXboot will be shown.   Current number is Ver0.7, thus
you will see "mini.7>".
