home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / KERNELS / LODLIN15.ZIP / LOADLIN / BOOTING.DOC < prev    next >
Encoding:
Text File  |  1994-08-28  |  5.3 KB  |  105 lines

  1.  
  2.   Some information on how booting of Linux happens
  3.   ================================================
  4.   (collected by lermen@elserv.ffm.fgan.de  as of Linux 1.1.47)
  5.  
  6.  
  7. 1.  The RAMDISK as a root device
  8.     ----------------------------
  9.  The RAMDISK cannot be set directly as root device (of course!)
  10.  But setting a FLOPPY as root device and configuring a RAMDISK (with
  11.  as much space as the floppy has) is used to generate the RAMDISK.
  12.  Then  rd_load() (in drivers/block/ramdisk.c) tries to load
  13.  the complete file system from the floppy. The file system on
  14.  the floppy must be MINIX, and if loading was successful, then
  15.  rd_load sets   ROOT_DEV = ((MEM_MAJOR << 8) | RAMDISK_MINOR).
  16.  
  17.  If you make a boot floppy by raw-writing the zImage to a floppy,
  18.  then no file system is on this floppy, therefore loading of the
  19.  file system fails and  ROOT_DEV  remains set for floppy. So, Linux
  20.  queries for a real floppy.  Be prepared for periodic syncs for the
  21.  floppy (update is running) and do NOT write-protect your floppy
  22.  or your screen will be filled up with kernel messages.
  23.  
  24.  However, with a trick you can boot with 2 floppies, one containing
  25.  the zImage (raw-written) and the other containing a valid filesystem.
  26.  If you configure Linux to ask for the video mode, then when that prompt
  27.  appears on the screen  all of the kernel has been read, so the
  28.  zImage floppy is no longer needed.  Replace it with the second floppy
  29.  and type ENTER or SPACE.
  30.  
  31.  This has the advantage that you can bypass the very complicated and
  32.  (for newbees) dangerous usage of LILO. (Don't use it before reading the
  33.  documentation completely; "FDISK /MBR"  cannot repair all damage).
  34.  
  35.  Using BOOTLIN (from F.Coutant), LOADLIN (from H.Lermen)  or
  36.  a raw-written zImage is much simpler and absolutely harmless.
  37.  It also has the advantage of more space on the floppy filesystem.
  38.  You can use "rdev" to change some params on your zImage file, or
  39.  better yet use LOADLIN's and Linux's (>0.99.14) command line feature.
  40.  
  41.  
  42. 2.  Layout of the first bytes of a zImage and the image in memory
  43.     at Linux boot:
  44.     --------------------------------------------------------------
  45.  
  46.  ------------|--------|-----------------------------------------------
  47.  file-offset | memory | comment
  48.  (hex)       |        |
  49.  ------------|--------|-----------------------------------------------
  50.              |  01000 | Swapper_pg_dir
  51.              |  02000 | pg0 , page 0
  52.              |  03000 | empty_bad_page
  53.              |  04000 | empty_bad_page_table
  54.              |  05000 | empty_zero_page
  55.              |        | Starting here, "head.s", the start32-code,
  56.              |        |  copies:
  57.              |        |   First 2Kb from 90000 to 05000
  58.              |        |   2Kb of command line to 05800
  59.              |        |   (see below: CL_OFFSET)
  60.              |        |  NOTE: Because this page is available only
  61.              |        |       during the first few steps of kernel
  62.              |        |       initialization, the kernel (main.c)
  63.              |        |       copies the command line to a static buffer
  64.              |        |       "command_line" of only 80 bytes!
  65.              |        |       You MUST patch it, if the resulting
  66.              |        |       command line size is greater or the
  67.              |        |       kernel will hang!  (>=1.0.5 is fixed)
  68.              |  10000 | Start of Linux kernel (boot/head.s)
  69.              |        |
  70.              |  7c000 | Here the BIOS normally loads a boot sector
  71.  0000 - 0200 |  90000 | Bootsector (512 bytes)
  72.              |        |
  73.              |        | Within this, BEFORE setup has run:
  74.  01F1 - WORD |  901f1 |   number of setup sectors
  75.  01F2 - WORD |  901f2 |   MOUNT_ROOT_RDONLY, =0 "rw" else "ro"
  76.  01F4 - WORD |  901f4 |   KERNEL size
  77.  01F6 - WORD |  901f6 |   SWAP device
  78.  01F8 - WORD |  901f8 |   RAM-DISK size
  79.  01FA - WORD |  901fa |   VGA-Mode
  80.              |        |         -3 = ask
  81.              |        |         -2 = Extended VGA
  82.              |        |         -1 = Normal VGA
  83.              |        |          0 = as "0" was entered
  84.              |        |          n = as "n" was entered
  85.  01FC - WORD |  901fc |   Root Device (high=Major, low=minor)
  86.  01FE - WORD |  901fe |   Bootsector magic (0x55aa)
  87.              |        |
  88.              |        | Within this, AFTER setup has run:
  89.              |  90000 |   Saved cursor position
  90.              |  90002 |   Extended memory size in Kb (from int 0x15)
  91.              |  90080 |   hd0-disk-parameter from intvector 0x41
  92.              |  90090 |   hd1-disk-parameter from intvector 0x46
  93.              |  90020 |   CL_MAGIC, WORD, commandline magic number (=0xA33F)
  94.              |  90022 |   CL_OFFSET, WORD, commandline offset
  95.              |        |   Address of commandline is calculated:
  96.              |        |    0x90000 + contents of 0x90022
  97.              |        |   The command line is parsed by "init/main.c"
  98.              |        |   Value of NAME=XXXX is put into the environment
  99.              |        |   and can then be interpreted by the drivers
  100.              |        |   and /etc/rc. The variable "root=xxxx" is
  101.              |        |   interpreted by main.c directly, "single" is
  102.              |        |   interpreted by init or simpleinit.
  103.  0200 - 09ff |  90200 | setup routine ( 2Kb )
  104.  
  105.