Bug#759018: [PATCH RFC] Provide prebuilt grub-xen binaries for host (dom0) use

Colin Watson cjwatson at debian.org
Mon Aug 25 21:46:31 UTC 2014


On Sat, Aug 23, 2014 at 09:38:07PM +0100, Ian Campbell wrote:
> I'm attaching a new version with a grub.cfg which is tested and seems to
> work. I've also taken the liberty of filing this into a wishlist bug
> (keeping entire quoted text below for the bug).

This generally looks good to me, thanks!  As you said in a follow-up,
there is the matter of establishing this as a boot protocol upstream,
which I hope I can leave up to you to sort out.

For the information of pkg-grub-devel: I have given Ian commit access to
pkg-grub, on the basis that he is much more familiar with Xen than I am
and can start maintaining the Xen-related bits himself.  Welcome!

> I needed to do a little hack which is to rmmod memdisk before searching
> for /boot/grub/grub.cfg or else it just loops infinitely finding the
> grub.cfg in the memdisk. I have a feeling that the same thing might
> apply to debian/grub-firmware-qemu_grub.cfg.

This is what
https://lists.gnu.org/archive/html/grub-devel/2013-12/msg00185.html and
subthread was about, but that never reached a clear conclusion, although
Andrey's patch seemed fairly reasonable to me.  The rmmod hack is OK for
now.

> On Mon, 2014-07-28 at 18:50 +0100, Ian Campbell wrote:
> > I wasn't sure whether to go for a static binary built at build time or a
> > grub-mkimage invocation in a postinst. I went for the former in the end
> > since I couldn't really think of a good reason to do the more dynamic
> > thing.

Static seems reasonable until we need otherwise.

> diff --git a/debian/grub-xen-host.dirs b/debian/grub-xen-host.dirs
> new file mode 100644
> index 0000000..a8dc877
> --- /dev/null
> +++ b/debian/grub-xen-host.dirs
> @@ -0,0 +1 @@
> +usr/lib/grub-xen

This file is probably unnecessary.  dh_install will create directories
as needed in response to debian/grub-xen-host.install.

> diff --git a/debian/grub-xen-host_grub.cfg b/debian/grub-xen-host_grub.cfg
> new file mode 100644
> index 0000000..1ad895c
> --- /dev/null
> +++ b/debian/grub-xen-host_grub.cfg
> @@ -0,0 +1,25 @@
> +# First search for a suitable grub to chainload
> +search -s -f /boot/grub/@@TARGET@@/core.elf
> +if multiboot /boot/grub/@@TARGET@@/core.elf ; then
> +	echo "Chainloading (${root})/boot/grub/@@TARGET@@/core.elf"
> +	boot
> +fi
> +
> +search -s -f /grub/@@TARGET@@/core.elf
> +if multiboot /grub/@@TARGET@@/core.elf ; then
> +	echo "Chainloading (${root})/grub/@@TARGET@@/core.elf"
> +	boot
> +fi

This is something that could perhaps be simplified if the guest boot
protocol were standardised.  I think there is some justification for
having it be in /boot/xen/ etc. instead, so that we don't have to deal
upstream with variations such as distributions that configure with
"--program-transform-name=s/grub/grub2/".

You may need to arrange for this to be executed using normal mode rather
than the rescue shell.  See debian/build-efi-images for a possible
source of inspiration.

> diff --git a/debian/rules b/debian/rules
> index f478e94..18f4776 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -35,7 +35,7 @@ confflags = PACKAGE_VERSION="$(deb_version)" PACKAGE_STRING="GRUB $(deb_version)
>  AUTOGEN_DEB_FILES = config templates preinst postinst postrm dirs install links maintscript
>  
>  BUILD_PACKAGES := $(strip $(shell dh_listpackages))
> -REAL_PACKAGES = grub-emu grub-pc grub-coreboot grub-efi-ia32 grub-efi-amd64 grub-efi-ia64 grub-efi-arm grub-efi-arm64 grub-ieee1275 grub-firmware-qemu grub-uboot grub-xen grub-yeeloong
> +REAL_PACKAGES = grub-emu grub-pc grub-coreboot grub-efi-ia32 grub-efi-amd64 grub-efi-ia64 grub-efi-arm grub-efi-arm64 grub-ieee1275 grub-firmware-qemu grub-uboot grub-xen grub-xen-host grub-yeeloong
>  
>  ifneq (,$(filter i386 amd64,$(DEB_HOST_ARCH_CPU)))
>  COMMON_PLATFORM := pc

As discussed, grub-xen-host shouldn't be in REAL_PACKAGES; it should be
in something new instead.  Then you won't need to have dummy
debian/stamps/configure-grub-xen-host* rules.

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Pkg-grub-devel mailing list