]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
build: Introduce `UK_IMAGE_NAME_OVERWRITE` make var
authorAlexander Jung <alex@unikraft.io>
Wed, 22 Nov 2023 13:46:33 +0000 (14:46 +0100)
committerSimon Kuenzer <simon@unikraft.io>
Thu, 23 Nov 2023 00:13:25 +0000 (01:13 +0100)
This commit introduces a new make variable,
`UK_IMAGE_NAME_OVERWRITE`, which is used to customize the
output binary name of the kernel image.  This is a special,
and experimental, variable which can be helpful in certain
use cases, for example where targets with the same architecture
and platform are present.  This variable should be used in
conjunction with a different build directory, `O=`, as the
resulting binary will always have the name from this option.

Signed-off-by: Alexander Jung <alex@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1169

Makefile
plat/kvm/Linker.uk
plat/linuxu/Linker.uk
plat/xen/Linker.uk

index a3fcddfef334f794136c95b4e2b63c673cb68fd4..b936d11e5d09ba75e7133f95c50cd8e9de168556 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -396,6 +396,20 @@ else
 CONFIG_UK_NAME ?= $(notdir $(APP_DIR))
 endif
 
+# Option to overwrite file name of generated images by supported platforms. The
+# target platform has to support this feature.  When unset or unsupported by the
+# platform, the default semantic of the target platform (typically
+# `$(UK_NAME)_$(PLAT)_$(ARCH)`) will be used.
+#
+# NOTE: Please note that multi-platform builds do not work anymore when this
+#       option is used.  The reason is that the build system will generate the
+#       same file by each selected platform.  Make won't be able to proceed
+#       building.
+# NOTE: This feature is currently used by kraftkit.
+ifneq ($(call qstrip,$(UK_IMAGE_NAME_OVERWRITE)),)
+UK_IMAGE_NAME_OVERWRITE := $(call qstrip,$(UK_IMAGE_NAME_OVERWRITE))
+endif
+
 # remove quotes from CONFIG_UK_NAME
 CONFIG_UK_NAME := $(call qstrip,$(CONFIG_UK_NAME))
 export CONFIG_UK_NAME
index d281452e40d8f006c042c6517e63b1954605def5..7223fd89fbf50f64e11489237e34e2ffabe2b53b 100644 (file)
@@ -35,7 +35,11 @@ else
 KVM_VMM := kvm
 endif
 
+ifneq ($(UK_IMAGE_NAME_OVERWRITE),)
+KVM_IMAGE := $(BUILD_DIR)/$(UK_IMAGE_NAME_OVERWRITE)
+else
 KVM_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_$(KVM_VMM)-$(CONFIG_UK_ARCH)
+endif
 KVM_DEBUG_IMAGE := $(KVM_IMAGE).dbg
 
 KVM_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-dT$(comma),\
index fd050078a832622cf6f07d0eb38996fdad254076..d5543ac3ec4da26f438eb64b11b1c3b65fd64a30 100644 (file)
@@ -3,7 +3,11 @@ LINUXU_LDFLAGS-y += -Wl,-e,_liblinuxuplat_start
 ##
 ## Link image
 ##
+ifneq ($(UK_IMAGE_NAME_OVERWRITE),)
+LINUXU_IMAGE := $(BUILD_DIR)/$(UK_IMAGE_NAME_OVERWRITE)
+else
 LINUXU_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_linuxu-$(CONFIG_UK_ARCH)
+endif
 LINUXU_DEBUG_IMAGE := $(LINUXU_IMAGE).dbg
 LINUXU_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-T$(comma),\
                            $(LINUXU_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y))
index 0186e4f6fb1f26aa3a10fa11207d43c947e1b996..30daf7feb9f152bbf150a1f2394620008cc5b778 100644 (file)
@@ -5,11 +5,15 @@ endif
 ##
 ## Link image
 ##
-ifeq (arm,$(CONFIG_UK_ARCH))
+ifneq ($(UK_IMAGE_NAME_OVERWRITE),)
+XEN_RAW_IMAGE   := $(BUILD_DIR)/$(UK_IMAGE_NAME_OVERWRITE)
+else
 XEN_RAW_IMAGE   := $(BUILD_DIR)/$(CONFIG_UK_NAME)_xen-$(CONFIG_UK_ARCH)
+endif
+ifeq (arm,$(CONFIG_UK_ARCH))
 XEN_IMAGE       := $(XEN_RAW_IMAGE).elf
 else
-XEN_IMAGE       := $(BUILD_DIR)/$(CONFIG_UK_NAME)_xen-$(CONFIG_UK_ARCH)
+XEN_IMAGE       := $(XEN_RAW_IMAGE)
 endif
 XEN_DEBUG_IMAGE := $(XEN_IMAGE).dbg