aboutsummaryrefslogtreecommitdiff
path: root/src/arm/PL1/kernel/kernel.ld
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2020-01-13 13:08:38 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2020-01-13 13:08:38 +0100
commit63b45f687868af38d21930790f0d0e517b50b2e2 (patch)
treed5e5350feee6cb2645d41592cd481bd45ebef535 /src/arm/PL1/kernel/kernel.ld
parent1af7591e37d09ddcd734ea07d0e999cf61c8bc5e (diff)
downloadrpi-MMU-example-63b45f687868af38d21930790f0d0e517b50b2e2.tar.gz
rpi-MMU-example-63b45f687868af38d21930790f0d0e517b50b2e2.zip
shorten linking in Makefile
Diffstat (limited to 'src/arm/PL1/kernel/kernel.ld')
-rw-r--r--src/arm/PL1/kernel/kernel.ld27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/arm/PL1/kernel/kernel.ld b/src/arm/PL1/kernel/kernel.ld
new file mode 100644
index 0000000..3130634
--- /dev/null
+++ b/src/arm/PL1/kernel/kernel.ld
@@ -0,0 +1,27 @@
+ENTRY(_boot) /* defined in boot.S; qemu needs it to run elf file */
+
+/* Code starts at 0x8000 - that's where RPis in 32-bit mode load
+ * kernel at. My experiments do, however, show, that qemu emulating
+ * RPi2 loads the kernel at 0x10000! (took some pain to find out).
+ * rpi-open-firmware, on the other hand, loads kernel at 0x2000000!
+ * This is not really a problem, since:
+ * 1. We can use our bootloader to load the kernel at 0x8000
+ * 2. We've rewritten stage 1 of both bootloader and kernel in
+ * careful assembly, so that they should work regardless of
+ * where they are loaded.
+ * 3. In qemu, we can load kernel.elf instead of raw binary
+ * (qemu will do the right thing then)
+ */
+
+SECTIONS
+{
+
+ . = 0x8000;
+
+ __start = .;
+ .kernel_stage1 :
+ {
+ KEEP(kernel_stage1.o)
+ }
+ __end = .;
+}