Debian Codegraph @

doc/multiboot.html

raw
1 <HTML>
2
3 <HEAD>
4 <TITLE>Multiboot Standard</TITLE>
5 </HEAD>
6
7 <BODY>
8
9 <CENTER><H1>Multiboot Standard</H1></CENTER>
10 <CENTER><H3>Version 0.6</H3></CENTER>
11
12 <HR>
13
14 <H2>Contents</H2>
15
16 <UL>
17 <LI> <A HREF="#motivation">Motivation</A>
18 <LI> <A HREF="#terminology">Terminology</A>
19 <LI> <A HREF="#scope">Scope and Requirements</A>
20 <LI> <A HREF="#details">Details</A>
21 <LI> <A HREF="#author">Authors</A>
22 <LI> <B>NOTE: The following items are not part of the standards document,
23 but are included for prospective OS and bootloader writers.</B>
24 <LI> <A HREF="#notes">Notes on PCs</A>
25 <LI> <A HREF="#example_os">Example OS Code</A>
26 <LI> <A HREF="#example_boot">Example Bootloader Code</A>
27 </UL>
28
29 <HR>
30
31 <H2><A NAME="motivation">Motivation</A></H2>
32
33 Every OS ever created tends to have its own boot loader. Installing a new
34 OS on a machine generally involves installing a whole new set of boot
35 mechanisms, each with completely different install-time and boot-time user
36 interfaces. Getting multiple operating systems to coexist reliably on one
37 machine through typical "chaining" mechanisms can be a nightmare. There is
38 little or no choice of boot loaders for a particular operating system - if
39 the one that comes with the OS doesn't do exactly what you want, or doesn't
40 work on your machine, you're screwed.<P>
41
42 While we may not be able to fix this problem in existing commercial
43 operating systems, it shouldn't be too difficult for a few people in the
44 free OS communities to put their heads together and solve this problem for
45 the popular free operating systems. That's what this standard aims for.
46 Basically, it specifies an interface between a boot loader and a operating
47 system, such that any complying boot loader should be able to load any
48 complying operating system. This standard does NOT specify how boot
49 loaders should work - only how they must interface with the OS being
50 loaded.<P>
51
52 <HR>
53
54 <H2><A NAME="terminology">Terminology</A></H2>
55
56 Throughout this document, the term "boot loader" means whatever program or
57 set of programs loads the image of the final operating system to be run on
58 the machine. The boot loader may itself consist of several stages, but
59 that is an implementation detail not relevant to this standard. Only the
60 "final" stage of the boot loader - the stage that eventually transfers
61 control to the OS - needs to follow the rules specified in this document
62 in order to be "MultiBoot compliant"; earlier boot loader stages can be
63 designed in whatever way is most convenient.<P>
64
65 The term "OS image" is used to refer to the initial binary image that the
66 boot loader loads into memory and transfers control to to start the OS.
67 The OS image is typically an executable containing the OS kernel.<P>
68
69 The term "boot module" refers to other auxiliary files that the boot loader
70 loads into memory along with the OS image, but does not interpret in any
71 way other than passing their locations to the OS when it is invoked.<P>
72
73 <HR>
74
75 <H2><A NAME="scope">Scope and Requirements</A></H2>
76
77 <H3>Architectures</H3>
78
79 This standard is primarily targetted at PC's, since they are the most
80 common and have the largest variety of OS's and boot loaders. However, to
81 the extent that certain other architectures may need a boot standard and do
82 not have one already, a variation of this standard, stripped of the
83 x86-specific details, could be adopted for them as well.<P>
84
85 <H3>Operating systems</H3>
86
87 This standard is targetted toward free 32-bit operating systems that can be
88 fairly easily modified to support the standard without going through lots of
89 bureaucratic rigmarole. The particular free OS's that this standard is
90 being primarily designed for are Linux, FreeBSD, NetBSD, Mach, and VSTa.
91 It is hoped that other emerging free OS's will adopt it from the start, and
92 thus immediately be able to take advantage of existing boot loaders. It
93 would be nice if commercial operating system vendors eventually adopted
94 this standard as well, but that's probably a pipe dream.<P>
95
96 <H3>Boot sources</H3>
97
98 It should be possible to write compliant boot loaders that
99 load the OS image from a variety of sources, including floppy disk, hard
100 disk, and across a network.<P>
101
102 Disk-based boot loaders may use a variety of techniques to find the
103 relevant OS image and boot module data on disk, such as by interpretation
104 of specific file systems (e.g. the BSD/Mach boot loader), using
105 precalculated "block lists" (e.g. LILO), loading from a special "boot
106 partition" (e.g. OS/2), or even loading from within another operating
107 system (e.g. the VSTa boot code, which loads from DOS). Similarly,
108 network-based boot loaders could use a variety of network hardware and
109 protocols.<P>
110
111 It is hoped that boot loaders will be created that support multiple loading
112 mechanisms, increasing their portability, robustness, and
113 user-friendliness.<P>
114
115 <H3>Boot-time configuration</H3>
116
117 It is often necessary for one reason or another for the user to be able to
118 provide some configuration information to the OS dynamically at boot time.
119 While this standard should not dictate how this configuration information
120 is obtained by the boot loader, it should provide a standard means for the
121 boot loader to pass such information to the OS.<P>
122
123 <H3>Convenience to the OS</H3>
124
125 OS images should be easy to generate. Ideally, an OS image should simply
126 be an ordinary 32-bit executable file in whatever file format the OS
127 normally uses. It should be possible to 'nm' or disassemble OS images just
128 like normal executables. Specialized tools should not be needed to create
129 OS images in a "special" file format. If this means shifting some work
130 from the OS to the boot loader, that is probably appropriate, because all
131 the memory consumed by the boot loader will typically be made available
132 again after the boot process is created, whereas every bit of code in the
133 OS image typically has to remain in memory forever. The OS should not have
134 to worry about getting into 32-bit mode initially, because mode switching
135 code generally needs to be in the boot loader anyway in order to load OS
136 data above the 1MB boundary, and forcing the OS to do this makes creation
137 of OS images much more difficult.<P>
138
139 Unfortunately, there is a horrendous variety of executable file formats
140 even among free Unix-like PC-based OS's - generally a different format for
141 each OS. Most of the relevant free OS's use some variant of a.out format,
142 but some are moving to ELF. It is highly desirable for boot loaders not to
143 have to be able to interpret all the different types of executable file
144 formats in existence in order to load the OS image - otherwise the boot
145 loader effectively becomes OS-specific again.<P>
146
147 This standard adopts a compromise solution to this problem.
148 MultiBoot compliant boot images always either (a) are in ELF format, or (b)
149 contain a "magic MultiBoot header", described below, which allows the boot
150 loader to load the image without having to understand numerous a.out
151 variants or other executable formats. This magic header does not need
152 to be at the very beginning of the executable file, so kernel images can
153 still conform to the local a.out format variant in addition to being
154 MultiBoot compliant.<P>
155
156 <H3>Boot modules</H3>
157
158 Many modern operating system kernels, such as those of VSTa and Mach, do
159 not by themselves contain enough mechanism to get the system fully
160 operational: they require the presence of additional software modules at
161 boot time in order to access devices, mount file systems, etc. While these
162 additional modules could be embedded in the main OS image along with the
163 kernel itself, and the resulting image be split apart manually by the OS
164 when it receives control, it is often more flexible, more space-efficient,
165 and more convenient to the OS and user if the boot loader can load these
166 additional modules independently in the first place.<P>
167
168 Thus, this standard should provide a standard method for a boot loader to
169 indicate to the OS what auxiliary boot modules were loaded, and where they
170 can be found. Boot loaders don't have to support multiple boot modules,
171 but they are strongly encouraged to, because some OS's will be unable to
172 boot without them.<P>
173
174 <HR>
175
176 <H2><A NAME="details">Details</H2>
177
178 There are three main aspects of the boot-loader/OS image interface this
179 standard must specify:<P>
180
181 <UL>
182 <LI>The format of the OS image as seen by the boot loader.
183 <LI>The state of the machine when the boot loader starts the OS.
184 <LI>The format of the information passed by the boot loader to the OS.
185 </UL>
186
187 <H3>OS Image Format</H3>
188
189 An OS image is generally just an ordinary 32-bit executable file in the
190 standard format for that particular OS, except that it may be linked at a
191 non-default load address to avoid loading on top of the PC's I/O region
192 or other reserved areas, and of course it can't use shared libraries or
193 other fancy features. Initially, only images in a.out format are
194 supported; ELF support will probably later be specified in the standard.<P>
195
196 Unfortunately, the exact meaning of the text, data, bss, and entry fields
197 of a.out headers tends to vary widely between different executable flavors,
198 and it is sometimes very difficult to distinguish one flavor from another
199 (e.g. Linux ZMAGIC executables and Mach ZMAGIC executables). Furthermore,
200 there is no simple, reliable way of determining at what address in memory
201 the text segment is supposed to start. Therefore, this standard requires
202 that an additional header, known as a 'multiboot_header', appear somewhere
203 near the beginning of the executable file. In general it should come "as
204 early as possible", and is typically embedded in the beginning of the text
205 segment after the "real" executable header. It _must_ be contained
206 completely within the first 8192 bytes of the executable file, and must be
207 longword (32-bit) aligned. These rules allow the boot loader to find and
208 synchronize with the text segment in the a.out file without knowing
209 beforehand the details of the a.out variant. The layout of the header is
210 as follows:<P>
211
212 <pre>
213 +-------------------+
214 0 | magic: 0x1BADB002 | (required)
215 4 | flags | (required)
216 8 | checksum | (required)
217 +-------------------+
218 8 | header_addr | (present if flags[16] is set)
219 12 | load_addr | (present if flags[16] is set)
220 16 | load_end_addr | (present if flags[16] is set)
221 20 | bss_end_addr | (present if flags[16] is set)
222 24 | entry_addr | (present if flags[16] is set)
223 +-------------------+
224 </pre>
225
226 All fields are in little-endian byte order, of course. The first field is
227 the magic number identifying the header, which must be the hex value
228 0x1BADB002.<P>
229
230 The flags field specifies features that the OS image requests or requires
231 of the boot loader. Bits 0-15 indicate requirements; if the boot loader
232 sees any of these bits set but doesn't understand the flag or can't fulfill
233 the requirements it indicates for some reason, it must notify the user and
234 fail to load the OS image. Bits 16-31 indicate optional features; if any
235 bits in this range are set but the boot loader doesn't understand them, it
236 can simply ignore them and proceed as usual. Naturally, all
237 as-yet-undefined bits in the flags word must be set to zero in OS
238 images. This way, the flags fields serves for version control as well as
239 simple feature selection.<P>
240
241 If bit 0 in the flags word is set, then all boot modules loaded along with
242 the OS must be aligned on page (4KB) boundaries. Some OS's expect to be
243 able to map the pages containing boot modules directly into a paged address
244 space during startup, and thus need the boot modules to be page-aligned.<P>
245
246 If bit 1 in the flags word is set, then information on available memory
247 via at least the 'mem_*' fields of the multiboot_info structure defined
248 below must be included. If the bootloader is capable of passing a memory
249 map (the 'mmap_*' fields) and one exists, then it must be included as
250 well.<P>
251
252 If bit 16 in the flags word is set, then the fields at offsets 8-24 in the
253 multiboot_header are valid, and the boot loader should use them instead of
254 the fields in the actual executable header to calculate where to load the
255 OS image. This information does not need to be provided if the kernel
256 image is in ELF format, but it should be provided if the images is in a.out
257 format or in some other format. Compliant boot loaders must be able to
258 load images that either are in ELF format or contain the load address
259 information embedded in the multiboot_header; they may also directly
260 support other executable formats, such as particular a.out variants, but
261 are not required to.<P>
262
263 All of the address fields enabled by flag bit 16 are physical addresses.
264 The meaning of each is as follows:<P>
265
266 <UL>
267 <LI><B>header_addr</B> -- Contains the address corresponding to the
268 beginning of the multiboot_header - the physical memory location at which
269 the magic value is supposed to be loaded. This field serves to "synchronize"
270 the mapping between OS image offsets and physical memory addresses.
271 <LI><B>load_addr</B> -- Contains the physical address of the beginning
272 of the text segment. The offset in the OS image file at which to start
273 loading is defined by the offset at which the header was found, minus
274 (header_addr - load_addr). load_addr must be less than or equal to
275 header_addr.
276 <LI><B>load_end_addr</B> -- Contains the physical address of the end of the
277 data segment. (load_end_addr - load_addr) specifies how much data to load.
278 This implies that the text and data segments must be consecutive in the
279 OS image; this is true for existing a.out executable formats.
280 <LI><B>bss_end_addr</B> -- Contains the physical address of the end of
281 the bss segment. The boot loader initializes this area to zero, and
282 reserves the memory it occupies to avoid placing boot modules and other
283 data relevant to the OS in that area.
284 <LI><B>entry</B> -- The physical address to which the boot loader should
285 jump in order to start running the OS.
286 </UL>
287
288 The checksum is a 32-bit unsigned value which, when added to
289 the other required fields, must have a 32-bit unsigned sum of zero.<P>
290
291 <H3>Machine State</H3>
292
293 When the boot loader invokes the 32-bit operating system,
294 the machine must have the following state:<P>
295
296 <UL>
297 <LI>CS must be a 32-bit read/execute code segment with an offset of 0
298 and a limit of 0xffffffff.
299 <LI>DS, ES, FS, GS, and SS must be a 32-bit read/write data segment with
300 an offset of 0 and a limit of 0xffffffff.
301 <LI>The address 20 line must be usable for standard linear 32-bit
302 addressing of memory (in standard PC hardware, it is wired to
303 0 at bootup, forcing addresses in the 1-2 MB range to be mapped to the
304 0-1 MB range, 3-4 is mapped to 2-3, etc.).
305 <LI>Paging must be turned off.
306 <LI>The processor interrupt flag must be turned off.
307 <LI>EAX must contain the magic value 0x2BADB002; the presence of this value
308 indicates to the OS that it was loaded by a MultiBoot-compliant boot
309 loader (e.g. as opposed to another type of boot loader that the OS can
310 also be loaded from).
311 <LI>EBX must contain the 32-bit physical address of the multiboot_info
312 structure provided by the boot loader (see below).
313 </UL>
314
315 All other processor registers and flag bits are undefined. This includes,
316 in particular:<P>
317
318 <UL>
319 <LI>ESP: the 32-bit OS must create its own stack as soon as it needs one.
320 <LI>GDTR: Even though the segment registers are set up as described above,
321 the GDTR may be invalid, so the OS must not load any segment registers
322 (even just reloading the same values!) until it sets up its own GDT.
323 <LI>IDTR: The OS must leave interrupts disabled until it sets up its own IDT.
324 </UL>
325
326 However, other machine state should be left by the boot loader in "normal
327 working order", i.e. as initialized by the BIOS (or DOS, if that's what
328 the boot loader runs from). In other words, the OS should be able to make
329 BIOS calls and such after being loaded, as long as it does not overwrite
330 the BIOS data structures before doing so. Also, the boot loader must leave
331 the PIC programmed with the normal BIOS/DOS values, even if it changed them
332 during the switch to 32-bit mode.<P>
333
334 <H3>Boot Information Format</H3>
335
336 Upon entry to the OS, the EBX register contains the physical address of
337 a 'multiboot_info' data structure, through which the boot loader
338 communicates vital information to the OS. The OS can use or ignore any
339 parts of the structure as it chooses; all information passed by the boot
340 loader is advisory only.<P>
341
342 The multiboot_info structure and its related substructures may be placed
343 anywhere in memory by the boot loader (with the exception of the memory
344 reserved for the kernel and boot modules, of course). It is the OS's
345 responsibility to avoid overwriting this memory until it is done using it.<P>
346
347 The format of the multiboot_info structure (as defined so far) follows:<P>
348
349 <pre>
350 +-------------------+
351 0 | flags | (required)
352 +-------------------+
353 4 | mem_lower | (present if flags[0] is set)
354 8 | mem_upper | (present if flags[0] is set)
355 +-------------------+
356 12 | boot_device | (present if flags[1] is set)
357 +-------------------+
358 16 | cmdline | (present if flags[2] is set)
359 +-------------------+
360 20 | mods_count | (present if flags[3] is set)
361 24 | mods_addr | (present if flags[3] is set)
362 +-------------------+
363 28 - 40 | syms | (present if flags[4] or flags[5] is set)
364 +-------------------+
365 44 | mmap_length | (present if flags[6] is set)
366 48 | mmap_addr | (present if flags[6] is set)
367 +-------------------+
368 </pre>
369
370 The first longword indicates the presence and validity of other fields in
371 the multiboot_info structure. All as-yet-undefined bits must be set to
372 zero by the boot loader. Any set bits that the OS does not understand
373 should be ignored. Thus, the flags field also functions as a version
374 indicator, allowing the multiboot_info structure to be expanded in the
375 future without breaking anything.<P>
376
377 If bit 0 in the multiboot_info.flags word is set, then the 'mem_*' fields
378 are valid. 'mem_lower' and 'mem_upper' indicate the amount of lower and upper
379 memory, respectively, in kilobytes. Lower memory starts at address 0, and
380 upper memory starts at address 1 megabyte. The maximum possible
381 value for lower memory is 640 kilobytes. The value returned for upper
382 memory is maximally the address of the first upper memory hole minus
383 1 megabyte. It is not guaranteed to be this value.<P>
384
385 If bit 1 in the multiboot_info.flags word is set, then the 'boot_device'
386 field is valid, and indicates which BIOS disk device the boot loader loaded
387 the OS from. If the OS was not loaded from a BIOS disk, then this field
388 must not be present (bit 3 must be clear). The OS may use this field as a
389 hint for determining its own "root" device, but is not required to. The
390 boot_device field is layed out in four one-byte subfields as follows:<P>
391
392 <pre>
393 +-------+-------+-------+-------+
394 | drive | part1 | part2 | part3 |
395 +-------+-------+-------+-------+
396 </pre>
397
398 The first byte contains the BIOS drive number as understood by the BIOS
399 INT 0x13 low-level disk interface: e.g. 0x00 for the first floppy disk or
400 0x80 for the first hard disk.<P>
401
402 The three remaining bytes specify the boot partition. 'part1' specifies
403 the "top-level" partition number, 'part2' specifies a "sub-partition" in
404 the top-level partition, etc. Partition numbers always start from zero.
405 Unused partition bytes must be set to 0xFF. For example, if the disk is
406 partitioned using a simple one-level DOS partitioning scheme, then 'part1'
407 contains the DOS partition number, and 'part2' and 'part3' are both zero.
408 As another example, if a disk is partitioned first into DOS partitions, and
409 then one of those DOS partitions is subdivided into several BSD partitions
410 using BSD's "disklabel" strategy, then 'part1' contains the DOS partition
411 number, 'part2' contains the BSD sub-partition within that DOS partition,
412 and 'part3' is 0xFF.<P>
413
414 DOS extended partitions are indicated as partition numbers starting from 4
415 and increasing, rather than as nested sub-partitions, even though the
416 underlying disk layout of extended partitions is hierarchical in nature.
417 For example, if the boot loader boots from the second extended partition
418 on a disk partitioned in conventional DOS style, then 'part1' will be 5,
419 and 'part2' and 'part3' will both be 0xFF.<P>
420
421 If bit 2 of the flags longword is set, the 'cmdline' field is valid, and
422 contains the physical address of the the command line to be passed to the
423 kernel. The command line is a normal C-style null-terminated string.<P>
424
425 If bit 3 of the flags is set, then the 'mods' fields indicate to the kernel
426 what boot modules were loaded along with the kernel image, and where they
427 can be found. 'mods_count' contains the number of modules loaded;
428 'mods_addr' contains the physical address of the first module structure.
429 'mods_count' may be zero, indicating no boot modules were loaded, even if
430 bit 1 of 'flags' is set. Each module structure is formatted as follows:<P>
431
432 <pre>
433 +-------------------+
434 0 | mod_start |
435 4 | mod_end |
436 +-------------------+
437 8 | string |
438 +-------------------+
439 12 | reserved (0) |
440 +-------------------+
441 </pre>
442
443 The first two fields contain the start and end addresses of the boot module
444 itself. The 'string' field provides an arbitrary string to be associated
445 with that particular boot module; it is a null-terminated ASCII string,
446 just like the kernel command line. The 'string' field may be 0 if there is
447 no string associated with the module. Typically the string might be a
448 command line (e.g. if the OS treats boot modules as executable programs),
449 or a pathname (e.g. if the OS treats boot modules as files in a file
450 system), but its exact use is specific to the OS. The 'reserved' field
451 must be set to 0 by the boot loader and ignored by the OS.<P>
452
453 NOTE: Bits 4 & 5 are mutually exclusive.<P>
454
455 If bit 4 in the multiboot_info.flags word is set, then the following
456 fields in the multiboot_info structure starting at byte 28 are valid:<P>
457
458 <pre>
459 +-------------------+
460 28 | tabsize |
461 32 | strsize |
462 36 | addr |
463 40 | reserved (0) |
464 +-------------------+
465 </pre>
466
467 These indicate where the symbol table from an a.out kernel image can be
468 found. 'addr' is the physical address of the size (4-byte unsigned
469 long) of an array of a.out-format 'nlist' structures, followed immediately
470 by the array itself, then the size (4-byte unsigned long) of a set of
471 null-terminated ASCII strings (plus sizeof(unsigned long) in this case),
472 and finally the set of strings itself. 'tabsize' is equal to it's size
473 parameter (found at the beginning of the symbol section), and 'strsize'
474 is equal to it's size parameter (found at the beginning of the string section)
475 of the following string table to which the symbol table refers. Note that
476 'tabsize' may be 0, indicating no symbols, even if bit 4 in the flags
477 word is set.<P>
478
479 If bit 5 in the multiboot_info.flags word is set, then the following
480 fields in the multiboot_info structure starting at byte 28 are valid:<P>
481
482 <pre>
483 +-------------------+
484 28 | num |
485 32 | size |
486 36 | addr |
487 40 | shndx |
488 +-------------------+
489 </pre>
490
491 These indicate where the section header table from an ELF kernel is, the
492 size of each entry, number of entries, and the string table used as the
493 index of names. They correspond to the 'shdr_*' entries ('shdr_num', etc.)
494 in the Executable and Linkable Format (ELF) specification in the program
495 header. All sections are loaded, and the physical address fields
496 of the elf section header then refer to where the sections are in memory
497 (refer to the i386 ELF documentation for details as to how to read the
498 section header(s)). Note that 'shdr_num' may be 0, indicating no symbols,
499 even if bit 5 in the flags word is set.<P>
500
501 If bit 6 in the multiboot_info.flags word is set, then the 'mmap_*' fields
502 are valid, and indicate the address and length of a buffer containing a
503 memory map of the machine provided by the BIOS. 'mmap_addr' is the address,
504 and 'mmap_length' is the total size of the buffer. The buffer consists of
505 one or more of the following size/structure pairs ('size' is really used
506 for skipping to the next pair):<P>
507
508 <pre>
509 +-------------------+
510 -4 | size |
511 +-------------------+
512 0 | BaseAddrLow |
513 4 | BaseAddrHigh |
514 8 | LengthLow |
515 12 | LengthHigh |
516 16 | Type |
517 +-------------------+
518 </pre>
519
520 where 'size' is the size of the associated structure in bytes, which can
521 be greater than the minimum of 20 bytes. 'BaseAddrLow' is the lower 32
522 bits of the starting address, and 'BaseAddrHigh' is the upper 32 bits,
523 for a total of a 64-bit starting address. 'LengthLow' is the lower 32 bits
524 of the size of the memory region in bytes, and 'LengthHigh' is the upper 32
525 bits, for a total of a 64-bit length. 'Type' is the variety of address
526 range represented, where a value of 1 indicates available RAM, and all
527 other values currently indicated a reserved area.<P>
528
529 The map provided is guaranteed to list all standard RAM that should
530 be available for normal use.<P>
531
532 <HR>
533
534 <H2><A NAME="author">Authors</A></H2>
535
536 <pre>
537 Bryan Ford
538 Computer Systems Laboratory
539 University of Utah
540 Salt Lake City, UT 84112
541 (801) 581-4280
542 [email protected]
543
544 Erich Stefan Boleyn
545 924 S.W. 16th Ave, #202
546 Portland, OR, USA 97205
547 (503) 226-0741
548 [email protected]
549 </pre>
550
551 We would also like to thank the many other people have provided comments,
552 ideas, information, and other forms of support for our work.<P>
553
554 <H3>Revision History</H3>
555
556 <pre>
557 Version 0.6 3/29/96 (a few wording changes, header checksum, and
558 clarification of machine state passed to the OS)
559 Version 0.5 2/23/96 (name change)
560 Version 0.4 2/1/96 (major changes plus HTMLification)
561 Version 0.3 12/23/95
562 Version 0.2 10/22/95
563 Version 0.1 6/26/95
564 </pre>
565
566 <HR>
567
568 <H2><A NAME="notes">Notes on PCs</A></H2>
569
570 In reference to bit 0 of the multiboot_info.flags parameter,
571 if the bootloader
572 in question uses older BIOS interfaces, or the newest ones are not
573 available (see description about bit 6), then a maximum of either
574 15 or 63 megabytes of memory may be reported. It is HIGHLY recommended
575 that bootloaders perform a thorough memory probe.<P>
576
577 In reference to bit 1 of the multiboot_info.flags parameter, it is
578 recognized that determination of which BIOS drive maps to which
579 OS-level device-driver is non-trivial, at best. Many kludges have
580 been made to various OSes instead of solving this problem, most of
581 them breaking under many conditions. To encourage the use of
582 general-purpose solutions to this problem, here are 2
583 <A HREF=bios_mapping.txt>BIOS Device Mapping Techniques</A>.<P>
584
585 In reference to bit 6 of the multiboot_info.flags parameter, it is
586 important to note that the data structure used there
587 (starting with 'BaseAddrLow') is the data returned by the
588 <A HREF=mem64mb.html>INT 15h, AX=E820h
589 - Query System Address Map</A> call. More information
590 on reserved memory regions is defined on that web page.
591 The interface here is meant to allow a bootloader to
592 work unmodified with any reasonable extensions of the BIOS interface,
593 passing along any extra data to be interpreted by the OS as desired.<P>
594
595 <HR>
596
597 <H2><A NAME="example_os">Example OS Code</A> (from Bryan Ford)</H2>
598
599 EDITOR'S NOTE: These examples are relevant to the Proposal version 0.5,
600 which is basically identical except for the multiboot OS header, which was
601 missing the checksum. A patch to bring Mach4 UK22 up to version 0.6 is
602 available in the GRUB FTP area mentioned in the
603 <A HREF="#example_boot">Example Bootloader Code</A> section below.<P>
604
605 The Mach 4 distribution, available by anonymous FTP from
606 flux.cs.utah.edu:/flux, contains a C header file that defines the
607 MultiBoot data structures described above; anyone is welcome to rip it
608 out and use it for other boot loaders and OS's:<P>
609
610 <pre>
611 mach4-i386/include/mach/machine/multiboot.h
612 </pre>
613
614 This distribution also contains code implementing a "Linux boot adaptor",
615 which collects a MultiBoot-compliant OS image and an optional set of boot
616 modules, compresses them, and packages them into a single traditional Linux
617 boot image that can be loaded from LILO or other Linux boot loaders. There
618 is also a corresponding "BSD boot adaptor" which can be used to wrap a
619 MultiBoot kernel and set of modules and produce an image that can be loaded
620 from the FreeBSD and NetBSD boot loaders. All of this code can be used as-is
621 or as a basis for other boot loaders. These are the directories of primary
622 relevance:<P>
623
624 <pre>
625 mach4-i386/boot
626 mach4-i386/boot/bsd
627 mach4-i386/boot/linux
628 </pre>
629
630 The Mach kernel itself in this distribution contains code that demonstrates
631 how to create a compliant OS. The following files are of primary
632 relevance:<P>
633
634 <pre>
635 mach4-i386/kernel/i386at/boothdr.S
636 mach4-i386/kernel/i386at/model_dep.c
637 </pre>
638
639 Finally, I have created patches against the Linux 1.2.2 and FreeBSD 2.0
640 kernels, in order to make them compliant with this proposed standard.
641 These patches are available in kahlua.cs.utah.edu:/private/boot.<P>
642
643 <HR>
644
645 <H2><A NAME"example_boot">Example Bootloader Code</A> (from Erich Boleyn)</H2>
646
647 The <A HREF=http://www.uruk.org/grub/>GRUB</A> bootloader project
648 will be fully
649 Multiboot-compliant, supporting all required and optional
650 features present in this standard.<P>
651
652 A final release has not been made, but both the GRUB beta release
653 (which is quite stable) and a patch for Multiboot version 0.6 for
654 Mach4 UK22 are available in the GRUB
655 <A HREF=ftp://ftp.uruk.org/public/grub/>public release</A>
656 area.<P>
657
658 <HR>
659
660 <A HREF=mailto:[email protected]><I>[email protected]</I></A><P>
661
662 </BODY>
663 </HTML>
664