I tried something different today. I like to build all my hardware drivers into the kernel image, except the monstrous amdgpu and its firmware. My rationale on the old computer was to initialize the video card last (interrupts were distributed better that way) but it's all MSI/MSI-X style now (with a few legacy edge reservations like acpi, timer and keyboard etc.) so my only reason now is size/impracticality which is easily dismissed.
So now I'm building amdgpu and all its firmware files right in. Look at the size difference in kilobytes from before and after (I didn't remove my old kernel this time because there was a good chance this one wouldn't boot, or boot to a black screen)
-rw------- 1 root root 5620736 Jan 2 15:00 vmlinuz-6.18.3
-rw------- 1 root root 10249216 Jan 8 17:01 vmlinuz-6.18.4
That's almost twice the size, 5M to 10M but that really doesn't matter, the modules would all need loading anyway (amdgpu + helper modules) and those firmware files would get loaded from disk anyway.
I got all this right the first time, I knew that my NAVI32 didn't actually use any of the "NAVI" files, so I did a search and found that I needed the gc_11_0_3 files. The rest I was able to get from looking up version strings from dmesg and searching around. I already knew what dmcub file I needed because of prior fighting with that.
So this is my kernel config string (in Device Drivers - Generic Driver Options - Firmware loader - CONFIG_EXTRA_FIRMWARE list) with all the firmware files I'm including, so all hardware can be built in. Nothing else of mine uses firmware but the onboard NIC and amdgpu.
Code: Select all
rtl_nic/rtl8125b-2.fw amdgpu/dcn_3_2_0_dmcub.bin amdgpu/gc_11_0_3_imu.bin amdgpu/gc_11_0_3_me.bin amdgpu/gc_11_0_3_mec.bin amdgpu/gc_11_0_3_mes1.bin amdgpu/gc_11_0_3_mes_2.bin amdgpu/gc_11_0_3_pfp.bin amdgpu/gc_11_0_3_rlc.bin amdgpu/psp_13_0_10_sos.bin amdgpu/psp_13_0_10_ta.bin amdgpu/sdma_6_0_3.bin amdgpu/smu_13_0_10.bin amdgpu/vcn_4_0_0.bin
Note that you can't do this with your distro's packaged firmware files, as they will most likely be compressed and this mechanism doesn't support that (only loading from userspace). I maintain my own specific set from the linux-firmware distribution tarballs at kernel.org
Of course this means that when firmware files change (I checksum compare them when new linux-firmware comes out) I'll have to recompile the kernel and include them, but I do that often enough anyway. Worse, is that if I have to change video cards these kernels will be absolutely NFG (I'll have to drop in a new one) but I'm good with that. I may even be able to get to normal VGA if I wait long enough, as it was from prior experience of forgetting to install firmware files when bringing up a LFS system.
I have no errors in dmesg about missing firmware (I renamed my firmware directory to test) and I can see stuff on my screen a fraction of a second sooner (I don't use an initramfs image). My framebuffer console should always work, not relying on udev to load the module. It doesn't boot up perceptibly faster (though it probably would by a few ms) and there's still display mode switching time, just that I see more systemd shit on screen initializing
