Trouble with installing a patched vanilla upstream kernel

Hi, I’ve been following this guide to build and install a custom kernel. I’m specifically targeting Fedora with the Asahi kernel.

I’m running into some weird issues and I don’t know what all is going wrong. But here’s what I’ve been doing (let me know if I’m missing anything important):

  1. I clone the Fedora Asahi kernel.
  2. I copy the config file from /boot/config-6.6.3-411.asahi.fc39.aarch64+16k to ./.config
  3. I modify the Makefile and set EXTRAVERSION = -custom.
  4. I run make oldconfig.
  5. I run make Image (I saw online that bzImage is changed for arm64).
  6. I run make -j4 (I saw online that make modules is redundant now). I should have a linux image built.
  7. I then run sudo make modules_install. It seems to have worked as now there’s a folder /lib/modules/6.6.3-custom
  8. I run sudo make install. It seems to have worked as now there’s a file /boot/vmlinuz-6.6.3-custom.

Now when I reboot my machine and run uname -r it prints out 6.6.3-custom. So I think that means it worked right? Or were there extra steps I needed to do? I thought I would have to modify some bootloader files but does sudo make install take care of that?

Well I try to do it all again with a patched version of the kernel. I clone kernel-asahi, but this time I modify the source files. I again modify the Makefile but this time set EXTRAVERSION = -modified. I run all the same commands as before, but when I reboot, uname -r still prints 6.6.3-custom instead of 6.6.3-modified. Why didn’t my patched kernel get booted up correctly?

I think I’m making some sort of mistake in the process, but I’m not sure what’s missing as I’m following that guide pretty closely…

Added kernel, kernel-install

Did you build create the -modified versions?
Check the files in your build tree to see what you have.

Also did you keep all the output from all the makes?
When I do this sort of thing I keep logs of all output so I can go back and see what was done.
Can you compare your custom build vs. your modified build?

Did you clean out the old compilation files before recompiling the newer kernel.
make clean should remove all the previous object files and allow a new full compile with the new settings. Without that it will not recompile and link already existing object files.

This is a part of the way make works.

1 Like

The -custom and -modified versions were created from 2 different git clone instances, so there was nothing to clean.

I did some digging and it looks like make install isn’t updating the BOOT_IMAGE parameter in the /proc/cmdline file

/proc/cmdline is a read-only copy of the kernel command line at boot.
Its not an input.

What is the booting your system? grub? You need to change that boot managers config.

How do I update grub to use my custom kernel? Do I just use sudo grubby --set-default? Or are there extra steps? Do I need to call grub2-mkconfig as well?

Research grub bls (boot loader spec) and create a bls file for grub pointing to your kernel. I do not know the details off the top of my head but know it is well documented so you should be able to get this working.

Running sudo grubby --set-default with my -custom kernel as input, and then calling grub2-mkconfig seems to have worked. I don’t know if that’s the “right” way to do it, but at least now uname -r returns the name of my -custom kernel. Is that sufficient proof or could it be a red herring?

That just picks which one of the installed kernels to boot.
It does not add a newly built kernel to grub.