ink On Sun, 2014-09-07 at 20:53 -0700, Roy Franz wrote:
This moves the boot.c,the file that implements the EFI entry point to efi/common, and builds with both EFI/non-EFI toolchains.
I'm not that familiar with the existing EFI stuff so maybe this is a dump question, but do you mean that it *can* now be built with either EFI or non-EFI, not that it *is* multiply compiled in a given build?
No code changes, just file movement and make updates.
For next time could you please pass -M to git send-email/format-patch so that handles moves more efficiently and shows only the actual changes.
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index c1e244d..5256bdf 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -75,6 +75,13 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
+# This seems to be required to get parallel builds to work, otherwise prelink-efi.o complains about +# no rule to make boot.init.o
I suppose we must recurse into common and arch at the same time.
+# Not sure what the right fix is
Me neither. This doesn't look right to me though, given that xen/common/efi is also entered via a subdir-y in xen/common/Makefile.
Perhaps Jan has some ideas but I'm wondering if we ought not to recurse into xen/common/efi from here and not from xen/common, or at least to not include extra-$(efi) += boot.init.o in xen/common/efi/Makefile (that would also let the x86 specific checkng code stay here, might it?)
symbols-dummy.o has a similar hack, but notice that it is not build from xen/common/Makefile.
Anyway, I'm flailing, perhaps Jan can suggest the correct fix.
+$(BASEDIR)/common/efi/boot.init.o: $(BASEDIR)/common/efi/boot.c
- $(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common/efi/ boot.init.o
ifeq ($(lto),y) # Gather all LTO objects together prelink_lto.o: $(ALL_OBJS) @@ -87,13 +94,13 @@ prelink-efi_lto.o: $(ALL_OBJS) efi/runtime.o efi/compat.o prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o $(LD) $(LDFLAGS) -r -o $@ $^ -prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink-efi_lto.o efi/boot.init.o +prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink-efi_lto.o $(BASEDIR)/common/efi/boot.init.o $(guard) $(LD) $(LDFLAGS) -r -o $@ $^ else prelink.o: $(ALL_OBJS) $(LD) $(LDFLAGS) -r -o $@ $^ -prelink-efi.o: $(ALL_OBJS) efi/boot.init.o efi/runtime.o efi/compat.o +prelink-efi.o: $(ALL_OBJS) $(BASEDIR)/common/efi/boot.init.o efi/runtime.o efi/compat.o $(guard) $(LD) $(LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^) endif @@ -143,8 +150,8 @@ $(TARGET).efi: prelink-efi.o efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbol if $(guard) false; then rm -f $@; echo 'EFI support disabled'; fi rm -f $(@D)/.$(@F).[0-9]* -efi/boot.init.o efi/runtime.o efi/compat.o: $(BASEDIR)/arch/x86/efi/built_in.o -efi/boot.init.o efi/runtime.o efi/compat.o: ; +efi/runtime.o efi/compat.o: $(BASEDIR)/arch/x86/efi/built_in.o +efi/runtime.o efi/compat.o: ; asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(CC) $(filter-out -flto,$(CFLAGS)) -S -o $@ $< diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 1daa7ac..609d05b 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -7,8 +7,8 @@ create = test -e $(1) || touch -t 199901010000 $(1) efi := $(filter y,$(x86_64)$(shell rm -f disabled)) efi := $(if $(efi),$(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c check.c 2>disabled && echo y)) efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y)) -efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o))) +efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,runtime.o))) -extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o +extra-$(efi) += relocs-dummy.o runtime.o compat.o stub.o: $(extra-y)
[...]
diff --git a/xen/common/Makefile b/xen/common/Makefile index 3683ae3..e5c7044 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -67,4 +67,5 @@ subdir-$(x86_64) += hvm subdir-$(coverage) += gcov subdir-y += libelf +subdir-y += efi subdir-$(HAS_DEVICE_TREE) += libfdt diff --git a/xen/common/efi/Makefile b/xen/common/efi/Makefile new file mode 100644 index 0000000..4313a4e --- /dev/null +++ b/xen/common/efi/Makefile @@ -0,0 +1,14 @@ +CFLAGS += -fshort-wchar
+obj-y += dummy.o
+create = test -e $(1) || touch -t 199901010000 $(1)
+efi := $(filter y,$(x86_64)$(shell rm -f disabled)) +efi := $(if $(efi),$(shell $(CC) $(filter-out $(CFLAGS-y) .%.d,$(CFLAGS)) -c check.c 2>disabled && echo y)) +efi := $(if $(efi),$(shell $(LD) -mi386pep --subsystem=10 -o check.efi check.o 2>disabled && echo y)) +efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(call create,runtime.o)))
+extra-$(efi) += boot.init.o
+dummy.o: boot.init.o $(extra-y)