[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXHzZAqHbqgJnrTjxtRvcVkpZan3LC6khFEucdR=cUhYfg@mail.gmail.com>
Date: Wed, 15 Jul 2020 09:51:12 +0300
From: Ard Biesheuvel <ardb@...nel.org>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: X86 ML <x86@...nel.org>, Masahiro Yamada <masahiroy@...nel.org>,
linux-kbuild@...r.kernel.org,
linux-efi <linux-efi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arch/x86/boot: Don't add the EFI stub to targets
On Wed, 15 Jul 2020 at 06:26, Arvind Sankar <nivedita@...m.mit.edu> wrote:
>
> vmlinux-objs-y is added to targets, which currently means that the EFI
> stub gets added to the targets as well. It shouldn't be added since it
> is built elsewhere.
>
> This confuses Makefile.build which interprets the EFI stub as a target
> $(obj)/$(objtree)/drivers/firmware/efi/libstub/lib.a
> and will create drivers/firmware/efi/libstub/ underneath
> arch/x86/boot/compressed, to hold this supposed target, if building
> out-of-tree. [0]
>
> Fix this by pulling the stub out of vmlinux-objs-y into efi-obj-y.
>
> [0] See scripts/Makefile.build near the end:
> # Create directories for object files if they do not exist
>
> Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
Acked-by: Ard Biesheuvel <ardb@...nel.org>
> ---
> arch/x86/boot/compressed/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 7619742f91c9..5a828fde7a42 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -90,8 +90,8 @@ endif
>
> vmlinux-objs-$(CONFIG_ACPI) += $(obj)/acpi.o
>
> -vmlinux-objs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
> vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_thunk_$(BITS).o
> +efi-obj-$(CONFIG_EFI_STUB) = $(objtree)/drivers/firmware/efi/libstub/lib.a
>
> # The compressed kernel is built with -fPIC/-fPIE so that a boot loader
> # can place it anywhere in memory and it will still run. However, since
> @@ -115,7 +115,7 @@ endef
> quiet_cmd_check-and-link-vmlinux = LD $@
> cmd_check-and-link-vmlinux = $(cmd_check_data_rel); $(cmd_ld)
>
> -$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
> +$(obj)/vmlinux: $(vmlinux-objs-y) $(efi-obj-y) FORCE
> $(call if_changed,check-and-link-vmlinux)
>
> OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
> --
> 2.26.2
>
Powered by blists - more mailing lists