From 7955f4b98acf028a14ed54424a31f0a5b6ea3394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Wed, 13 Sep 2023 22:34:45 +0200 Subject: [PATCH 1/4] Move helpers and guestagent into make variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor the list of helpers and lima-guestagent binaries. This makes it easier to make them into optional, later on. Signed-off-by: Anders F Björklund --- Makefile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 60c099161f8..0017a81291c 100644 --- a/Makefile +++ b/Makefile @@ -55,21 +55,30 @@ minimal: clean \ mkdir -p _output/share/lima/templates cp -aL examples/default.yaml _output/share/lima/templates/ +HELPERS = \ + _output/bin/nerdctl.lima \ + _output/bin/apptainer.lima \ + _output/bin/docker.lima \ + _output/bin/podman.lima \ + _output/bin/kubectl.lima + +GUESTAGENT += \ + _output/share/lima/lima-guestagent.Linux-x86_64 +GUESTAGENT += \ + _output/share/lima/lima-guestagent.Linux-aarch64 +GUESTAGENT += \ + _output/share/lima/lima-guestagent.Linux-armv7l +GUESTAGENT += \ + _output/share/lima/lima-guestagent.Linux-riscv64 + .PHONY: binaries binaries: clean \ _output/bin/lima \ _output/bin/lima$(bat) \ _output/bin/limactl$(exe) \ codesign \ - _output/bin/nerdctl.lima \ - _output/bin/apptainer.lima \ - _output/bin/docker.lima \ - _output/bin/podman.lima \ - _output/bin/kubectl.lima \ - _output/share/lima/lima-guestagent.Linux-x86_64 \ - _output/share/lima/lima-guestagent.Linux-aarch64 \ - _output/share/lima/lima-guestagent.Linux-armv7l \ - _output/share/lima/lima-guestagent.Linux-riscv64 + $(HELPERS) \ + $(GUESTAGENT) cp -aL examples _output/share/lima/templates ifneq ($(GOOS),windows) ln -sf templates _output/share/lima/examples From cbd30383bdc72e6b5250830b5987af1af73e9962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Wed, 13 Sep 2023 22:39:02 +0200 Subject: [PATCH 2/4] Add basic Kconfig support for lima-guestagent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to configure which guestagents to build. Regenerating config file requires kconfig or kbuild tools. Signed-off-by: Anders F Björklund --- .gitignore | 1 + Kconfig | 32 ++++++++++++++++++++++++++++++++ Makefile | 32 ++++++++++++++++++++++++++++++++ config.mk | 5 +++++ 4 files changed, 70 insertions(+) create mode 100644 Kconfig create mode 100644 config.mk diff --git a/.gitignore b/.gitignore index 2bae5197a34..344e50b3d6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ _output/ _artifacts/ lima.REJECTED.yaml +.config diff --git a/Kconfig b/Kconfig new file mode 100644 index 00000000000..3e68bc4f2db --- /dev/null +++ b/Kconfig @@ -0,0 +1,32 @@ + +mainmenu "Lima" + +config GUESTAGENT_OS_LINUX + bool "guestagent OS: Linux" + help + Build lima-guestagent for "Linux" OS + default y + +config GUESTAGENT_ARCH_X8664 + bool "guestagent Arch: x86_64" + help + Build lima-guestagent for "x86_64" Arch + default y + +config GUESTAGENT_ARCH_AARCH64 + bool "guestagent Arch: aarch64" + help + Build lima-guestagent for "aarch64" Arch + default y + +config GUESTAGENT_ARCH_ARMV7L + bool "guestagent Arch: armv7l" + help + Build lima-guestagent for "armv7l" Arch + default y + +config GUESTAGENT_ARCH_RISCV64 + bool "guestagent Arch: riscv64" + help + Build lima-guestagent for "riscv64" Arch + default y diff --git a/Makefile b/Makefile index 0017a81291c..fc0760a261d 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,10 @@ TAR ?= tar ZIP ?= zip PLANTUML ?= plantuml # may also be "java -jar plantuml.jar" if installed elsewhere +# The KCONFIG programs are only needed for re-generating the ".config" file. +KCONFIG_CONF ?= kconfig-conf +KCONFIG_MCONF ?= kconfig-mconf + GOOS ?= $(shell $(GO) env GOOS) ifeq ($(GOOS),windows) bat = .bat @@ -45,6 +49,11 @@ GO_BUILD := $(GO) build -ldflags="-s -w -X $(PACKAGE)/pkg/version.Version=$(VERS .PHONY: all all: binaries manpages +.PHONY: help +help: + @echo ' binaries - Build all binaries' + @echo ' manpages - Build manual pages' + exe: _output/bin/limactl$(exe) .PHONY: minimal @@ -55,6 +64,19 @@ minimal: clean \ mkdir -p _output/share/lima/templates cp -aL examples/default.yaml _output/share/lima/templates/ +config: Kconfig + $(KCONFIG_CONF) $< + +menuconfig: Kconfig + $(KCONFIG_MCONF) $< + +# Copy the default config, if not overridden locally +# This is done to avoid a dependency on KCONFIG tools +.config: config.mk + cp $^ $@ + +-include .config + HELPERS = \ _output/bin/nerdctl.lima \ _output/bin/apptainer.lima \ @@ -62,14 +84,24 @@ HELPERS = \ _output/bin/podman.lima \ _output/bin/kubectl.lima +ifeq ($(CONFIG_GUESTAGENT_OS_LINUX),y) +ifeq ($(CONFIG_GUESTAGENT_ARCH_X8664),y) GUESTAGENT += \ _output/share/lima/lima-guestagent.Linux-x86_64 +endif +ifeq ($(CONFIG_GUESTAGENT_ARCH_AARCH64),y) GUESTAGENT += \ _output/share/lima/lima-guestagent.Linux-aarch64 +endif +ifeq ($(CONFIG_GUESTAGENT_ARCH_ARMV7L),y) GUESTAGENT += \ _output/share/lima/lima-guestagent.Linux-armv7l +endif +ifeq ($(CONFIG_GUESTAGENT_ARCH_RISCV64),y) GUESTAGENT += \ _output/share/lima/lima-guestagent.Linux-riscv64 +endif +endif .PHONY: binaries binaries: clean \ diff --git a/config.mk b/config.mk new file mode 100644 index 00000000000..89f5488fe55 --- /dev/null +++ b/config.mk @@ -0,0 +1,5 @@ +CONFIG_GUESTAGENT_OS_LINUX=y +CONFIG_GUESTAGENT_ARCH_X8664=y +CONFIG_GUESTAGENT_ARCH_AARCH64=y +CONFIG_GUESTAGENT_ARCH_ARMV7L=y +CONFIG_GUESTAGENT_ARCH_RISCV64=y From a99965daf44cb58dc90b7d8111ca5f886129897d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Fri, 15 Sep 2023 11:39:16 +0200 Subject: [PATCH 3/4] Add the portable python programs for kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fc0760a261d..857b77a3809 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,9 @@ ZIP ?= zip PLANTUML ?= plantuml # may also be "java -jar plantuml.jar" if installed elsewhere # The KCONFIG programs are only needed for re-generating the ".config" file. -KCONFIG_CONF ?= kconfig-conf -KCONFIG_MCONF ?= kconfig-mconf +# You can install the python "kconfiglib", if you don't have kconfig/kbuild. +KCONFIG_CONF ?= $(shell command -v kconfig-conf || command -v kbuild-conf || echo oldconfig) +KCONFIG_MCONF ?= $(shell command -v kconfig-mconf || command -v kbuild-mconf || echo menuconfig) GOOS ?= $(shell $(GO) env GOOS) ifeq ($(GOOS),windows) @@ -68,6 +69,7 @@ config: Kconfig $(KCONFIG_CONF) $< menuconfig: Kconfig + MENUCONFIG_STYLE=aquatic \ $(KCONFIG_MCONF) $< # Copy the default config, if not overridden locally From d41e74d908375443af87f71d5ac640c7f2773d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Tue, 19 Sep 2023 11:51:17 +0200 Subject: [PATCH 4/4] Update website with the kconfig programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- website/content/en/docs/Installation/_index.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/website/content/en/docs/Installation/_index.md b/website/content/en/docs/Installation/_index.md index 5991f1b8794..9449cff5f42 100644 --- a/website/content/en/docs/Installation/_index.md +++ b/website/content/en/docs/Installation/_index.md @@ -56,5 +56,18 @@ cd lima make make install ``` + +To change the build configuration, run `make config` or `make menuconfig`. + +This requires kconfig tools installed, it is also possible to edit `.config`. +The default configuration can be found in the file `config.mk` (make syntax). + +## Kconfig tools + +The tools are available as either "kconfig-frontends" or "kbuild-standalone". +There is one `conf` for the text, and one `mconf` for the menu interface. + +A python implementation is available at . +It can be installed with `pip install --user kconfiglib`, including `guiconfig`. {{% /tab %}} {{< /tabpane >}}