From 0a21ad78b12d362912a826b8e22140f45e8d9f9f Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Tue, 7 Feb 2023 18:30:16 +0100 Subject: [PATCH] osbuilder: fix default build target in makefile The .dracut_rootfs.done file is accidentally being picked up as the default target, regardless of BUILD_METHOD. Move the 'all' target definition up, so that it's the default (=first) target in the makefile. Additionally make the .dracut_rootfs.done target conditional on the right BUILD_METHOD being selected, as building it doesn't make sense with BUILD_METHOD=distro. Fixes: #6235 Signed-off-by: Jeremi Piotrowski --- tools/osbuilder/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/osbuilder/Makefile b/tools/osbuilder/Makefile index 25effc967e..19dc3bd0e5 100644 --- a/tools/osbuilder/Makefile +++ b/tools/osbuilder/Makefile @@ -85,6 +85,9 @@ endif ################################################################################ +.PHONY: all +all: image initrd + rootfs-%: $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX) @ # DONT remove. This is not cancellation rule. @@ -97,11 +100,13 @@ $(ROOTFS_BUILD_DEST)/.%$(ROOTFS_MARKER_SUFFIX):: rootfs-builder/% # extract it in a local folder. # Notes: # - assuming a not compressed initrd. +ifeq (dracut,$(BUILD_METHOD)) .PRECIOUS: $(ROOTFS_BUILD_DEST)/.dracut$(ROOTFS_MARKER_SUFFIX) $(ROOTFS_BUILD_DEST)/.dracut$(ROOTFS_MARKER_SUFFIX): $(TARGET_INITRD) mkdir -p $(TARGET_ROOTFS) (cd $(TARGET_ROOTFS); cat $< | cpio --extract --preserve-modification-time --make-directories) @touch $@ +endif image-%: $(IMAGES_BUILD_DEST)/kata-containers-image-%.img @ # DONT remove. This is not cancellation rule. @@ -117,9 +122,6 @@ initrd-%: $(IMAGES_BUILD_DEST)/kata-containers-initrd-%.img $(IMAGES_BUILD_DEST)/kata-containers-initrd-%.img: rootfs-% $(call silent_run,Creating initrd image for $*,$(INITRD_BUILDER) -o $@ $(ROOTFS_BUILD_DEST)/$*_rootfs) -.PHONY: all -all: image initrd - .PHONY: rootfs rootfs: $(TARGET_ROOTFS_MARKER)