kbuild: Allow building of samples with UML
Subsystems (4)
PATCH 1/1 kbuild: Allow building of samples with UML
It's useful to build samples/* with UML and the only blocker is the artificial incompatibility with CONFIG_HEADERS_INSTALL.
Allow the headers_install target with ARCH=um, which then allow building samples (and tests using them) with UML too:
printf 'CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' >.config make ARCH=um olddefconfig headers_install
make ARCH=um samples/landlock/
--- Makefile | 1 - lib/Kconfig.debug | 1 - 2 files changed, 2 deletions(-)
Makefile +0 -1
@@ -1355,7 +1355,6 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj PHONY += headers headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts - $(if $(filter um, $(SRCARCH)), $(error Headers not exportable for UML)) $(Q)$(MAKE) $(hdr-inst)=include/uapi $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
lib/Kconfig.debug +0 -1
@@ -473,7 +473,6 @@ config READABLE_ASM config HEADERS_INSTALL bool "Install uapi headers to usr/include" - depends on !UML help This option will install uapi headers (headers exported to user-space) into the usr/include directory for use during the kernel build.
Signature · 1 line
2.47.1
Quoted 18 lines · Mickaël Salaün
It's useful to build
samples/*with UML and the only blocker is the artificial incompatibility withCONFIG_HEADERS_INSTALL.Allow the
headers_installtarget with ARCH=um, which then allow building samples (and tests using them) with UML too:printf '
CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' >.config make ARCH=um olddefconfigheaders_install
make ARCH=umsamples/landlock/Cc Anton Ivanov <[email protected]>Cc Johannes Berg <[email protected]>Cc Masahiro Yamada <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Nicolas Schier <[email protected]>Cc Richard Weinberger <[email protected]>Fixes 1b620d539ccc ("kbuild: disable header exports for UML in a straightforward way")Signed-off-by Mickaël Salaün <[email protected]>
Quoted 5 lines
--- Makefile | 1 - lib/Kconfig.debug | 1 - 2 files changed, 2 deletions(-)
Thanks, looks good to me.
Quoted 49 lines · Mickaël Salaün
It's useful to build
samples/*with UML and the only blocker is the artificial incompatibility withCONFIG_HEADERS_INSTALL.Allow the
headers_installtarget with ARCH=um, which then allow building samples (and tests using them) with UML too:printf '
CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' >.config make ARCH=um olddefconfigheaders_install
make ARCH=umsamples/landlock/Cc Anton Ivanov <[email protected]>Cc Johannes Berg <[email protected]>Cc Masahiro Yamada <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Nicolas Schier <[email protected]>Cc Richard Weinberger <[email protected]>Fixes 1b620d539ccc ("kbuild: disable header exports for UML in a straightforward way")Signed-off-by Mickaël Salaün <[email protected]>--- Makefile | 1 - lib/Kconfig.debug | 1 - 2 files changed, 2 deletions(-)Makefile +0
-1@@ -1355,7 +1355,6 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj PHONY += headers headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts - $(if $(filter um, $(SRCARCH)), $(error Headers not exportable for UML)) $(Q)$(MAKE) $(hdr-inst)=include/uapi $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapilib/Kconfig.debug +0
-2@@ -473,7 +473,6 @@ config READABLE_ASM config HEADERS_INSTALL bool "Install uapi headers to usr/include" - depends on !UML help This option will install uapi headers (headers exported to user-space) into the usr/include directory for use during the kernel build. --
Quoted 2 lines
2.47.1
This patch was not even compile-tested.
Apply this patch.
Enable CONFIG_HEADERS_INSTALL and CONFIG_UAPI_HEADERS_TEST. "make ARCH=um" and see the errors.
The reason is obvious, UML is a kernel. No such userspace.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 55 lines · Masahiro Yamada
Quoted 49 lines · Mickaël Salaün
It's useful to build
samples/*with UML and the only blocker is the artificial incompatibility withCONFIG_HEADERS_INSTALL.Allow the
headers_installtarget with ARCH=um, which then allow building samples (and tests using them) with UML too:printf '
CONFIG_SAMPLES=y\nCONFIG_HEADERS_INSTALL=y\nCONFIG_SAMPLE_LANDLOCK=y\n' >.config make ARCH=um olddefconfigheaders_install
make ARCH=umsamples/landlock/Cc Anton Ivanov <[email protected]>Cc Johannes Berg <[email protected]>Cc Masahiro Yamada <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Nicolas Schier <[email protected]>Cc Richard Weinberger <[email protected]>Fixes 1b620d539ccc ("kbuild: disable header exports for UML in a straightforward way")Signed-off-by Mickaël Salaün <[email protected]>--- Makefile | 1 - lib/Kconfig.debug | 1 - 2 files changed, 2 deletions(-)Makefile +0
-1@@ -1355,7 +1355,6 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj PHONY += headers headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts - $(if $(filter um, $(SRCARCH)), $(error Headers not exportable for UML)) $(Q)$(MAKE) $(hdr-inst)=include/uapi $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapilib/Kconfig.debug +0
-2@@ -473,7 +473,6 @@ config READABLE_ASM config HEADERS_INSTALL bool "Install uapi headers to usr/include" - depends on !UML help This option will install uapi headers (headers exported to user-space) into the usr/include directory for use during the kernel build. --Quoted 2 lines
2.47.1
This patch was not even compile-tested.
Quoted 5 lines
Apply this patch.
EnableCONFIG_HEADERS_INSTALLandCONFIG_UAPI_HEADERS_TEST. "make ARCH=um" and see the errors.The reason is obvious, UML is a kernel. No such userspace.
oh, I sorry. I should have seen that when reviewing, but confused myself as I missed the UAPI_HEADERS_TEST and just looked at a "successful" run of 'make headers_install'.
Kind regards,
Nicolas