From a2ce17753fa4a727f082bfb9bd515dc3fde56f02 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Wed, 25 Dec 2024 02:55:41 +0100 Subject: mbr: zig only real mode 16 bit --- x86-bare-metal/mbr-pure-zig/mbr.ld | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 x86-bare-metal/mbr-pure-zig/mbr.ld (limited to 'x86-bare-metal/mbr-pure-zig/mbr.ld') diff --git a/x86-bare-metal/mbr-pure-zig/mbr.ld b/x86-bare-metal/mbr-pure-zig/mbr.ld new file mode 100644 index 0000000..9ada8c4 --- /dev/null +++ b/x86-bare-metal/mbr-pure-zig/mbr.ld @@ -0,0 +1,24 @@ +/*OUTPUT_FORMAT(binary)*/ +OUTPUT_FORMAT(elf32-i386) +OUTPUT_ARCH(i386) +ENTRY(_entry) + +SECTIONS { + . = 0x7c00; + .boot : { *(.boot) } + .text : { *(.text) } + .data : { *(.data) } + .rodata : { *(.rodata) *(.rodata.str*) } + _boot_end = .; + + . = 0x7c00 + 510; + .mbr.magic : { + BYTE(0x55); + BYTE(0xaa); + } + + /*/DISCARD/ : { *(.*) }*/ + /*rest : { *(.*) }*/ + + ASSERT(_boot_end - 0x7c00 < 510, "boot sector must fit in 510 bytes") +} -- cgit v1.2.3