
LOADLIN and LOADLINX User Guide                                   94-08-27

============================================================================

   LOADLIN v1.5 (C) 1994 Hans Lermen (lermen@elserv.ffm.fgan.de)

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 2 of the License or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You may have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


============================================================================



      CONTENTS
      ========


1.    Why use LOADLIN or BOOTLIN (and not LILO) ?

2.    Why LOADLIN if you already have BOOTLIN ?

3.    How to use LOADLIN
3.1.  What you need
3.2.  Booting from the DOS prompt
3.2.1 Quick start
3.2.2 Quick help
3.2.3 Starting Linux from a batch file (LINUX.BAT)
3.2.4 Floppys and Ramdisks
3.2.5 System constraints
3.2.6 Patches for the kernel ?
3.3   Booting from CONFIG.SYS
3.3.1 Example of a CONFIG.SYS file
3.3.2 Constraints in CONFIG.SYS syntax

4.    The LOADLIN command line parameters
4.1   Maximum length of the command line

5.    If you have problems
5.1.  Example problem 1
5.2.  Example problem 2
5.3.  Confusion regarding device-file MINOR numbers
5.3.1 Changed device-file MAJOR number for /dev/xd
5.4.  Problems with some DOS memory managers and device drivers
5.4.1 Creating REALBIOS.INT
5.4.2 Using REALBIOS.INT
5.4.3 High loaded Drivers and high located data
5.4.4 Problems detecting V86
5.5.  Description of debug output (-v,-t,-d)

6.    The LOADLINX pre-processor for booting UMSDOS systems
6.1.  The LOADLINX command line

7.    Where to send comments and bug reports

8.    Contributions and Credits


                         --------- +++  --------



1.    Why use LOADLIN or BOOTLIN (and not LILO) ?
      ===========================================

      LOADLIN or BOOTLIN is the safest way to boot Linux (>0.99.14) from
      your hard disk.  Most Linux-newbees are too impatient to read the
      very good  but too long *)  documentation of LILO, and start using it
      incorrectly ... bang !!!   Goodbye DOS.

      (FDISK /MBR is not the Superman of disk repair.)


                              *) I must admit:
                                 the LOADLIN doc also is too long !

                         --------- +++  --------


2.    Why LOADLIN if you already have BOOTLIN ?
      =========================================

      BOOTLIN is clear and simple and very efficient.  The information found
      in the source code of BOOTLIN was the base for LOADLIN.

      LOADLIN, however, can pass a "command line" to the kernel to configure
      the behaviour of Linux (root device, video mode, drivers, etc.).
      It also accepts a parameter file (a file containing the command line
      parameters) so the 128-byte limit of the DOS command line ceases to be
      a problem.

      It may be that there is a newer version of BOOTLIN (from F.Coutant)
      somewhere on the internet, but I couldn't find it, so I wrote LOADLIN
      from scratch and added more testing for unusual situations.  LOADLIN
      is also capable of booting a UMSDOS-based system from a DOS drive (by
      using the LOADLINX pre-processor utility).

      Some options (-v, -t, -d) produce debug information, so if you have
      problems, you can follow what is really being done by LOADLIN.

      LOADLIN also can load out of Virtual-86 mode (which is normal when
      using EMS drivers) if a VCPI server is present.



                         --------- +++  --------



3.    How to use LOADLIN
      ==================

      NOTE:

      LOADLIN is a utility which starts a "logical reload" of your machine,
      causing DOS to be completely overlaid with Linux.  When you wish to
      return to DOS you must use the Linux "reboot" command.


3.1.  What you need
      -------------

      1. A 386 or higher CPU (of course!)
      2. Any compressed linux kernel image  ( >0.99.14).
      3. The  LODLIN15  package, which includes among other things:

          LOADLIN.EXE
          MANUAL.TXT (this file)
          Example parameters file, TEST.PAR
          PARAMS.DOC

         The following you may need or not:
          LOADLINX.EXE
          BIOSINTV.SYS
          REALBIOS.EXE
          BOOTSECT.BIN



3.2.  Booting from the DOS prompt
      ---------------------------

3.2.1 Quick start
      -----------

      For the rest of this documentation I will assume that you have
      unpacked  LODLIN15.TGZ  into the directory  C:\LOADLIN.

      Starting with version 1.5 all configuration steps, that where
      necessary for 1.4 and below are now superfluous on allmost all machines.
      A very clever guy in Spain, Javier Achirica, invented a method
      to intercept the Linux setup code just before protected mode
      transition. I call it the "Javier method" and it is enabled
      if no configuration is done.

      At the DOS prompt you can type, for example:

         C:> CD \LOADLIN
         C:\LOADLIN> LOADLIN zimage /dev/hdb1 ro vga=extended

         NOTE: Veteran LOADLIN users should use the -ja switch to disable
               their BIOSINTV/REALBIOS or remove them:

               C:\LOADLIN> LOADLIN zimage -ja /dev/hdb1 ro vga=extended

      or, if you have more parameters than will fit into the 128-byte
      DOS command line:

         C:\LOADLIN> LOADLIN @params

      An example params file is "test.par".    Please read it.
      Currently the parameters file is not supported by LOADLINX.

      A detailed collection (extracted from kernel sources) of all current
      command line parameters can be found in the file  PARAMS.DOC



