]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
tools/shim: Apply more duct tape to the linkfarm logic
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 2 Sep 2019 16:16:53 +0000 (17:16 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 3 Sep 2019 13:48:45 +0000 (14:48 +0100)
Sander reported a build failure which manifests as `make; make install`
failing with:

  <snip>/cross-install -m0644 -p xen-dir/xen-shim //usr/local/lib/xen/boot/xen-shim
  install: cannot stat 'xen-dir/xen-shim': No such file or directory
  make[4]: *** [Makefile:52: install] Error 1
  make[4]: Leaving directory '/usr/src/new/xen-unstable/tools/firmware'

It has subsequently been seen intermittently by OSSTest.  This was caused by
c/s 32b1d628 triggering a preexisting linkfarm bug for partial rebuilds.

Between the first `make` and the subsequent `make install`, the linkfarm logic
observes new final build products and regenerates the linkfarm.  This includes
a distclean, which throws away everything from the first `make`.

As the xen-shim rule use a symlink, the link itself remains still up-to-date
but is broken due to the distclean, which causes install to fail.

Update the linkfarm logic to not regenerate itself when build artefacts
appear.  This isn't a comprehensive fix but is the best which can be done
easily.  Any further effort would be better spent making out-of-tree builds
work for Xen.

Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/firmware/xen-dir/Makefile

index df3f5a7006ec52ab126c21f3673a4884fe838d0d..538931e9b4b85e1b92a2f29424068f405617e342 100644 (file)
@@ -14,6 +14,26 @@ LINK_FILES=Config.mk
 DEP_DIRS=$(foreach i, $(LINK_DIRS), $(XEN_ROOT)/$(i))
 DEP_FILES=$(foreach i, $(LINK_FILES), $(XEN_ROOT)/$(i))
 
+# Exclude some intermediate files and final build products
+LINK_EXCLUDES := '*.[isoa]' '.*.d' '.*.d2' '.config'
+LINK_EXCLUDES += '*.map' 'xen' 'xen.gz' 'xen.efi' 'xen-syms'
+
+# This is all a giant mess and doesn't really work.
+#
+# The correct solution is to fix Xen to be able to do out-of-tree builds.
+#
+# Until that happens, we set up a linkfarm by iterating over the xen/ tree,
+# linking source files.  This is repeated each time we enter this directory,
+# which poses a problem for a two-step "make; make install" build process.
+#
+# Any time the list of files to link changes, we relink all files, then
+# distclean to take out not-easy-to-classify intermediate files.  This is to
+# support easy development of the shim, but has a side effect of clobbering
+# the already-built shim.
+#
+# $(LINK_EXCLUDES) should be set such that a parallel build of shim and xen/
+# doesn't cause a subsequent `make install` to decide to regenerate the
+# linkfarm.  This means that all final build artefacts must be excluded.
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
        mkdir -p $(D)
        rm -f linkfarm.stamp.tmp
@@ -25,8 +45,7 @@ linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
                        sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p .);) \
        $(foreach d, $(LINK_DIRS), \
                (cd $(XEN_ROOT); \
-                find $(d) ! -type l -type f \
-                $(addprefix ! -name , '*.[isoa]' '.*.d' '.*.d2')) \
+                find $(d) ! -type l -type f $(addprefix ! -name ,$(LINK_EXCLUDES))) \
                 >> linkfarm.stamp.tmp ; ) \
        $(foreach f, $(LINK_FILES), \
                echo $(f) >> linkfarm.stamp.tmp ;)