diff mbox series

[v2,6/6] riscv: efi: enable generic EFI compressed boot

Message ID 20220809080944.1119654-7-ardb@kernel.org
State New
Headers show
Series efi: implement generic compressed boot support | expand

Commit Message

Ard Biesheuvel Aug. 9, 2022, 8:09 a.m. UTC
Wire up the generic EFI zboot support for RISC-V.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/riscv/Makefile      |  5 +++++
 arch/riscv/boot/Makefile | 14 ++++++++++++++
 2 files changed, 19 insertions(+)

Comments

Palmer Dabbelt Sept. 12, 2022, 2:26 p.m. UTC | #1
On Tue, 09 Aug 2022 01:09:44 PDT (-0700), ardb@kernel.org wrote:
> Wire up the generic EFI zboot support for RISC-V.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/riscv/Makefile      |  5 +++++
>  arch/riscv/boot/Makefile | 14 ++++++++++++++
>  2 files changed, 19 insertions(+)
>
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 81029d40a672..c30ea65ec877 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -142,6 +142,11 @@ $(BOOT_TARGETS): vmlinux
>  Image.%: Image
>  	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
>
> +ifneq ($(CONFIG_EFI_ZBOOT),)
> +zImage.efi: Image
> +	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
> +endif
> +
>  install: KBUILD_IMAGE := $(boot)/Image
>  zinstall: KBUILD_IMAGE := $(boot)/Image.gz
>  install zinstall:
> diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
> index becd0621071c..60cd319685ea 100644
> --- a/arch/riscv/boot/Makefile
> +++ b/arch/riscv/boot/Makefile
> @@ -58,3 +58,17 @@ $(obj)/Image.lzo: $(obj)/Image FORCE
>
>  $(obj)/loader.bin: $(obj)/loader FORCE
>  	$(call if_changed,objcopy)
> +
> +ZBOOT_PAYLOAD		:= $(obj)/Image
> +ZBOOT_BFD_TARGET	:= elf$(BITS)-littleriscv
> +ZBOOT_LD_FLAGS		:= --defsym=__efistub_strnlen=strnlen \
> +			   --defsym=__efistub_memmove=memmove \
> +			   --defsym=__efistub_memcpy=memcpy \
> +			   --defsym=__efistub_memset=memset
> +
> +ZBOOT_EXTRA_OBJS	:= memcpy.o memset.o memmove.o
> +ZBOOT_EXTRA_DEPS	:= $(objtree)/lib/string.o \
> +			   $(objtree)/lib/ctype.o \
> +			   $(addprefix $(objtree)/arch/riscv/lib/,$(ZBOOT_EXTRA_OBJS))
> +
> +include $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
diff mbox series

Patch

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 81029d40a672..c30ea65ec877 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -142,6 +142,11 @@  $(BOOT_TARGETS): vmlinux
 Image.%: Image
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
+ifneq ($(CONFIG_EFI_ZBOOT),)
+zImage.efi: Image
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+endif
+
 install: KBUILD_IMAGE := $(boot)/Image
 zinstall: KBUILD_IMAGE := $(boot)/Image.gz
 install zinstall:
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
index becd0621071c..60cd319685ea 100644
--- a/arch/riscv/boot/Makefile
+++ b/arch/riscv/boot/Makefile
@@ -58,3 +58,17 @@  $(obj)/Image.lzo: $(obj)/Image FORCE
 
 $(obj)/loader.bin: $(obj)/loader FORCE
 	$(call if_changed,objcopy)
+
+ZBOOT_PAYLOAD		:= $(obj)/Image
+ZBOOT_BFD_TARGET	:= elf$(BITS)-littleriscv
+ZBOOT_LD_FLAGS		:= --defsym=__efistub_strnlen=strnlen \
+			   --defsym=__efistub_memmove=memmove \
+			   --defsym=__efistub_memcpy=memcpy \
+			   --defsym=__efistub_memset=memset
+
+ZBOOT_EXTRA_OBJS	:= memcpy.o memset.o memmove.o
+ZBOOT_EXTRA_DEPS	:= $(objtree)/lib/string.o \
+			   $(objtree)/lib/ctype.o \
+			   $(addprefix $(objtree)/arch/riscv/lib/,$(ZBOOT_EXTRA_OBJS))
+
+include $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot