aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/boot
diff options
context:
space:
mode:
authorPaul Walmsley <paul.walmsley@sifive.com>2019-11-22 18:59:09 -0800
committerPaul Walmsley <paul.walmsley@sifive.com>2019-11-22 18:59:09 -0800
commit5ba9aa56e6d3e8fddb954c2f818d1ce0525235bb (patch)
treeb9f61d0544ed06b7f07000a11797711cdd97d83f /arch/riscv/boot
parent4a979862dde46b738316014ca4995eae2f428413 (diff)
parent405fe7aa0dbaa6cb8cfe62771eee67076d30aca1 (diff)
downloadlinux-5ba9aa56e6d3e8fddb954c2f818d1ce0525235bb.tar.gz
Merge branch 'next/nommu' into for-next
Conflicts: arch/riscv/boot/Makefile arch/riscv/include/asm/sbi.h
Diffstat (limited to 'arch/riscv/boot')
-rw-r--r--arch/riscv/boot/Makefile7
-rw-r--r--arch/riscv/boot/loader.S8
-rw-r--r--arch/riscv/boot/loader.lds.S16
3 files changed, 30 insertions, 1 deletions
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
index 88356650c992..a474f98ce4fa 100644
--- a/arch/riscv/boot/Makefile
+++ b/arch/riscv/boot/Makefile
@@ -16,7 +16,7 @@
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
-targets := Image
+targets := Image loader
$(obj)/Image: vmlinux FORCE
$(call if_changed,objcopy)
@@ -24,6 +24,11 @@ $(obj)/Image: vmlinux FORCE
$(obj)/Image.gz: $(obj)/Image FORCE
$(call if_changed,gzip)
+loader.o: $(src)/loader.S $(obj)/Image
+
+$(obj)/loader: $(obj)/loader.o $(obj)/Image $(obj)/loader.lds FORCE
+ $(Q)$(LD) -T $(obj)/loader.lds -o $@ $(obj)/loader.o
+
$(obj)/Image.bz2: $(obj)/Image FORCE
$(call if_changed,bzip2)
diff --git a/arch/riscv/boot/loader.S b/arch/riscv/boot/loader.S
new file mode 100644
index 000000000000..dcf88cf44dc1
--- /dev/null
+++ b/arch/riscv/boot/loader.S
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+ .align 4
+ .section .payload, "ax", %progbits
+ .globl _start
+_start:
+ .incbin "arch/riscv/boot/Image"
+
diff --git a/arch/riscv/boot/loader.lds.S b/arch/riscv/boot/loader.lds.S
new file mode 100644
index 000000000000..47a5003c2e28
--- /dev/null
+++ b/arch/riscv/boot/loader.lds.S
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <asm/page.h>
+
+OUTPUT_ARCH(riscv)
+ENTRY(_start)
+
+SECTIONS
+{
+ . = PAGE_OFFSET;
+
+ .payload : {
+ *(.payload)
+ . = ALIGN(8);
+ }
+}