From cd7efed090b3d9f2c360951dbae21fff361fb16a Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Sat, 7 Mar 2020 20:31:58 -0600 Subject: [PATCH] Initial commit. Next section 'Obtaining GRUB' --- .gitingnore | 2 ++ link.ld | 26 ++++++++++++++++++++++++++ loader.s | 17 +++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .gitingnore create mode 100644 link.ld create mode 100644 loader.s diff --git a/.gitingnore b/.gitingnore new file mode 100644 index 0000000..20596b5 --- /dev/null +++ b/.gitingnore @@ -0,0 +1,2 @@ +*.o +*.elf diff --git a/link.ld b/link.ld new file mode 100644 index 0000000..53bd227 --- /dev/null +++ b/link.ld @@ -0,0 +1,26 @@ +ENTRY(loader) + +SECTIONS { + . = 0x00100000; /* Load the code at 1 MB */ + + .text ALIGN (0x1000) : + { + *(.text) + } + + .rodata ALIGN (0x1000) : + { + *(.rodata*) + } + + .data ALIGN (0x1000) : + { + *(.data) + } + + .bss ALIGN (0x1000) : + { + *(COMMON) + *(.bss) + } +} diff --git a/loader.s b/loader.s new file mode 100644 index 0000000..dadcc86 --- /dev/null +++ b/loader.s @@ -0,0 +1,17 @@ +global loader + +MAGIC_NUMBER equ 0x1BADB002 +FLAGS equ 0x0 +CHECKSUM equ -MAGIC_NUMBER + +section .text: +align 4 + dd MAGIC_NUMBER + dd FLAGS + dd CHECKSUM + +loader: + mov eax, 0xCAFEBABE +.loop: + jmp .loop +