Skip to content

Commit

Permalink
Add basic Kconfig support for lima-guestagent
Browse files Browse the repository at this point in the history
Make it possible to configure which guestagents to build.

Regenerating config requires python kconfiglib or similar.

Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Sep 13, 2023
1 parent 4cc8d2c commit 2be798c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .config
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mainmenu "Lima"

config GUESTAGENT_OS_LINUX
bool "guestagent OS: Linux"
default y

config GUESTAGENT_ARCH_X8664
bool "guestagent Arch: x86_64"
default y

config GUESTAGENT_ARCH_AARCH64
bool "guestagent Arch: aarch64"
default y

config GUESTAGENT_ARCH_ARMV7L
bool "guestagent Arch: armv7l"
default y

config GUESTAGENT_ARCH_RISCV64
bool "guestagent Arch: riscv64"
default y
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ TAR ?= tar
ZIP ?= zip
PLANTUML ?= plantuml # may also be "java -jar plantuml.jar" if installed elsewhere

KCONFIG_CONF ?= oldconfig
KCONFIG_MCONF ?= menuconfig

GOOS ?= $(shell $(GO) env GOOS)
ifeq ($(GOOS),windows)
bat = .bat
Expand Down Expand Up @@ -45,6 +48,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
Expand All @@ -55,21 +63,39 @@ minimal: clean \
mkdir -p _output/share/lima/templates
cp -aL examples/default.yaml _output/share/lima/templates/

-include .config

config: Kconfig
$(KCONFIG_CONF) $<

menuconfig: Kconfig
$(KCONFIG_MCONF) $<

HELPERS = \
_output/bin/nerdctl.lima \
_output/bin/apptainer.lima \
_output/bin/docker.lima \
_output/bin/podman.lima \
_output/bin/kubectl.lima

ifdef CONFIG_GUESTAGENT_OS_LINUX
ifdef CONFIG_GUESTAGENT_ARCH_X8664
GUESTAGENT += \
_output/share/lima/lima-guestagent.Linux-x86_64
endif
ifdef CONFIG_GUESTAGENT_ARCH_AARCH64
GUESTAGENT += \
_output/share/lima/lima-guestagent.Linux-aarch64
endif
ifdef CONFIG_GUESTAGENT_ARCH_ARMV7L
GUESTAGENT += \
_output/share/lima/lima-guestagent.Linux-armv7l
endif
ifdef CONFIG_GUESTAGENT_ARCH_RISCV64
GUESTAGENT += \
_output/share/lima/lima-guestagent.Linux-riscv64
endif
endif

.PHONY: binaries
binaries: clean \
Expand Down

0 comments on commit 2be798c

Please sign in to comment.