Laszlo Ersek
2022-Apr-26 13:38 UTC
[Libguestfs] [p2v PATCH] virt-p2v-make-kickstart: add packages for making the P2V ISO UEFI-bootable
Including the shim-x64 and grub2-efi-x64-cdboot packages causes livecd-creator to automatically build a UEFI-bootable CD. I didn't modify the dependencies for distros other than the RH family, because: - I checked Debian briefly for any package providing a file ending with "BOOTX64.EFI", and the only hit was irrelevant (it was a systemd file). - Kickstart is RH-specific anyway. Tested with an actual conversion: - Built the ISO with the following livecd-creator and dnf fixes included: - https://github.com/rpm-software-management/dnf/pull/1825 - https://github.com/livecd-tools/livecd-tools/pull/227 - Booted the P2V ISO in UEFI mode on QEMU, against a previously installed (UEFI) RHEL-7.9 guest's disk. - Converted the guest with the help of a virt-v2v conversion server VM, using the QEMU output module. - Successfully booted the converted guest. Thanks: Neal Gompa <ngompa13 at gmail.com> Cc: Neal Gompa <ngompa13 at gmail.com> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2038105 Signed-off-by: Laszlo Ersek <lersek at redhat.com> --- dependencies.m4 | 4 ++++ virt-p2v-make-kickstart.pod | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dependencies.m4 b/dependencies.m4 index fc3715e4d3c7..8a88b61d3120 100644 --- a/dependencies.m4 +++ b/dependencies.m4 @@ -59,6 +59,10 @@ ifelse(REDHAT,1, dnl RHBZ#1157679 @hardware-support + + dnl UEFI Boot (RHBZ#2038105) + shim-x64 + grub2-efi-x64-cdboot ) ifelse(DEBIAN,1, diff --git a/virt-p2v-make-kickstart.pod b/virt-p2v-make-kickstart.pod index c5e23d59222a..eda0c737c2e8 100644 --- a/virt-p2v-make-kickstart.pod +++ b/virt-p2v-make-kickstart.pod @@ -147,7 +147,7 @@ RHEL 6-based virt-p2v 0.9 they can boot on any hardware. =head2 TESTING THE P2V ISO USING QEMU -You can use qemu to test-boot the P2V ISO: +You can use qemu to test-boot the P2V ISO (BIOS mode): qemu-kvm -m 1024 -hda /tmp/guest.img -cdrom /tmp/livecd-p2v.iso -boot d @@ -155,6 +155,18 @@ Note that C<-hda> is the (virtual) system that you want to convert (for test purposes). It could be any guest type supported by L<virt-v2v(1)>, including Windows or Red Hat Enterprise Linux. +For UEFI: + + qemu-kvm -m 1024 -M q35 \ + -drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_CODE.fd,readonly=on \ + -drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS.fd,snapshot=on \ + \ + -drive if=none,format=raw,file=/tmp/guest.img,media=disk,id=guest-disk \ + -device ide-hd,drive=guest-disk,bus=ide.0 \ + \ + -drive if=none,format=raw,file=/tmp/livecd-p2v.iso,media=cdrom,id=p2v-cdrom \ + -device ide-cd,drive=p2v-cdrom,bus=ide.1,bootindex=1 + =head2 TESTING PXE SUPPORT USING QEMU =over 4 -- 2.19.1.3.g30247aa5d201
Richard W.M. Jones
2022-Apr-26 14:31 UTC
[Libguestfs] [p2v PATCH] virt-p2v-make-kickstart: add packages for making the P2V ISO UEFI-bootable
On Tue, Apr 26, 2022 at 03:38:23PM +0200, Laszlo Ersek wrote:> Including the shim-x64 and grub2-efi-x64-cdboot packages causes > livecd-creator to automatically build a UEFI-bootable CD. > > I didn't modify the dependencies for distros other than the RH family, > because: > > - I checked Debian briefly for any package providing a file ending with > "BOOTX64.EFI", and the only hit was irrelevant (it was a systemd file). > > - Kickstart is RH-specific anyway.This is correct - we don't recommend any Debian-specific way to build virt-p2v (except maybe the virt-builder method, but that has some drawbacks). SUSE contributed their own tool, using "kiwi". A Debian- based tool would presumably have to use the bootcd method (https://packages.debian.org/stable/bootcd), but no one has contributed that support. The dependencies.m4 file is shared across all distros (as well as having per-distro sections) but as long as it doesn't regress on other distros then it's all fine.> Tested with an actual conversion: > > - Built the ISO with the following livecd-creator and dnf fixes included: > - https://github.com/rpm-software-management/dnf/pull/1825 > - https://github.com/livecd-tools/livecd-tools/pull/227 > > - Booted the P2V ISO in UEFI mode on QEMU, against a previously installed > (UEFI) RHEL-7.9 guest's disk. > > - Converted the guest with the help of a virt-v2v conversion server VM, > using the QEMU output module. > > - Successfully booted the converted guest. > > Thanks: Neal Gompa <ngompa13 at gmail.com> > Cc: Neal Gompa <ngompa13 at gmail.com> > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2038105 > Signed-off-by: Laszlo Ersek <lersek at redhat.com> > --- > dependencies.m4 | 4 ++++ > virt-p2v-make-kickstart.pod | 14 +++++++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/dependencies.m4 b/dependencies.m4 > index fc3715e4d3c7..8a88b61d3120 100644 > --- a/dependencies.m4 > +++ b/dependencies.m4 > @@ -59,6 +59,10 @@ ifelse(REDHAT,1, > > dnl RHBZ#1157679 > @hardware-support > + > + dnl UEFI Boot (RHBZ#2038105) > + shim-x64 > + grub2-efi-x64-cdboot > )Just adding packages for Fedora/RHEL cannot regress other distros. If we try to build virt-p2v for some old RHEL, it won't have these packages, which is not a problem as it will continue to build the old BIOS-based image.> ifelse(DEBIAN,1, > diff --git a/virt-p2v-make-kickstart.pod b/virt-p2v-make-kickstart.pod > index c5e23d59222a..eda0c737c2e8 100644 > --- a/virt-p2v-make-kickstart.pod > +++ b/virt-p2v-make-kickstart.pod > @@ -147,7 +147,7 @@ RHEL 6-based virt-p2v 0.9 they can boot on any hardware. > > =head2 TESTING THE P2V ISO USING QEMU > > -You can use qemu to test-boot the P2V ISO: > +You can use qemu to test-boot the P2V ISO (BIOS mode): > > qemu-kvm -m 1024 -hda /tmp/guest.img -cdrom /tmp/livecd-p2v.iso -boot d > > @@ -155,6 +155,18 @@ Note that C<-hda> is the (virtual) system that you want to convert > (for test purposes). It could be any guest type supported by > L<virt-v2v(1)>, including Windows or Red Hat Enterprise Linux. > > +For UEFI: > + > + qemu-kvm -m 1024 -M q35 \ > + -drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_CODE.fd,readonly=on \ > + -drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS.fd,snapshot=on \ > + \ > + -drive if=none,format=raw,file=/tmp/guest.img,media=disk,id=guest-disk \ > + -device ide-hd,drive=guest-disk,bus=ide.0 \ > + \ > + -drive if=none,format=raw,file=/tmp/livecd-p2v.iso,media=cdrom,id=p2v-cdrom \ > + -device ide-cd,drive=p2v-cdrom,bus=ide.1,bootindex=1 > + > =head2 TESTING PXE SUPPORT USING QEMU >Looks good, so: Reviewed-by: Richard W.M. Jones <rjones at redhat.com> Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v