diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-04-13 23:15:53 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-04-13 23:16:30 +0200 |
commit | 1183cba6c9c44d5a8f7282b247f44645c6d9aefe (patch) | |
tree | cfc389277c35b245bdbbcf65f92fba9fe941b877 /x86-bare-metal/mbr-disk-lba/mbr.ld | |
parent | bdc785b6d09ee0bc6f289f707b0fd317448027b4 (diff) | |
download | zig-playground-1183cba6c9c44d5a8f7282b247f44645c6d9aefe.tar.gz zig-playground-1183cba6c9c44d5a8f7282b247f44645c6d9aefe.zip |
mbr: read disk lba addressing example
Diffstat (limited to 'x86-bare-metal/mbr-disk-lba/mbr.ld')
-rw-r--r-- | x86-bare-metal/mbr-disk-lba/mbr.ld | 26 |
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") +} |