Skip to content

Commit c2a0fe9

Browse files
committed
removed confusing old README information
1 parent c2288e6 commit c2a0fe9

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

README.md

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ used in a Multiboot2-kernel.
1010

1111
It follows the Multiboot 2.0 specification at https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html and the ELF 64 specification at http://www.uclibc.org/docs/elf-64-gen.pdf.
1212

13-
Below is the draft for a blog post about this. I don't plan to finish it but maybe it's helpful as documentation.
14-
15-
## The Multiboot 2 Information Structure
13+
## Background: The Multiboot 2 Information Structure
1614
The Multiboot information structure looks like this:
1715

1816
Field | Type
@@ -30,46 +28,7 @@ type | u32
3028
size | u32
3129
other fields | variable
3230

33-
All tags are 8-byte aligned. The last tag must be the _end tag_, which is a tag of type `0` and size `8`.
34-
35-
## Tags
36-
37-
We are interested in two tags, the _Elf-symbols_ tag and the _memory map_ tag. For a full list of possible tags see section 3.4 in the Multiboot 2 specification ([PDF][Multiboot 2]).
38-
39-
[Multiboot 2]: http://nongnu.askapache.com/grub/phcoder/multiboot.pdf
40-
41-
### The Elf-Symbols Tag
42-
The Elf-symbols tag contains a list of all sections of the loaded [ELF] kernel. It has the following format:
43-
44-
[ELF]: http://www.uclibc.org/docs/elf-64-gen.pdf
45-
46-
Field | Type
47-
--------------------------- | -----------------
48-
type = 9 | u32
49-
size | u32
50-
number of entries | u32
51-
entry size | u32
52-
string table | u32
53-
section headers | variable
54-
55-
Note that this format differs from the description in the Multiboot specification because it seems to be wrong for ELF 64 kernels: The `number of entries`, `entry size`, and `string table` fields seem to be `u32` instead of `u16`. The `multiboot2.h` file in the example section of the specification also specifies these fields as being `u32`, which suggests that the `u16` fields are an editing error. The GRUB2 bootloader [uses u32 fields](https://github.com/josefbacik/grub2/blob/96695ad84ce9c93f057ba53ae77d04d8561586e9/include/multiboot2.h#L298-L300), too.
56-
57-
The section headers are just copied from the ELF file, so we need to look at the ELF specification to find the corresponding structure definition. Our kernel is a 64-bit ELF file, so we need to look at the ELF-64 specification ([PDF][ELF specification]). According to section 4 and figure 3, a section header has the following format:
58-
59-
[ELF specification]: http://www.uclibc.org/docs/elf-64-gen.pdf
60-
61-
Field | Type | Value
62-
--------------------------- | ---------------- | -----------
63-
name | u32 | string table index
64-
type | u32 | `0` (unused), `1` (section of program), `3` (string table), `8` (uninitialized section), etc.
65-
flags | u64 | `0x1` (writable), `0x2` (loaded), `0x4` (executable), etc.
66-
address | u64 | virtual start address of section (0 if not loaded)
67-
file offset | u64 | offset (in bytes) of section contents in the file
68-
size | u64 | size of the section in bytes
69-
link | u32 | associated section (only for some section types)
70-
info | u32 | extra information (only for some section types)
71-
address align | u64 | required alignment of section (power of 2)
72-
entry size | u64 | contains the entry size for table sections (e.g. string table)
31+
All tags and the mbi itself are 8-byte aligned. The last tag must be the _end tag_, which is a tag of type `0` and size `8`.
7332

7433
## License
7534

0 commit comments

Comments
 (0)