summaryrefslogtreecommitdiff
path: root/x86-bare-metal/mbr-e820/mbr.ld
blob: 9ada8c41ce7f0a304505da610b8c5bddc273dfe3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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")
}