build: remove shim related targets
PATCH v2 1/1 build: remove shim related targets
There's no need to have shim specific targets, so just use the regular xen makefile targets in order to build the shim binary.
When the shim is build as part of the firmware directory install the stripped Xen binary to the firmware directory and place a binary with symbols in the debug directory.
The objcopy step of the shim build is also removed in this patch:
since the shim is booted in PVH mode there's no need for the resulting binary to be in elf32 format. Xen can load PVH kernels with either a 32 or 64bit elf header.
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
---
Changes since v1:
- Copy a shim binary with symbols to the debug dir.
- Use ln to link xen-shim and xen-shim-syms instead of cp.
- Expand commit message to explain the reason for dropping the objcopy step.
--- tools/firmware/Makefile | 4 ++++ tools/firmware/xen-dir/Makefile | 9 +++++---- xen/Makefile | 16 +++------------- xen/arch/x86/Makefile | 12 +++--------- 4 files changed, 15 insertions(+), 26 deletions(-)
tools/firmware/Makefile +4 -0
@@ -8,6 +8,7 @@ endif # hvmloader is a 32-bit protected mode binary. TARGET := hvmloader/hvmloader INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR) +DEBG_DIR := $(DESTDIR)$(DEBUG_DIR)$(XENFIRMWAREDIR) SUBDIRS-y := SUBDIRS-$(CONFIG_OVMF) += ovmf-dir
@@ -46,6 +47,7 @@ endif .PHONY: install install: all [ -d $(INST_DIR) ] || $(INSTALL_DIR) $(INST_DIR) + [ -d $(DEBG_DIR) ] || $(INSTALL_DIR) $(DEBG_DIR) [ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(INST_DIR) ifeq ($(CONFIG_SEABIOS),y) $(INSTALL_DATA) seabios-dir/out/bios.bin $(INST_DIR)/seabios.bin
@@ -55,6 +57,7 @@ ifeq ($(CONFIG_OVMF),y) endif ifeq ($(CONFIG_PV_SHIM),y) $(INSTALL_DATA) xen-dir/xen-shim $(INST_DIR)/xen-shim + $(INSTALL_DATA) xen-dir/xen-shim-syms $(DEBG_DIR)/xen-shim-syms endif .PHONY: uninstall
@@ -68,6 +71,7 @@ ifeq ($(CONFIG_OVMF),y) endif ifeq ($(CONFIG_PV_SHIM),y) rm -f $(INST_DIR)/xen-shim + rm -f $(DEBG_DIR)/xen-shim-syms endif .PHONY: clean
tools/firmware/xen-dir/Makefile +5 -4
@@ -48,13 +48,14 @@ shim-%config: $(D) FORCE KCONFIG_CONFIG=$(CURDIR)/shim.config xen-shim: $(D) shim-olddefconfig - $(MAKE) -C $(D)/xen install-shim \ + $(MAKE) -C $(D)/xen build \ XEN_CONFIG_EXPERT=y \ - KCONFIG_CONFIG=$(CURDIR)/shim.config \ - DESTDIR=$(CURDIR) + KCONFIG_CONFIG=$(CURDIR)/shim.config + ln -sf $(D)/xen/xen xen-shim + ln -sf $(D)/xen/xen-syms xen-shim-syms .PHONY: distclean clean distclean clean: - rm -f xen-shim *.old + rm -f xen-shim xen-shim-syms *.old rm -rf $(D) rm -f linkfarm.stamp*
xen/Makefile +3 -13
@@ -37,10 +37,10 @@ default: build .PHONY: dist dist: install -build install build-shim:: include/config/auto.conf +build install:: include/config/auto.conf -.PHONY: build install uninstall clean distclean cscope TAGS tags MAP gtags tests install-shim build-shim -build install uninstall debug clean distclean cscope TAGS tags MAP gtags tests install-shim build-shim:: +.PHONY: build install uninstall clean distclean cscope TAGS tags MAP gtags tests +build install uninstall debug clean distclean cscope TAGS tags MAP gtags tests:: ifneq ($(XEN_TARGET_ARCH),x86_32) $(MAKE) -f Rules.mk _$@ else
@@ -80,13 +80,6 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX) fi; \ fi -.PHONY: _build-shim -_build-shim: $(TARGET)-shim - -.PHONY: _install-shim -_install-shim: build-shim - $(INSTALL_DATA) $(TARGET)-shim $(DESTDIR) - .PHONY: _tests _tests: $(MAKE) -f $(BASEDIR)/Rules.mk -C test tests
@@ -151,9 +144,6 @@ $(TARGET): delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET) -$(TARGET)-shim: $(TARGET) - $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)-shim - # drivers/char/console.o contains static banner/compile info. Blow it away. # Don't refresh these files during e.g., 'sudo make install' .PHONY: delete-unfresh-files
xen/arch/x86/Makefile +3 -9
@@ -78,12 +78,12 @@ efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \ -O $(BASEDIR)/include/xen/compile.h ]; then \ echo '$(TARGET).efi'; fi) -shim-$(CONFIG_PVH_GUEST) := $(TARGET)-shim - ifneq ($(build_id_linker),) notes_phdrs = --notes else -notes_phdrs = +ifeq ($(CONFIG_PVH_GUEST),y) +notes_phdrs = --notes +endif endif ifdef CONFIG_LIVEPATCH
@@ -149,11 +149,6 @@ $(TARGET)-syms: prelink.o xen.lds $(BASEDIR)/common/symbols-dummy.o >$(@D)/$(@F).map rm -f $(@D)/.$(@F).[0-9]* -# Use elf32-x86-64 if toolchain support exists, elf32-i386 otherwise. -$(TARGET)-shim: FORMAT = $(firstword $(filter elf32-x86-64,$(shell $(OBJCOPY) --help)) elf32-i386) -$(TARGET)-shim: $(TARGET)-syms - $(OBJCOPY) -O $(FORMAT) $< $@ - note.o: $(TARGET)-syms $(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(BASEDIR)/xen-syms [email protected] $(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
@@ -238,6 +233,5 @@ clean:: rm -f asm-offsets.s *.lds boot/*.o boot/*~ boot/core boot/mkelf32 rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/disabled efi/mkreloc - rm -f $(BASEDIR)/xen-shim rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin rm -f note.o
Signature · 7 lines
2.16.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Roger Pau Monne
tools/firmware/xen-dir/Makefile +0
-0@@ -48,13 +48,14 @@ shim-%config: $(D) FORCE KCONFIG_CONFIG=$(CURDIR)/shim.config
tools/firmware/xen-dir/Makefile shim-%config: $(D) FORCE · line 55
Quoted 10 lines
tools/firmware/xen-dir/Makefile +4
-3xen-shim: $(D) shim-olddefconfig - $(MAKE) -C $(D)/xen install-shim \ + $(MAKE) -C $(D)/xen build \ XEN_CONFIG_EXPERT=y \ - KCONFIG_CONFIG=$(CURDIR)/shim.config \ - DESTDIR=$(CURDIR) + KCONFIG_CONFIG=$(CURDIR)/shim.config + ln -sf $(D)/xen/xen xen-shim + ln -sf $(D)/xen/xen-syms xen-shim-syms
This might be fine for developer builds, but it will break RPM (and probably DEB) packages.
They are separate files, and need copying into place, to avoid interacting with later rebuilds of Xen.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 21 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
tools/firmware/xen-dir/Makefile +0
-0@@ -48,13 +48,14 @@ shim-%config: $(D) FORCE KCONFIG_CONFIG=$(CURDIR)/shim.configtools/firmware/xen-dir/Makefile shim-%config: $(D) FORCE · line 55
Quoted 10 lines
tools/firmware/xen-dir/Makefile +4
-3xen-shim: $(D) shim-olddefconfig - $(MAKE) -C $(D)/xen install-shim \ + $(MAKE) -C $(D)/xen build \ XEN_CONFIG_EXPERT=y \ - KCONFIG_CONFIG=$(CURDIR)/shim.config \ - DESTDIR=$(CURDIR) + KCONFIG_CONFIG=$(CURDIR)/shim.config + ln -sf $(D)/xen/xen xen-shim + ln -sf $(D)/xen/xen-syms xen-shim-symsThis might be fine for developer builds, but it will break RPM (and probably DEB) packages.
Quoted 2 lines
They are separate files, and need copying into place, to avoid interacting with later rebuilds of Xen.
I'm not sure I follow, interacting with rebuilds in which way?
The target of those symlinks is a file in $(D)/xen/, which is already xen-shim firmware specific (rebuilds of top level xen/ are not going to affect this binary).
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
tools/firmware/xen-dir/Makefile shim-%config: $(D) FORCE · line 55
Quoted 9 lines · Roger Pau Monne
xen-shim: $(D) shim-olddefconfig
tools/firmware/xen-dir/Makefile +4
-3- $(MAKE) -C $(D)/xen install-shim \ + $(MAKE) -C $(D)/xen build \ XEN_CONFIG_EXPERT=y \ - KCONFIG_CONFIG=$(CURDIR)/shim.config \ - DESTDIR=$(CURDIR) + KCONFIG_CONFIG=$(CURDIR)/shim.config + ln -sf $(D)/xen/xen xen-shim + ln -sf $(D)/xen/xen-syms xen-shim-syms
I'm not sure this is right -- do you get to install the shim to DESTDIR like this?
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 13 lines · Wei Liu
tools/firmware/xen-dir/Makefile shim-%config: $(D) FORCE · line 55
Quoted 9 lines · Roger Pau Monne
xen-shim: $(D) shim-olddefconfig
tools/firmware/xen-dir/Makefile +4
-3- $(MAKE) -C $(D)/xen install-shim \ + $(MAKE) -C $(D)/xen build \ XEN_CONFIG_EXPERT=y \ - KCONFIG_CONFIG=$(CURDIR)/shim.config \ - DESTDIR=$(CURDIR) + KCONFIG_CONFIG=$(CURDIR)/shim.config + ln -sf $(D)/xen/xen xen-shim + ln -sf $(D)/xen/xen-syms xen-shim-symsI'm not sure this is right -- do you get to install the shim to DESTDIR like this?
Yes, the file installed is the target, not the symlink itself:
# ls -lah /usr/local/lib/xen/boot/xen-shim -rw-r--r-- 1 root wheel 1.9M Feb 20 14:36 /usr/local/lib/xen/boot/xen-shim
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 20.02.18 at 15:37, <[email protected]> wrote:
tools/firmware/xen-dir/Makefile +0
-0@@ -48,13 +48,14 @@ shim-%config: $(D) FORCE KCONFIG_CONFIG=$(CURDIR)/shim.config
tools/firmware/xen-dir/Makefile shim-%config: $(D) FORCE · line 55
Quoted 10 lines
tools/firmware/xen-dir/Makefile +4
-3xen-shim: $(D) shim-olddefconfig - $(MAKE) -C $(D)/xen install-shim \ + $(MAKE) -C $(D)/xen build \ XEN_CONFIG_EXPERT=y \ - KCONFIG_CONFIG=$(CURDIR)/shim.config \ - DESTDIR=$(CURDIR) + KCONFIG_CONFIG=$(CURDIR)/shim.config + ln -sf $(D)/xen/xen xen-shim + ln -sf $(D)/xen/xen-syms xen-shim-syms
I think it is advisable to use $@ instead of open coding the target.
tools/firmware/xen-dir/Makefile $(TARGET): delete-unfresh-files · line 155
Quoted 6 lines
tools/firmware/xen-dir/Makefile +0
-2@@ -151,9 +144,6 @@ $(TARGET): delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET) -$(TARGET)-shim: $(TARGET) - $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)-shim
I think you need to rebase over the change I've committed earlier today.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel