Skip to contentSkip to conversation

openrisc: Add vmlinux.bin target

PATCH Superseded Joel Stanley 2 participants 2 messages Dec 22, 2020 Openrisc architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openrisc: Add vmlinux.bin target

Build it by default. This is commonly used by fpga targets.

---
 arch/openrisc/Makefile      | 7 +++++++
 arch/openrisc/boot/Makefile | 8 ++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 arch/openrisc/boot/Makefile
arch/openrisc/Makefile +7 -0
index bf10141c7426..239bca2d1925 100644
@@ -24,6 +24,10 @@ LIBGCC 		:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
 KBUILD_CFLAGS	+= -pipe -ffixed-r10 -D__linux__
 
+all: vmlinux.bin
+
+boot := arch/$(ARCH)/boot
+
 ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y)
 	KBUILD_CFLAGS += $(call cc-option,-mhard-mul)
 else
@@ -49,3 +53,6 @@ else
 BUILTIN_DTB := n
 endif
 core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/
+
+vmlinux.bin: vmlinux
+	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
arch/openrisc/boot/Makefile new file +8 -0
new file mode 100644
index 000000000000..0e71e8f78bb2
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for bootable kernel images
+#
+
+OBJCOPYFLAGS_vmlinux.bin := -O binary
+$(obj)/vmlinux.bin: vmlinux FORCE
+	$(call if_changed,objcopy)
Signature · 1 line
2.29.2
#1 lore raw
Quoted 26 lines · Joel Stanley

Build it by default. This is commonly used by fpga targets.

---
 arch/openrisc/Makefile      | 7 +++++++
 arch/openrisc/boot/Makefile | 8 ++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 arch/openrisc/boot/Makefile
arch/openrisc/Makefile +4 -0
index bf10141c7426..239bca2d1925 100644
@@ -24,6 +24,10 @@ LIBGCC               := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
 KBUILD_CFLAGS  += -pipe -ffixed-r10 -D__linux__
 
+all: vmlinux.bin
+
+boot := arch/$(ARCH)/boot
+
 ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y)
        KBUILD_CFLAGS += $(call cc-option,-mhard-mul)
 else

arch/openrisc/Makefile else · line 56

Quoted 4 lines
arch/openrisc/Makefile +1 -0
@@ -49,3 +53,6 @@ else
 BUILTIN_DTB := n
 endif
 core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/
+

Since vmlinux.bin is a phony target, you need this:

PHONY += vmlinux.bin

arch/openrisc/Makefile else · line 58

Quoted 2 lines
arch/openrisc/Makefile +2 -0
+vmlinux.bin: vmlinux
+       $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)

This is simpler:

          $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

For clean-up, you need this:

archclean:

        $(Q)$(MAKE) $(clean)=$(boot)
Quoted 6 lines
arch/openrisc/boot/Makefile new file +0 -0
new file mode 100644
index 000000000000..0e71e8f78bb2

arch/openrisc/boot/Makefile line 8

Quoted 8 lines
arch/openrisc/boot/Makefile new file +8 -0
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for bootable kernel images
+#
+
+OBJCOPYFLAGS_vmlinux.bin := -O binary
+$(obj)/vmlinux.bin: vmlinux FORCE
+       $(call if_changed,objcopy)

Please add

targets += vmlinux.bin

Also, you need to add arch/openrisc/boot/.gitignore

Quoted 3 lines

--
2.29.2

Signature · 2 lines
Best Regards
Masahiro Yamada