Commit e42a4a3f authored by Kevin Wolf's avatar Kevin Wolf
Browse files

Multiboot-Header in eine eigene Sektion

parent d4cb2bbd
No related merge requests found
Showing with 40 additions and 6 deletions
+40 -6
......@@ -6,7 +6,7 @@ LD = ld
ASFLAGS = -m32
CFLAGS = -m32 -Wall -g -fno-stack-protector
LDFLAGS = -melf_i386 -Ttext=0x100000
LDFLAGS = -melf_i386 -Tkernel.ld
kernel: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^
......
/* Bei _start soll die Ausfuehrung losgehen */
ENTRY(_start)
/*
* Hier wird festgelegt, in welcher Reihenfolge welche Sektionen in die Binary
* geschrieben werden sollen
*/
SECTIONS
{
/*
* . ist die aktuelle Position in der Datei. Wir wollen den Kernel wie gehabt
* an 1 MB laden, also muessen wir dort die erste Sektion hinlegen
*/
. = 0x100000;
/*
* Der Multiboot-Header muss zuerst kommen (in den ersten 8 kB).
* Die Standardsektionen einfach hintereinander weg einbinden.
*/
.text : {
*(multiboot)
*(.text)
}
.data ALIGN(4096) : {
*(.data)
}
.rodata ALIGN(4096) : {
*(.rodata)
}
.bss ALIGN(4096) : {
*(.bss)
}
}
.section .text
// Init ist eine Funktion aus init.c
.extern init
.section multiboot
#define MB_MAGIC 0x1badb002
#define MB_FLAGS 0x0
#define MB_CHECKSUM -(MB_MAGIC + MB_FLAGS)
......@@ -13,6 +9,11 @@
.int MB_FLAGS
.int MB_CHECKSUM
.section .text
// Init ist eine Funktion aus init.c
.extern init
// _start muss global sein, damit der Linker es findet und als Einsprungspunkt
// benutzen kann (alle Labels, die nicht global sind, sind nur in dieser Datei
// sichtbar)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment