home *** CD-ROM | disk | FTP | other *** search
- This file describes the loading process of Linux used by BOOTLIN.
- People not interested in modifying the assembler source of BootLinux
- should not read this document (except those that are curious).
-
- Here are the steps of loading process:
- (1) clear screen, print system configuration and check for
- 386, 640K base memory and 1M extended memory.
- shrink the stack to lower the lowest address usable for loading
- the kernel.
- (2) parse options
- (3) try to open the image file. possibly ask a new name and retry(3).
- (4) load bootsector at 9000h:0; check for AA55h bootable flag at 9000h:1FEh
- (5) determine setup length, using the sector count found at offset 497 in
- the boot sector if present (or the default value of 4); load setup at
- 9020h:0
- (6) loads the kernel into memory. Two strategies are possible, depending
- on BOOTLIN loading address in the base memory:
- 0 1 2 3 4 5 6 7 8 9 A x 64K
- |------|------|------|------|------|------|------|------|------|------
- <-(a)-> ^-(c)
- <--------------------------(b)------------------------->
- (d)-^
- (c) is the loading zone of bootsector and setup. (length 8K)
- (d) is reserved for moving some part of BOOTLIN. (length 4K)
- BOOTLIN is approx. 6K, so the total reserved memory is 18K, and a
- kernel will be loadable if its size remains less than <free mem> - 18K.
-
- (6a) BOOTLIN is loaded in (a): the kernel is directly loaded in the
- part of memory it expects to be. If the kernel is more than 512K,
- the remaining part will be loaded between (c) and (d), then an
- error message will be issued (kernel more than 512K or not enough
- memory).
-
- (6b) BOOTLIN extends over (b) (this is mainly the case if BootLinux is run
- from the DOS command line): the kernel is loaded just after the stack
- of BOOTLIN, up to the end of (b). If more of the image is to be loaded,
- it is loaded between (c) and (d). If more is to be loaded, then there
- is not enough memory, and the corresponding message is issued.
- The space between (c) and (d) is 64-4-8=52K.
-
- (7) the bootsector is updated with informations provided on the command
- line via options, and the informations about LINUX are displayed.
-
- (8) checks for non-null root fs device number. If this is not the case,
- asks for it and redisplay LINUX informations.
-
- (9) run LINUX, depending on wether (6) was (6a) or (6b):
-
- (6a)->(9a) BOOTLIN redirects Int 15h (in case HIMEM.SYS is loaded), then
- merely jumps into the setup code.
-
- (6b)->(9b) the setup does a few things, then finally jumps into
- the kernel code, expecting it at address 1000h:0. This is
- obviously not the case here.
- The kernel code could be moved to its right address before
- jumping to the setup, but it would crash DOS programs and DOS
- itself, so it is not possible because the setup uses a few
- DOS/BIOS interrupts: int 11h, 13h, 15h and 16h. Int 13h may be
- redirected by a disk cache, and Int 15h is nearly always redirected
- by HIMEM.SYS.
- The solution is to wait the call to the last interrupt to move
- the kernel code to its right place. After the move, interrupts must
- be disabled (cli) to avoid a possible call to Int 8 (timer) that would
- crash the computer.
- This is done by moving the appropriate BOOTLIN move code in zone
- (d), and redirecting int 13h and int 15h to this code.
- To handle correctly linux v1.1, int 11h is also redirected and
- emulated; it is actually the last int called, but this way int 13h
- can still be considered the last, and the one that must do the hard
- job.
- In fact, it is int 13h that can be considered called the last, but
- int 15h has to be redirected in every case, since the possible presence
- of HIMEM.SYS would make Int 15h report a false value of the
- available extended memory. The real value is always fetched by
- BOOTLIN in the CMOS, for its own use first, then to supply to
- the setup when it needs it.
- Linux 1.1's setup also calls int 13h twice with the same parameters,
- the first being a dummy one ("Bootlin needs this to be done early" !).
- Some code has added to check that int 13h will do its job only if the
- int 15h has already been called.
-
- NOTE that (9b) operations depend closely on the setup calling given
- interrupts in a given order with given parameters in the registers.
- A change of these dependencies in the setup would imply:
- (1) changes in BootLinux, possibly major.
- (2) nearly sure incompatibility with previous versions.
-
- NOTE the setup changed in linux v1.1, but BootLinux could be adapted to it
- and remains compatible with previous versions.
-
-