Skip to content

Commit 2a1feb2

Browse files
authored
Merge pull request #1790 from afbjorklund/kconfig
Add basic Kconfig support for lima-guestagent
2 parents 65b5f3f + d41e74d commit 2a1feb2

File tree

5 files changed

+103
-9
lines changed

5 files changed

+103
-9
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: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ 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+
# You can install the python "kconfiglib", if you don't have kconfig/kbuild.
12+
KCONFIG_CONF ?= $(shell command -v kconfig-conf || command -v kbuild-conf || echo oldconfig)
13+
KCONFIG_MCONF ?= $(shell command -v kconfig-mconf || command -v kbuild-mconf || echo menuconfig)
14+
1015
GOOS ?= $(shell $(GO) env GOOS)
1116
ifeq ($(GOOS),windows)
1217
bat = .bat
@@ -45,6 +50,11 @@ GO_BUILD := $(GO) build -ldflags="-s -w -X $(PACKAGE)/pkg/version.Version=$(VERS
4550
.PHONY: all
4651
all: binaries manpages
4752

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

5060
.PHONY: minimal
@@ -55,21 +65,54 @@ minimal: clean \
5565
mkdir -p _output/share/lima/templates
5666
cp -aL examples/default.yaml _output/share/lima/templates/
5767

68+
config: Kconfig
69+
$(KCONFIG_CONF) $<
70+
71+
menuconfig: Kconfig
72+
MENUCONFIG_STYLE=aquatic \
73+
$(KCONFIG_MCONF) $<
74+
75+
# Copy the default config, if not overridden locally
76+
# This is done to avoid a dependency on KCONFIG tools
77+
.config: config.mk
78+
cp $^ $@
79+
80+
-include .config
81+
82+
HELPERS = \
83+
_output/bin/nerdctl.lima \
84+
_output/bin/apptainer.lima \
85+
_output/bin/docker.lima \
86+
_output/bin/podman.lima \
87+
_output/bin/kubectl.lima
88+
89+
ifeq ($(CONFIG_GUESTAGENT_OS_LINUX),y)
90+
ifeq ($(CONFIG_GUESTAGENT_ARCH_X8664),y)
91+
GUESTAGENT += \
92+
_output/share/lima/lima-guestagent.Linux-x86_64
93+
endif
94+
ifeq ($(CONFIG_GUESTAGENT_ARCH_AARCH64),y)
95+
GUESTAGENT += \
96+
_output/share/lima/lima-guestagent.Linux-aarch64
97+
endif
98+
ifeq ($(CONFIG_GUESTAGENT_ARCH_ARMV7L),y)
99+
GUESTAGENT += \
100+
_output/share/lima/lima-guestagent.Linux-armv7l
101+
endif
102+
ifeq ($(CONFIG_GUESTAGENT_ARCH_RISCV64),y)
103+
GUESTAGENT += \
104+
_output/share/lima/lima-guestagent.Linux-riscv64
105+
endif
106+
endif
107+
58108
.PHONY: binaries
59109
binaries: clean \
60110
_output/bin/lima \
61111
_output/bin/lima$(bat) \
62112
_output/bin/limactl$(exe) \
63113
codesign \
64-
_output/bin/nerdctl.lima \
65-
_output/bin/apptainer.lima \
66-
_output/bin/docker.lima \
67-
_output/bin/podman.lima \
68-
_output/bin/kubectl.lima \
69-
_output/share/lima/lima-guestagent.Linux-x86_64 \
70-
_output/share/lima/lima-guestagent.Linux-aarch64 \
71-
_output/share/lima/lima-guestagent.Linux-armv7l \
72-
_output/share/lima/lima-guestagent.Linux-riscv64
114+
$(HELPERS) \
115+
$(GUESTAGENT)
73116
cp -aL examples _output/share/lima/templates
74117
ifneq ($(GOOS),windows)
75118
ln -sf templates _output/share/lima/examples

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

website/content/en/docs/Installation/_index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,18 @@ cd lima
5656
make
5757
make install
5858
```
59+
60+
To change the build configuration, run `make config` or `make menuconfig`.
61+
62+
This requires kconfig tools installed, it is also possible to edit `.config`.
63+
The default configuration can be found in the file `config.mk` (make syntax).
64+
65+
## Kconfig tools
66+
67+
The tools are available as either "kconfig-frontends" or "kbuild-standalone".
68+
There is one `conf` for the text, and one `mconf` for the menu interface.
69+
70+
A python implementation is available at <https://pypi.org/project/kconfiglib>.
71+
It can be installed with `pip install --user kconfiglib`, including `guiconfig`.
5972
{{% /tab %}}
6073
{{< /tabpane >}}

0 commit comments

Comments
 (0)