]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
build: Forward host architecture from build system to KConfig
authorSimon Kuenzer <simon@unikraft.io>
Fri, 8 Sep 2023 21:30:11 +0000 (23:30 +0200)
committerRazvan Deaconescu <razvand@unikraft.io>
Fri, 20 Oct 2023 16:32:28 +0000 (19:32 +0300)
Commit c11dceaa9698 ("kconfig: Determine the default arch from CC")
introduced the automatic selection of a default target architecture by
querying and parsing the default compiler's target machine. Because the
detection breaks across GCC output versions, this commit forwards the host
architecture already detected by the main Makefile to the KConfig
system. This way, KConfig will be in sync with what the Makefile system has
detected.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1084

Config.uk
Makefile
arch/Config.uk

index 74d625246f01d2d958514c8e0ddcba78fcf417ba..cbb56ace760235d64bed4cfdff27543d77733e06 100644 (file)
--- a/Config.uk
+++ b/Config.uk
@@ -3,12 +3,15 @@
 # see https://www.kernel.org/doc/Documentation/kbuild/Config.in-language.txt.
 #
 mainmenu "Unikraft/$(UK_FULLVERSION) Configuration"
+
 config UK_FULLVERSION
        string
        default "$(UK_FULLVERSION)"
+
 config UK_CODENAME
        string
        default "$(UK_CODENAME)"
+
 config UK_ARCH
        string
        default "x86_64" if ARCH_X86_64
@@ -16,6 +19,10 @@ config UK_ARCH
        default "arm"   if ARCH_ARM_32
        default "$(UK_ARCH)"
 
+config HOST_ARCH
+       string
+       default "$(HOST_ARCH)"
+
 config NO_APP
        def_bool $(shell,test $(UK_BASE) = $(UK_APP) && echo y || echo n)
 
index 4badad8529082965fbd256362d87f4d66068b19a..ba7b592adb86ad911d38a2169f8662830b80d8b2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -882,13 +882,12 @@ DEFCONFIG = $(call qstrip,$(UK_DEFCONFIG))
 # We don't want to fully expand UK_DEFCONFIG here, so Kconfig will
 # recognize that if it's still at its default $(CONFIG_DIR)/defconfig
 COMMON_CONFIG_ENV = \
-       CC=$(CC)\
        CONFIG_="CONFIG_" \
        KCONFIG_CONFIG="$(UK_CONFIG)" \
        KCONFIG_AUTOCONFIG="$(KCONFIG_AUTOCONFIG)" \
        KCONFIG_AUTOHEADER="$(KCONFIG_AUTOHEADER)" \
        KCONFIG_TRISTATE="$(KCONFIG_TRISTATE)" \
-       HOST_GCC_VERSION="$(HOSTCC_VERSION)" \
+       HOST_ARCH="$(HOSTARCH)" \
        BUILD_DIR="$(BUILD_DIR)" \
        UK_BASE="$(CONFIG_UK_BASE)" \
        UK_APP="$(CONFIG_UK_APP)" \
index 6c3e3d66e30632a7ac8244addc882efc1bb2ff38..cd4e0d78153b8e1543a7fad89bd17b48d86d1049 100644 (file)
@@ -1,7 +1,7 @@
 choice
        prompt "Architecture"
-       default ARCH_ARM_32 if ($(shell,$(CC) -dumpmachine | cut -d '-' -f1) = "arm")
-       default ARCH_ARM_64 if ($(shell,$(CC) -dumpmachine | cut -d '-' -f1) = "arm64")
+       default ARCH_ARM_32 if HOST_ARCH = "arm"
+       default ARCH_ARM_64 if HOST_ARCH = "arm64"
        default ARCH_X86_64
        help
          Select the target CPU architecture.