On Tue, May 10, 2011 at 09:53:55AM +0300, Alkis Georgopoulos wrote: > Proposed implementation: > * Put ipxe.lkrn to /boot > * Use /etc/grub.d/20_memtest86+ as a template for a new grub hook > in /etc/grub.d/grub-ipxe > * Call update-grub on grub-gpxe.postinst
here's an alternate implementation, that simply installs ipxe.lkrn to /boot and adds grub2 entries (based on memtest86+) on x86 architectures: commit 3c35e8fcdc68c9a5ea7eb84735d360cb2f715f10 Author: Vagrant Cascadian <[email protected]> Date: Sun May 15 08:31:50 2011 -0700 Support booting iPXE from grub2 (Closes: #626238). diff --git a/debian/grub.d/20_ipxe b/debian/grub.d/20_ipxe new file mode 100755 index 0000000..7c0d69e --- /dev/null +++ b/debian/grub.d/20_ipxe @@ -0,0 +1,42 @@ +#!/bin/sh +set -e + +if [ -f /usr/lib/grub/grub-mkconfig_lib ]; then + . /usr/lib/grub/grub-mkconfig_lib + LX=linux16 +elif [ -f /usr/lib/grub/update-grub_lib ]; then + . /usr/lib/grub/update-grub_lib + LX=linux +else + # no grub file, so we notify and exit gracefully + echo "Cannot find grub config file, exiting." >&2 + exit 0 +fi + +# We can't cope with loop-mounted devices here. +case ${GRUB_DEVICE_BOOT} in + /dev/loop/*|/dev/loop[0-9]) exit 0 ;; +esac + +# iPXE is only supported on x86 +case $(dpkg --print-architecture) in + *i386|*amd64) ;; + *) exit 0 ;; +esac + +prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" + +IPXE=/boot/ipxe.lkrn + +if test -e "$IPXE" ; then + IPXEPATH=$( make_system_path_relative_to_its_root "$IPXE" ) + echo "Found iPXE image : $IPXEPATH" >&2 + cat << EOF +menuentry "Network boot (iPXE)" { +EOF + printf '%s\n' "${prepare_boot_cache}" + cat << EOF + $LX $IPXEPATH +} +EOF +fi diff --git a/debian/ipxe.install b/debian/ipxe.install index ee3d65a..c862e7d 100644 --- a/debian/ipxe.install +++ b/debian/ipxe.install @@ -1,3 +1,5 @@ src/bin/*.rom usr/lib/ipxe -src/bin/ipxe.{iso,lkrn,pxe} usr/lib/ipxe +src/bin/ipxe.{iso,pxe} usr/lib/ipxe src/bin/undionly.kpxe usr/lib/ipxe +src/bin/ipxe.lkrn boot +debian/grub.d/* etc/grub.d might be good to add an update-grub call to postinst to ensure it gets added on install. /boot/ipxe.lkrn is a little odd location on non-x86 architectures. another idea would be to have the grub.d/20_ipxe script copy /usr/share/ipxe/ipxe.lkrn into /boot on the appropriate architectures, but then you could end up with /boot/ipxe.lkrn out of sync with /usr/share/ipxe/ipxe.lkrn in some cases. the above approach could also easily be split into an additional package, but not sure it warrants a that. live well, vagrant -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