3.2.2 Quick help
      ----------

      You can get online help and configuration analysis by typing:

         C:\LOADLIN> loadlin <enter>

      or, perhaps a bit more helpful:

         C:\LOADLIN> loadlin | more <enter>


      You then get an output like this (from my machine) ....

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      LOADLIN v1.5 (C) 1994 Hans Lermen (lermen@elserv.ffm.fgan.de)

      USAGE:
        LOADLIN @params
        LOADLIN [zimage_file] [options] [boot_params]
          without any params, LOADLIN displays this help message.
          @params:
             params is a DOS file containing all other options
          zimage_file:
             DOS file name of compressed Linux kernel image
          options:
             -v        verbose, show information on params and configuration
             -t        test mode, do all but starting Linux, also sets -v
             -d file   debug mode, same as -t, but duplicates output to "file"
                       (for -v, -t, -d please see 5.5)
             -rb       search for REALBIOS before BIOSINTV
             -rx       don't check REALBIOS' ROM-date
                       (for -rb, -rx please see 5.4.2)
             -ja       use Javier's method, disable BIOSINTV and REALBIOS.
                       (please see 5.4)
             -clone    use alternate CPU-check, assume we have a 486 clone
                       (please see 5.4.4)
             -oldxd    use old /dev/xda,xdb numbering 0xC00,0xC40,
                       newer kernels ( >= 1.1.0 ) have 0xD00,0xD40.
                       (please see 5.3.1)
             -n        no translation for root=...  (goes into command_line)
                       (please see 5.3)
          boot_params:
             root=xxx  filesystem to be mounted by Linux as "/"
                  xxx = hex number (e.g. root=201 for /dev/fd1)
                      = /dev/mmmn (e.g. root=/dev/hda2)
                             mmm = fd,hda,hdb,sda,sdb...
                             n   = 1..10.. decimal
                             n   = 01..0a.. or 0x1..0xa.. or a..f hexnumber
                       (please see 5.3)
             ro        mount "/" readonly
             rw        mount "/" read/write
             ramdisk=x install ramdisk of size x Kbytes.  If also root=/dev/fdx,
                       then LOADLIN prompts for a floppy (copied into ramdisk)
                       (please see 3.2.4)
             vga=xxx   vga mode (e.g. -3..0.., ask, normal, extended)
             (for more boot params see file PARAMS.DOC)

      Your current DOS/CPU configuration is:
        load buffer size:   0x775F0   setup buffer size:   0x1000
        total memory:     0x0FE0000
        CPU is in V86 mode
        BIOSINTV.SYS:   NO
        SetupIntercept: YES, patching setup code
        stat4: VCPI_present, physmap=logmap, all OK for switch to realmode
        input params size 0x0000
        input params:

        LOADLIN started from DOS-prompt

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      NOTE: All LOADLIN options (such as -t,... ) MUST come before
            the Linux command_line params


