From 23e6ba8ef9f9967e0c15c6245fd92cdd5f60fc55 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 11 Oct 2019 11:59:59 +0200 Subject: add initial bootloader work --- loader_stage1.ld | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 loader_stage1.ld (limited to 'loader_stage1.ld') diff --git a/loader_stage1.ld b/loader_stage1.ld new file mode 100644 index 0000000..ce11095 --- /dev/null +++ b/loader_stage1.ld @@ -0,0 +1,47 @@ +ENTRY(_start) + +SECTIONS +{ + /* Starts at LOADER_ADDR. */ + /* Warning! Internet says RPis in 32-bit mode load binary at 0x8000! */ + /* My experiments do, however, show, that qemu emulating RPi2 */ + /* loads it at 0x10000! (took some pain to find out) */ + . = 0x10000; + /* For AArch64, use . = 0x80000; Unless this too is wrong */ + __start = .; + __text_start = .; + .text : + { + KEEP(*(.text.boot)) + *(.text) + } + . = ALIGN(4096); /* align to page size */ + __text_end = .; + + __rodata_start = .; + .rodata : + { + *(.rodata) + } + . = ALIGN(4096); /* align to page size */ + __rodata_end = .; + + __data_start = .; + .data : + { + *(.data) + } + . = ALIGN(4096); /* align to page size */ + __data_end = .; + + __bss_start = .; + .bss : + { + bss = .; + *(.bss) + } + . = ALIGN(4096); /* align to page size */ + __bss_end = .; + __bss_size = __bss_end - __bss_start; + __end = .; +} -- cgit v1.2.3