home *** CD-ROM | disk | FTP | other *** search
-
- Some information on how booting of Linux happens
- ================================================
- (collected by lermen@elserv.ffm.fgan.de as of Linux 1.1.47)
-
-
- 1. The RAMDISK as a root device
- ----------------------------
- The RAMDISK cannot be set directly as root device (of course!)
- But setting a FLOPPY as root device and configuring a RAMDISK (with
- as much space as the floppy has) is used to generate the RAMDISK.
- Then rd_load() (in drivers/block/ramdisk.c) tries to load
- the complete file system from the floppy. The file system on
- the floppy must be MINIX, and if loading was successful, then
- rd_load sets ROOT_DEV = ((MEM_MAJOR << 8) | RAMDISK_MINOR).
-
- If you make a boot floppy by raw-writing the zImage to a floppy,
- then no file system is on this floppy, therefore loading of the
- file system fails and ROOT_DEV remains set for floppy. So, Linux
- queries for a real floppy. Be prepared for periodic syncs for the
- floppy (update is running) and do NOT write-protect your floppy
- or your screen will be filled up with kernel messages.
-
- However, with a trick you can boot with 2 floppies, one containing
- the zImage (raw-written) and the other containing a valid filesystem.
- If you configure Linux to ask for the video mode, then when that prompt
- appears on the screen all of the kernel has been read, so the
- zImage floppy is no longer needed. Replace it with the second floppy
- and type ENTER or SPACE.
-
- This has the advantage that you can bypass the very complicated and
- (for newbees) dangerous usage of LILO. (Don't use it before reading the
- documentation completely; "FDISK /MBR" cannot repair all damage).
-
- Using BOOTLIN (from F.Coutant), LOADLIN (from H.Lermen) or
- a raw-written zImage is much simpler and absolutely harmless.
- It also has the advantage of more space on the floppy filesystem.
- You can use "rdev" to change some params on your zImage file, or
- better yet use LOADLIN's and Linux's (>0.99.14) command line feature.
-
-
- 2. Layout of the first bytes of a zImage and the image in memory
- at Linux boot:
- --------------------------------------------------------------
-
- ------------|--------|-----------------------------------------------
- file-offset | memory | comment
- (hex) | |
- ------------|--------|-----------------------------------------------
- | 01000 | Swapper_pg_dir
- | 02000 | pg0 , page 0
- | 03000 | empty_bad_page
- | 04000 | empty_bad_page_table
- | 05000 | empty_zero_page
- | | Starting here, "head.s", the start32-code,
- | | copies:
- | | First 2Kb from 90000 to 05000
- | | 2Kb of command line to 05800
- | | (see below: CL_OFFSET)
- | | NOTE: Because this page is available only
- | | during the first few steps of kernel
- | | initialization, the kernel (main.c)
- | | copies the command line to a static buffer
- | | "command_line" of only 80 bytes!
- | | You MUST patch it, if the resulting
- | | command line size is greater or the
- | | kernel will hang! (>=1.0.5 is fixed)
- | 10000 | Start of Linux kernel (boot/head.s)
- | |
- | 7c000 | Here the BIOS normally loads a boot sector
- 0000 - 0200 | 90000 | Bootsector (512 bytes)
- | |
- | | Within this, BEFORE setup has run:
- 01F1 - WORD | 901f1 | number of setup sectors
- 01F2 - WORD | 901f2 | MOUNT_ROOT_RDONLY, =0 "rw" else "ro"
- 01F4 - WORD | 901f4 | KERNEL size
- 01F6 - WORD | 901f6 | SWAP device
- 01F8 - WORD | 901f8 | RAM-DISK size
- 01FA - WORD | 901fa | VGA-Mode
- | | -3 = ask
- | | -2 = Extended VGA
- | | -1 = Normal VGA
- | | 0 = as "0" was entered
- | | n = as "n" was entered
- 01FC - WORD | 901fc | Root Device (high=Major, low=minor)
- 01FE - WORD | 901fe | Bootsector magic (0x55aa)
- | |
- | | Within this, AFTER setup has run:
- | 90000 | Saved cursor position
- | 90002 | Extended memory size in Kb (from int 0x15)
- | 90080 | hd0-disk-parameter from intvector 0x41
- | 90090 | hd1-disk-parameter from intvector 0x46
- | 90020 | CL_MAGIC, WORD, commandline magic number (=0xA33F)
- | 90022 | CL_OFFSET, WORD, commandline offset
- | | Address of commandline is calculated:
- | | 0x90000 + contents of 0x90022
- | | The command line is parsed by "init/main.c"
- | | Value of NAME=XXXX is put into the environment
- | | and can then be interpreted by the drivers
- | | and /etc/rc. The variable "root=xxxx" is
- | | interpreted by main.c directly, "single" is
- | | interpreted by init or simpleinit.
- 0200 - 09ff | 90200 | setup routine ( 2Kb )
-