linux: allow the user to respect Linux kernel defconfig's CONFIG_WERROR
PATCH 1/1 linux: allow the user to respect Linux kernel defconfig's CONFIG_WERROR
From: Quentin Schulz <[email protected]>
Buildroot forcibly disables WERROR (and PPC_WERROR via PPC_DISABLE_WERROR for PowerPC) for all kernels since commit 6b56e0b4f09b ("linux: disable -Werror") for the former and 1713c3c344be ("linux: disable Werror for powerpc kernels") for the latter.
Some users (me :) ) may only build kernels within Buildroot and may be required by audit companies to ensure that no warnings are generated when building them. While we could look at the log manually and report that indeed no warnings are seen, better not even build if there's a warning and catch them as early as possible.
Thus, let's allow the user to not override the WERROR state gotten from the defconfig. It is left as force-disabled by default as upstream Buildroot likely does not want to fail builds when bumping the toolchains with newer warnings and no bandwidth to fix or backport fixes for kernels for upstream Buildroot defconfigs.
---
I believe that commit 6b56e0b4f09b ("linux: disable -Werror") should rather have disabled WERROR from ESP_HOSTED_LINUX_CONFIG_FIXUPS in package/esp-hosted/esp-hosted.mk instead of disabling it for everybody.
I understand Buildroot not wanting to respect WERROR if in the kernel defconfig to avoid additional friction when bumping toolchains, hence why I made this into a Kconfig knob.
I'm assuming we do not want upstream Buildroot defconfigs to have this set to N. I can add this info to the Kconfig help text. I can also make sure defconfigs aren't setting this to N by adding a check in utils/checkpackagelib/lib_defconfig.py. Let me know if this is something you're interested in.
--- linux/Config.in | 14 ++++++++++++++ linux/linux.mk | 12 +++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)
linux/Config.in +14 -0
@@ -223,6 +223,20 @@ config BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES A space-separated list of kernel configuration fragment files, that will be merged to the main kernel configuration file. +config BR2_LINUX_KERNEL_DISABLE_WERROR + bool "Force-disable Werror" + default y + help + This allows to force disable CONFIG_WERROR (and force enable + CONFIG_PPC_DISABLE_WERROR for PPC) even if set by the kernel + defconfig. This is typically wanted for third party kernel + trees or old kernel releases when attempting to build with + newer toolchains. Since 2019.08 for PPC and since 2024.05 for + the other architectures, the default has been Y. + + You may want to set this to N if you want to make sure your + kernel builds without warning for your specific setup. + config BR2_LINUX_KERNEL_CUSTOM_LOGO_PATH string "Custom boot logo file path" help
linux/linux.mk +9 -3
@@ -419,6 +419,14 @@ define LINUX_KCONFIG_FIXUP_CMDS_ROOTFS_CPIO endef endif +ifeq ($(BR2_LINUX_KERNEL_DISABLE_WERROR),y) +define LINUX_FIXUP_CONFIG_DISABLE_WERROR + $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), + $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) + $(call KCONFIG_DISABLE_OPT,CONFIG_WERROR) +endef +endif + define LINUX_KCONFIG_FIXUP_CMDS @$(call MESSAGE,"Updating kernel config with fixups") $(if $(LINUX_NEEDS_MODULES),
@@ -431,8 +439,6 @@ define LINUX_KCONFIG_FIXUP_CMDS $(LINUX_FIXUP_CONFIG_PAHOLE_CHECK) $(if $(BR2_arm)$(BR2_armeb), $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) - $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), - $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) $(if $(BR2_ARC_PAGE_SIZE_4K), $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
@@ -474,7 +480,7 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224)) $(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS) - $(call KCONFIG_DISABLE_OPT,CONFIG_WERROR) + $(LINUX_FIXUP_CONFIG_DISABLE_WERROR) $(PACKAGES_LINUX_CONFIG_FIXUPS) endef
---
base-commit: c8dd9e9a011f1a5755df62baceb865efc09862fe
change-id: 20260325-linux-werror-9f6e4ad44b0f
Best regards,
Signature · 6 lines
Quentin Schulz <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 19 lines · Quentin Schulz via buildroot
From: Quentin Schulz <[email protected]>
Buildroot forcibly disables WERROR (and
PPC_WERRORviaPPC_DISABLE_WERRORfor PowerPC) for all kernels since commit6b56e0b4f09b("linux: disable -Werror") for the former and1713c3c344be("linux: disable Werror for powerpc kernels") for the latter.Some users (me :) ) may only build kernels within Buildroot and may be required by audit companies to ensure that no warnings are generated when building them. While we could look at the log manually and report that indeed no warnings are seen, better not even build if there's a warning and catch them as early as possible.
Thus, let's allow the user to not override the WERROR state gotten from the defconfig. It is left as force-disabled by default as upstream Buildroot likely does not want to fail builds when bumping the toolchains with newer warnings and no bandwidth to fix or backport fixes for kernels for upstream Buildroot defconfigs.
Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>---
I believe that commit6b56e0b4f09b("linux: disable -Werror") should rather have disabled WERROR fromESP_HOSTED_LINUX_CONFIG_FIXUPSinpackage/esp-hosted/esp-hosted.mkinstead of disabling it for everybody.
Yeah, I agree with that. And even so, it should only be done if it's really
needed.
Quoted 3 lines
I understand Buildroot not wanting to respect WERROR if in the kernel defconfig to avoid additional friction when bumping toolchains, hence why I made this into a
Kconfigknob.
Not really - for the defconfigs, we can easily create
board/linux-disable-werror.fragment and include that as a Kconfig fragment for all problematic defconfigs. Ideally though the error should be resolved in a more recent kernel.
So I'd tend to prefer to revert 6b56e0b4f09b (or perhaps move it to
esp-hosted) rather than adding yet another weird Config.in option.
For 1713c3c344be, it's probably not worth to bother reverting that one (and
trying to find out which defconfigs break due to it). Unless you also need PPC builds to comply?
Regards,
Arnout
Quoted 78 lines
I'm assuming we do not want upstream Buildroot defconfigs to have this set to N. I can add this info to the
Kconfighelp text. I can also make sure defconfigs aren't setting this to N by adding a check inutils/checkpackagelib/lib_defconfig.py. Let me know if this is something you're interested in.--- linux/Config.in | 14 ++++++++++++++ linux/linux.mk | 12 +++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)linux/Config.in +14
-0@@ -223,6 +223,20 @@ config BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES A space-separated list of kernel configuration fragment files, that will be merged to the main kernel configuration file. +config BR2_LINUX_KERNEL_DISABLE_WERROR + bool "Force-disable Werror" + default y + help + This allows to force disable CONFIG_WERROR (and force enable + CONFIG_PPC_DISABLE_WERROR for PPC) even if set by the kernel + defconfig. This is typically wanted for third party kernel + trees or old kernel releases when attempting to build with + newer toolchains. Since 2019.08 for PPC and since 2024.05 for + the other architectures, the default has been Y. + + You may want to set this to N if you want to make sure your + kernel builds without warning for your specific setup. + config BR2_LINUX_KERNEL_CUSTOM_LOGO_PATH string "Custom boot logo file path" helplinux/linux.mk +9
-4@@ -419,6 +419,14 @@ define LINUX_KCONFIG_FIXUP_CMDS_ROOTFS_CPIO endef endif +ifeq ($(BR2_LINUX_KERNEL_DISABLE_WERROR),y) +define LINUX_FIXUP_CONFIG_DISABLE_WERROR + $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), + $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) + $(call KCONFIG_DISABLE_OPT,CONFIG_WERROR) +endef +endif + define LINUX_KCONFIG_FIXUP_CMDS @$(call MESSAGE,"Updating kernel config with fixups") $(if $(LINUX_NEEDS_MODULES),@@ -431,8 +439,6 @@ define LINUX_KCONFIG_FIXUP_CMDS $(LINUX_FIXUP_CONFIG_PAHOLE_CHECK) $(if $(BR2_arm)$(BR2_armeb), $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) - $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), - $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) $(if $(BR2_ARC_PAGE_SIZE_4K), $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)@@ -474,7 +480,7 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO) $(call KCONFIG_ENABLE_OPT,CONFIG_LOGO_LINUX_CLUT224)) $(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS) - $(call KCONFIG_DISABLE_OPT,CONFIG_WERROR) + $(LINUX_FIXUP_CONFIG_DISABLE_WERROR) $(PACKAGES_LINUX_CONFIG_FIXUPS) endef ---base-commit:
c8dd9e9a011f1a5755df62baceb865efc09862fe
change-id: 20260325-linux-werror-9f6e4ad44b0f
Quoted 8 lines
Best regards,
--
Quentin Schulz <[email protected]>_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Arnout,
Quoted 35 lines · Arnout Vandecappelle
Quoted 19 lines · Quentin Schulz via buildroot
From: Quentin Schulz <[email protected]>
Buildroot forcibly disables WERROR (and
PPC_WERRORviaPPC_DISABLE_WERRORfor PowerPC) for all kernels since commit6b56e0b4f09b("linux: disable -Werror") for the former and1713c3c344be("linux: disable Werror for powerpc kernels") for the latter.Some users (me :) ) may only build kernels within Buildroot and may be required by audit companies to ensure that no warnings are generated when building them. While we could look at the log manually and report that indeed no warnings are seen, better not even build if there's a warning and catch them as early as possible.
Thus, let's allow the user to not override the WERROR state gotten from the defconfig. It is left as force-disabled by default as upstream Buildroot likely does not want to fail builds when bumping the toolchains with newer warnings and no bandwidth to fix or backport fixes for kernels for upstream Buildroot defconfigs.
Quoted 5 lines
Signed-off-by Quentin Schulz <[email protected]>---
I believe that commit6b56e0b4f09b("linux: disable -Werror") should rather have disabled WERROR fromESP_HOSTED_LINUX_CONFIG_FIXUPSinpackage/esp-hosted/esp-hosted.mkinstead of disabling it for everybody.Yeah, I agree with that. And even so, it should only be done if it's
really needed.Quoted 3 lines
I understand Buildroot not wanting to respect WERROR if in the kernel defconfig to avoid additional friction when bumping toolchains, hence why I made this into a
Kconfigknob.
Quoted 6 lines
Not really - for the defconfigs, we can easily create board/linux-
disable-werror.fragment and include that as aKconfigfragment for all problematic defconfigs. Ideally though the error should be resolved in a more recent kernel.So I'd tend to prefer to revert
6b56e0b4f09b(or perhaps move it to
esp-hosted) rather than adding yet another weird Config.in option.
Works for me. Is there something you want me to check specifically before sending a revert? I'll build esp-hosted with an updated version of the Buildroot defconfigs that triggered the revert commit, to make sure it isn't failing anymore. I'll build the Linux kernel and kernel modules for upstream Buildroot defconfigs. That'll take some time but at least we'll know for sure upstream defconfigs are fine. Looking at the defconfigs, only very few kernel modules are actually part of Buildroot upstream defconfigs:
configs/orangepi_lite_defconfig:BR2_PACKAGE_RTL8189FS=y configs/orangepi_pc_plus_defconfig:BR2_PACKAGE_RTL8189FS=y configs/mangopi_mq1rdw2_defconfig:BR2_PACKAGE_RTL8723DS=y configs/sipeed_lichee_rv_dock_defconfig:BR2_PACKAGE_RTL8723DS=y configs/sipeed_lichee_rv_dock_defconfig:BR2_PACKAGE_RTL8723DS_BT=y configs/orangepi_zero_defconfig:BR2_PACKAGE_XR819_XRADIO=y
So that doesn't cover much of the 34 kernel modules I found with
git grep -l --full-name kernel-module package/ | xargs basename -a | grep '.mk' | xargs basename -a -s .mk | sed 's/-/_/g' | tr '[:lower:]' '[:upper:]' | sed 's/\(.*\)/BR2_PACKAGE_\1/'
BR2_PACKAGE_BATMAN_ADVBR2_PACKAGE_CRYPTODEV_LINUXBR2_PACKAGE_DAHDI_LINUXBR2_PACKAGE_DTBOCFGBR2_PACKAGE_EMLOGBR2_PACKAGE_ESP_HOSTEDBR2_PACKAGE_FALCOSECURITY_LIBSBR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIVBR2_PACKAGE_FWTSBR2_PACKAGE_GCNANO_BINARIESBR2_PACKAGE_IGH_ETHERCATBR2_PACKAGE_LINUX_BACKPORTSBR2_PACKAGE_LTTNG_MODULESBR2_PACKAGE_MALI_DRIVERBR2_PACKAGE_MDIO_TOOLSBR2_PACKAGE_NVIDIA_DRIVERBR2_PACKAGE_NXP_MWIFIEXBR2_PACKAGE_OPENVMTOOLSBR2_PACKAGE_OWL_LINUXBR2_PACKAGE_PKG_KERNEL_MODULEBR2_PACKAGE_RTL8188EUBR2_PACKAGE_RTL8189ESBR2_PACKAGE_RTL8189FSBR2_PACKAGE_RTL8192EUBR2_PACKAGE_RTL8723BUBR2_PACKAGE_RTL8723DSBR2_PACKAGE_RTL8812AU_AIRCRACK_NGBR2_PACKAGE_RTL8821AUBR2_PACKAGE_RTL8821CUBR2_PACKAGE_RTL8822CSBR2_PACKAGE_V4L2LOOPBACKBR2_PACKAGE_WILC_DRIVERBR2_PACKAGE_WIREGUARD_LINUX_COMPATBR2_PACKAGE_XR819_XRADIOBR2_PACKAGE_ZFS
I guess I'll let people figure out which package needs to be patched and how?
Quoted 3 lines
For
1713c3c344be, it's probably not worth to bother reverting that one
(and trying to find out which defconfigs break due to it). Unless you also need PPC builds to comply?
I don't care about PPC :)
Cheers,
Quentin
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot