implement ucode and uki hooks
I received these patches from Daniel Semyonov. I have not tested them yet, but I figured I would post them here so that anyone can take a look.
Some notes from the author:
- As tinyramfs uses POSIX sh, I made sure to only use POSIX features of other commands I called (awk, sed, grep, wc). For awk specifically, the code I wrote didn't work for gawk without the -Wposix flag, but testing with 3 other implementations (those available in Void) indicates they only emit a warning with this flag to stderr.
- As I used objcopy (which isn't really standardized AFAIK) to build the UKI, I added support for both GNU's objcopy (which also need objdump) and llvm-objcopy.
- The microcode hook adds only the current CPU's microcode in hostonly mode (it generates an image from the firmware files, though I only tested this hook on an AMD machine), unless a prebuilt image is specified (in which case it just uses it).
My comments: After looking at the patches, they mostly look fine. This is quite close to the scripts I've been already using for a while, except for:
-
I was passing
--set-section-flagstollvm-objcopy. I now tested without, and it works indeed fine. -
At least for intel && hostonly, I was using
iucode_tool -S --write-earlyfw=${tmpdir}/ucode /usr/lib/firmware/intel-ucode/*instead, and I wonder if this simpler command is preferred.
At the moment, it seems that intel code uses decimal, but it should use hex.
Btw, I think exporting DM_DISABLE_UDEV=1 in cryptsetup hook is not needed, while it's enough to do it for lvm.
@dkwo out of curiousity, what are you testing this on? when testing on a typical qemu/kvm virtual machine, building with llvm-objcopy as opposed to binutils produces an "BdsDxe: failed to load... Unsupported" for me with llvm19 on Void
edit: boots fine given each section has a --set-section-flags to go with it, as according to your kernel.d uki hook
Yes, indeed I am testing just with my own version. I also received an updated version from the author, but did not have time to post it here yet..
superseded.