From 37df1678ae8e3c913b23e6bcfce3ccb5975241e0 Mon Sep 17 00:00:00 2001 From: Yu Li Date: Thu, 20 Jan 2022 10:53:22 +0800 Subject: [PATCH] build: always reset ARCH after getting it When building with `ARCH=x86_64`, the previous `Makefile` will use it without checking and cause: Makefile:319: *** "ERROR: No hypervisors known for architecture x86_64 (looked for: acrn firecracker qemu cloud-hypervisor)". Stop. This commit fix the above issue by checking `ARCH` no matter where it is assigned. Fixes: #3444 Signed-off-by: James O. D. Hunt Signed-off-by: Yu Li --- src/runtime/Makefile | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/runtime/Makefile b/src/runtime/Makefile index f936bd796c..db2c5446ca 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -8,20 +8,19 @@ SKIP_GO_VERSION_CHECK= include golang.mk #Get ARCH. -ifneq (,$(golang_version_raw)) - GOARCH=$(shell go env GOARCH) - ifeq ($(ARCH),) - ARCH = $(GOARCH) - endif -else - ARCH = $(shell uname -m) - ifeq ($(ARCH),x86_64) - ARCH = amd64 - endif - ifeq ($(ARCH),aarch64) - ARCH = arm64 +ifeq ($(ARCH),) + ifneq (,$(golang_version_raw)) + override ARCH = $(shell go env GOARCH) + else + override ARCH = $(shell uname -m) endif endif +ifeq ($(ARCH),x86_64) + override ARCH = amd64 +endif +ifeq ($(ARCH),aarch64) + override ARCH = arm64 +endif ARCH_DIR = arch ARCH_FILE_SUFFIX = -options.mk @@ -29,8 +28,12 @@ ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX) ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX)) ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES)) -# Load architecture-dependent settings -include $(ARCH_FILE) +ifeq (,$(realpath $(ARCH_FILE))) + $(error "ERROR: invalid architecture: '$(ARCH)'") +else + # Load architecture-dependent settings + include $(ARCH_FILE) +endif PROJECT_TYPE = kata PROJECT_NAME = Kata Containers