home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / MILO-HOWTO < prev    next >
Text File  |  1998-10-14  |  45KB  |  1,062 lines

  1.   Alpha Miniloader Howto
  2.   David A. Rusling, david.rusling@reo.mts.dec.com
  3.   v0.84, 6 December 1996
  4.  
  5.   This document describes the Miniloader, a program for Alpha based sys¡
  6.   tems that can be used to initialize the machine and load Linux.  The
  7.   Alpha Linux Miniloader (to give it it's full name) is also known as
  8.   MILO.
  9.  
  10.   1.  Introduction
  11.  
  12.   This document describes the Miniloader for Linux on Alpha AXP (MILO).
  13.   This firmware is used to initialize Alpha AXP based systems, load and
  14.   start Linux and, finally, provide PALcode for Linux.
  15.  
  16.   1.1.  Copyright
  17.  
  18.   The Alpha Miniloader (MILO) HOWTO is copyright (C) 1995, 1996 David A
  19.   Rusling.
  20.  
  21.   Copyright. Like all Linux HOWTO documents, it may be reproduced and
  22.   distributed in whole or in part, in any medium, physical or
  23.   electronic, so long as this copyright notice is retained on all
  24.   copies.  Commercial redistribution is allowed and encouraged; however
  25.   the author would like to be notified of such distributions.  You may
  26.   translate this HOWTO into any language whatsover provided that you
  27.   leave this copyright statement and disclaimer intact, and that you
  28.   append a notice stating who translated the document.
  29.  
  30.   Disclaimer. While I have tried to include the most correct and up to
  31.   date information available to me, I cannot guarantee that usage of
  32.   information in this document does not result in loss of data or
  33.   equipment.   I provide NO WARRENTY about the information in the HOWTO
  34.   and I cannot be made liable for any consequences resulting from using
  35.   the information in this HOWTO.
  36.  
  37.   1.2.  New Versions of this Document
  38.  
  39.   The latest version of this document can be found in
  40.   <ftp://gatekeeper.dec.com/pub/Digital/Linux-Alpha/Miniloader/docs> and
  41.   David Mosberger-Tang is kind enough to include the html form of it in
  42.   his excellent Linux Alpha FAQ site
  43.   <http://www.azstarnet.com/~axplinux>.
  44.  
  45.   2.  What is MILO?
  46.  
  47.   On Intel based PC systems, the BIOS firmware sets up the system and
  48.   then loads the image to be run from the boot block of a DOS file
  49.   system.  This is more or less what MILO does on an Alpha based system,
  50.   however there are several interesting differences between BIOS
  51.   firmware and MILO, not least of which is that MILO includes and uses
  52.   standard Linux device drivers unmodified.  MILO is firmware, unlike
  53.   LILO, which relies on the BIOS firmware to get itself loaded.  The
  54.   main functional parts of MILO are:
  55.  
  56.   1. PALcode,
  57.  
  58.   2. Memory set up code (builds page tables and turns on virtual
  59.      addressing),
  60.  
  61.   3. Video code (BIOS emulation code and TGA (21030)),
  62.  
  63.   4. Linux kernel code.  This includes real Linux kernel code (for
  64.      example, the interrupt handling) and ersatz or mock Linux kernel,
  65.  
  66.   5. Linux block device drivers (for example, the floppy driver),
  67.  
  68.   6. File system support (ext2, MS-DOS and ISO9660),
  69.  
  70.   7. User inteface code (MILO),
  71.  
  72.   8. Kernel interface code (sets up the HWRPB and memory map for linux),
  73.  
  74.   9. NVRAM code for managing environment variables.
  75.  
  76.   The following paragraphs describe these functional parts in more
  77.   detail.
  78.  
  79.   PALcode can be thought of as a tiny software layer that tailors the
  80.   chip to a particular operating system.  It runs in a special mode
  81.   (PALmode) which has certain restrictions but it uses the standard
  82.   Alpha instruction set with just five extra instructions.  In this way,
  83.   the Alpha chip can run such diverse operating systems as Windows NT,
  84.   OpenVMS, Digital Unix and, of course, Linux.  The PALcode that MILO
  85.   uses (and therefore Linux itself) is, like the rest of MILO, freeware.
  86.   It is derived from Digital's Evaluation Board software example Digital
  87.   Unix PALcode..  The differences between the different PALcodes are
  88.   because of differences in address mapping and interrupt handling that
  89.   exist between the Alpha chips (21066 based systems have a different
  90.   I/O map to 21064+2107x systems) and different Alpha based systems.
  91.  
  92.   For MILO to operate properly it needs to know what memory is
  93.   available, where Linux will eventually be running from and it must be
  94.   able to allocate temporary memory for the Linux device drivers.  The
  95.   code maintains a memory map that has entries for permanent and
  96.   temporary allocated pages.  As it boots, MILO uncompresses itself into
  97.   the correct place in physical memory.   When it passes control to the
  98.   Linux kernel, it reserves memory for the compressed version of itself,
  99.   the PALcode (which the kernel needs) and some data structures.  This
  100.   leaves most of the memory in the system for Linux itself.
  101.  
  102.   The final act of the memory code is to set up and turn on virtual
  103.   addressing so that the data structures that Linux expects to see are
  104.   at the correct place in virtual memory.
  105.  
  106.   MILO contains video code that initialises and uses the video device
  107.   for the system.  It will detect and use a VGA device if there is one,
  108.   otherwise it will try to use a TGA (21030) video device.  Failing
  109.   that, it will assume that there is no graphics device.  The BIOS
  110.   emulation that the standard, pre-built, images include is Digital's
  111.   own BIOS emulation which supports most, if not all, of the standard
  112.   graphics devices available.
  113.  
  114.   Linux device drivers live within the kernel and expect certain
  115.   services from the kernel.  Some of these services are provided
  116.   directly by Linux kernel code, for example the interrupt handling and
  117.   some is provided by kernel look-alike routines.
  118.  
  119.   MILO's most powerful feature is that you can embed unaltered Linux
  120.   device drivers into it.  This gives it the potential to support every
  121.   device that Linux does.  MILO includes all of the block devices that
  122.   are configured into the Linux kernel that it is built against as well
  123.   as a lot of the block device code (for example, ll_rw_blk()).
  124.  
  125.   MILO loads the Linux kernel from real file systems rather than  from
  126.   boot blocks and other strange places.  It understands MSDOS, EXT2 and
  127.   ISO9660 filesystems.  Gzip'd files are supported and these are
  128.   recommended, particularly if you are loading from floppy which is
  129.   rather slow.  MILO recognises these by their .gz suffix.
  130.  
  131.   Built into MILO is a simple keyboard driver which, together with an
  132.   equally simple video driver allows it to have a simple user interface.
  133.   That interface allows you to list file systems on configured devices,
  134.   boot Linux or run flash update utilities and set environment variables
  135.   that control the system's booting.  Like LILO, you can pass arguments
  136.   to the Kernel.
  137.  
  138.   MILO must tell the Linux kernel what sort of system this is, how much
  139.   memory there is and which of that memory is free.  It does this using
  140.   the HWRPB (Hardware Restart Parameter Block) data structure and
  141.   associated memory cluster descriptions.  These are placed at the
  142.   appropriate place in virtual memory just before control is passed to
  143.   the Linux kernel.
  144.  
  145.   3.  Pre-Built Standard MILO Images.
  146.  
  147.   If you are planning to run Linux on a standard Alpha based system,
  148.   then there are pre-built "standard" MILO images that you might use.
  149.   These (along with the sources and other interesting stuff) can be
  150.   found in <ftp://gatekeeper.dec.com/pub/Digital/Linux-
  151.   Alpha/Miniloader>.
  152.  
  153.   The images subdirectory contains a directory per standard system (eg
  154.   AlphaPC64) with MILO images having the following naming convention:
  155.  
  156.   1. MILO - Miniloader executable image, this image can be loaded in a
  157.      variety of ways,
  158.  
  159.   2. fmu.gz - Flash management utility,
  160.  
  161.   3. MILO.dd - Boot block floppy disk image.  These should be written
  162.      using rawrite.exe or dd on Linux.
  163.  
  164.   The test-images, like the images subdirectory contains a directory per
  165.   standard system.   These images are somewhat experimental but tend to
  166.   contain all the latest features.
  167.  
  168.   4.  How To Build MILO
  169.  
  170.   You build MILO seperately from the Kernel.  As MILO requires parts of
  171.   the kernel to function (for example interrupt handling) you must first
  172.   configure and build the kernel that matches with MILO that you want to
  173.   build.  Mostly this means building the kernel with the same version
  174.   number.  So, MILO-2.0.25.tar.gz will build against
  175.   linux-2.0.25.tar.gz.  MILO may build against a higher version of the
  176.   kernel, but there again it may not.  Also, now that ELF shared
  177.   libraries are fully supported, there are two versions of the MILO
  178.   sources.  To build under an ELF system you must first unpack the
  179.   standard MILO sources and then patch those sources with the same
  180.   version numbered ELF patch.  In the remainder of this discussion, I
  181.   assume that your kernel sources and object files are stored in the
  182.   subtree at /usr/src/linux and that the linux kernel has been fully
  183.   built with the command make boot
  184.  
  185.   To build MILO, change your working directory to the MILO source
  186.   directory and invoke make with:
  187.  
  188.        $    make KSRC=/usr/src/linux config
  189.  
  190.   Just like the Linux kernel, you will be asked a series of questions
  191.  
  192.             Echo output to the serial port (MINI_SERIAL_ECHO) [y]
  193.  
  194.   It's a good idea to echo kernel printk to /dev/ttyS0 if you can.  If
  195.   you can (and want to), then type "y", otherwise "n".  All of the
  196.   standard, pre-built, MILO images include serial port I/O using COM1.
  197.  
  198.             Use Digital's BIOS emulation code (not free) (MINI_DIGITAL_BIOS_EMU) [y]
  199.  
  200.   This code is included as a library which is freely distributable so
  201.   long as it is used on an Alpha based system.  The sources are not
  202.   available.   If you answer n then the freeware alternative BIOS
  203.   emulation will be built.  It's sources are included with MILO.  Note
  204.   that you cannot right now build choose Digital's BIOS emulation code
  205.   in an ELF system (the library is not yet ready) and so you must answer
  206.   no to this question.
  207.  
  208.             Build PALcode from sources (Warning this is dangerous) (MINI_BUILD_PALCODE_FROM_SOURCES) [n]
  209.  
  210.   You should only do this if you have changed the PALcode sources,
  211.   otherwise use the standard, pre-built PALcode included with MILO.
  212.  
  213.   You are now all set to build the MILO image itself:
  214.  
  215.   $    make KSRC=/usr/src/linux
  216.  
  217.   When the build has successfully completed, the MILO image is in the
  218.   file called milo.  There are a lot of images called milo.*, these
  219.   should be ignored.
  220.  
  221.   5.  How To Load MILO
  222.  
  223.   The most commonly supported method of loading MILO is from the Windows
  224.   NT ARC firmware as most shipping systems support this.  However, there
  225.   are a wide variety of  loading MILO.   It may be loaded from:
  226.  
  227.   ╖  a failsafe boot block floppy,
  228.  
  229.   ╖  the Windows NT ARC firmware,
  230.  
  231.   ╖  Digital's SRM console,
  232.  
  233.   ╖  an Alpha Evaluation Board Debug Monitor,
  234.  
  235.   ╖  flash/ROM.
  236.  
  237.   5.1.  Loading MILO from the Windows NT ARC firmware
  238.  
  239.   Most, if not all, Alpha AXP based systems include the Windows NT ARC
  240.   firmware and this is the prefered method of booting MILO and thus
  241.   Linux.  Once the Windows NT firmware is running and you have the
  242.   correct MILO image for your system, this method is completely generic.
  243.  
  244.   The Windows NT ARC firmware is an environment in which programs can
  245.   run and make callbacks into the firmware to perform actions.  The
  246.   Windows NT OSLoader is a program that does exactly this.   Linload.exe
  247.   is a much simpler program which does just enough to load and execute
  248.   MILO.  It loads the appropriate image file into memory at 0x00000000
  249.   and then makes a swap-PAL PALcall to it.  MILO, like Linux, uses a
  250.   different PALcode to Windows NT which is why the swap has to happen.
  251.   MILO relocates itself to 0x200000 and continues on through the PALcode
  252.   reset entry point as before.
  253.  
  254.   Before you add a Linux boot option, you will need to copy linload.exe
  255.   and the appropriate MILO that you wish to load to someplace that the
  256.   Windows NT ARC firmware can read from.  In the following example, I
  257.   assume that you are booting from a DOS format floppy disk:
  258.  
  259.   1. At the boot menu, select "Supplementary menu..."
  260.  
  261.   2. At the "Supplementary menu", select "Set up the system..."
  262.  
  263.   3. At the "Setup menu", select "Manage boot selection menu..."
  264.  
  265.   4. In the "Boot selections menu", choose "Add a boot selection"
  266.  
  267.   5. Choose "Floppy Disk 0"
  268.  
  269.   6. Enter "linload.exe" as the osloader directory and name
  270.  
  271.   7. Say "yes" to the operating system being on the same partition as
  272.      the osloader
  273.  
  274.   8. Enter "
  275.  
  276.   9. I usually enter "Linux" as the name for this boot selection
  277.  
  278.   10.
  279.      Say "No" you do not want to initialise the debugger at boot time
  280.  
  281.   11.
  282.      You should now be back in the "Boot selections menu", choose the
  283.      "Change a boot selection option" and pick the selection you just
  284.      created as the one to edit
  285.  
  286.   12.
  287.      Use the down arrow to get "OSLOADFILENAME" up and then type in the
  288.      name of the MILO image that you wish to use, for example
  289.      "noname.arc" followed by return.
  290.  
  291.   13.
  292.      Press ESC to get back to the "Boot Selections menu"
  293.  
  294.   14.
  295.      Choose "Setup Menu" (or hit ESC again) and choose "Supplementary
  296.      menu, and save changes" option
  297.  
  298.   15.
  299.      ESC will get you back to the "Boot menu" and you can attempt to
  300.      boot MILO.  If you do not want Linux as the first boot option, then
  301.      you can alter the order of the boot options in the "Boot selections
  302.      menu".
  303.  
  304.   At the end of all this, you should have a boot selection that looks
  305.   something like:
  306.  
  307.        LOADIDENTIFIER=Linux
  308.        SYSTEMPARTITION=multi(0)disk(0)fdisk(0)
  309.        OSLOADER=multi(0)disk(0)fdisk(0)\linload.exe
  310.        OSLOADPARTITION=multi(0)disk(0)fdisk(0)
  311.        OSLOADFILENAME=\noname.arc
  312.        OSLOADOPTIONS=
  313.  
  314.   You can now boot MILO (and then Linux).  You can load linload.exe and
  315.   MILO directly from a file system that Windows NT understands such as
  316.   NTFS or DOS on a hard disk.
  317.  
  318.   The contents OSLOADOPTIONS are passed to MILO which interprets it as a
  319.   command.   So, in order to boot Linux directly from Windows NT without
  320.   pausing in MILO, you could pass the following in OSLOADOPTIONS:
  321.  
  322.        boot sda2:vmlinux.gz root=/dev/sda2
  323.  
  324.   See ``MILO's User Interface'' for more information on the commands
  325.   available.
  326.  
  327.   Another (rather sneaky) way of loading of loading MILO via the WNT ARC
  328.   firmware is to put MILO onto an MS-DOS floppy and call it fwupdate.exe
  329.   and then choose the "Upgrade Firmware" option.
  330.  
  331.   5.2.  Loading MILO from the Evaluation Board Debug Monitor
  332.  
  333.   Evaluation boards (and often designs cloned from them) include support
  334.   for the Alpha Evaluation Board Debug Monitor.   Consult your system
  335.   document before considering this method of booting MILO.   The
  336.   following systems are known to include Debug Monitor support:
  337.  
  338.   ╖  AlphaPC64 (Section ``AlphaPC64'')
  339.  
  340.   ╖  EB64+ (Section ``EB64+'')
  341.  
  342.   ╖  EB66+ (Section ``EB66+'')
  343.  
  344.   ╖  EB164 (Section ``EB164'')
  345.  
  346.   ╖  PC164 (Section ``PC164'')
  347.  
  348.   Before you consider this method, you should note that the early
  349.   versions of the Evaluation Board Debug Monitor did not include video
  350.   or keyboard drivers and so you must be prepared to connect another
  351.   system via the serial port so that you can use the Debug Monitor.  Its
  352.   interface is very simple and typing help shows a whole heap of
  353.   commands.  The ones that are most interesting include the word boot or
  354.   load in them.
  355.  
  356.   The Evaluation Board Debug Monitor can load an image either via the
  357.   network (netboot) or via a floppy (flboot).  In either case, set the
  358.   boot address to 0x200000 (> bootadr 200000) before booting the image.
  359.  
  360.   If the image is on floppy (and note that only DOS formatted floppies
  361.   are supported), then you will need to type the following command:
  362.  
  363.             AlphaPC64> flboot <MILO-image-name>
  364.  
  365.   5.3.  Loading MILO from a Failsafe Boot Block Floppy
  366.  
  367.   Only the AxpPCI33 is known to include failsafe boot block floppy
  368.   support (Section < id="noname-section" name="Noname">).
  369.  
  370.   If you do not have a standard pre-built MILO .dd image, then you may
  371.   need to build an SRM boot block floppy.  Once you have built MILO, you
  372.   need to do the following on Digital Unix box:
  373.  
  374.        fddisk -fmt /dev/rfd0a
  375.        cat mboot bootm > /dev/rfd0a
  376.        disklabel -rw rfd0a 'rx23' mboot bootm
  377.  
  378.   Or on a Linux box:
  379.  
  380.             cat mboot bootm > /dev/fd0
  381.  
  382.   If you have a standard MILO image available (say MILO.dd) then you
  383.   would build a boot block floppy using the following command:
  384.  
  385.             dd if=MILO.dd of=/dev/fd0
  386.  
  387.   5.4.  Loading MILO from Flash
  388.  
  389.   There are a number of systems where MILO can be blown into flash and
  390.   booted directly (instead of via the Windows NT ARC firmware):
  391.  
  392.   ╖  AlphaPC64 (Section ``AlphaPC64'')
  393.  
  394.   ╖  Noname (Section ``Noname'')
  395.  
  396.   ╖  EB66+ (Section ``EB66+'')
  397.  
  398.   ╖  EB164 (Section ``EB164'')
  399.  
  400.   ╖  PC164 (Section ``PC164'')
  401.  
  402.   5.5.  Loading MILO from the SRM Console
  403.  
  404.   The SRM (short for System Reference Manual) Console knows nothing
  405.   about filesystems or disk-partitions, it simply expects that the
  406.   secondary bootstrap loader occupies a consecutive range of physical
  407.   disk sectors starting from a given offset.   The information
  408.   describing the secondary bootstrap loader (its size and offset) is
  409.   given in the first 512 byte block.   To load MILO via the SRM you must
  410.   generate that structure on a device which the SRM can access (such as
  411.   a floppy disk).  This is what mboot and bootm, mboot is the first
  412.   block (or boot description) and mboot is the MILO image rounded up to
  413.   a 512 byte boundary.
  414.  
  415.   To load MILO from a boot block device, either build mboot and bootm
  416.   and push them onto the boot device using the following command:
  417.  
  418.                $ cat mboot bootm > /dev/fd0
  419.  
  420.   Or, grab the appropriate MILO.dd from a web site and write it onto the
  421.   boot device using either RAWRITE.EXE or dd.
  422.  
  423.   Once you have done that you can boot the SRM console and use one of
  424.   its many commands to boot MILO.   For example, to boot MILO from a
  425.   boot block floppy you would use the following command:
  426.  
  427.                >>>boot dva0
  428.                (boot dva0.0.0.0.1 -flags 0)
  429.                block 0 of dva0.0.0.0.1 is a valid boot block
  430.                reading 621 blocks from dva0.0.0.0.1
  431.                bootstrap code read in
  432.                base = 112000, image_start = 0, image_bytes = 4da00
  433.                initializing HWRPB at 2000
  434.                initializing page table at 104000
  435.                initializing machine state
  436.                setting affinity to the primary CPU
  437.                jumping to bootstrap code
  438.                MILO Stub: V1.1
  439.                Unzipping MILO into position
  440.                Allocating memory for unzip
  441.                ####...
  442.  
  443.   The following systems are known to have SRM Console support:
  444.  
  445.   ╖  Noname (Section ``Noname'')
  446.  
  447.   ╖  AlphaPC64 (Section ``AlphaPC64'')
  448.  
  449.   ╖  EB164 (Section ``EB164'')
  450.  
  451.   ╖  PC164 (Section ``PC164'')
  452.  
  453.   5.6.  System Specific Information
  454.  
  455.   5.6.1.  AxpPCI33 (Noname)
  456.  
  457.   The Noname board can load MILO from the Windows NT ARC firmware
  458.   (Section ``booting from Windows NT ARC firmware''), from the SRM
  459.   Console (Section ``Loading MILO from the SRM Console'').  and from a
  460.   failsafe boot block floppy (Section ``Loading from a Failsafe Boot
  461.   Block Floppy'').  A flash management utility, runnable from MILO is
  462.   available so that once MILO is running, it can be blown into flash
  463.   (Section ``running the flash management utility'').  However, be
  464.   warned that once you have done this you will lose the previous image
  465.   held there as there is only room for one image.
  466.  
  467.   The way that Noname boots is controlled by a set of jumpers on the
  468.   board, J29 and J28.  These look like:
  469.  
  470.                       4
  471.           J29     2 x x x 6
  472.                   1 x x x 5
  473.  
  474.           J28     2 x x x 6
  475.                   1 x x x 5
  476.                       3
  477.  
  478.   The two options that we're interested in are J28, pins 1-3 which boots
  479.   the console/loader from flash and J29, pins 1-3 which boots the
  480.   console/loader from a boot block floppy.  The second option is the one
  481.   that you need to first boot MILO on the Noname board.
  482.  
  483.   Once you've selected the boot from floppy option via the jumpers, put
  484.   the SRM boot block floppy containing MILO into the floppy and reboot.
  485.   In a few seconds (after the floppy light goes out) you should see the
  486.   screen blank to white and MILO telling you what's going on.
  487.  
  488.   If you are really interested in technical stuff, the Noname loads
  489.   images off of the floppy into physical address 0x104000 and images
  490.   from flash into 0x100000.  For this reason, MILO is built with it's
  491.   PALcode starting at 0x200000.  When it is first loaded, it moves
  492.   itself to the correct location (see relocate.S).
  493.  
  494.   5.6.2.  AlphaPC64 (Cabriolet)
  495.  
  496.   The AlphaPC64 includes the Windows NT ARC firmware (Section ``booting
  497.   from Windows NT ARC firmware''), the SRM Console (Section ``Loading
  498.   MILO from the SRM Console'') and the Evaluation Debug Monitor (Section
  499.   ``Loading from the Debug Monitor'').  These images are in flash and
  500.   there is room to add MILO so that you can boot MILO directly from
  501.   flash.  A flash management utility, runnable from MILO is available so
  502.   that once MILO is running, it can be blown into flash (Section
  503.   ``running the flash management utility'').  This system supports MILO
  504.   environment variables.
  505.  
  506.   You select between the boot options (and MILO when it is been put into
  507.   flash) using a combination of jumpers and a boot option which is saved
  508.   in the NVRAM of the TOY clock.
  509.  
  510.   The jumper is J2, SP bits 6 and 7 have the following meanings:
  511.  
  512.   ╖  SP bit 6 should always be out.  If this jumper is set then the SROM
  513.      mini-debugger gets booted,
  514.  
  515.   ╖  SP bit 7 in is boot image selected by the boot option byte in the
  516.      TOY clock,
  517.  
  518.   ╖  SP bit 7 out is boot first image in flash.
  519.  
  520.   So, with bit 7 out, the Debug Monitor will be booted as it is always
  521.   the first image in flash.  With bit 7 in, the image selected by the
  522.   boot option in the TOY clock will be selected.  The Debug Monitor, the
  523.   Windows NT ARC firmware and MILO all support setting this boot option
  524.   byte but you must be very careful using it.  In particular, you cannot
  525.   set the boot option so that next time the system boots MILO when you
  526.   are running the Windows NT ARC firmware, it only allows you to set
  527.   Debug Monitor or Windows NT ARC as boot options.
  528.   To get MILO into flash via the Evaluation Board Debug Monitor, you
  529.   will need a flashable image.  The build proceedures make MILO.rom, but
  530.   you can also make a rom image using the makerom tool in the Debug
  531.   Monitor software that comes with the board:
  532.  
  533.       > makerom -v -i7 -l200000 MILO -o mini.flash
  534.  
  535.   (type makerom to find out what the arguments mean, but 7 is a flash
  536.   image id used by the srom and -l200000 gives the load address for the
  537.   image as 0x200000).
  538.  
  539.   Load that image into memory (via the Debug Monitor commands flload,
  540.   netload, and so on) at 0x200000 and then blow the image into flash:
  541.  
  542.             AlphaPC64> flash 200000 8
  543.  
  544.   (200000 is where the image to be blown is in memory and 8 is the
  545.   segment number where you put the image.   There are 16 1024*64 byte
  546.   segments in the flash and the Debug Monitor is at seg 0 and the
  547.   Windows NT ARC firmware is at seg 4).
  548.  
  549.   Set up the image that the srom will boot by writing the number of the
  550.   image into the TOY clock.
  551.  
  552.             AlphaPC64> bootopt 131
  553.  
  554.   (131 means boot the 3rd image, 129 = 1st, 130 = 2nd and so on).
  555.  
  556.   Power off, put jumper 7 on and power on and you should see the MILO
  557.   burst into life.  If you don't then take jumper 7 back off and reboot
  558.   the Debug Monitor.
  559.  
  560.   5.6.3.  EB66+
  561.  
  562.   The EB66+, like all of the Alpha Evaluation Boards built by Digital
  563.   contains the Evaluation Board Debug Monitor and so this is available
  564.   to load MILO (Section ``Loading from the Debug Monitor'').  Quite
  565.   often (although not always) boards whose design is derived from these
  566.   include the Debug Monitor also.  Usually, these boards include the
  567.   Windows NT ARC firmware (Section ``booting from Windows NT ARC
  568.   firmware'').  A flash management utility, runnable from MILO is
  569.   available so that once MILO is running, it can be blown into flash
  570.   (Section ``running the flash management utility'').  This system
  571.   supports MILO environment variables.
  572.  
  573.   These systems have several boot images in flash controlled by jumpers.
  574.   The two jumper banks are J18 and J16 and are located at the bottom of
  575.   the board in the middle (if the Alpha chip is at the top).  You select
  576.   between the boot options (and MILO when it is been put into flash)
  577.   using a combination of jumpers and a boot option which is saved in the
  578.   NVRAM of the TOY clock.
  579.  
  580.   Jumper 7-8 of J18 in means boot the image described by the boot
  581.   option.   Jumper 7-8 of J18 out means boot the Evaluation Board Debug
  582.   Monitor.
  583.  
  584.   Blowing an image into flash via the Evaluation Board Debug Monitor is
  585.   exactly the same proceedure as for the AlphaPC64 (Section
  586.   ``AlphaPC64'').
  587.  
  588.   5.6.4.  EB64+/Aspen Alpine
  589.  
  590.   This system is quite like the AlphaPC64 except that it does not
  591.   contain flash which MILO can be loaded from.  The EB64+ has two ROMs,
  592.   one of which contains the Windows NT ARC firmware (Section ``booting
  593.   from Windows NT ARC firmware'').  and the other contains the
  594.   Evaluation Board Debug Monitor (Section ``Loading from the Debug
  595.   Monitor'').
  596.  
  597.   The Aspen Alpine is a little different in that it only has one ROM;
  598.   this contains the Windows NT ARC firmware.
  599.  
  600.   5.6.5.  Universal Desktop Box (Multia)
  601.  
  602.   This is a very compact pre-packaged 21066 based system that includes a
  603.   TGA (21030) graphics device.   Although you can just fit a half height
  604.   PCI graphics card in the box you are better off waiting for full TGA
  605.   support in XFree86.   It includes the Windows NT ARC firmware and so
  606.   booting from that is the prefered method (Section ``Loading from
  607.   Windows NT'').
  608.  
  609.   5.6.6.  EB164
  610.  
  611.   The EB164, like all of the Alpha Evaluation Boards built by Digital
  612.   contains the Evaluation Board Debug Monitor and so this is available
  613.   to load MILO (Section ``Loading from the Debug Monitor'').  Quite
  614.   often (although not always) boards whose design is derived from these
  615.   include the Debug Monitor also.  Usually, these boards include the
  616.   Windows NT ARC firmware (Section ``booting from Windows NT ARC
  617.   firmware'').  The SRM console is also available (Section ``Loading
  618.   MILO from the SRM Console'').  A flash management utility, runnable
  619.   from MILO is available so that once MILO is running, it can be blown
  620.   into flash (Section ``running the flash management utility'').  This
  621.   system supports MILO environment variables.
  622.  
  623.   These systems have several boot images in flash controlled by jumpers.
  624.   The two jumper bank is J1 and is located at the bottom of the board on
  625.   the left (if the Alpha chip is at the top).  You select between the
  626.   boot options (and MILO when it is been put into flash) using a
  627.   combination of jumpers and a boot option which is saved in the NVRAM
  628.   of the TOY clock.
  629.  
  630.   Jumper SP-11 of J1 in means boot the image described by the boot
  631.   option.   Jumper SP-11 of J1 out means boot the Evaluation Board Debug
  632.   Monitor.
  633.  
  634.   Blowing an image into flash via the Evaluation Board Debug Monitor is
  635.   exactly the same proceedure as for the AlphaPC64 (Section
  636.   ``AlphaPC64'').
  637.  
  638.   5.6.7.  PC164
  639.  
  640.   The PC164, like all of the Alpha Evaluation Boards built by Digital
  641.   contains the Evaluation Board Debug Monitor and so this is available
  642.   to load MILO (Section ``Loading from the Debug Monitor'').  Quite
  643.   often (although not always) boards whose design is derived from these
  644.   include the Debug Monitor also.  Usually, these boards include the
  645.   Windows NT ARC firmware (Section ``booting from Windows NT ARC
  646.   firmware'').  The SRM console is also available (Section ``Loading
  647.   MILO from the SRM Console'').  A flash management utility, runnable
  648.   from MILO is available so that once MILO is running, it can be blown
  649.   into flash (Section ``running the flash management utility'').  This
  650.   system supports MILO environment variables.
  651.  
  652.   These systems have several boot images in flash controlled by jumpers.
  653.   The main jumper block, J30, contains the system configuration jumpers
  654.   and jumper CF6 in means that the system will boot the Debug Monitor,
  655.   the default is out.
  656.  
  657.   Blowing an image into flash via the Evaluation Board Debug Monitor is
  658.   exactly the same proceedure as for the AlphaPC64 (Section
  659.   ``AlphaPC64'').
  660.  
  661.   5.6.8.  XL266
  662.  
  663.   The XL266 is one of a family of systems that are known as Avanti.  It
  664.   has a riser card containing the Alpha chip and cache which plugs into
  665.   the main board at right angles.   This board can replace the
  666.   equivalent Pentium board.
  667.  
  668.   Some of these systems ship with the SRM console but others, notably
  669.   the XL266 ship with only the Windows NT ARC firmware (Section
  670.   ``booting from Windows NT ARC firmware'').
  671.  
  672.   Here is my list of compatible systems:
  673.  
  674.   ╖  AlphaStation 400 (Avanti),
  675.  
  676.   ╖  AlphaStation 250,
  677.  
  678.   ╖  AlphaStation 200 (Mustang),
  679.  
  680.   ╖  XL.  There are two flavours, XL266 and XL233 with the only
  681.      difference being in processor speed and cache size.
  682.  
  683.   Note The system that I use to develop and test MILO is an XL266 and so
  684.   this is the only one that I can guarentee will work.  However,
  685.   technically, all of the above systems are equivalent; they have the
  686.   same support chipsets and the same interrupt handling mechanisms.
  687.  
  688.   5.6.9.  Platform2000
  689.  
  690.   This is a 233Mhz 21066 based system.
  691.  
  692.   6.  MILO's User Interface
  693.  
  694.   Once you have correctly installed/loaded/run MILO you will see the
  695.   MILO (for MIniLOader) prompt displayed on your screen.  There is a
  696.   very simple interface that you must use in order to boot a particular
  697.   Linux kernel image.  Typing "help" is a good idea as it gives a useful
  698.   summary of the commands.
  699.  
  700.   6.1.  The ''help'' Command
  701.  
  702.   Probably the most useful command that MILO has:
  703.  
  704.        MILO> help
  705.        MILO command summary:
  706.  
  707.        ls [-t fs] [dev:[dir]]
  708.                            - List files in directory on device
  709.        boot [-t fs] [dev:file] [boot string]
  710.                            - Boot Linux from the specified device and file
  711.        run [-t fs] dev:file
  712.                            - Run the standalone program dev:file
  713.        show                - Display all known devices and file systems
  714.        set VAR VALUE       - Set the variable VAR to the specified VALUE
  715.        unset VAR           - Delete the specified variable
  716.        reset               - Delete all variables
  717.        print               - Display current variable settings
  718.        help [var]          - Print this help text
  719.  
  720.        Devices are specified as: fd0, hda1, hda2, sda1...
  721.        Use the '-t filesystem-name' option if you want to use
  722.          anything but the default filesystem  ('ext2').
  723.        Use the 'show' command to show known devices and filesystems.
  724.        Type 'help var' for a list of variables.
  725.  
  726.   Note that the bootopt command only appears on AlphaPC64 (and similar)
  727.   systems.  Refer to the board's dcoumentation to find out just what it
  728.   means.
  729.  
  730.   Devices.  Until you use a command that needs to make use of a device,
  731.   no device inititalisation will take place.   The first show, ls, boot
  732.   or run commands all cause the devices within MILO to be initialised.
  733.   Devices are named in the same way (exactly) that Linux itself will
  734.   name them.  So, the first IDE disk will be called 'hda' and it's first
  735.   partition will be 'hda1'.  Use the show command to show what devices
  736.   are available.
  737.  
  738.   File Systems.   MILO supports three file systems, MSDOS, EXT2 and
  739.   ISO9660.  So long as a device is available to it, MILO can listboot or
  740.   run an image stored on one of these file systems.  MILO's default file
  741.   system is EXT2 and so you have tell MILO that the file system is
  742.   something other than that.  All of the commands that use filenames
  743.   allow you to pass the file system using the -t [filesystem]option.
  744.   So, if you wanted to list the contents of a SCSI CD ROM, you might
  745.   type the following:
  746.  
  747.             MILO> ls -t iso9660 scd0:
  748.  
  749.   Variables.  MILO contains some settable variables that help the boot
  750.   process.  If you are loading via the Windows NT ARC firmware, then
  751.   MILO makes use of the boot option environment variables set up by that
  752.   firmware.  For some systems, MILO (for example, the AlphaPC64)
  753.   maintains its own set of environment variables that do not change from
  754.   boot to boot.  These variables are:
  755.  
  756.        MILO> help var
  757.        Variables that MILO cares about:
  758.          MEMORY_SIZE      - System memory size in megabytes
  759.          BOOT_DEV         - Specifies the default boot device
  760.          BOOT_FILE        - Specifies the default boot file
  761.          BOOT_STRING      - Specifies the boot string to pass to the kernel
  762.          SCSIn_HOSTID     - Specifies the host id of the n-th SCSI controller.
  763.          AUTOBOOT         - If set, MILO attempts to boot on powerup
  764.                             and enters command loop only on failure.
  765.          AUTOBOOT_TIMEOUT - Seconds to wait before auto-booting on powerup.
  766.  
  767.   6.2.  Booting Linux
  768.  
  769.   The boot command boots a linux kernel from a device.  You will need to
  770.   have a linux kernel image on an EXT2 formated disk (SCSI, IDE or
  771.   floppy) or an ISO9660 formatted CD available to MILO.  The image can
  772.   be gzip'd and in this case MILO will recognise that it is gzip'd by
  773.   the .gz suffix.
  774.  
  775.   You should note that the version of MILO does not usually have to
  776.   match the version of the Linux kernel that you are loading.  You boot
  777.   Linux using the following command syntax:
  778.  
  779.             MILO> boot [-t file-system] device-name:file-name [[boot-option] [boot-option] ...]
  780.  
  781.   Where device-name is the name of the device that you wish to use and
  782.   file-name is the name of the file containing the Linux kernel.   All
  783.   arguments supplied after the file name are passed directly to the
  784.   Linux kernel.
  785.  
  786.   If you are installing Red Hat, then you will need to specify a root
  787.   device and so on.  So you would use:
  788.             MILO> boot fd0:vmlinux.gz root=/dev/fd0 load_ramdisk=1
  789.  
  790.   MILO will automatically contain the block devices that you configure
  791.   into your vmlinux.  I have tested the floppy driver, the IDE driver
  792.   and a number of SCSI drivers (for example, the NCR 810), and these
  793.   work fine.  Also, it is important to set the host id of the SCSI
  794.   controller to a reasonable value.  By default, MILO will initialize it
  795.   to the highest possible value (7) which should normally work just
  796.   fine.  However, if you wish, you can explicitly set the host id of the
  797.   n-th SCSI controller in the system by setting environment variable
  798.   SCSIn_HOSTID to the appropriate value.  For example, to set the hostid
  799.   of the first SCSI controller to 7, you can issue the following command
  800.   at the MILO prompt:
  801.  
  802.             setenv SCSI0_HOSTID 7
  803.  
  804.   6.3.  Rebooting Linux
  805.  
  806.   You may want to reboot a running Linux system using the shutdown -r
  807.   now command.  In this case, the Linux kernel returns control to MILO
  808.   (via the HALT CallPAL entrypoint).  MILO leaves a compressed copy of
  809.   itself in memory for just this reason and detects that the system is
  810.   being rebooted from information held in the HWRPB (Hardware Restart
  811.   Parameter Block).  In this case it starts to reboot using exactly the
  812.   same command that was used to boot the Linux kernel the last time.
  813.   There is a 30 second timeout that allows you to interrupt this process
  814.   and boot whatever kernel you wish in whatever way you wish.
  815.  
  816.   6.4.  The ''bootopt'' command
  817.  
  818.   For flash based systems such as the AlphaPC64, EB164 and the EB66+,
  819.   there are a number of possible boot options and these are changed
  820.   using the bootopt command.  This has one argument, a decimal number
  821.   which is the type of the image to be booted the next time the system
  822.   is power cycled or reset:
  823.  
  824.   0 Boot the Evaluation Board Debug Monitor,
  825.  
  826.   1 Boot the Windows NT ARC firmware.
  827.  
  828.   In order to tell the boot code to boot the MILO firmware from flash
  829.   then you need a boot option that means boot the N'th image.  For this,
  830.   you need to 128 plus N, so if MILO is the third image, you would use
  831.   the command:
  832.  
  833.             MILO> bootopt 131
  834.  
  835.   Note: Be very careful with this command.   A good rule is never to set
  836.   bootopt to 0 (the Evaluation Board Debug Monitor), but instead use the
  837.   system's jumpers to achieve the same thing.
  838.  
  839.   7.  Running the Flash Management Utility
  840.  
  841.   The run command is used to run the flash management utility.  Before
  842.   you start you will need a device available to MILO that contains the
  843.   updateflash program.  This (like vmlinux) can be gzip'd.  You need to
  844.   run the flash management utility  program from the MILO using the
  845.   (run) command:
  846.  
  847.             MILO> run fd0:fmu.gz
  848.  
  849.   Once it has loaded and initialised, the flash management utility will
  850.   tell you some information about the flash device and give you a
  851.   command prompt.  Again the help command is most useful.
  852.  
  853.        Linux MILO Flash Management Utility V1.0
  854.  
  855.        Flash device is an Intel 28f008SA
  856.          16 segments, each of 0x10000 (65536) bytes
  857.        Scanning Flash blocks for usage
  858.        Block 12 contains the environment variables
  859.        FMU>
  860.  
  861.   Note that on systems where environment variables may be stored and
  862.   where there is more than one flash block (for example, the AlphaPC64)
  863.   the flash management utility will look for a block to hold MILO's
  864.   environment variables.  If such a block already exists, the flash
  865.   management utility will tell you where it is.  Otherwise, you must use
  866.   the environment command to set a block and initialise it.  In the
  867.   above example, flash block 12 contains MILO's environment variables.
  868.  
  869.   7.1.  The ''help'' command
  870.  
  871.        FMU> help
  872.        FMU command summary:
  873.  
  874.        list                - List the contents of flash
  875.        program             - program an image into flash
  876.        quit                - Quit
  877.        environment         - Set which block should contain the environment variables
  878.        bootopt num         - Select firmware type to use on next power up
  879.        help                - Print this help text
  880.        FMU>
  881.  
  882.   Note that the environment and bootopt commands are only available on
  883.   the EB66+, the AlphaPC64, EB164 and PC164 systems (and their clones).
  884.  
  885.   7.2.  The ''list'' command
  886.  
  887.   The ''list'' command shows the current usage of the flash memory.
  888.   Where there is more than one flash block, the usage of each flash
  889.   block is shown.   In the example below you can see that Windows NT ARC
  890.   is using blocks 4:7 and block 15.
  891.  
  892.        FMU> list
  893.        Flash blocks:  0:DBM  1:DBM  2:DBM  3:WNT  4:WNT  5:WNT  6:WNT  7:WNT  8:MILO
  894.                9:MILO 10:MILO 11:MILO 12:MILO 13:U 14:U 15:WNT
  895.        Listing flash Images
  896.          Flash image starting at block 0:
  897.            Firmware Id:  0 (Alpha Evaluation Board Debug Monitor)
  898.            Image size is 191248 bytes (3 blocks)
  899.            Executing at 0x300000
  900.          Flash image starting at block 3:
  901.            Firmware Id:  1 (Windows NT ARC)
  902.            Image size is 277664 bytes (5 blocks)
  903.            Executing at 0x300000
  904.          Flash image starting at block 8:
  905.            Firmware Id:  7 (MILO/Linux)
  906.            Image size is 217896 bytes (4 blocks)
  907.            Executing at 0x200000
  908.        FMU>
  909.  
  910.   7.3.  The ''program'' command
  911.  
  912.   The flash management utility contains a compressed copy of a flash
  913.   image of MILO.  The ''program'' command allows you to blow this image
  914.   into flash.  The command allows you to back out, but before you run it
  915.   you should use the ''list'' command to see where to put MILO.  If MILO
  916.   is already in flash, then the flash management utility will offer to
  917.   overwrite it.
  918.  
  919.        FMU> program
  920.        Image is:
  921.            Firmware Id:  7 (MILO/Linux)
  922.            Image size is 217896 bytes (4 blocks)
  923.            Executing at 0x200000
  924.        Found existing image at block 8
  925.        Overwrite existing image? (N/y)? y
  926.        Do you really want to do this (y/N)? y
  927.        Deleting blocks ready to program: 8 9 10 11
  928.        Programming image into flash
  929.        Scanning Flash blocks for usage
  930.        FMU>
  931.  
  932.   Wait until it has completed before powering off your system.
  933.  
  934.   Note: I cannot emphasise just how careful you must be here not to
  935.   overwrite an existing flash image that you might need or render your
  936.   system useless.   A very good rule is never to overwrite the Debug
  937.   Monitor.
  938.  
  939.   7.4.  The ''environment'' command
  940.  
  941.   This selects a flash block to contain MILO's environment variables.
  942.  
  943.   7.5.  The ''bootopt'' command
  944.  
  945.   This is just the same as MILO's ''bootopt'' command, see (Section
  946.   ``The ''bootopt'' command'').
  947.  
  948.   7.6.  The ''quit'' command
  949.  
  950.   This is really pretty meaningless.  The only way back to MILO (or
  951.   anything else) once the flash management utility has run is to reboot
  952.   the system.
  953.  
  954.   8.  Restrictions.
  955.  
  956.   Unfortunately this is not a perfect world and there, as always, some
  957.   restrictions that you should be aware of.
  958.  
  959.   MILO is not meant to load operating systems other than Linux, although
  960.   it can load images linked to run at the same place in memory as Linux
  961.   (which is 0xFFFFFC0000310000).  This is how the flash management
  962.   utilities can be run.
  963.  
  964.   The PALcode sources included in miniboot/palcode/blah are correct,
  965.   however there are problems when they are built using the latest gas.
  966.   They do build if you use the ancient a.out gas that's supplied in the
  967.   Alpha Evaluation Board toolset (and that's how they were built).  I'm
  968.   trying to get someone to fix the new gas.  Meanwhile, as a workaround,
  969.   I have provided pre-built PALcode for the supported boards and David
  970.   Mosberger-Tang has a fixed gas on his ftp site.
  971.  
  972.   9.  Problem Solving.
  973.  
  974.   Here are some common problems that people have seen, together with the
  975.   solutions.
  976.  
  977.   Reading MS-DOS floppies from the Evaluation Board Debug Monitor.
  978.  
  979.   Some of the older versions of the Evaluation Board Debug Monitor (pre-
  980.   version 2.0) have a problem with DOS format flopies generated from
  981.   Linux.  Usually, the Debug Monitor can load the first few sectors all
  982.   right, but then goes into an endless loop complaining about "bad
  983.   sectors."  Apparently, there is an incompatibility between the DOS
  984.   file system as expected by the Debug Monitor and the Linux
  985.   implementation of DOSFS.  To make the long story short: if you run
  986.   into this problem, try using DOS to write the floppy disk.  For
  987.   example, if loading the file MILO.cab doesn't work, use a DOS machine,
  988.   insert the floppy and then do:
  989.  
  990.        copy a:MILO.cab c:
  991.        copy c:MILO.cab a:
  992.        del c:MILO.cab
  993.  
  994.   Then try booting from that floppy again.  This normally solves the
  995.   problem.
  996.  
  997.   MILO displays a long sequence of O> and does not accept input.
  998.  
  999.   This usually happens when MILO was built to use COM1 as a secondary
  1000.   console device.   In such a case, MILO echo output to COM1 and accepts
  1001.   input from there also.   This is great for debugging but not so great
  1002.   if you have a device other than a terminal connected.  If this
  1003.   happens, disconnect the device or power it down until the Linux kernel
  1004.   has booted.  Once Linux is up and running, everything will work as
  1005.   expected.
  1006.  
  1007.   MILO complains that the kernel image has the wrong magic number
  1008.  
  1009.   Older versions of MILO did not support the ELF object file format and
  1010.   so could not recognise an ELF image and this might be your problem.
  1011.   If this is reported, upgrade to the latest MILO that you can find.
  1012.   All 2.0.20 and beyond MILOs support ELF.  On the other hand it could
  1013.   be that the image is indeed damaged.  You should also note that MILO
  1014.   does not yet automatically distinquish between GZIP'd and non-GZIP'd
  1015.   images; you need to add the ".gz" suffix to the file name.
  1016.  
  1017.   MILO prints "...turning on virtual addressing and jumping to the Linux
  1018.   Kernel" and nothing else happens
  1019.  
  1020.   One obvious problem is that the kernel image is wrongly built or is
  1021.   built for another Alpha system altogether.  Another is that the video
  1022.   board is a TGA (Zlxp) device and the kernel has been built for a VGA
  1023.   device (or vice versa).  It is worth building the kernel to echo to
  1024.   COM1 and then connecting a terminal to that serial port or retrying
  1025.   the kernel that came with the Linux distribution that you installed.
  1026.  
  1027.   MILO does not recognise the SCSI device
  1028.  
  1029.   The standard MILO images include as many device drivers as are known
  1030.   to be stable for Alpha (as of now that includes the NCR 810, QLOGIC
  1031.   ISP, Buslogic and Adaptec 2940s and 3940 cards).  If your card is not
  1032.   included, it may be that the driver is not stable enough on an Alpha
  1033.   system yet.  Again, the latest MILO images are worth trying.  You can
  1034.   tell which SCSI devices a MILO image has built into it by using the
  1035.   "show" command.
  1036.  
  1037.   10.  Acknowledgements.
  1038.  
  1039.   I would like to thank:
  1040.  
  1041.   ╖  Eric Rasmussen and Eilleen Samberg the authors of the PALcode,
  1042.  
  1043.   ╖  Jim Paradis for the keyboard driver and the original MILO
  1044.      interface,
  1045.  
  1046.   ╖  Jay Estabrook for his help and bugfixes,
  1047.  
  1048.   ╖  David Mosberger-Tang for the freeware BIOS emulation and his
  1049.      support and encouragement,
  1050.  
  1051.   ╖  Last (and not least) Linus Torvalds for the timer code and his
  1052.      kernel.
  1053.  
  1054.   There are a number of things that still need doing to MILO, if you
  1055.   want to add something yourself, then do let me know
  1056.   david.rusling@reo.mts.dec.com <mailto:david.rusling@reo.mts.dec.com>
  1057.   so that we do not duplicate our efforts.
  1058.  
  1059.   Finally, a big thank you to Digital for producing such a wonderful
  1060.   chip (and paying me to do this).
  1061.  
  1062.