0

Hopefully this will be a simple question to answer: I am trying to add a package to buildroot that requires the kernel BPF syscall feature to be enabled.

If the feature is enabled, everything works fine, if not, the build fails with a marginally unhelpful error. What i would like to do is perform a quick check in the .mk file to see if the feature is present and print out a slightly more user-friendly error if it is not.

I tried adding:

ifneq ($(CONFIG_BPF_SYSCALL),y)
$(error Kernel feature CONFIG_BPF_SYSCALL is required)
endif

But this always seems to trigger as i assume CONFIG_BPF_SYSCALL does not exist in the package build scope. Is there a simple way to access to the kernel config list from a package build env?

Many thanks

1 Answers1

1

It works the other way around: it is the "linux" package in Buildroot that ensures it enables the right options when a given package is enabled and requires some specific kernel features. See linux/linux.mk, which contains things like that:

        $(if $(BR2_PACKAGE_KTAP),
                $(call KCONFIG_ENABLE_OPT,CONFIG_DEBUG_FS,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_ENABLE_DEFAULT_TRACERS,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_PERF_EVENTS,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_FUNCTION_TRACER,$(@D)/.config))

This ensures that CONFIG_DEBUG_FS, CONFIG_ENABLE_DEFAULT_TRACERS, CONFIG_PERF_EVENTS and CONFIG_FUNCTION_TRACER are enabled in the kernel configuration when the ktap Buildroot is enabled.

Note that this mechanism may be changed in the near future in Buildroot, see the patch series at http://patchwork.ozlabs.org/project/buildroot/list/?series=168565.

Thomas Petazzoni
  • 5,636
  • 17
  • 25