3.2.3 Starting linux from a batch file (LINUX.BAT)
      --------------------------------------------

      Most DOS users have disk caching (e.g. SMARTDRV) activated.
      If "write-behind" caching is supported by the cache program,
      then any unwritten cache buffers MUST be flushed before
      LOADLIN is called.

      Example:

       C\LOADLIN> smartdrv /C    do this to "sync" your disk (usually not
                                  needed for DOS 6.2, but it doesn't hurt)
       C\LOADLIN> loadlin ....


      It would be much smarter to use a batch file something like this:

      +-------------------- start of LINUX.BAT
      |
      |  SMARTDRV /C
      |  C:\LOADLIN\LOADLIN C:\LOADLIN\ZIMAGE root=/dev/hdb2 ro vga=3
      |
      +-------------------- end of LINUX.BAT


      So you could simply type:

       C> linux

      ... and you are on the road!

      A sample LINUX.BAT file is provided with the LOADLIN package.



3.2.4 Floppys and Ramdisks
      --------------------

      If LOADLIN encounters  ramdisk=xxxx  together with  root=/dev/fdx
      it loads the kernel image into memory, but before starting up
      Linux it prompts for insertion of the root floppy.

      This enables you to boot DOS (and start LOADLIN) from the same
      floppy drive as the root disk.

      Of course, this is a two-floppy boot, but with Linux becoming
      bigger and bigger there will be no room on the root floppy to
      hold both the kernel image and the root filesystem.  With
      LOADLIN there is no need for any fancy tricks to install a
      distribution when your drive configuration doesn't match that
      of the distribution.

      Examples:

        LST 1.07 distribution comes only with a 3.5 inch floppy
        but your drive A: is 5.25 inch.

        Slackware 2.0.0 has a big directory tree with lots of possible
        drive constellations.  With LOADLIN you need only the image disk
        and an appropriate root disk.
        Bwt.: LOADLIN is distributed together with Slackware and will be
        automatically added if installing UMSDOS.


3.2.5 System constraints
      ------------------

      1. There must be enough memory to load the compressed kernel image
         (between the start of LOADLIN and 090000h).

         The field "load buffer size" of the LOADLIN verbose output
         tells you what you really have.

         The setup program and LOADLIN itself go into 090000h ... 09A000h,
         therefor you MUST have 640 K byte of base memory.
         Starting with Linux 1.1.43 the setup program does no longer
         fit into 2 K, so it is made of variable size and will grow
         over the time. Currently (1.1.47) setup is 5 * 512 bytes
         long and the setup buffer of LOADLIN has 31 * 512 bytes,
         so this will work for a long time.

         The field "setup buffer size" of the LOADLIN verbose output
         tells you what you really have.

         The 20 K byte remaining memory on top of the 640 K are
         hopefully enough for BIOS- and highloaded driver-data.



      2. DOS programs can be executed only in the so-called real mode
         (or on >386 in virtual-86 mode (V86)).

         Linux, however, runs in protected mode, and the kernel must be
         able to enter privilege level 0 (P0, supervisor mode).  However,
         from V86 it is impossible to switch to protected mode P0 if the
         V86 server does not allow this (as is the case with DPMI).

         Therefore:
         - You must be in 86 real mode (no EMS driver, no WINDOWS, ...).
             or
         - You must have the VCPI server enabled in your EMS driver (still
           not running WINDOWS, however).
           Using EMM386 please avoid the NOVCI-option, but NOEMS doesn't hurt.

         VCPI allows P0 and is supported by most EMS drivers (if EMS is
         enabled), but never under MS-WINDOWS (MICROSOFT doesn't like P0
         for users).

         Physical-to-Virtual memory mapping must be identical for the first
         640K of RAM, which is a given under normal conditions but which
         also can be forced, typically by an EMS driver option like:

           EXCLUDE=1000-A000     (for 386MAX)
             or
           B=A000                (for EMM386.EXE, but normally not needed).


         Check the manual for your EMS driver for details.
         Don't worry, if something is missing LOADLIN will tell you.

         NOTE:

         May be that your VCPI server does garbage collection before
         entering protected mode, so please BE PATIENT, especially
         on systems with many mega bytes !

      3. Of course you must not execute LOADLIN out of Linux DOSEMU !
         If you do it, fortunately DOSEMU terminates due to the
         V86 check instructions (changing IOPL) with general protection fault.
         So your file systems remain intact.
         However, in case of starting LOADLIN out of a DOS prompt in
         WINDOWS 3.0 running under Linux DOSEMU ( .. grrrr..),
         ... I don't know what happens to your DOS-FAT.



3.2.6 Patches for the kernel ?
      ------------------------

      At this time (Linux-1.1.47) there are no special patches needed
      to use LOADLIN. Starting with LOADLIN-1.5 we normally
      don't need all that configuration stuff, that was needed prior
      to 1.5. (see 3.2.1 and also 5.4.).

      We work around the problems we had with resident drivers and V86 mode.
      But we need to intercept the Linux setup program just before
      transition to protected mode. For the current kernels we can
      scan the setup code at runtime and will find the exact location.
      It works, but it's a dirty hack! A clean and proper solution would
      be to put the interception mechanism into the setup program itself,
      i.e. let the setup program support LOADLIN.

      In the directory LOADLIN\KERNEL there are some patches for setup.S
      fitting in the last used kernels. I will send the patches to Linus,
      and hopefully he puts them into the official kernel.
      Until this happens you can apply the patches yourself, but you
      need not until you use a kernel > 1.1.47, which doesn't boot
      with LOADLIN.

      For you convenience you would like to apply the initmain.dif patch,
      which lets Linux print the actually recieved commandline params.



3.3   Booting from CONFIG.SYS
      -----------------------

      Starting with DOS version 6.0 it is possible to boot different
      configurations during the startup of MSDOS. This is handled at the
      time of CONFIG.SYS interpretation.  Therefore this is often a good
      place to put the LOADLIN/LOADLINX/Linux stuff.

      Even if you have decided to boot DOS, you can boot Linux later,
      either from the DOS command line or from a batch file.



3.3.1 Example of a CONFIG.SYS file
      ----------------------------

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      rem If you use BIOSINTV.SYS, put it at the TOP !!! (before [MENU])
      rem    DEVICE=C:\LOADLIN\BIOSINTV.SYS
      rem but in most cases you won't need it

      SWITCHES=/F


      [MENU]
      menuitem=DOS, DOS boot
      menuitem=LINUX_1, LINUX boot (SLS 1.03)
      menuitem=LINUX_2, LINUX boot (Slackware, LST)
      menuitem=LINUX_3, LINUX boot (UMSDOS, with C: as DBLSPACE'd drive)
      menuitem=LINUX_4, LINUX boot from 3.5 inch floppy B:
      menuitem=LINUX_5, LINUX boot (Slackware, high partition number)
      menuitem=LINUX_6, Create a dump file for bug report


      [DOS]
      device=c:\dos\himem.sys
      device=c:\dos\emm386.exe 2048 ram
      DOS=HIGH,UMB
      SHELL=C:\COMMAND.COM C:\ /e:1024 /p
      ...   etc.,  etc.,  etc.


      [LINUX_1]
      shell=c:\loadlin\loadlin.exe c:\loadlin\zimage vga=ask root=/dev/hdb3


      [LINUX_2]
      shell=c:\loadlin\loadlin.exe c:\loadlin\zimage vga=-3 root=/dev/hdb2 ro


      [LINUX_3]
      rem  The UMSDOS filesystem is on NON-compressed drive D: (/dev/hdb1)
      device=c:\dos\dblspace.sys
      rem                     v----- we are using LOADLINX preprocessor
      shell=c:\loadlin\loadlinX.exe d:\linux\zimage.{15 root=D: vga=ask
      rem  This is a UMSDOS filename ---------------^^^      |
      rem  This will be translated to root=/dev/... ---------+

      [LINUX_4]
      shell=c:\loadlin\loadlin.exe c:\loadlin\zimage root=/dev/fd1 ramdisk=1440


      [LINUX_5]
      shell=c:\loadlin\loadlin.exe c:\loadlin\zimage root=/dev/hdb10
      rem  NOTE: the partition number is decimal 10 (not 16, as the kernel would
      rem        decode).  LOADLIN translates this to avoid conflicts with
      rem        existing device names and MINOR numbers in /dev of Slackware
      rem        distribution.


      [LINUX_6]
      shell=c:\loadlin\loadlin.exe c:\loadlin\zimage -d c:\dump.txt root=/dev/fd1 ramdisk=1440
      rem                                            ^^^^^^^^^^^^^^
      rem  This writes debug information to a file ---------^
      rem  All is set up as usual, but Linux is not loaded and LOADLIN idles.
      rem  CAUTION: Don't do this if you haven't a [MENU] in CONFIG.SYS,
      rem           because you then need a DOS System floppy to boot normally.


      [COMMON]
      rem   Here we put any other "common" configuration stuff ....

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



3.3.2 Constraints in CONFIG.SYS syntax
      --------------------------------

      1. All parameters on the "shell=" lines are converted to uppercase
         by DOS, but Linux parameters are case sensitive. LOADLIN converts
         the following parameters back to lowercase:

           mem=...
           no387
           single
           auto
           debug
           no-hlt
           reserve=...
           hd=...
           xd=...
           bmouse=...
           max_scsi_luns=


         The following parameters are not put onto the commandline, but
         converted to numeric values for the boot sector:

           vga=...
           ramdisk=
           ro
           rw

         If the -n switch is NOT set, this applies also for:
           root=...


      2. You can bypass the uppercase/lowercase problem by using a parameter
         file.   An example  CONFIG.SYS  line would be:

         [LINUX]
         shell=c:\loadlin\loadlin.exe @c:\loadlin\params


         An example parameter file is "test.par".  Please read it.
         Currently the parameter file is not supported by LOADLINX
         for UMSDOS systems.


                         --------- +++  --------




4.    The LOADLIN command line parameters
      ===================================

      Note that if you use a parameters file (for example  @TEST.PAR),
      this must be the FIRST parameter you use on the LOADLIN command
      line.  Other parameters, including the name of the zImage file,
      are contained within the parameters file.

      When Linux boots it gets a runstring passed from setup
      (the program that checks the basic hardware configuration
      and puts the machine into protected mode ). This string, the
      command line, is then checked for some well known compiled-in
      keywords.  Some are used to change kernel variables (such as
      mem=, root=, ro, rw, no387), some are passed to the device
      drivers (such as ether=, hd=, sound=) and some (such as single
      and auto) are passed as options to /etc/init (or /bin/init or
      /sbin/init, whatever is found first).

      See the file "PARAMS.DOC" for details.

      Any unknown keywords of format "keyword=value" are placed in
      "envp_init", which is also passed to /etc/init.  This environment
      string can be checked in /etc/rc* (/etc/rc.d/rc.*).

      For example, the command "set >/etc/boot_env_string" in  rc.local
      will place the contents of  envp_init  into a file which can then
      be accessed by other processes.  Don't put this command in any  rc
      file which gets executed before the filesystem is mounted r/w !



4.1   Maximum length of the command line
      ----------------------------------

      The length of a DOS command line can be 127 bytes (including
      the program name).  With a params file (@param, see 3.2.2)
      the length of the string passed to the kernel can in theory be
      2047 bytes, but the string is held in a temporary place and must
      be copied by the kernel to a save static buffer in init/main.
      This forces the maximum length to a compiled-in constant.

      In kernel versions below Linux 1.0.5 there is a small problem
      (in init/main.c).  The static buffer in  main.c  is only 80 bytes.
      LOADLIN compacts the parameters, but too many parameters may cause
      the kernel to hang at boot time, because the length is not checked.

      Starting with Linux 1.0.5, "command_line[]" is set according to the
      def COMMAND_LINE_SIZE 256.  The incoming command line is also checked
      for size. If you need a greater size, you can simply change
      COMMAND_LINE_SIZE in init/main.c.




                         --------- +++  --------



5.    If you have problems
      ====================

      I received some feedback re version 1.2 which lead to version 1.3
      and more extensive error checking.  Some bugs were also found and
      fixed.  However, with the thousands of possible hardware/software
      configurations of a PC, a program can never be totally bug-free.
      So please, I need your feedback regarding problems you encounter.

      If you recognize a bug, please don't work around it, mail it to me !

      But, if you report a problem, I need information!  Something like
      "My screen always displays in blue, what is wrong?"  is not enough.

      LOADLIN can produce information for me (and for you) if you use
      the -d or -t switch.



5.1.  Example problem 1
      -----------------

        C:\LOADLIN>loadlin zimage /dev/sda1 ro

      The kernel loads (LOADING.......), but Linux "panics" with the message
      "unable to read superblock".    You have to hard-reset your machine.

      To check what was wrong you can type:

        C:\LOADLIN>loadlin zimage -t /dev/sda1 ro
                                  --

      LOADLIN now does all the same things, but doesn't actually start Linux.
      It displays:

        Your current LINUX kernel boot configuration is:
          image file:       zimage
          kernel size:     0x4D010
          ram disk size:    0x0000
          root device:      0x0342  read only
          VGA mode:         0xFFFF
          command line size 0x001B
          command line:
            /dev/sda1 BOOT_IMAGE=zimage
          ..
          ..
          ..

      Looking at the field "root device", you can see that it is NOT the
      MAJOR+MINOR of /dev/sda1, but you did use "/dev/sda1" as the root disk
      parameter in the boot command line.  The error is clear, you forgot
      the "root=" in front of "/dev/sda1".  (Alternatively, you could use
      rdev to alter the root device flag in the zimage file.)



5.2.  Example problem 2
      -----------------

        C:\LOADLIN>loadlin zimage root=/dev/sda1 ro mem=0xFF0000

      The kernel loads (LOADING.......), but Linux "panics" with the message
      "<2M Ram   system halted".    You have to hard-reset your machine.

      To check what was wrong you can type:

        C:\LOADLIN>loadlin zimage -d report.dmp root=/dev/sda1 ro mem=0xFF0000
                                  -------------

       and get the output on-screen (and in the file report.dmp):

        Your current LINUX kernel boot configuration is:
          ..
          ..
          command line:
            BOOT_IMAGE=zimage

        Your current DOS/CPU configuration is:
          ..
          ..
          total memory:     0x01E0000
          ..
          ..


      This could be a bug in LOADLIN, because "mem=0xFF0000" should have
      appeared in "command line" in front of "BOOT_IMAGE=zimage".

      You should mail me a description of what has happened, including the
      file "report.dmp" and the contents of your CONFIG.SYS so I can check
      what is wrong.

      NOTE:

      Under certain conditions (but not with Javiers's method) INT15 is used
      to report the memory size, but it can be intercepted by some TSRs
      or drivers (e.g. HIMEM.SYS).
      With the "mem=0xFF0000" option however, you can solve the problem.
      When Linux has been loaded and uncompressed successfully,
      nothing in DOS (or the BIOS) is used from that point forward.



5.3.  Confusion regarding device-file MINOR numbers
      ---------------------------------------------

      The following illustrates the problem with numbering conventions
      for device-file MINOR numbers:

      With version 1.2 of LOADLIN, I got the following bug report:

       "SHELL=c:\loadlin\loadlin.exe c:\loadlin\zimage root=/dev/hda10
        does load, but panics with 'unable to read superblock'"

      The problem is:

      Linus interprets the number following "/dev/hda" as a HEX number,
      the device names in /dev of the Slackware distribution 1.2.x however
      (not Slackware 2.0.0), are numbered /dev/hda1 .. hda9 .. hda10 .. hda16,
      instead of  /dev/hda1 .. hda9 .. hdaa .. hdaf, as Linus would have done.

      So, starting with version 1.3 of LOADLIN, I interpret the root device
      myself and pass the device numerically in the boot-sector.  My
      naming convention is a compromise, which I hope will result in less
      confusion:

      If the digit appended to "/dev/hda, hdb, sda ..."  starts with  0, 0x
      or  a..f, it is interpreted as a HEX number.  (Examples:  /dev/hdaa
      /dev/sda0xE, /dev/hdb0c)

      If it starts with 1..9 it is interpreted as a decimal number.

      If none is appropriate the string is passed to the command line
      (some later kernel versions may have other device names).

      NOTE: you can switch off the above translation with the -n switch
            the root=/dev .... is then put unchanged into the command_line.
            Actually it does both, translates and put into command_line, but
            Linux will overwrite the LOADLIN-translation, and LOADLIN has
            a chance to check for know numbers.
            This option is intended for future Linux devellopement,
            if Linus expands the root device list, you can use these
            new device with your then not uptodate LOADLIN.

5.3.1 Changed device-file MAJOR number for /dev/xd
      ---------------------------------------------

      Newer kernel have changed the MAJOR number of /dev/xd to 13.
      Because the root device is translated within LOADLIN, you get
      in trouble when loading older kernels. In this case
      set the -oldxd switch to use old numbering (12).
      If you have applied the setup.S patches, LOADLIN will do this
      automatically for you.


5.4.  Problems with some DOS memory managers and device drivers
      ----------------------------------------------------------


      When LOADLIN has loaded the kernel image, and before it jumps to
      Linux, it must either

        a) have the possibility (using Javier's method) to
           intercept the setup-code of Linux just before Linux wants to move
           down the image and switch to protected mode,
        b) or restore the interrupt vector (and eventually some BIOS data)
           to simulate a "boot time" state.

      For a) you need a kernel version greater 0.99.14, better have the
      setup.dif patches applied (I will send the patches to Linus, and
      hopefully he puts them into the official kernel).
      You should always try Javier's method first, I'm sure, it will work
      on almost all machines and configurations. Using it you need not to do
      any prior configuration for DOS, I'm repeating this here specially for
      users of older LOADLIN versions:

         For Javier's method you must remove BIOSINTV/REALBIOS from your
         configuration or use the -ja switch of LOADLIN !


      If you don't succeed with Javier's method, then you can try b).
      For b) I recommend that you put the following line AT THE TOP of
         your CONFIG.SYS:

            DEVICE=C:\LOADLIN\BIOSINTV.SYS

         This driver saves default BIOS values for the interrupt vector.
         It is approx.700 bytes, so it won't use too much low memory.
         BIOSINTV.SYS must NOT be loaded high by any memory manager!

         If any TSRs or drivers intercept INT15, Linux can get the
         wrong total available memory reported.
         Some DOS memory managers (like QEMM) will cause this problem
         when using what is commonly called "Stealth" techniques.

         If this happens, you can then put  mem=xxxx  in the LOADLIN
         command line, where xxxx is the total size of memory in bytes.
         (NOTE: the motherboard BIOS may have mapped some 128Kb for
                Shadow RAM).


         The field "total memory" of the LOADLIN verbose output will
         tell you what Linux would see as total RAM available.


      My simple method (using BIOSINTV.SYS) gets an interrupt table that is
      slightly modified by DOS (i.e. it is NOT the *real* original), but it
      works for almost all configurations. It doesn't require changing the
      BIOS data/scratch areas, because they are mostly consistent with the
      interrupt vector.  You should try the BIOSINTV method prior to the
      REALBIOS method.

      I have had problems reported with the use of DOS memory managers (QEMM,
      for example) which apparently hook some vectors or access data which is
      no longer available when LOADLIN re-enters real mode.

      As an alternative to the BIOSINTV method, I introduced with version 1.4
      the REALBIOS method, which consists of:

         The REALBIOS.EXE utility
         BOOTSECT.BIN
         The file REALBIOS.INT, which REALBIOS creates on your machine.

      Alessandro Rubini (rubini@ipvvis.unipv.it) wrote BOOTSECT.BIN (which
      contains code from bootsect.S by Linus Torvalds).

      His way (used in his package linuxEXE ) of getting the *real* original
      BIOS interrupt vector is the safest way.  All other solutions are too
      tricky.  I added saving of BIOS data/scratch, PIC-IMR and TOP-ROM, but
      it remains essentially Alessandro's technique.

      If, and only if, you don't succeed with Javier's method or the BIOSINTV
      method, try the REALBIOS method instead as a last resort.

      But NOTE:
      --------
      !  The  C:\REALBIOS.INT  file created by the REALBIOS method is unique
      !  to the machine on which it is generated!  It must be in C:\ .
      !
      !  Do NOT DISTRIBUTE it to your friends (distribute only "lodlin14.tgz").
      !  Do NOT COPY it from your friend's machine.
      !  Do NOT SHARE it (e.g. via NFS).
      !  Rebuild the file if you make ANY hardware changes to your machine
      !   (such as adding/removing an adapter card, adding/removing RAM or
      !    changing an IRQ or I/O address).
      !  Use it only on the machine it is generated on!
         ----------------------------------------------



      BTW:
      I guess that on a PS2 you may have problems with the extended BIOS data.

      Sorry, but I have no way of testing it.



