Skip to content
Snippets Groups Projects

Draft: parse.kconfig: support checking generated kconfig from fragments

Open Clayton Craft requested to merge craftyguy/kconfigcheck-generated-config into master

This teaches kconfig check to generate and validate kconfig that was generated by abuild prepare, e.g. when using config fragments.

If the standard *.config files are not found in pmaports for a kernel package, then it runs abuild unpack && abuild prepare to unpack the kernel source, apply patches, and (for pkgs that use fragments) generate a config based on those fragments. After this, it runs the check on that generated config.

It seems kinda wasteful to be downloading/extracting the kernel source just to validate the kconfig, but I think that in most situations where the kconfig is being checked, the kernel source is already being downloaded for other reasons (build testing / checksumming in CI or locally). Obviously there are exceptions and this way of doing kconfig check could be annoying (making broad kernel changes in CI), but I still think it's not that bad since 1) very few kernels in pmaports use fragments, and 2) we can improve this later if the first point changes significantly

I used this on a kernel pkg being developed in pmaports!5837 (merged) and it found real kconfig check failures with some earlier version of the kconfig fragments in that patch:

[11:46:14] WARNING: .config: CONFIG_LEDS_TRIGGER_PATTERN should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_NETFILTER_XT_MATCH_MARK should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_NETFILTER_XT_MATCH_MULTIPORT should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_NETFILTER_XT_MATCH_STATISTIC should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_UCLAMP_TASK should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_UCLAMP_TASK_GROUP should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_RT_GROUP_SCHED should *not* be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_DM_INTEGRITY should be set (category:community_various)
[11:46:14] WARNING: .config: CONFIG_NFT_COMPAT should be set (category:containers)
[11:46:14] WARNING: .config: CONFIG_DYNAMIC_FTRACE should be set (category:debug)
[11:46:14] WARNING: .config: CONFIG_UDF_FS should be set (category:filesystems)
[11:46:14] WARNING: .config: CONFIG_XFS_FS should be set (category:filesystems)
[11:46:14] WARNING: .config: CONFIG_HIDRAW should be set (category:input)
[11:46:14] WARNING: .config: CONFIG_JOYSTICK_XPAD should be set (category:input)
[11:46:14] WARNING: .config: CONFIG_JOYSTICK_XPAD_FF should be set (category:input)
[11:46:14] WARNING: .config: CONFIG_JOYSTICK_XPAD_LEDS should be set (category:input)
[11:46:14] WARNING: .config: CONFIG_USB_ANNOUNCE_NEW_DEVICES should be set (category:input)
[11:46:14] WARNING: .config: CONFIG_USB_HIDDEV should be set (category:input)
[11:46:14] WARNING: .config: CONFIG_USB_PRINTER should be set (category:input)
Edited by Clayton Craft

Merge request reports

Test summary results are being parsed

Merge request contains no changes

Use merge requests to propose changes to your project and discuss them with your team. To make changes, use the Code dropdown list above, then test them with CI/CD before merging.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • this is awesome! thanks for implementing it

  • Caleb Connolly
  • Clayton Craft added 1 commit

    added 1 commit

    • 74c27944 - parse.kconfig: support checking generated kconfig from fragments

    Compare with previous version

  • mentioned in commit pmaports@ce79aa47

  • mentioned in commit pmaports@086c54c8

  • mentioned in commit pmaports@fefe267a

  • mentioned in commit pmaports@a4289529

  • 260 # abuild prepare
    261 logging.debug("(native) patching and generating .config")
    262 pmb.chroot.user(
    263 ["abuild", "prepare"],
    264 working_dir=Path("/home/pmos/build"),
    265 env={"CARCH": str(arch)},
    266 )
    267 # extract .config from chroot
    268 chroot = Chroot.native()
    269 cmd = "srcdir=/home/pmos/build/src source APKBUILD; echo $builddir"
    270 p = Path(
    271 pmb.chroot.user(
    272 ["sh", "-c", cmd], chroot, Path("/home/pmos/build"), output_return=True
    273 ).rstrip()
    274 )
    275 config_path = chroot / p / ".config"
  • Clayton Craft added 2 commits

    added 2 commits

    • 91f0a4fe - 1 commit from branch master
    • 1a83ce87 - parse.kconfig: support checking generated kconfig from fragments

    Compare with previous version

    • This is amazing!

      It seems kinda wasteful to be downloading/extracting the kernel source just to validate the kconfig, but I think that in most situations where the kconfig is being checked, the kernel source is already being downloaded for other reasons (build testing / checksumming in CI or locally). Obviously there are exceptions and this way of doing kconfig check could be annoying (making broad kernel changes in CI), but I still think it's not that bad since 1) very few kernels in pmaports use fragments, and 2) we can improve this later if the first point changes significantly

      Idea to fix this: add a custom variable to the APKBUILD that points directly to the kernel config URL. Then we would only need to download and that and could avoid the extraction step (?)

      If you think this is out-of-scope for this MR, feel free to resolve this here.

    • Author Maintainer

      There is no kernel config URL because the kernel config for these kernels is generated at abuild time in the prepare() function. The current implementation for that (using linux-next as an example) requires running stuff like make on the kernel tree to merge fragments and generate a .config, so I don't think we can link to anything useful that doesn't require extracting the kernel source

    • Please register or sign in to reply
  • Clayton Craft added 34 commits

    added 34 commits

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading