From: Alexander Jung Date: Wed, 22 Nov 2023 13:46:33 +0000 (+0100) Subject: build: Introduce `UK_IMAGE_NAME_OVERWRITE` make var X-Git-Tag: RELEASE-0.16.0~207 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0a82b246dc72c171e4746455eb63576c588046f2;p=unikraft%2Funikraft.git build: Introduce `UK_IMAGE_NAME_OVERWRITE` make var 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 Reviewed-by: Simon Kuenzer Approved-by: Simon Kuenzer GitHub-Closes: #1169 --- diff --git a/Makefile b/Makefile index a3fcddfef..b936d11e5 100644 --- 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 diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk index d281452e4..7223fd89f 100644 --- a/plat/kvm/Linker.uk +++ b/plat/kvm/Linker.uk @@ -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),\ diff --git a/plat/linuxu/Linker.uk b/plat/linuxu/Linker.uk index fd050078a..d5543ac3e 100644 --- a/plat/linuxu/Linker.uk +++ b/plat/linuxu/Linker.uk @@ -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)) diff --git a/plat/xen/Linker.uk b/plat/xen/Linker.uk index 0186e4f6f..30daf7feb 100644 --- a/plat/xen/Linker.uk +++ b/plat/xen/Linker.uk @@ -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