Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EFI System Partition cleanups #98

Merged
merged 5 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions run_qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ make_install_kernel()

cat arch/x86_64/boot/bzImage > "$inst_path"/vmlinuz-"$kver"
cp System.map "$inst_path"/System.map-"$kver"
ln -fs "$inst_path"/vmlinuz-"$kver" "$inst_path"/vmlinuz
ln -fs "$inst_path"/System.map-"$kver" "$inst_path"/System.map
ln -fs vmlinuz-"$kver" "$inst_path"/vmlinuz
ln -fs System.map-"$kver" "$inst_path"/System.map
}

install_build_initrd()
Expand Down Expand Up @@ -781,16 +781,16 @@ update_rootfs_boot_kernel()
fail "Unable to determine root partition UUID, is the mkosi image 'Bootable'?"
fi

# Note there is no initrd when booting this way, root filesystem must be built-in.
build_kernel_cmdline "PARTUUID=$root_partuuid"
sudo tee "$conffile" > /dev/null <<- EOF
title run-qemu-$_distro ($kver)
version $kver
source /efi/EFI/Linux/linux-$kver.efi
linux EFI/Linux/linux-$kver.efi
linux run-qemu-kernel/$kver/vmlinuz
options ${kcmd[*]}
EOF
sudo mkdir -p "$builddir/mnt/run-qemu-kernel/$kver"
sudo cp "$builddir/mkosi.extra/boot/vmlinuz-$kver" "$builddir/mnt/EFI/Linux/linux-$kver.efi"
sudo cp "$builddir/mkosi.extra/boot/vmlinuz-$kver" "$builddir/mnt/run-qemu-kernel/$kver/vmlinuz"

defconf="$builddir/mnt/loader/loader.conf"
if [ -f "$defconf" ]; then
Expand All @@ -800,10 +800,17 @@ update_rootfs_boot_kernel()
echo "timeout 4" | sudo tee "$defconf"
fi
echo "default run-qemu-kernel-$kver.conf" | sudo tee -a "$defconf"

# Fedora
sudo cp "$ovmf_path"/Shell.efi "$builddir"/mnt/shellx64.efi ||
# Arch Linux
sudo cp /usr/share/edk2-shell/x64/Shell_Full.efi "$builddir"/mnt/shellx64.efi ||
true

umount_rootfs 1

mount_rootfs 2 # Linux root partition
sudo ln -sf "$builddir/mnt/efi/run-qemu-kernel" "$builddir/mnt/boot/run-qemu-kernel"
sudo ln -sf "../efi/run-qemu-kernel" "$builddir/mnt/boot/run-qemu-kernel"
umount_rootfs 2
}

Expand Down Expand Up @@ -1303,7 +1310,7 @@ get_ovmf_binaries()
fi
if ! [ -e "OVMF_CODE.fd" ] && ! [ -e "OVMF_VARS.fd" ]; then
if [ ! -f "$ovmf_path/OVMF_CODE.fd" ]; then
echo "OVMF binaries not found, please install 'edk2-ovmf' or similar"
echo "OVMF binaries not found, please install '[edk2-]ovmf' or similar, 'edk2-shell', ..."
exit 1
fi
cp "$ovmf_path/OVMF_CODE.fd" .
Expand Down