diff --git a/usr/bin/dracut-ukify b/usr/bin/dracut-ukify index 290b256..10967a6 100755 --- a/usr/bin/dracut-ukify +++ b/usr/bin/dracut-ukify @@ -219,6 +219,8 @@ function gen_image() { cmdline=$(sed -e 's/^[[:space:]]//g' -e 's/[[:space:]]$//g' -e 's/initrd.*$//g' "/proc/cmdline") fi + cmdline_terminal="$cmdline systemd.unit=multi-user.target" + vmlinuz="$kernel_dir/vmlinuz" initrd_image="$(mktemp)" @@ -226,6 +228,7 @@ function gen_image() { efi_image="$BOOT_PATH/$kernel_name.efi" efi_image_fallback="$BOOT_PATH/$kernel_name-fallback.efi" + efi_image_fallback_terminal="$BOOT_PATH/$kernel_name-fallback-terminal.efi" echo "==> Building initrd image $kernel_name $initrd_image" # dracut --force --hostonly --no-hostonly-cmdline --kver "$kernel_version" "$initrd_image" @@ -283,6 +286,34 @@ function gen_image() { /usr/lib/systemd/ukify build "${ukify_args[@]}" fi + echo "==> Building initrd image $kernel_name $initrd_image_fallback TERMINAL" +# dracut --force --kver "$kernel_version" "$initrd_image_fallback" + dracut --force --no-hostonly --no-hostonly-i18n --early-microcode --kernel-cmdline="$cmdline_terminal" --kver "$kernel_version" "$initrd_image_fallback" + + declare -a ukify_args=("${ukify_global_args[@]}") + ukify_args+=(--linux "$vmlinuz") + if [ -f "/boot/amd-ucode.img" ];then + ukify_args+=(--initrd "/boot/amd-ucode.img") + fi + if [ -f "/boot/intel-ucode.img" ];then + ukify_args+=(--initrd "/boot/intel-ucode.img") + fi + ukify_args+=(--initrd "$initrd_image_fallback") + ukify_args+=(--cmdline "$cmdline_terminal") + ukify_args+=(--os-release "/etc/os-release") + ukify_args+=(--uname "$kernel_version") + ukify_args+=(--output "$efi_image_fallback_terminal") + ukify_args+=(--measure) + + echo "==> Ukify image $kernel_name $efi_image_fallback TERMINAL" + if [ -f "${ukify_conf}" ]; then +# ukify_args+=(--sbat='sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md +# uki.author.myimage,1,UKI for System,uki.author.myimage,1,https://www.freedesktop.org/software/systemd/man/systemd-stub.html') + /usr/lib/systemd/ukify --config "${ukify_conf}" build "${ukify_args[@]}" + else + /usr/lib/systemd/ukify build "${ukify_args[@]}" + fi + rm -f "$initrd_image" rm -f "$initrd_image_fallback" }