Skip to content

Commit 8b5e5b1

Browse files
committed
live-iso: Write kernel (and hmac) to /boot too
This is useful in order to make the dracut FIPS module work. For ostree, we put the kernel stuff in `/boot/ostree` in order to namespace things. But non-ostree systems tend to use `/boot` directly, and that's what the dracut module is hardcoded to do. Now we did add some logic in the dracut module which scrapes the grub-injected `BOOT_IMAGE`, except this doesn't work for how we generate the CoreOS Live ISO today because the filenames of the kernel don't include versions etc. In the case of the Live ISO though we don't really need to "ostree namespace" things, so just hardlink the kernel binary and the hmac file into the traditional places in `/boot`. We *could* not do this, and do it in our dracut module in the initramfs in fips mode only for the Live ISO, but that'd be way more ugly. xref https://issues.redhat.com/browse/OCPBUGS-23907 (cherry picked from commit 86943ca)
1 parent 331f68c commit 8b5e5b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/gf-mksquashfs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@ coreos_gf_run_mount "${src}" --ro
3636
coreos_gf download /ostree/repo/config "${tmpd}/config"
3737
grep -v readonly=true "${tmpd}/config" > "${tmpd}/config.new"
3838
coreos_gf upload "${tmpd}/config.new" /ostree/repo/config
39-
coreos_gf mksquashfs / "${tmp_dest}" "compress:${compression}"
4039

40+
# And ensure that the kernel binary and hmac file is in the place that dracut
41+
# expects it to be; xref https://issues.redhat.com/browse/OCPBUGS-15843
42+
kernel_binary=$(coreos_gf glob-expand /boot/ostree/*/vmlinuz*)
43+
kernel_hmac=$(coreos_gf glob-expand /boot/ostree/*/.*.hmac)
44+
coreos_gf ln "${kernel_hmac}" "/boot/$(basename "${kernel_hmac}")"
45+
coreos_gf ln "${kernel_binary}" "/boot/$(basename "${kernel_binary}")"
46+
47+
coreos_gf mksquashfs / "${tmp_dest}" "compress:${compression}"
4148
coreos_gf_shutdown
4249

4350
mv "${tmp_dest}" "${dest}"

0 commit comments

Comments
 (0)