diff mbox series

[v5,8/8] loongarch: efi: enable generic EFI compressed boot

Message ID 20220910081152.2238369-9-ardb@kernel.org (mailing list archive)
State New, archived
Headers show
Series efi: implement generic compressed boot support | expand

Commit Message

Ard Biesheuvel Sept. 10, 2022, 8:11 a.m. UTC
Wire up the generic EFI zboot support for LoongArch64

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/loongarch/Kconfig         | 1 +
 arch/loongarch/Makefile        | 4 ++--
 arch/loongarch/boot/.gitignore | 1 +
 arch/loongarch/boot/Makefile   | 6 ++++++
 4 files changed, 10 insertions(+), 2 deletions(-)

Comments

Huacai Chen Sept. 10, 2022, 2:21 p.m. UTC | #1
Hi, Ard,

I prefer to give a chance to disable ZBOOT, so I don't want to select EFI_ZBOOT unconditionally in Kconfig, and then the Makefile can be like this:
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index c3f579bdf9e5..bc6fe65125f5 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -14,6 +14,10 @@ else
 KBUILD_IMAGE   := $(boot)/vmlinux.efi
 endif

+ifdef CONFIG_EFI_ZBOOT
+KBUILD_IMAGE    := $(boot)/vmlinuz.efi
+endif
+
 archscripts: scripts_basic
        $(Q)$(MAKE) $(build)=arch/loongarch/boot/tools relocs

Huacai


