Makefile: Provide default hypervisor CMD settings#1168
Conversation
8efaaea to
9dc3e5e
Compare
|
quick feedback - you'll need to modify the PR to match the project format/requirements to pass the initial CI - see link in the travis logs as per https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md#patch-format below: |
|
@grahamwhaley Thanks for the pointer, I had just tossed it up and was looking to see what stuck. I'll open an issue as that seems like the only thing I'm failing on with the patch-format now after fixing the signoff. |
9dc3e5e to
7b1752d
Compare
|
/test |
jodh-intel
left a comment
There was a problem hiding this comment.
Thanks for raising but either I'm misunderstanding what your PR does, or you are misunderstanding what our build system does :)
The way it currently works is to load arch-specific settings from arch/*.mk. That sets the correct QEMUCMD (which is architecture dependent btw) and also sets FCCMD for those architectures that FC supports.
Providing a default qemu binary name is meaningless if you look at how they vary by platform.
| LOCALSTATEDIR := /var | ||
|
|
||
| # default CMD names if not | ||
| QEMUCMD ?= kata-qemu-lite-system-x86_64 |
There was a problem hiding this comment.
What's this? We don't use a kata prefix as this is not a Kata-developed component.
|
Ah - I think I might see what you were trying to do now; the build currently requires diff --git a/Makefile b/Makefile
index 1c11f74..86ce694 100644
--- a/Makefile
+++ b/Makefile
@@ -23,22 +23,20 @@ ifeq ($(SKIP_GO_VERSION_CHECK),)
include golang.mk
endif
-ifneq ($(GOPATH),)
- GOARCH=$(shell go env GOARCH)
- ifeq ($(ARCH),)
- ARCH = $(GOARCH)
- endif
-
- ARCH_DIR = arch
- ARCH_FILE_SUFFIX = -options.mk
- 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)
+GOARCH=$(shell go env GOARCH)
+ifeq ($(ARCH),)
+ ARCH = $(GOARCH)
endif
+ARCH_DIR = arch
+ARCH_FILE_SUFFIX = -options.mk
+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)
+
PROJECT_TYPE = kata
PROJECT_NAME = Kata Containers
PROJECT_TAG = kata-containers |
|
@jodh-intel So the issue raised is when the GOPATH is set, the autodetection using the arch scripts isn't run is that something that could be modified then? |
|
@jodh-intel Okay, I'll give that a try. |
|
@jodh-intel I tested your patch, it as I was expecting, what I dont really get is that the GOPATH is actually set en my environment |
Architecture-dependent settings were not being populated when GOPATH was set. This change ensures they are always set. Fixes kata-containers#1169 Signed-off-by: William Douglas <william.douglas@intel.com>
7b1752d to
a02c39e
Compare
|
@jodh-intel Okay, I just applied your suggestion directly and am happy with the result, thanks! |
| # Load architecture-dependent settings | ||
| include $(ARCH_FILE) | ||
| GOARCH=$(shell go env GOARCH) | ||
| ifeq ($(ARCH),) |
There was a problem hiding this comment.
It might be worth adding a comment here explaining this is to allow the user to set ARCH before we overwrite it.
More info
A quick look makes it appear as though this is wrong since ARCH isn't set yet. However, since ARCH is added to the USER_VARS variable, that check is to allow the user to define the architecture they want to build with (cross build). If not specified, we default to the host architecture (using go's naming rather than that of arch(1)):
$ make ARCH=foo ...|
/test |
|
/retest |
|
fedora vsocks CI failed due to network timeout. But since all the other CI's are passing (ignoring the known ARM issue), I'm going to merge anyway since this code is not distro specific... |
@jodh-intel does makefile call "go" without GOPATH? If so, maybe I can update "GOPATH not set mode" to non-go mode because: |
|
I think you probably want |
As arch detection isn't being done and KNOWN_HYPERVISORS was only
being populated via environment variable settings (and is a runtime
rather than build time dependency anyway) just provide a set of
defaults that can be overridden as needed at build time.
This will also cause any hypervisor configuration to always be
installed.