5.4.1 Creating REALBIOS.INT
      ---------------------

      - At the DOS prompt type:

          C:> CD \LOADLIN
          C:\LOADLIN> REALBIOS


      - You then get the following output:

          Generation of the file C:\REALBIOS.INT (for the REALBIOS method)
          consists of TWO steps:

            1. Generating the special boot floppy and booting with it.

            2. Reading the saved interrupt table and BIOS data from the floppy
               and writing it to C:\REALBIOS.INT

          Type 1 or 2, (depending on which step you are in) or any other key
          to cancel:


      - Because you are doing the first step you must type a "1", which gets
        you the following output:

          OK, we first generate the floppy !
          Insert an empty but DOS-formatted disk into drive A:
          (no matter what DOS format it is)

          Type C to continue or any other key to cancel


      - You insert the floppy, type "C" and get the following output:

          OK, The special boot floppy has been generated.
          Leave it inserted in drive A: and reboot your machine
            But NOTE:
            If you have a disk cache program (like SMARTDRV)
            you may need to flush the write-behind cache first!


      - You press the reset button, or do the "3-finger salute", and your
        machine then boots from the floppy.  The boot loader then saves
        all needed BIOS intvectors and data onto the floppy.  Finally the
        machine will display the following:

          Interrupt table and BIOS-data saved on floppy.
          Open the floppy door and reboot from your hard drive,
          then run REALBIOS again (step 2).


      - Now you open the floppy door (to avoid booting from the floppy),
        reboot, and re-enter the LOADLIN directory.  Then you type:

          C:\LOADLIN> REALBIOS

      - You now answer with a "2", (because you are running step 2) and
        get the following output:

          OK, we now read the saved interrupt vector from the floppy
          and save it to the file C:\REALBIOS.INT (no way to change the name!)
          Is the floppy (used in step 1) inserted in drive A: ?

          Type Y to continue or any other key to cancel

      - Re-insert the floppy into drive A.  If you then type Y the file
        C:\REALBIOS.INT  will be created from the data on the floppy.
        If anything goes wrong, REALBIOS will let you know.



