[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 0/2] xen/efi: Make boot more flexible, especially with GRUB2
On Thu, Jun 26, 2025 at 09:12:53AM +0100, Frediano Ziglio wrote: > On Wed, Jun 25, 2025 at 9:26 PM Marek Marczykowski-Górecki > <marmarek@xxxxxxxxxxxxxxxxxxxxxx> wrote: > > > > On Tue, Jun 24, 2025 at 09:38:42AM +0100, Frediano Ziglio wrote: > > > On Tue, Jun 24, 2025 at 9:32 AM Frediano Ziglio > > > <frediano.ziglio@xxxxxxxxx> wrote: > > > > > > > > The combination of GRUB2, EFI and UKI allows potentially more > > > > flexibility. > > > > For instance is possible to load xen.efi from a no ESP partition leaving > > > > a boot loader like GRUB2 taking care of the file loading. > > > > This however requires some changes in Xen to be less restrictive. > > > > Specifically for GRUB2 these changes allows the usage of "chainloader" > > > > command with UKI and reading xen.efi from no ESP (so no DeviceHandle > > > > set) and usage of "linux" and "initrd" commands to load separately > > > > the kernel (embedding using UKI) and initrd (using LoadFile2 protocol). > > > > > > I was forgetting. If somebody wants to test "linux" and "initrd" > > > command with these changes be aware that GRUB currently has a problem > > > passing arguments, I posted a patch, see > > > https://lists.gnu.org/archive/html/grub-devel/2025-06/msg00156.html. > > > I also have a workaround for this issue in xen but it would be better > > > to have a fix in GRUB. > > > > Can you tell more how to test this, especially the second variant? When > > trying to use GRUB linux or linuxefi commands on xen.efi, I get "invalid > > magic number" error. > > > > That's weird. > > Be the way. As usual I have a super complicated script that does everything. > > But to simplify: > - I compile xen (plain upstream plus my patches) with "make -C > ~/work/xen/xen -j O=normal MAP" Is there any that would be related to the "invalid magic" error? IIUC without your patches options will be mangled, but I don't think I get this far. > - output xen.efi in "~/work/xen/xen/normal/xen.efi" > - add configuration and kernel with "./add_sections xen.efi > xen.unified.efi .config xen.cfg .kernel vmlinuz-xen" > - boot using patched Grub (or patched Xen, to handle command line, if > you don't care about command line you can use a stock one), the menu > entry is > > menuentry 'XenServer (Serial)' { > search --label --set root EFI-BOOT > linux /boot/xen.unified.efi -- com1=115200,8n1 > console=com1,vga dom0_mem=1232M,max:1232M watchdog dom0_max_vcpus=1-4 > crashkernel=256M,below=4G -- root=LABEL=root-qjhppe ro nolvm > hpet=disable console=tty0 console=hvc0 > initrd /boot/initrd.img > } All looks quite similar. FWIW my setup is: https://gitlab.com/xen-project/people/marmarek/xen/-/blob/test-uki/automation/scripts/qemu-smoke-x86-64-efi-uki.sh?ref_type=heads Booting such UKI from OVMF directly works, as well as with "chainloader" grub command: https://gitlab.com/xen-project/people/marmarek/xen/-/pipelines/1891308263 CI uses Grub 2.06 from Debian, but I get the same result with 2.12 from Fedora too. > > xen.cfg file: > ---------- > [global] > default=xen > > [xen] > ---------- > > add_sections file: > ---------- > #!/usr/bin/env perl > use strict; > > die if $#ARGV < 1; > my $in = shift @ARGV; > my $out = shift @ARGV; > > my $max = 0; > open(IN, "objdump -h $in |") or die; > while (<IN>) { > next if !/^\s*\d+\s+\S+\s+([0-9a-f]+)\s+([0-9a-f]+)\s+/; > my $val = hex($1) + hex($2); > $max = $val if $val > $max; > } > close(IN); > > sub up($) { > my $n = shift; > return ($n + 4095) & -4096; > } > > my @args = ('objcopy'); > > my $start = up($max); > while ($#ARGV >= 1) { > my $name = shift; > my $fn = shift; > push @args, '--add-section', "$name=$fn"; > push @args, '--change-section-vma', sprintf("%s=%#x", $name, $start); > $start += -s $fn; > $start = up($start); > } > push @args, $in, $out; > print "Executing @args\n"; > system(@args) == 0 || die "Error!"; > ---------- > > My script creates the initrd, builds a full disk for Qemu and launches > Qemu too with specific options. > > Frediano -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab Attachment:
signature.asc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |