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 make target for generating current arch config #2446

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented Jun 25, 2024

make nativeconfig

$ make config
cp config.mk .config
/usr/local/bin/kconfig-conf Kconfig
*
* Lima
*
guestagent OS: Linux (GUESTAGENT_OS_LINUX) [Y/n/?] 
guestagent Arch: x86_64 (GUESTAGENT_ARCH_X8664) [Y/n/?] 
guestagent Arch: aarch64 (GUESTAGENT_ARCH_AARCH64) [Y/n/?] 
guestagent Arch: armv7l (GUESTAGENT_ARCH_ARMV7L) [Y/n/?] 
guestagent Arch: riscv64 (GUESTAGENT_ARCH_RISCV64) [Y/n/?] 
#
# configuration written to .config
#
$ make menuconfig
cp config.mk .config
MENUCONFIG_STYLE=aquatic \
/usr/local/bin/kconfig-mconf Kconfig


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

lima-menuconfig

The goal was to generate a config file, with only the current architecture.


Default config, empty defconfig:

#
# Automatically generated file; DO NOT EDIT.
# Lima
#
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

Could have used files:

arch/x86_64/defconfig
arch/aarch64/defconfig

As in the tool default:

ARCH=x86_64 kconfig-conf --defconfig Kconfig

***
*** Can't find default configuration "arch/x86_64/defconfig"!
***

arch/x86_64/config.mk

CONFIG_GUESTAGENT_OS_LINUX=y
CONFIG_GUESTAGENT_ARCH_X8664=y
CONFIG_GUESTAGENT_ARCH_AARCH64=n
CONFIG_GUESTAGENT_ARCH_ARMV7L=n
CONFIG_GUESTAGENT_ARCH_RISCV64=n

alternatively, defconfig:

# CONFIG_GUESTAGENT_ARCH_X8664 is not set
# CONFIG_GUESTAGENT_ARCH_ARMV7L is not set
# CONFIG_GUESTAGENT_ARCH_RISCV64 is not set

ARCH=aarch64 kconfig-conf --defconfig Kconfig

***
*** Can't find default configuration "arch/aarch64/defconfig"!
***

arch/aarch64/config.mk

CONFIG_GUESTAGENT_OS_LINUX=y
CONFIG_GUESTAGENT_ARCH_X8664=n
CONFIG_GUESTAGENT_ARCH_AARCH64=y
CONFIG_GUESTAGENT_ARCH_ARMV7L=n
CONFIG_GUESTAGENT_ARCH_RISCV64=n

alternatively, defconfig:

# CONFIG_GUESTAGENT_ARCH_AARCH64 is not set
# CONFIG_GUESTAGENT_ARCH_ARMV7L is not set
# CONFIG_GUESTAGENT_ARCH_RISCV64 is not set

The framework is overkill here, compared with kernel.

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch

Makefile Show resolved Hide resolved
@afbjorklund afbjorklund marked this pull request as draft June 28, 2024 06:35
@afbjorklund

This comment was marked as off-topic.

@afbjorklund afbjorklund marked this pull request as ready for review August 31, 2024 15:57
@AkihiroSuda AkihiroSuda added this to the v1.0 milestone Sep 1, 2024
@AkihiroSuda AkihiroSuda requested a review from a team September 8, 2024 23:05
@norio-nomura
Copy link
Contributor

I agree with the opinion that a way to install only the native guest agent is needed, but I don’t quite understand why that would require kconfig support. It seems like this could be achieved without using kconfig.

@norio-nomura
Copy link
Contributor

I don’t necessarily want to block this PR, but since I don't understand the reasons for its implementation, I don’t have the criteria to judge its merits and therefore cannot evaluate the PR.

@afbjorklund
Copy link
Member Author

afbjorklund commented Sep 9, 2024

I agree with the opinion that a way to install only the native guest agent is needed, but I don’t quite understand why that would require kconfig support. It seems like this could be achieved without using kconfig.

The Kconfig is the configuration for the Makefile code, so enabling/disabling features is done there.
The output (.config) is not complicated: https://github.com/lima-vm/lima/blob/master/config.mk

A similar system is autoconf for automake, you might have seen a ./configure script being used?
That system is still (rather) simple for the end user, but is much more complicated for the developer.

@afbjorklund

This comment was marked as outdated.

Copy link
Contributor

@norio-nomura norio-nomura left a comment

Choose a reason for hiding this comment

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

I understand what this PR is doing, but I still don’t understand why it’s necessary.

Makefile Outdated Show resolved Hide resolved
@afbjorklund
Copy link
Member Author

afbjorklund commented Sep 19, 2024

I understand what this PR is doing, but I still don’t understand why it’s necessary.

The only requirement was to be able to build Lima for the host architecture only...

Building "minimal" does this, but it doesn't include any templates or helpers.

Current workaround is doing the quiz:

*
* Lima
*
guestagent OS: Linux (GUESTAGENT_OS_LINUX) [Y/n/?] (NEW) 
guestagent Arch: x86_64 (GUESTAGENT_ARCH_X8664) [Y/n/?] (NEW) y
guestagent Arch: aarch64 (GUESTAGENT_ARCH_AARCH64) [Y/n/?] (NEW) n
guestagent Arch: armv7l (GUESTAGENT_ARCH_ARMV7L) [Y/n/?] (NEW) n
guestagent Arch: riscv64 (GUESTAGENT_ARCH_RISCV64) [Y/n/?] (NEW) n
guestagent compress (GUESTAGENT_COMPRESS) [N/y/?] (NEW) 
#
# configuration written to .config
#

i.e. same as what the new script does

@norio-nomura
Copy link
Contributor

The only requirement was to be able to build Lima for the host architecture only...

I’ve drafted a PR #2638 that refactors the Makefile, including a solution to that requirement.

@afbjorklund
Copy link
Member Author

In other news, I updated kconfig-frontends so that it builds without warnings (on Linux or Mac).

You do have to brew install qt@5 if you want the Qt GUI, it did not yet support Qt6 in Linux 5.4.

@afbjorklund
Copy link
Member Author

An improvement would be to rename it from "defconfig" to "nativeconfig" or somesuch.

And to copy the non-arch fields from the config.mk, instead of duplicating them here.

@afbjorklund afbjorklund changed the title Add defconfig make target for current arch config Add make target for generating current arch config Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants