Skip to content

Commit cbd3038

Browse files
committed
Add basic Kconfig support for lima-guestagent
Make it possible to configure which guestagents to build. Regenerating config file requires kconfig or kbuild tools. Signed-off-by: Anders F Björklund <[email protected]>
1 parent 7955f4b commit cbd3038

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_output/
22
_artifacts/
33
lima.REJECTED.yaml
4+
.config

Kconfig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
mainmenu "Lima"
3+
4+
config GUESTAGENT_OS_LINUX
5+
bool "guestagent OS: Linux"
6+
help
7+
Build lima-guestagent for "Linux" OS
8+
default y
9+
10+
config GUESTAGENT_ARCH_X8664
11+
bool "guestagent Arch: x86_64"
12+
help
13+
Build lima-guestagent for "x86_64" Arch
14+
default y
15+
16+
config GUESTAGENT_ARCH_AARCH64
17+
bool "guestagent Arch: aarch64"
18+
help
19+
Build lima-guestagent for "aarch64" Arch
20+
default y
21+
22+
config GUESTAGENT_ARCH_ARMV7L
23+
bool "guestagent Arch: armv7l"
24+
help
25+
Build lima-guestagent for "armv7l" Arch
26+
default y
27+
28+
config GUESTAGENT_ARCH_RISCV64
29+
bool "guestagent Arch: riscv64"
30+
help
31+
Build lima-guestagent for "riscv64" Arch
32+
default y

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ TAR ?= tar
77
ZIP ?= zip
88
PLANTUML ?= plantuml # may also be "java -jar plantuml.jar" if installed elsewhere
99

10+
# The KCONFIG programs are only needed for re-generating the ".config" file.
11+
KCONFIG_CONF ?= kconfig-conf
12+
KCONFIG_MCONF ?= kconfig-mconf
13+
1014
GOOS ?= $(shell $(GO) env GOOS)
1115
ifeq ($(GOOS),windows)
1216
bat = .bat
@@ -45,6 +49,11 @@ GO_BUILD := $(GO) build -ldflags="-s -w -X $(PACKAGE)/pkg/version.Version=$(VERS
4549
.PHONY: all
4650
all: binaries manpages
4751

52+
.PHONY: help
53+
help:
54+
@echo ' binaries - Build all binaries'
55+
@echo ' manpages - Build manual pages'
56+
4857
exe: _output/bin/limactl$(exe)
4958

5059
.PHONY: minimal
@@ -55,21 +64,44 @@ minimal: clean \
5564
mkdir -p _output/share/lima/templates
5665
cp -aL examples/default.yaml _output/share/lima/templates/
5766

67+
config: Kconfig
68+
$(KCONFIG_CONF) $<
69+
70+
menuconfig: Kconfig
71+
$(KCONFIG_MCONF) $<
72+
73+
# Copy the default config, if not overridden locally
74+
# This is done to avoid a dependency on KCONFIG tools
75+
.config: config.mk
76+
cp $^ $@
77+
78+
-include .config
79+
5880
HELPERS = \
5981
_output/bin/nerdctl.lima \
6082
_output/bin/apptainer.lima \
6183
_output/bin/docker.lima \
6284
_output/bin/podman.lima \
6385
_output/bin/kubectl.lima
6486

87+
ifeq ($(CONFIG_GUESTAGENT_OS_LINUX),y)
88+
ifeq ($(CONFIG_GUESTAGENT_ARCH_X8664),y)
6589
GUESTAGENT += \
6690
_output/share/lima/lima-guestagent.Linux-x86_64
91+
endif
92+
ifeq ($(CONFIG_GUESTAGENT_ARCH_AARCH64),y)
6793
GUESTAGENT += \
6894
_output/share/lima/lima-guestagent.Linux-aarch64
95+
endif
96+
ifeq ($(CONFIG_GUESTAGENT_ARCH_ARMV7L),y)
6997
GUESTAGENT += \
7098
_output/share/lima/lima-guestagent.Linux-armv7l
99+
endif
100+
ifeq ($(CONFIG_GUESTAGENT_ARCH_RISCV64),y)
71101
GUESTAGENT += \
72102
_output/share/lima/lima-guestagent.Linux-riscv64
103+
endif
104+
endif
73105

74106
.PHONY: binaries
75107
binaries: clean \

config.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG_GUESTAGENT_OS_LINUX=y
2+
CONFIG_GUESTAGENT_ARCH_X8664=y
3+
CONFIG_GUESTAGENT_ARCH_AARCH64=y
4+
CONFIG_GUESTAGENT_ARCH_ARMV7L=y
5+
CONFIG_GUESTAGENT_ARCH_RISCV64=y

0 commit comments

Comments
 (0)