summaryrefslogtreecommitdiff
path: root/x86-bare-metal/mbr-disk-lba/mbr.ld
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2025-04-13 23:15:53 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-04-14 22:43:55 +0200
commita115fc9ad01a605aaad6886cd0fa8d05c328d403 (patch)
tree9275e89f659770df5b94e04edf3c723b19c6fcf8 /x86-bare-metal/mbr-disk-lba/mbr.ld
parent2449af676962af487dabc8099862e5c404d9efd8 (diff)
downloadzig-playground-a115fc9ad01a605aaad6886cd0fa8d05c328d403.tar.gz
zig-playground-a115fc9ad01a605aaad6886cd0fa8d05c328d403.zip
mbr: read disk lba addressing exampleHEADmain
Diffstat (limited to 'x86-bare-metal/mbr-disk-lba/mbr.ld')
-rw-r--r--x86-bare-metal/mbr-disk-lba/mbr.ld26
1 files changed, 26 insertions, 0 deletions
diff --git a/x86-bare-metal/mbr-disk-lba/mbr.ld b/x86-bare-metal/mbr-disk-lba/mbr.ld
new file mode 100644
index 0000000..b93543a
--- /dev/null
+++ b/x86-bare-metal/mbr-disk-lba/mbr.ld
@@ -0,0 +1,26 @@
+/*OUTPUT_FORMAT(binary)*/
+OUTPUT_FORMAT(elf32-i386)
+OUTPUT_ARCH(i386)
+
+SECTIONS {
+ . = 0x7c00;
+ .boot : {
+ *(.boot)
+ }
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) }
+ .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")
+}