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 defconfig make target for 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 defconfig

$ 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

@@ -72,6 +72,11 @@ menuconfig: Kconfig
MENUCONFIG_STYLE=aquatic \
$(KCONFIG_MCONF) $<

# Generate config for the current architecture (only)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we build arm64 and amd64 by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly. But we build for everything by default. This was a request for something between "minimal" and "all"

What I have wanted in the past is something like make minimal templates install, so I still get all the templates, but only the native guestagent. Because minimal only installs the default template.

Going with files (instead of a script) is probably easiest for discussion, even if config is somewhat duplicated.

@afbjorklund afbjorklund marked this pull request as draft June 28, 2024 06:35
@afbjorklund

This comment was marked as off-topic.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
@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
Copy link
Member Author

afbjorklund commented Sep 9, 2024

Another approach would be to add another boolean, that would override the other ones (per arch).

e.g. GUESTAGENT_ARCH_HOSTONLY

lima-qconf

#
# Automatically generated file; DO NOT EDIT.
# Lima
#
CONFIG_GUESTAGENT_OS_LINUX=y
CONFIG_GUESTAGENT_ARCH_HOSTONLY=y
CONFIG_GUESTAGENT_COMPRESS=n

And then do the rest (uname) in the Makefile.

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.

@@ -72,6 +72,11 @@ menuconfig: Kconfig
MENUCONFIG_STYLE=aquatic \
$(KCONFIG_MCONF) $<

# Generate config for the current architecture (only)
# This is done to avoid a dependency on KCONFIG tools
defconfig:
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the name defconfig mean? If it stands for something like 'default config,' wouldn't config.mk already be the default? I believe the name should be something that users searching for the feature added by this PR can easily find.

Copy link
Member Author

@afbjorklund afbjorklund Sep 19, 2024

Choose a reason for hiding this comment

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

It's a kconfig thing, I think it stands for default config for this specific architecture or some-such?
It's unrelated to the "default config" (all options off / empty config file), in that it does have config.

The way it is created is that you select the options you want, and then run "savedefconfig" to defconfig.
The normal .config file that is generated has all available options, including ones you didn't pick.

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 is useful when you are building something linux or busybox, or an embedded system like buildroot.

It is totally overkill for something with a half dozen options (like Lima) - unless you are already used to it :-)

@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
#

@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.

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