Kernel configuration/Adjusting multiple kernels

From postmarketOS Wiki

This article has step-by-step instructions for getting kernel config options changed in multiple kernels, and for adjusting CI that it stays that way in the future. See Kernel configuration for an overview.

Requesting a change

1. Verifying

It is recommended that you verify that your proposed change works as expected with the kernel you use, before you start the discussion. See Kernel configuration: Adjusting one kernel for more information.

2. Discussing

Create a new issue with the Change_Kernel_Config template and give people a bit of time to respond to the issue. You may additionally link to your issue in the postmarketos-devel chat and ask for input, so more people see it.

3. Waiting

You can either wait for somebody to go through all issues with the change-kernel-config label (that your issue should have too if you used the proper template), where it was concluded that this change should be made. We plan to do this once a month or so (but no promises, as usually people are busy and have a lot of other tasks).

Alternatively, you may do this yourself by following the steps below. Consider announcing it in the postmarketos-devel chat, so the work is not duplicated.

Applying changes

As a starting point, we have the following - somewhat hacky, but working - approach based on what Luca wrote in pmaports!5544 (thanks a lot!). Over time we would like to have this simplified and possibly integrated into pmbootstrap (pmbootstrap#2190).

Use fish shell and the pmos_changed_packages script.

1. Adjust kconfigcheck.toml

Go through all issues with the change-kernel-config label, review the discussions regarding whether it was decided to accept the change or not (or just do it if nobody commented and it looks reasonable). Apply all agreed on changes to kconfigcheck.toml.

Run pmbootstrap kconfig check, if you did it right then it should complain now about kernels not having the new options set.

2. Prepare variables

$ set configs $(pmb kconfig check -k --no-details 2>&1 | grep -o "config-[^ ]\+")
$ set packages $(for i in $configs; echo $i | sed 's/config-\(.*\)\..*/linux-\1/'; end)

3. Download all archives

$ pmbootstrap checksum $packages

4. Get rid of non-committed diff before making changes

$ for i in $packages; pmbootstrap kconfig migrate $i; end
$ git add -A
$ git commit

5. Adjust all kernel config files

Use a shell line similar to the following. Note that you need to take care to enable dependencies, e.g. DYNAMIC_FTRACE actually needs FTRACE enabled too.

$ for i in $configs; echo -e  "CONFIG_BT_HIDP=m\nCONFIG_DM_INTEGRITY=m\nCONFIG_DRM_USE_DYNAMIC_DEBUG=y\nCONFIG_DYNAMIC_DEBUG=y\nCONFIG_DYNAMIC_FTRACE=y\nCONFIG_HIDRAW=y\nCONFIG_JOYSTICK_XPAD=m\nCONFIG_NETFILTER_XT_MATCH_MARK=m\nCONFIG_NETFILTER_XT_MATCH_MULTIPORT=m\nCONFIG_UDF_FS=m\nCONFIG_USB_ANNOUNCE_NEW_DEVICES=y\nCONFIG_USB_HIDDEV=y\nCONFIG_USB_PRINTER=m\nCONFIG_XFS_FS=m" >> device/*/*/$i; end

6. Update checksums of kernel config files

$ pmbootstrap checksum $(pmos_changed_packages)

7. Run "pmbootstrap kconfig migrate"

Ensure that dependencies are set right etc.

$ for i in $(pmos_changed_packages); yes '' | pmbootstrap kconfig migrate $i; end

8. Bump pkgrels

$ pmbootstrap pkgrel_bump $(pmos_changed_packages)

9. Run pmbootstrap kconfig check locally

Verify that everything is passing now:

$ pmbootstrap kconfig check

10. Create the merge request

  • Commit your changes.
  • If you modified many kernels, CI won't be able to build the kernels in time so put `[ci:skip-build]` in the commit message of the last commit. It will run pmbootstrap kconfig check in any case.
  • Open the merge request.
  • Add the change-kernel-config label.
  • Add lines to the MR description to fix related issues.
  • Time to celebrate, you are awesome!! :D