All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch/x86/boot: Don't add the EFI stub to targets
@ 2020-07-15  3:26 Arvind Sankar
  2020-07-15  6:51 ` Ard Biesheuvel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arvind Sankar @ 2020-07-15  3:26 UTC (permalink / raw)
  To: x86, Masahiro Yamada; +Cc: linux-kbuild, linux-efi, linux-kernel

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@alum.mit.edu>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/x86/boot: Don't add the EFI stub to targets
  2020-07-15  3:26 [PATCH] arch/x86/boot: Don't add the EFI stub to targets Arvind Sankar
@ 2020-07-15  6:51 ` Ard Biesheuvel
  2020-07-15  7:21 ` Masahiro Yamada
  2020-07-19 11:08 ` [tip: x86/urgent] x86/boot: " tip-bot2 for Arvind Sankar
  2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2020-07-15  6:51 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: X86 ML, Masahiro Yamada, linux-kbuild, linux-efi,
	Linux Kernel Mailing List

On Wed, 15 Jul 2020 at 06:26, Arvind Sankar <nivedita@alum.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@alum.mit.edu>

Acked-by: Ard Biesheuvel <ardb@kernel.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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arch/x86/boot: Don't add the EFI stub to targets
  2020-07-15  3:26 [PATCH] arch/x86/boot: Don't add the EFI stub to targets Arvind Sankar
  2020-07-15  6:51 ` Ard Biesheuvel
@ 2020-07-15  7:21 ` Masahiro Yamada
  2020-07-19 11:08 ` [tip: x86/urgent] x86/boot: " tip-bot2 for Arvind Sankar
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2020-07-15  7:21 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: X86 ML, Linux Kbuild mailing list, linux-efi, Linux Kernel Mailing List

On Wed, Jul 15, 2020 at 12:26 PM Arvind Sankar <nivedita@alum.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@alum.mit.edu>
> ---


Reviewed-by: Masahiro Yamada <masahiroy@kernel.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
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip: x86/urgent] x86/boot: Don't add the EFI stub to targets
  2020-07-15  3:26 [PATCH] arch/x86/boot: Don't add the EFI stub to targets Arvind Sankar
  2020-07-15  6:51 ` Ard Biesheuvel
  2020-07-15  7:21 ` Masahiro Yamada
@ 2020-07-19 11:08 ` tip-bot2 for Arvind Sankar
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Arvind Sankar @ 2020-07-19 11:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Arvind Sankar, Thomas Gleixner, Masahiro Yamada, Ard Biesheuvel,
	x86, LKML

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     da05b143a308bd6a7a444401f9732678ae63fc70
Gitweb:        https://git.kernel.org/tip/da05b143a308bd6a7a444401f9732678ae63fc70
Author:        Arvind Sankar <nivedita@alum.mit.edu>
AuthorDate:    Tue, 14 Jul 2020 23:26:31 -04:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sun, 19 Jul 2020 13:07:11 +02:00

x86/boot: Don't add the EFI stub to targets

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@alum.mit.edu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lkml.kernel.org/r/20200715032631.1562882-1-nivedita@alum.mit.edu

---
 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 7619742..5a828fd 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-19 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15  3:26 [PATCH] arch/x86/boot: Don't add the EFI stub to targets Arvind Sankar
2020-07-15  6:51 ` Ard Biesheuvel
2020-07-15  7:21 ` Masahiro Yamada
2020-07-19 11:08 ` [tip: x86/urgent] x86/boot: " tip-bot2 for Arvind Sankar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.