> -----原始邮件-----
> 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> 发送时间:2022-09-10 16:11:52 (星期六)
> 收件人: linux-efi@vger.kernel.org
> 抄送: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>, "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Huacai Chen" <chenhuacai@loongson.cn>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> 主题: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> 
> Wire up the generic EFI zboot support for LoongArch64
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  arch/loongarch/Kconfig         | 1 +
>  arch/loongarch/Makefile        | 4 ++--
>  arch/loongarch/boot/.gitignore | 1 +
>  arch/loongarch/boot/Makefile   | 6 ++++++
>  4 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index fca106a8b8af..f960dbbfb62d 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -55,6 +55,7 @@ config LOONGARCH
>  	select BUILDTIME_TABLE_SORT
>  	select COMMON_CLK
>  	select EFI
> +	select EFI_ZBOOT
>  	select GENERIC_CLOCKEVENTS
>  	select GENERIC_CMOS_UPDATE
>  	select GENERIC_CPU_AUTOPROBE
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index 4bc47f47cfd8..357ed2a771bf 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -10,7 +10,7 @@ KBUILD_DEFCONFIG := loongson3_defconfig
>  ifndef CONFIG_EFI_STUB
>  KBUILD_IMAGE	:= $(boot)/vmlinux.elf
>  else
> -KBUILD_IMAGE	:= $(boot)/vmlinux.efi
> +KBUILD_IMAGE	:= $(boot)/vmlinuz.efi
>  endif
>  
>  #
> @@ -93,7 +93,7 @@ vdso_install:
>  
>  all:	$(notdir $(KBUILD_IMAGE))
>  
> -vmlinux.elf vmlinux.efi: vmlinux
> +vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
>  	$(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@
>  
>  install:
> diff --git a/arch/loongarch/boot/.gitignore b/arch/loongarch/boot/.gitignore
> index 49423ee96ef3..e5dc594dc4b6 100644
> --- a/arch/loongarch/boot/.gitignore
> +++ b/arch/loongarch/boot/.gitignore
> @@ -1,2 +1,3 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  vmlinux*
> +vmlinuz*
> diff --git a/arch/loongarch/boot/Makefile b/arch/loongarch/boot/Makefile
> index fecf34f50e56..4e1c374c5782 100644
> --- a/arch/loongarch/boot/Makefile
> +++ b/arch/loongarch/boot/Makefile
> @@ -18,3 +18,9 @@ $(obj)/vmlinux.elf: vmlinux FORCE
>  targets += vmlinux.efi
>  $(obj)/vmlinux.efi: vmlinux FORCE
>  	$(call if_changed,objcopy)
> +
> +EFI_ZBOOT_PAYLOAD      := vmlinux.efi
> +EFI_ZBOOT_BFD_TARGET   := elf64-loongarch
> +EFI_ZBOOT_MACH_TYPE    := LOONGARCH64
> +
> +include $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot
> -- 
> 2.35.1


本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.
Ard Biesheuvel Sept. 10, 2022, 2:28 p.m. UTC | #2
On Sat, 10 Sept 2022 at 15:22, 陈华才 <chenhuacai@loongson.cn> wrote:
>
> Hi, Ard,
>
> I prefer to give a chance to disable ZBOOT, so I don't want to select EFI_ZBOOT unconditionally in Kconfig, and then the Makefile can be like this:
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index c3f579bdf9e5..bc6fe65125f5 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -14,6 +14,10 @@ else
>  KBUILD_IMAGE   := $(boot)/vmlinux.efi
>  endif
>
> +ifdef CONFIG_EFI_ZBOOT
> +KBUILD_IMAGE    := $(boot)/vmlinuz.efi
> +endif
> +
>  archscripts: scripts_basic
>         $(Q)$(MAKE) $(build)=arch/loongarch/boot/tools relocs
>

OK, I will fold this in. This actually aligns it with the other
architectures, so I prefer this approach as well.


>
> > -----原始邮件-----
> > 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> > 发送时间:2022-09-10 16:11:52 (星期六)
> > 收件人: linux-efi@vger.kernel.org
> > 抄送: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>, "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Huacai Chen" <chenhuacai@loongson.cn>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> > 主题: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> >
> > Wire up the generic EFI zboot support for LoongArch64
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> >  arch/loongarch/Kconfig         | 1 +
> >  arch/loongarch/Makefile        | 4 ++--
> >  arch/loongarch/boot/.gitignore | 1 +
> >  arch/loongarch/boot/Makefile   | 6 ++++++
> >  4 files changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > index fca106a8b8af..f960dbbfb62d 100644
> > --- a/arch/loongarch/Kconfig
> > +++ b/arch/loongarch/Kconfig
> > @@ -55,6 +55,7 @@ config LOONGARCH
> >       select BUILDTIME_TABLE_SORT
> >       select COMMON_CLK
> >       select EFI
> > +     select EFI_ZBOOT
> >       select GENERIC_CLOCKEVENTS
> >       select GENERIC_CMOS_UPDATE
> >       select GENERIC_CPU_AUTOPROBE
> > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > index 4bc47f47cfd8..357ed2a771bf 100644
> > --- a/arch/loongarch/Makefile
> > +++ b/arch/loongarch/Makefile
> > @@ -10,7 +10,7 @@ KBUILD_DEFCONFIG := loongson3_defconfig
> >  ifndef CONFIG_EFI_STUB
> >  KBUILD_IMAGE := $(boot)/vmlinux.elf
> >  else
> > -KBUILD_IMAGE := $(boot)/vmlinux.efi
> > +KBUILD_IMAGE := $(boot)/vmlinuz.efi
> >  endif
> >
> >  #
> > @@ -93,7 +93,7 @@ vdso_install:
> >
> >  all: $(notdir $(KBUILD_IMAGE))
> >
> > -vmlinux.elf vmlinux.efi: vmlinux
> > +vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
> >       $(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@
> >
> >  install:
> > diff --git a/arch/loongarch/boot/.gitignore b/arch/loongarch/boot/.gitignore
> > index 49423ee96ef3..e5dc594dc4b6 100644
> > --- a/arch/loongarch/boot/.gitignore
> > +++ b/arch/loongarch/boot/.gitignore
> > @@ -1,2 +1,3 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  vmlinux*
> > +vmlinuz*
> > diff --git a/arch/loongarch/boot/Makefile b/arch/loongarch/boot/Makefile
> > index fecf34f50e56..4e1c374c5782 100644
> > --- a/arch/loongarch/boot/Makefile
> > +++ b/arch/loongarch/boot/Makefile
> > @@ -18,3 +18,9 @@ $(obj)/vmlinux.elf: vmlinux FORCE
> >  targets += vmlinux.efi
> >  $(obj)/vmlinux.efi: vmlinux FORCE
> >       $(call if_changed,objcopy)
> > +
> > +EFI_ZBOOT_PAYLOAD      := vmlinux.efi
> > +EFI_ZBOOT_BFD_TARGET   := elf64-loongarch
> > +EFI_ZBOOT_MACH_TYPE    := LOONGARCH64
> > +
> > +include $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot
> > --
> > 2.35.1
>
>
> 本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
> This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.
Huacai Chen Sept. 11, 2022, 3:02 p.m. UTC | #3
> -----原始邮件-----
> 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> 发送时间:2022-09-10 22:28:04 (星期六)
> 收件人: "陈华才" <chenhuacai@loongson.cn>
> 抄送: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> 主题: Re: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> 
> On Sat, 10 Sept 2022 at 15:22, 陈华才 <chenhuacai@loongson.cn> wrote:
> >
> > Hi, Ard,
> >
> > I prefer to give a chance to disable ZBOOT, so I don't want to select EFI_ZBOOT unconditionally in Kconfig, and then the Makefile can be like this:
> > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > index c3f579bdf9e5..bc6fe65125f5 100644
> > --- a/arch/loongarch/Makefile
> > +++ b/arch/loongarch/Makefile
> > @@ -14,6 +14,10 @@ else
> >  KBUILD_IMAGE   := $(boot)/vmlinux.efi
> >  endif
> >
> > +ifdef CONFIG_EFI_ZBOOT
> > +KBUILD_IMAGE    := $(boot)/vmlinuz.efi
> > +endif
> > +
> >  archscripts: scripts_basic
> >         $(Q)$(MAKE) $(build)=arch/loongarch/boot/tools relocs
> >
> 
> OK, I will fold this in. This actually aligns it with the other
> architectures, so I prefer this approach as well.

Thank you, and if "make install" can also handle the zboot case, that's even better. :)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index c3f579bdf9e5..5480fe2de7cd 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -137,7 +137,11 @@ vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
 core-y += arch/loongarch/boot/dts/

 install:
+ifndef CONFIG_EFI_ZBOOT
        $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
+else
+       $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
+endif
        $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
        $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)



> 
> 
> >
> > > -----原始邮件-----
> > > 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> > > 发送时间:2022-09-10 16:11:52 (星期六)
> > > 收件人: linux-efi@vger.kernel.org
> > > 抄送: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Ard Biesheuvel" <ardb@kernel.org>, "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Huacai Chen" <chenhuacai@loongson.cn>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> > > 主题: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> > >
> > > Wire up the generic EFI zboot support for LoongArch64
> > >
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > ---
> > >  arch/loongarch/Kconfig         | 1 +
> > >  arch/loongarch/Makefile        | 4 ++--
> > >  arch/loongarch/boot/.gitignore | 1 +
> > >  arch/loongarch/boot/Makefile   | 6 ++++++
> > >  4 files changed, 10 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> > > index fca106a8b8af..f960dbbfb62d 100644
> > > --- a/arch/loongarch/Kconfig
> > > +++ b/arch/loongarch/Kconfig
> > > @@ -55,6 +55,7 @@ config LOONGARCH
> > >       select BUILDTIME_TABLE_SORT
> > >       select COMMON_CLK
> > >       select EFI
> > > +     select EFI_ZBOOT
> > >       select GENERIC_CLOCKEVENTS
> > >       select GENERIC_CMOS_UPDATE
> > >       select GENERIC_CPU_AUTOPROBE
> > > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > > index 4bc47f47cfd8..357ed2a771bf 100644
> > > --- a/arch/loongarch/Makefile
> > > +++ b/arch/loongarch/Makefile
> > > @@ -10,7 +10,7 @@ KBUILD_DEFCONFIG := loongson3_defconfig
> > >  ifndef CONFIG_EFI_STUB
> > >  KBUILD_IMAGE := $(boot)/vmlinux.elf
> > >  else
> > > -KBUILD_IMAGE := $(boot)/vmlinux.efi
> > > +KBUILD_IMAGE := $(boot)/vmlinuz.efi
> > >  endif
> > >
> > >  #
> > > @@ -93,7 +93,7 @@ vdso_install:
> > >
> > >  all: $(notdir $(KBUILD_IMAGE))
> > >
> > > -vmlinux.elf vmlinux.efi: vmlinux
> > > +vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
> > >       $(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@
> > >
> > >  install:
> > > diff --git a/arch/loongarch/boot/.gitignore b/arch/loongarch/boot/.gitignore
> > > index 49423ee96ef3..e5dc594dc4b6 100644
> > > --- a/arch/loongarch/boot/.gitignore
> > > +++ b/arch/loongarch/boot/.gitignore
> > > @@ -1,2 +1,3 @@
> > >  # SPDX-License-Identifier: GPL-2.0-only
> > >  vmlinux*
> > > +vmlinuz*
> > > diff --git a/arch/loongarch/boot/Makefile b/arch/loongarch/boot/Makefile
> > > index fecf34f50e56..4e1c374c5782 100644
> > > --- a/arch/loongarch/boot/Makefile
> > > +++ b/arch/loongarch/boot/Makefile
> > > @@ -18,3 +18,9 @@ $(obj)/vmlinux.elf: vmlinux FORCE
> > >  targets += vmlinux.efi
> > >  $(obj)/vmlinux.efi: vmlinux FORCE
> > >       $(call if_changed,objcopy)
> > > +
> > > +EFI_ZBOOT_PAYLOAD      := vmlinux.efi
> > > +EFI_ZBOOT_BFD_TARGET   := elf64-loongarch
> > > +EFI_ZBOOT_MACH_TYPE    := LOONGARCH64
> > > +
> > > +include $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot
> > > --
> > > 2.35.1
> >
> >
> > 本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
> > This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.


本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.
Ard Biesheuvel Sept. 12, 2022, 10:18 a.m. UTC | #4
On Sun, 11 Sept 2022 at 16:03, 陈华才 <chenhuacai@loongson.cn> wrote:
>
>
>
>
> > -----原始邮件-----
> > 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> > 发送时间:2022-09-10 22:28:04 (星期六)
> > 收件人: "陈华才" <chenhuacai@loongson.cn>
> > 抄送: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> > 主题: Re: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> >
> > On Sat, 10 Sept 2022 at 15:22, 陈华才 <chenhuacai@loongson.cn> wrote:
> > >
> > > Hi, Ard,
> > >
> > > I prefer to give a chance to disable ZBOOT, so I don't want to select EFI_ZBOOT unconditionally in Kconfig, and then the Makefile can be like this:
> > > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > > index c3f579bdf9e5..bc6fe65125f5 100644
> > > --- a/arch/loongarch/Makefile
> > > +++ b/arch/loongarch/Makefile
> > > @@ -14,6 +14,10 @@ else
> > >  KBUILD_IMAGE   := $(boot)/vmlinux.efi
> > >  endif
> > >
> > > +ifdef CONFIG_EFI_ZBOOT
> > > +KBUILD_IMAGE    := $(boot)/vmlinuz.efi
> > > +endif
> > > +
> > >  archscripts: scripts_basic
> > >         $(Q)$(MAKE) $(build)=arch/loongarch/boot/tools relocs
> > >
> >
> > OK, I will fold this in. This actually aligns it with the other
> > architectures, so I prefer this approach as well.
>
> Thank you, and if "make install" can also handle the zboot case, that's even better. :)
>
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index c3f579bdf9e5..5480fe2de7cd 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -137,7 +137,11 @@ vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
>  core-y += arch/loongarch/boot/dts/
>
>  install:
> +ifndef CONFIG_EFI_ZBOOT
>         $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
> +else
> +       $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
> +endif
>         $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
>         $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
>

Is there any reason in particular this is open coded like this? Other
architectures just do something like

install:
    $(call cmd,install)

and be done with it.
Huacai Chen Sept. 12, 2022, 2:45 p.m. UTC | #5
Hi, Ard,


> -----原始邮件-----
> 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> 发送时间:2022-09-12 18:18:05 (星期一)
> 收件人: "陈华才" <chenhuacai@loongson.cn>
> 抄送: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> 主题: Re: Re: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> 
> On Sun, 11 Sept 2022 at 16:03, 陈华才 <chenhuacai@loongson.cn> wrote:
> >
> >
> >
> >
> > > -----原始邮件-----
> > > 发件人: "Ard Biesheuvel" <ardb@kernel.org>
> > > 发送时间:2022-09-10 22:28:04 (星期六)
> > > 收件人: "陈华才" <chenhuacai@loongson.cn>
> > > 抄送: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>, "Matthew Garrett" <mjg59@srcf.ucam.org>, "Peter Jones" <pjones@redhat.com>, "Ilias Apalodimas" <ilias.apalodimas@linaro.org>, "Heinrich Schuchardt" <heinrich.schuchardt@canonical.com>, "AKASHI Takahiro" <takahiro.akashi@linaro.org>, "Palmer Dabbelt" <palmer@dabbelt.com>, "Atish Patra" <atishp@atishpatra.org>, "Arnd Bergmann" <arnd@arndb.de>, "Xi Ruoyao" <xry111@xry111.site>, "Lennart Poettering" <lennart@poettering.net>, "Jeremy Linton" <jeremy.linton@arm.com>, "Will Deacon" <will@kernel.org>, "Catalin Marinas" <catalin.marinas@arm.com>
> > > 主题: Re: [PATCH v5 8/8] loongarch: efi: enable generic EFI compressed boot
> > >
> > > On Sat, 10 Sept 2022 at 15:22, 陈华才 <chenhuacai@loongson.cn> wrote:
> > > >
> > > > Hi, Ard,
> > > >
> > > > I prefer to give a chance to disable ZBOOT, so I don't want to select EFI_ZBOOT unconditionally in Kconfig, and then the Makefile can be like this:
> > > > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > > > index c3f579bdf9e5..bc6fe65125f5 100644
> > > > --- a/arch/loongarch/Makefile
> > > > +++ b/arch/loongarch/Makefile
> > > > @@ -14,6 +14,10 @@ else
> > > >  KBUILD_IMAGE   := $(boot)/vmlinux.efi
> > > >  endif
> > > >
> > > > +ifdef CONFIG_EFI_ZBOOT
> > > > +KBUILD_IMAGE    := $(boot)/vmlinuz.efi
> > > > +endif
> > > > +
> > > >  archscripts: scripts_basic
> > > >         $(Q)$(MAKE) $(build)=arch/loongarch/boot/tools relocs
> > > >
> > >
> > > OK, I will fold this in. This actually aligns it with the other
> > > architectures, so I prefer this approach as well.
> >
> > Thank you, and if "make install" can also handle the zboot case, that's even better. :)
> >
> > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> > index c3f579bdf9e5..5480fe2de7cd 100644
> > --- a/arch/loongarch/Makefile
> > +++ b/arch/loongarch/Makefile
> > @@ -137,7 +137,11 @@ vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
> >  core-y += arch/loongarch/boot/dts/
> >
> >  install:
> > +ifndef CONFIG_EFI_ZBOOT
> >         $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
> > +else
> > +       $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
> > +endif
> >         $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
> >         $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
> >
> 
> Is there any reason in particular this is open coded like this? Other
> architectures just do something like
> 
> install:
>     $(call cmd,install)
> 
> and be done with it.
It seems that there are two problems:
1, the default install script doesn't install the configuration file;
2, the kernel name in "installkernel" isn't the same as the open coded version, it looks like this:
if [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
    KERNEL_NAME=vmlinux
else
    KERNEL_NAME=vmlinuz
fi

Maybe we can provide an arch-specific install.sh as arm64 does, but it is even more complex than the open coded version.

Huacai



本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.
diff mbox series

Patch

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index fca106a8b8af..f960dbbfb62d 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -55,6 +55,7 @@  config LOONGARCH
 	select BUILDTIME_TABLE_SORT
 	select COMMON_CLK
 	select EFI
+	select EFI_ZBOOT
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index 4bc47f47cfd8..357ed2a771bf 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -10,7 +10,7 @@  KBUILD_DEFCONFIG := loongson3_defconfig
 ifndef CONFIG_EFI_STUB
 KBUILD_IMAGE	:= $(boot)/vmlinux.elf
 else
-KBUILD_IMAGE	:= $(boot)/vmlinux.efi
+KBUILD_IMAGE	:= $(boot)/vmlinuz.efi
 endif
 
 #
@@ -93,7 +93,7 @@  vdso_install:
 
 all:	$(notdir $(KBUILD_IMAGE))
 
-vmlinux.elf vmlinux.efi: vmlinux
+vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@
 
 install:
diff --git a/arch/loongarch/boot/.gitignore b/arch/loongarch/boot/.gitignore
index 49423ee96ef3..e5dc594dc4b6 100644
--- a/arch/loongarch/boot/.gitignore
+++ b/arch/loongarch/boot/.gitignore
@@ -1,2 +1,3 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
 vmlinux*
+vmlinuz*
diff --git a/arch/loongarch/boot/Makefile b/arch/loongarch/boot/Makefile
index fecf34f50e56..4e1c374c5782 100644
--- a/arch/loongarch/boot/Makefile
+++ b/arch/loongarch/boot/Makefile
@@ -18,3 +18,9 @@  $(obj)/vmlinux.elf: vmlinux FORCE
 targets += vmlinux.efi
 $(obj)/vmlinux.efi: vmlinux FORCE
 	$(call if_changed,objcopy)
+
+EFI_ZBOOT_PAYLOAD      := vmlinux.efi
+EFI_ZBOOT_BFD_TARGET   := elf64-loongarch
+EFI_ZBOOT_MACH_TYPE    := LOONGARCH64
+
+include $(srctree)/drivers/firmware/efi/libstub/Makefile.zboot