aboutsummaryrefslogtreecommitdiff
path: root/kernel_stage1.ld
diff options
context:
space:
mode:
authorvetch <vetch97@gmail.com>2020-01-02 17:54:31 +0100
committervetch <vetch97@gmail.com>2020-01-02 17:54:31 +0100
commitab7b754bb32022336527c1a2d5d710b95a589d0e (patch)
tree19f508f06c72efcbdd2cfad46949ed6f1ae45a3c /kernel_stage1.ld
parent5e1e6796109c892c4300c3da17c35e7874a40107 (diff)
parent6bf5a3b8c6e8a5d1cb3fb4880a5d9688ab094c62 (diff)
downloadrpi-MMU-example-ab7b754bb32022336527c1a2d5d710b95a589d0e.tar.gz
rpi-MMU-example-ab7b754bb32022336527c1a2d5d710b95a589d0e.zip
Merge branch 'bob' of https://repo.or.cz/RPi-MMU-example into alice
# Conflicts: # .gitignore # PL0_test.ld # demo_functionality.c # interrupt_vector.S # interrupts.c # kernel.c # memory.h
Diffstat (limited to 'kernel_stage1.ld')
-rw-r--r--kernel_stage1.ld27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel_stage1.ld b/kernel_stage1.ld
new file mode 100644
index 0000000..3130634
--- /dev/null
+++ b/kernel_stage1.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 = .;
+}