Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Kconfig support for lima-guestagent #1790

Merged
merged 4 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_output/
_artifacts/
lima.REJECTED.yaml
.config
32 changes: 32 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -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
61 changes: 52 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ 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.
# 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)
bat = .bat
Expand Down Expand Up @@ -45,6 +50,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make minimal should now generate a new .config and run make binary ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everything is configurable, and there is no mechanism for "host arch"

Expand All @@ -55,21 +65,54 @@ minimal: clean \
mkdir -p _output/share/lima/templates
cp -aL examples/default.yaml _output/share/lima/templates/

config: Kconfig
$(KCONFIG_CONF) $<

menuconfig: Kconfig
MENUCONFIG_STYLE=aquatic \
$(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 \
_output/bin/docker.lima \
_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 \
_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
Expand Down
5 changes: 5 additions & 0 deletions config.mk
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
13 changes: 13 additions & 0 deletions website/content/en/docs/Installation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraphs should be inside ## Kconfig tools

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was for the user that doesn't have any tools, but edits the config as text

## Kconfig tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Kconfig tools
## Kconfig tools (optional)


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 <https://pypi.org/project/kconfiglib>.
It can be installed with `pip install --user kconfiglib`, including `guiconfig`.
{{% /tab %}}
{{< /tabpane >}}
Loading