5.4.2 Using REALBIOS.INT
      ------------------

      The file  C:\REALBIOS.INT  will be a "HIDDEN+SYSTEM" file to avoid
      distribution to other machines. (you can't see it with DIR)

      LOADLIN first searches for BIOSINTV.SYS and then for REALBIOS.INT.
      You can reverse this order by using the "-rb" switch.

      LOADLIN checks the ROM-BIOS-DATE saved in REALBIOS.INT and, if there
      is a mismatch, it switches to "-t" verbose mode.  Some DOS memory
      managers, however, remap the top page of the ROM-BIOS to intercept
      a warm-boot, and do not supply the correct ROM-BIOS-DATE.  LOADLIN
      then fails because it checks this date before going into real mode.

      In this case you can use the "-rx" switch to skip the check.


      NOTE:
      ----

       - C:\REALBIOS.INT is marked HIDDEN+SYSTEM to avoid distribution.
         It must reside in C:\  even if the C: drive is compressed.

       - The floppy used above is rendered unusable for DOS, so you must
         fully format it again (not just a "quick" format).

       - Whenever you add, remove or reconfigure any hardware you MUST
                      ---  ------    ----------- ---
         rerun REALBIOS !  (This is the reason I prefer Javier's method.)
         ----- --------

5.4.3 High loaded Drivers and high located data
      -----------------------------------------

      With version 1.5 the problem of high loaded DOS drivers comes
      to a minimum (I guess there isn't any at all). But keep in
      mind that, when using BIOSINTV/REALBIOS, LOADLIN will behave as
      if in version 1.4. And then you *will* come into the problem:

      After back switch to real mode all mapped memory above 0A0000h
      will dissapear, so, with BIOSINTV/REALBIOS do NOT load high
      any device driver ( DEVICEHIGH=..., LOADHI..., LH...).

      NOTE: Many installation programs for DOS drivers (such as
      the Drive Rocket Data Accelerator by Ontrack) are loading high
      by default !

      Also there mustn't be any relevant data from 090000h to 09BFFFFh
      because this is the place where setup and LOADLIN must go.
      This is true also for version 1.5, you will be warned, however,
      if this happens, and  normally the remaining space of 20 K byte
      at the top of the 640 K base memory is only occupied by 1 K byte
      BIOS scratch.


5.4.4 Problems detecting V86
      ----------------------

      On some 486 clones we have problems with CR0 while probing for V86 mode.
      (as reported by Jacek Zapala zapala@if.pw.edu.pl ).
      It can happen that the CPU is in realmode, but PAGING is enabled !
      This is possible, but neither documented nor supported by INTEL.
      May be the motherboard's BIOS is mapping shadow ram this way,
      or one of those old and strange EMM managers is used,
      but probably this is an indication of a not exactly compatible
      486 clone. The -clone switch byepasses the CR0 check and assumes
      V86 if an EMM manger is found.
      But of course this EMM manager must not use real paging !



5.5.  Description of debug output (-v,-t,-d)
      --------------------------------------

      The ouput produced by the -v, -t or -d options occurs at the point at
      which the boot sector and setup are loaded and updated by LOADLIN.
      The information is that seen by Linux, but in the case of -t and -d,
      the zimage file is not loaded and linux is not started.

      Description:

      Your current LINUX kernel boot configuration is:
        image file:       d:\tmp\1-1-47.0     <- filename of kernel image
        kernel size:     0x5BFF0              setup size:  0x0A00
                         ^                    ^- size of setup in bytes
                         |---------------------- size of kernel in bytes
        kernel version:   1.1.47 (root@el15) #4 Mon Aug 00:57:07 MET DST 1994
                          ^---- this only if setup.S has the LOADLIN patches
        ram disk size:    0x0000              <- 0 = none, else size in Kbytes
        root device:      0x0342  read/write  <- MAJOR+MINOR of root device
        VGA mode:         0xFFFF              <- video mode at startup
        command line size 0x0011              <- size of compacted command line
        command line:                         <- contents of command_line as
          BOOT_IMAGE=zimage                       seen by Linux

      Your current DOS/CPU configuration is:
        load buffer size:   0x775F0   setup buffer size:   0x1000
                         ^                    ^- size of buffer in bytes which
                         |                       holds the setup code.
                         |                       must be >= "setup size"
                         |---------------------- size of buffer in bytes which
                                                 holds the uncompressed image
                                                 Must be > "kernel size"
        total memory:     0x0FE0000           <- highest RAM address as seen
                                                  by Linux, calculated from the
                                                  INT15 information
        CPU is in V86 mode                    <- if in Virtual-86 mode
      or
        CPU is in REAL mode
      or
        CPU is in undocumented REAL PAGING mode, trying any way


        BIOSINTV.SYS:  YES                    <- YES, if $BIOSINT was
      or                                          read successfully.
        REALBIOS:      YES
      or
        REALBIOS:      YES, but ROM-BIOS-DATE differs, must rerun REALBIOS.EXE

        SetupIntercept: NO                    <- using LOADLIN-1.4 mode
      or
        SetupIntercept: YES, patching setup code  <- using Javier's method
      or
        SetupIntercept: YES, legal intercept      <- dito, but legal Setup
                                                     (compiled in patches)


      One of four possible status messages may appear here:

        stat1: cpu in real 386 mode
        stat2: cpu_V86, but no VCPI available (check aborted)
        stat3: VCPI_present, but physmap != logmap (check aborted)
        stat4: VCPI_present, physmap=logmap, all OK for switch to realmode


      The following may come from the DOS command line or from the params file:

        input params size 0x000D              <- size of DOS command line
                                                  (or compacted params file)
        input params:                         <- contents of DOS command line
          ..\zimage -t


      Some additional information and/or warnings can follow:

        LOADLIN started from DOS-prompt       <- one of these two Lines
           "       "     "   CONFIG.SYS       <- (LOADLIN assumes the environ.
                                                  has a  COMSPEC=  for DOS)

        You are running under MS-WINDOWS      <- this warning, if in WINDOWS.
                                                 (LOADLIN assumes the environ.
                                                  has a  WINDIR=  for WINDOWS)



                         --------- +++  --------




6.    The LOADLINX pre-processor for booting UMSDOS systems
      =====================================================


      This program is used as a "pre-processor" for the LOADLIN utility.
      It does translation of DOS-ish drive numbering (C:, D:, etc.) to
      the equivalent Linux device names (/dev/....).

      In addition to "root=X:" LOADLINX accepts the same parameters as
      LOADLIN and passes them to it.
      It even can (opposite to LOADLIN) preset params from a @params-file
      and then overwrite some of them during actual call.
      (e.g. "loadlinX zImage @default vga=3" works for loadlinX, but
      not for loadlin).
      With this feature it confortable to use loalinX, even if not using
      UMSDOS.

      LOADLINX can even be executed via a  shell=  in your CONFIG.SYS,
      but it MUST reside in the same directory where LOADLIN is located.

      Jacques Gelinas (jacques@solucorp.qc.ca) is the author of the trans-
      lation algorithm (I just implemented and enhanced it for LOADLIN,
      and adapted it to the exact behavior of DOS).

      It is intended for UMSDOS users only, since others do not use a
      DOS partition for "root".

      It is restricted to systems with either all AT-type (IDE) drives
      or a maximum of two SCSI drives using the SCSI adapter card's
      own BIOS under DOS (e.g. must be accessable via INT13).
      Mixed use of IDE and SCSI is not (yet) supported.
      Nevertheless, you can bypass LOADLINX for other configurations and
      determine the  root=/dev/xxxx  yourself.


6.1.  The LOADLINX command line
      -------------------------

      Usage:

        LOADLINX [--dv]  LOADLIN_command_line

           --dv               debug verbose; doesn't exec LOADLIN
           --version          print the version string from the zimage
                              (needs the setup.S patch).
           --version=-1.0.9   Checks for correct kernel version <= 1.0.9
           --version=1.1.47   Checks for correct kernel version >= 1.1.47
           --version=1.1.47#2 Checks for correct kernel version >= 1.1.47 () #2


      Examples:

        LOADLINX zimage.ums root=D: vga=ask

        (NOTE: You must never use the "ro" option because UMSDOS needs
               to mount its root filesystem r/w at boot time.)


        LOADLINX zimage_1.147 @test.par root=/dev/hdb2 --version=1.1.47#2

        (NOTE: This will take all params from the file test.par, then
               replace the image name, the root device and check for version.

      It would be much smarter to use a batch file something like this:

      +-------------------- start of LINUX.BAT
      |
      |  SMARTDRV /C
      |  C:\LOADLIN\LOADLINX C:\LOADLIN\ZIMAGE root=C: vga=3
      |
      +-------------------- end of LINUX.BAT


      So you could simply type:

       C> linux

       .... and be on your way.




                         --------- +++  --------



7.    Where to send comments and bug reports
      ======================================

      Comments and bug reports are welcome and may be sent to:

      E-Mail:    lermen@elserv.ffm.fgan.de

      SnailMail: Hans Lermen
                 Am Muehlenweg 38
                 D53424 REMAGEN-Unkelbach
                 GERMANY


      ... and PLEASE, PLEASE, PLEASE:
          Check your "Reply to" path for a valid E-Mail address,
          I get many "bounced" mails back ! It's not a fun having
          answered your mail for the trash.

                         --------- +++  --------



8.    Contributions and Credits
      =========================

      This program could not have been written as quickly without the
      information found in the source code of F.Coutant's BOOTLIN.

      This program would be absolutely superfluous without Linus Torvalds.

      Jacques Gelinas encouraged me in realizing the VCPI-support.
      The LOADLINX pre-processor is an implementation of his ideas.

      Alessandro Rubini contributed some code from his linuxEXE package
      (BOOTSECT.BIN) and gave some important hints.

      Chuck Munro gave hints concerning problems with QEMM and ALPHA-
      tested version 1.4.
      He also did much work for better documentation.

      Javier Achirica invented the switch-out-of-setup method (LOADLIN-1.5),
      which makes the BIOSINTV and REALBIOS method superfluous on nearly
      all machines. The trick is: let setup run in V86 and intercept
      just before going to protected mode.


      Important problem and bug reports came from:

      Mitchum Dsouza, UK
      Claus Tondering, Denmark
      Johann Friedrich Heinrichmeyer, Germany
      Jacek Zapala, Poland
      Jon Peatfield, UK

      Thanks also to all the ALPHA testers, who responded on my
      "call for testers". The list is too long to put it here,
      but some of them did heavy testings:

      Michael Goddard, US
      Shih-Hua Chao, US
      Rene Baart, Netherlands
      Asad Khan,
      Jan Lien, Sweden


      Many thanks also to those people, who did not have any
      problems with LOADLIN, but nevertheless mailed me "it works"
      ( positive feedback is the best one ).


                         --------- END --------

