summaryrefslogtreecommitdiff
path: root/x86-bare-metal/mbr-palette/mbr.ld
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-12-23 22:51:52 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-12-25 21:25:16 +0100
commit14845124cf5d4fb42a04cb1262b32bd3d00f45f8 (patch)
tree13162d26afeb49a9c9b8d9d31049066c0f4b2998 /x86-bare-metal/mbr-palette/mbr.ld
parent42b6f9d23ab0f94744a90edb6fd74450f589ca14 (diff)
downloadzig-playground-14845124cf5d4fb42a04cb1262b32bd3d00f45f8.tar.gz
zig-playground-14845124cf5d4fb42a04cb1262b32bd3d00f45f8.zip
mbr: rm->pm, then jump into zig
Diffstat (limited to 'x86-bare-metal/mbr-palette/mbr.ld')
-rw-r--r--x86-bare-metal/mbr-palette/mbr.ld25
1 files changed, 25 insertions, 0 deletions
diff --git a/x86-bare-metal/mbr-palette/mbr.ld b/x86-bare-metal/mbr-palette/mbr.ld
new file mode 100644
index 0000000..372ea42
--- /dev/null
+++ b/x86-bare-metal/mbr-palette/mbr.ld
@@ -0,0 +1,25 @@
+/*OUTPUT_FORMAT(binary)*/
+OUTPUT_FORMAT(elf32-i386)
+OUTPUT_ARCH(i386)
+
+SECTIONS {
+ . = 0x7c00;
+ .boot : {
+ *(.boot)
+ }
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .rodata : { *(.rodata) }
+ _boot_end = .;
+
+ . = 0x7c00 + 510;
+ .mbr.magic : {
+ BYTE(0x55);
+ BYTE(0xaa);
+ }
+
+ /*/DISCARD/ : { *(.*) }*/
+ /*rest : { *(.*) }*/
+
+ ASSERT(_boot_end - 0x7c00 < 510, "boot sector must fit in 510 bytes")
+}