All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com
Cc: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Subject: [PATCH OSSTEST v2 01/19] Introduce mg-pxe-loader-update
Date: Thu, 18 Jun 2015 17:24:52 +0100	[thread overview]
Message-ID: <1434644710-28881-1-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1434644687.28264.53.camel@citrix.com>

The story for PXE booting via UEFI (at least on arm64) is not so
straightforward as with pxelinux on x86. There seems to no good
bootloader to launch via UEFI+pxe, in fact all I could find was grub
(syslinux, and by extension pxelinux.efi, is x86 only).

Add mg-pxe-loader-update modelled on mg-debian-installer-update which
will download the necessary grub binaries and produce a grub image
which can be used to pxe boot.

grub lacks the convenient ability to search for config file based on
(substrings of) the MAC or IP address. So we arrange for the grub.cfg
in TftpGrubBase to chain load another config file from
TftpTmpDir/'$net_default_mac' where $net_default_mac is a grub
variable which is substituted at boot time.

Actually using this requires that bootp/dhcp provide a next-file so
UEFI knows what to boot (usually this would be pxelinux.0 which we
can't use here). Locally we have configured this as $name/pxe.img, so
we can use different loaders.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest.pm           |  3 ++
 README               |  4 ++-
 mg-pxe-loader-update | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 production-config    |  5 +++
 4 files changed, 100 insertions(+), 1 deletion(-)
 create mode 100755 mg-pxe-loader-update

diff --git a/Osstest.pm b/Osstest.pm
index e8bd77b..e668b3c 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -199,6 +199,9 @@ sub readglobalconfig () {
     $c{TftpDiBase} ||= "$c{TftpPlayDir}debian-installer";
     $c{TftpDiVersion} ||= 'current';
 
+    $c{TftpGrubBase} ||= "$c{TftpPlayDir}grub";
+    $c{TftpGrubVersion} ||= 'current';
+
     $c{WebspaceFile} ||= "$ENV{'HOME'}/public_html/";
     $c{WebspaceUrl} ||= "http://$myfqdn/~$whoami/";
     $c{WebspaceCommon} ||= 'osstest/';
diff --git a/README b/README
index 44e2989..503d15d 100644
--- a/README
+++ b/README
@@ -206,7 +206,9 @@ To run osstest in standalone mode:
      netcat
      chiark-utils-bin
 
- - Optional: ipmitool
+ - Optional:
+     ipmitool -- for hosts which use IPMI for power control
+     grub-common -- for mg-pxe-loader-update
 
  - Write a config file
     ~/.xen-osstest/config
diff --git a/mg-pxe-loader-update b/mg-pxe-loader-update
new file mode 100755
index 0000000..b336fdb
--- /dev/null
+++ b/mg-pxe-loader-update
@@ -0,0 +1,89 @@
+#!/bin/bash
+# usage
+#   ./mg-pxe-loader-update jessie
+#
+# Requires grub-mkimage (Debian package: grub-common)
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2015 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+set -e
+
+. cri-getconfig
+
+suite=$1
+
+fail () { echo >&2 "$0: $1"; exit 1; }
+
+site=http://ftp.debian.org/debian/
+sbase=$site/dists/$suite
+
+archs="amd64 i386 arm64"
+
+dstroot=`getconfig TftpPath`/`getconfig TftpGrubBase`/
+date=`date +%Y-%m-%d`
+dst=$date
+
+grubpfx=`getconfig TftpGrubBase`/$date/grub
+grubcfg=`getconfig TftpTmpDir`/grub.cfg-'$net_default_mac'
+
+mkdir -p $dstroot
+cd $dstroot
+mkdir -p $dst
+cd $dst
+rm -rf grub
+mkdir grub
+
+cat >grub/grub.cfg <<EOF
+set stage1=yes
+configfile $grubcfg
+EOF
+for arch in $archs ; do
+    case $arch in
+	amd64) grubdeb=grub-efi-amd64-bin; platform=x86_64-efi;;
+	i386)  grubdeb=grub-efi-ia32-bin;  platform=i386-efi;;
+	arm64) grubdeb=grub-efi-arm64-bin; platform=arm64-efi;;
+	*) echo "No grub on $arch" >&2; exit 0;;
+    esac
+
+    pfile=$sbase/main/binary-$arch/Packages.gz
+
+    curl -s $pfile >Packages.gz
+
+    echo >&2 "collecting $grubdeb"
+    pkgfile=`zcat Packages.gz | grep-dctrl -PX $grubdeb -nsFilename | sort -n -r | head -n1`
+    rc=$?
+    set -e
+    if [ $rc -ne 0 ] || [ x$pkgfile = x ]; then fail "$grubdeb package not found"; fi
+    curl -s "$site/$pkgfile" >$grubdeb.deb
+
+    dpkg-deb -x $grubdeb.deb x
+
+    mv x/usr/lib/grub/* grub/
+
+    rm -rf x
+
+    rm Packages.gz
+
+    grub-mkimage -O "$platform" \
+		 -d ./grub/$platform \
+		 -o pxegrub-$arch.efi -p "$grubpfx" \
+		 search configfile normal efinet tftp net
+done
+
+echo $date
+echo >&2 "downloaded $dstroot/$date"
diff --git a/production-config b/production-config
index 47c0c4c..46fedc9 100644
--- a/production-config
+++ b/production-config
@@ -85,12 +85,17 @@ TftpPxeTemplates %name%/pxelinux.cfg
 TftpPxeTemplatesReal pxelinux.cfg/%ipaddrhex%
 
 TftpPxeGroup osstest
+# Update with ./mg-debian-installer-update(-all)
 TftpDiVersion 2015-01-10
 
 # These should normally be the same.
+# Update with ./mg-cpu-microcode-update
 MicrocodeUpdateAmd64 microcode.x86.2015-06-12.cpio
 MicrocodeUpdateI386 microcode.x86.2015-06-12.cpio
 
+# Update with ./mg-pxe-loader-update
+TftpGrubVersion XXXX-XX-XX
+
 XenUsePath /usr/groups/xencore/systems/bin/xenuse
 XenUseUser osstest
 
-- 
2.1.4

  reply	other threads:[~2015-06-18 16:24 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 16:24 [PATCH OSSTEST v2 00/19] Initial support for ARM64 Ian Campbell
2015-06-18 16:24 ` Ian Campbell [this message]
2015-06-18 17:42   ` [PATCH OSSTEST v2 01/19] Introduce mg-pxe-loader-update Ian Jackson
2015-06-19 10:44     ` Ian Campbell
2015-06-18 16:24 ` [PATCH OSSTEST v2 02/19] Debian: Preseed a EFI system partition during host install Ian Campbell
2015-06-18 17:44   ` Ian Jackson
2015-06-18 16:24 ` [PATCH OSSTEST v2 03/19] ts-host-install: Split initrd out of @installcmdline Ian Campbell
2015-06-18 17:53   ` Ian Jackson
2015-06-18 16:24 ` [PATCH OSSTEST v2 04/19] ts-host-install: split the "di" from the "host" command line Ian Campbell
2015-06-18 17:53   ` Ian Jackson
2015-06-18 16:24 ` [PATCH OSSTEST v2 05/19] Refactor pxelinux configuration Ian Campbell
2015-06-18 17:49   ` Ian Jackson
2015-06-19  9:53     ` Ian Campbell
2015-06-19 10:45       ` Ian Jackson
2015-06-19 10:55         ` Ian Campbell
2015-06-18 16:24 ` [PATCH OSSTEST v2 06/19] ts-host-install: Support UEFI PXE boot using grub.efi Ian Campbell
2015-06-18 17:51   ` Ian Jackson
2015-06-18 16:24 ` [PATCH OSSTEST v2 07/19] Enable chain loading to local disk for UEFI PXE systems Ian Campbell
2015-06-18 17:52   ` Ian Jackson
2015-06-19  9:57     ` Ian Campbell
2015-06-18 16:24 ` [PATCH OSSTEST v2 08/19] Add arm64 build and test jobs Ian Campbell
2015-06-18 17:54   ` Ian Jackson
2015-06-18 16:25 ` [PATCH OSSTEST v2 09/19] ts-kernel-build: Additional kernel options for Mustang Ian Campbell
2015-06-18 17:55   ` Ian Jackson
2015-06-19 10:04     ` Ian Campbell
2015-06-18 16:25 ` [PATCH OSSTEST v2 10/19] ts-host-install: Set dtbs in the non-special kernel case too Ian Campbell
2015-06-18 17:56   ` Ian Jackson
2015-06-19 10:07     ` Ian Campbell
2015-06-19 10:46       ` Ian Jackson
2015-06-18 16:25 ` [PATCH OSSTEST v2 11/19] Debian: Fixup UEFI boot order during install Ian Campbell
2015-06-18 17:57   ` Ian Jackson
2015-06-19 10:22     ` Ian Campbell
2015-06-19 11:02       ` Ian Jackson
2015-06-19 11:15         ` Ian Campbell
2015-06-18 16:25 ` [PATCH OSSTEST v2 12/19] ts-kernel-build: Support --reuse to keep same build tree Ian Campbell
2015-06-18 17:58   ` Ian Jackson
2015-06-19  9:40     ` Ian Campbell
2015-06-18 16:25 ` [PATCH OSSTEST v2 13/19] standalone: Prefer ./standalone.config to $HOME/.xen-osstest/config Ian Campbell
2015-06-18 17:59   ` Ian Jackson
2015-06-19 10:22     ` Ian Campbell
2015-06-19 10:24       ` Ian Campbell
2015-06-19 11:04         ` Ian Jackson
2015-06-19 11:08           ` Ian Campbell
2015-06-18 16:25 ` [PATCH OSSTEST v2 14/19] Debian: grub2: Log full line range of menuentry and submenu entries Ian Campbell
2015-06-18 18:00   ` Ian Jackson
2015-06-18 16:25 ` [PATCH OSSTEST v2 15/19] Debian: grub2: Use GRUB_CMDLINE_LINUX_XEN_REPLACE(_DEFAULT) Ian Campbell
2015-06-18 18:02   ` Ian Jackson
2015-06-18 16:25 ` [PATCH OSSTEST v2 16/19] Collect xen.efi into xendist and install in appropriate place Ian Campbell
2015-06-18 18:04   ` Ian Jackson
2015-06-18 16:25 ` [PATCH OSSTEST v2 17/19] Debian: Ignore xen-syms entries in grub.cfg Ian Campbell
2015-06-18 18:04   ` Ian Jackson
2015-06-19  9:44     ` Ian Campbell
2015-06-18 16:25 ` [PATCH OSSTEST v2 18/19] Debian: Collect kernel command line from grub.cfg Ian Campbell
2015-06-18 18:05   ` Ian Jackson
2015-06-18 16:25 ` [PATCH OSSTEST v2 19/19] Debian: Arrange to be able to chainload a xen.efi from grub2 Ian Campbell
2015-06-18 18:11   ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434644710-28881-1-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.