tinyramfs icon indicating copy to clipboard operation
tinyramfs copied to clipboard

implement ucode and uki hooks

Open dkwo opened this issue 11 months ago • 4 comments

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).

dkwo avatar Jan 09 '25 14:01 dkwo

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:

  1. I was passing --set-section-flags to llvm-objcopy. I now tested without, and it works indeed fine.

  2. 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.

dkwo avatar Jan 09 '25 16:01 dkwo

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 avatar Jan 09 '25 18:01 dkwo

@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

kkrruumm avatar May 01 '25 18:05 kkrruumm

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..

dkwo avatar May 02 '25 22:05 dkwo

superseded.

dkwo avatar Jul 21 '25 19:07 dkwo