savedefconfig:
@$(COMMON_CONFIG_ENV) $(KPYTHON) $(CONFIGLIB)/savedefconfig.py --kconfig $(CONFIG_CONFIG_IN) --out $(DEFCONFIG)
+ifeq ($(HOSTARCH),$(CONFIG_UK_ARCH))
+ @# Make sure arch is stored in the file even if arch matches between host and config
+ @echo "$(call ukarch_str2cfg,$(CONFIG_UK_ARCH))=y" >> $(DEFCONFIG)
+endif
oldconfig:
@$(COMMON_CONFIG_ENV) $(KPYTHON) $(CONFIGLIB)/oldconfig.py $(CONFIG_CONFIG_IN)
@$(COMMON_CONFIG_ENV) $< \
--savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
$(CONFIG_CONFIG_IN)
+ifeq ($(HOSTARCH),$(CONFIG_UK_ARCH))
+ @# Make sure arch is stored in the file even if arch matches between host and config
+ @echo "$(call ukarch_str2cfg,$(CONFIG_UK_ARCH))=y" >> \
+ $(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
+endif
.PHONY: defconfig savedefconfig silentoldconfig
define aarch64_no_reserved_tcb_overlap =
$(eval LIBCONTEXT_CFLAGS-y+=-DCONFIG_AARCH64_NO_TCB_OVERLAP=1)
endef
+
+# Converts an architecture string to the corresponding name of a configuration
+# variable
+# WARNING: This function might need to get modified as sson as we introduce
+# another (external) architecture. This is is only necessary if the
+# following assumption will note be valid:
+# This function intents that for any future architecture the
+# configuration name of matches with its name string, like we we have
+# with x86: For example, the architecture string is called "x86_64" and
+# its configuration name just contains this string in capital letters:
+# `CONFIG_ARCH_X86_64`
+# Usage:
+# $(call ukarch_str2cfg,"<architecture name>")
+define ukarch_str2cfg =
+$(addprefix CONFIG_ARCH_,$(call uc,$(subst arm,ARM_32,$(subst arm64,ARM_64,$(1)))))
+endef