Kernel configuration/Adjusting one kernel
The list of specific kernel config options has been moved to Kernel configuration/Specific options. |
This article has step-by-step instructions for adjusting the config of one kernel. Use this guide to test if a proposed change works as intended, refer to Kernel configuration: Adjusting multiple kernels for properly upstreaming your change and ensuring this kernel config change is persistent by adjusting CI. See Kernel configuration for an overview.
Changing the kernel configuration
You can change the kernel configuration with pmbootstrap. On some devices the naming convention is simply linux-<vendor>-<device>, for the linux-sony-yuga package for example we run:
pmbootstrap kconfig edit sony-yuga
Some devices do not follow this naming convention, in which case you can check what package provided the kernel by running:
apk info --who-owns /boot/vmlinuz-*
On the pinephone by pine64 you would run:
pmbootstrap kconfig edit linux-postmarketos-allwinner
This gives you a menu where you can select and deselect all kernel configuration options. Press the /
key to get a search dialog. After finding something, type the number of the search result to quickly jump to it.
If you don't like the terminal user interface, you can also use pmbootstrap kconfig edit -x
or pmbootstrap kconfig edit -n
. See pmbootstrap kconfig edit -h
for details.
Options aren't always visible!
If you're looking for an option and you just can't find it, then it might not show up because it depends on other options that have been disabled. In that case, press /
and search for the option in question. You will see the dependencies. Then use the search again to find these dependencies, and enable them until you can finally enable the option you wanted to change in the first place.
Some options are hidden behind CONFIG_EXPERT
try enabling it and recheck.
Packaging and flashing the kernel
On some devices the naming convention is simply linux-<vendor>-<device>, for the linux-sony-yuga package for example we run:
$ pmbootstrap build --force linux-sony-yuga
(Skip this flashing part if you have an UEFI device and not a smartphone with Android-like bootloader.) After compiling and packaging the kernel, it can be flashed to device using the standard pmbootstrap flash commands. This only works for devices with an Android-like bootloader, and e.g. won't work when using postmarketOS on a generic x64 desktop machine.
$ pmbootstrap flasher flash_kernel
After that, install the kernel package using one of these approaches:
Approach A: Sideload (all devices with SSH configured)
If your target device has SSH set up and running, you can also sideload the kernel package, so that modules and any other necessary files are copied over:
$ pmbootstrap sideload --arch=[device's arch goes here] linux-[your-kernel-package]
Approach B: Manual package install (all devices)
Alternatively, you can copy the package file manually to install it. To do that, find the kernel apk file that was built:
$ find ~/.local/var/pmbootstrap/packages | grep -i linux | grep apk
/home/user/.local/var/pmbootstrap/packages/edge/x86_64/linux-valve-jupiter-6.10-r0.apk
Then copy that apk file to wherever you can easily find it, e.g. your desktop:
$ cp '/home/user/.local/var/pmbootstrap/packages/edge/x86_64/linux-valve-jupiter-6.10-r0.apk' ~/Desktop/
...and then copy it to the target device and install it on the device itself as you would any package, e.g. via sudo apk add --allow-untrusted path/to/the.apk.
See also
- Linux Kernel Driver Database
- How to find configuration options quickly in make menuconfig
- Compiling kernels with envkernel.sh
- #2190 make it easy to change kernel config options with pmbootstrap