What is a good way to update/maintain a custom kernel without manual config each build?

My question is about when you are maintaining a custom kernel, how do people normally deal with configuration every time they build it?

Is it considered ‘safe’ to copy the old .config over the new .config? Any gotchas to be aware of?

I feel like manually configuring the kernel every time you build it (with menuconfig for example) seems inefficient and someone would have figured out a better way.

Thanks for advice for this kernel newbie!

Either
zcat /proc/config.gz > .config
or in PKGBUILD uncomment
make oldconfig

https://wiki.archlinux.org/title/Compile_kernel_module

3 Likes

Here’s how I used to do it (this is from my archive files - I did not look at a current Manjaro kernel PKGBUILD, so YMMV).

  1. In my PKGBUILD, (I put it on the line preceding “Arch=”): _projdir=$PWD

  2. The line immediately following make... insert this snippet:

msg2 "Updating config..."
cp -u ".config" "${_projdir}/.config.current"

When your build is done, check for the existence of .config.current. That is how your kernel is currently configured. Diff it against the original config if you want. If you’re happy with it, rename .config.current to whatever Manjaro now names the default config (it used to be config.x86_64).

Now the fun part…go and comment out all of the make menuconfig, etc lines in your PKGBUILD. Next time you build a kernel, you shouldn’t have to have any interaction from the time you invoke makepkg until you’re finished.

If you need to make subsequent config changes, re-enable (remove the # from a config line) and you’re all set.

  1. Have fun.
2 Likes

I like the diff idea – seems like I could modify the PGKBUILD to proceed [Y/n] after showing the diff.