Trying out custom kernels

Hi! Some information on customizing the 5.12.0 kernel is in Help with Wi-Fi Problem - #4 by nils but I was wondering if it’s possible to install a 5.10.x kernel. Or maybe upgrade to the latest in the 5.12.x series. The reason being that there’s a module I use (9p) that seems to work in 5.10.x but not in 5.12.0. Ordinarily I would just untar the 5.10.x kernel, make menuconfig, make, make module_install, make install. But it seems for the reform I’d have to copy the new image to /Image instead. And then I’m not sure the reform hardware would be supported by such a kernel… thank you!

You need to use reform-system-image/reform2-imx8mq scripts to build a kernel, there’s mkkernel.sh script which tries to apply template-kernel/patches patchset to the kernel tree. Most likely the patchset won’t apply cleanly so you’d need to go through commit history and pick older patchsets with a risk it may have some regressions comparing to the latest one.

1 Like

You can build a custom kernel just fine, though use the reform-system-image that ruff linked as a base. It contains the needed patches for a 5.12 kernel for the reform as there’s a few things not mainlined yet and some changes that needed reverting. If you wish to build a newer kernel I updated the needed patches to work on a 5.14 kernel back in September last year and have been running that 5.14.0 kernel since then with no issues. I do need to recompile that though to get myself on a newer patch set, and just haven’t gotten around to it yet. 5.15 and newer should also be possible, I’d start the patch set I adapted then go from there, there may be changes that break the diff’s or the kernel may have included the needed changes since then.

As for installing the kernel, you want to build it with no modules (no initrd) that aren’t compiled straight into the kernel, then compile the two dtb device trees for the reform with and without hdmi. The mkkernel.sh script will do this for you. If you wish to customize the kernel what I normally do is exit out of the mkkernel script before the make line in it so I can do make menuconfig and set my own options.

Then to install you want to copy the built kernel image to a file called Image on the root of the SD card (or the emmc recovery partition if you’ve change to that), not to your VNME drive’s root. Then also copy the two dtb files to the root and copy the one you want to use to the name imx8mq-mnt-reform2.dtb

3 Likes

Thank you both @ruff and @Chartreuse.

Just FYI I’m now running on 5.15:

$ uname -a
Linux reform 5.15.13+ #2 SMP PREEMPT Sun Jan 9 00:08:59 CET 2022 aarch64 GNU/Linux

But this is not mainline but Purism’s kernel (pureos/byzantium)

1 Like

Thanks to your suggestions I was able to try out many kernels. None of them solved my problem (that was really just trial and error) so in the end I debugged the specific problem I was having and ended up finding a workaround, so after all I’m on 5.12, recompiled only to include the 9P driver. Thanks again for the pointers!