All of 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 v3 07/22] Refactor pxelinux configuration
Date: Wed, 24 Jun 2015 16:32:26 +0100	[thread overview]
Message-ID: <1435159961-22292-7-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1435159944.28264.295.camel@citrix.com>

The mechanism used to PXE boot can differ depending on the firmware
type. Therefore refactor into Osstest::TestSupport and key off a new
host property "firmware".

Currently supported is "bios" (the default) and "uboot", both of which
use pxelinux.cfg style files.

The default for the firmware property is "bios", hence no change for
any existing system (including those which use uboot, regardless of
whether they are now configured with the firmware proprty or not)

As part of this "setup_pxeboot" becomes "setup_pxeboot_di" since it is
somewhat d-i specific.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: reorder setup_${firmware}_pxeboot to setup_pxeboot_${firmware}
    join $dicmd in setup_pxeboot instead of caller
---
 Osstest/TestSupport.pm | 49 +++++++++++++++++++++++++++++++++++++++++++++----
 ts-host-install        | 23 ++++++-----------------
 2 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 66a0d81..512efd2 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -104,7 +104,7 @@ BEGIN {
 
                       await_webspace_fetch_byleaf create_webfile
                       file_link_contents get_timeout
-                      setup_pxeboot setup_pxeboot_local host_pxefile
+                      setup_pxeboot_di setup_pxeboot_local host_pxefile
 
                       ether_prefix
 
@@ -2098,16 +2098,34 @@ sub host_pxefile ($;$) {
         (join ",", sort keys %v)." ?";
 }
 
-sub setup_pxeboot ($$) {
+sub setup_pxelinux_bootcfg ($$) {
     my ($ho, $bootfile) = @_;
     my $f= host_pxefile($ho);
     file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile,
 	"$ho->{Name}-pxelinux.cfg");
 }
 
-sub setup_pxeboot_local ($) {
+# Systems using BIOS are configured to use pxelinux
+sub setup_pxeboot_di_bios ($$$$$;%) {
+    my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_;
+    my $dtbs = "fdtdir $xopts{dtbs}" if $xopts{dtbs};
+    setup_pxelinux_bootcfg($ho, <<END);
+    serial 0 $c{Baud}
+timeout 5
+label overwrite
+	menu label ^Overwrite
+	menu default
+	kernel $kern
+	append $dicmd initrd=$initrd -- $hocmd
+	ipappend $xopts{ipappend}
+	$dtbs
+default overwrite
+END
+}
+
+sub setup_pxeboot_local_bios ($) {
     my ($ho) = @_;
-    setup_pxeboot($ho, <<END);
+    setup_pxelinux_bootcfg($ho, <<END);
 serial 0 $c{Baud}
 timeout 5
 label local
@@ -2116,6 +2134,29 @@ default local
 END
 }
 
+# uboot emulates pxelinux, so reuse BIOS stuff
+sub setup_pxeboot_di_uboot ($$$$$;%) { return &setup_pxeboot_di_bios; }
+sub setup_pxeboot_local_uboot ($) { return &setup_pxeboot_local_bios; }
+
+sub setup_pxeboot_local ($) {
+    my ($ho) = @_;
+    my $firmware = get_host_property($ho, "firmware", "bios");
+    $firmware =~ s/-/_/g;
+    no strict qw(refs);
+    return &{"setup_pxeboot_local_${firmware}"}($ho);
+}
+
+sub setup_pxeboot_di ($$$$$;%) {
+    my ($ho,$kern,$initrd,$dicmd,$hocmd,%xopts) = @_;
+    my $firmware = get_host_property($ho, "firmware", "bios");
+    $firmware =~ s/-/_/g;
+    no strict qw(refs);
+    return &{"setup_pxeboot_di_${firmware}"}($ho,$kern,$initrd,
+					     join(' ',@{$dicmd}),
+					     join(' ',@{$hocmd}),
+					     %xopts);
+}
+
 #---------- ISO images ----------
 sub iso_create_genisoimage ($$$$;@) {
     my ($ho,$iso,$dir,$isotimeout,@xopts) = @_;
diff --git a/ts-host-install b/ts-host-install
index 57a6b3f..632bac7 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -244,13 +244,14 @@ SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$ho->{Ether}", A
 END
     }
 
-    my $dtbs = "";
+    my %xopts;
+
     foreach my $kp (keys %{ $ho->{Flags} }) {
 	# Backwards compatibility
 	$kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp";
 	$kp =~ s/need-kernel-deb-$ho->{Suite}-// or next;
 
-	$dtbs = "fdtdir /$d_i/$kp-dtbs"
+	$xopts{dtbs} = "/$d_i/$kp-dtbs"
 	    if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs";
     }
 
@@ -284,21 +285,9 @@ END
         get_host_property($ho, "linux-boot-append $ho->{Suite}", ''),
         get_host_property($ho, "linux-boot-append $ho->{Suite} $r{arch}", '');
 
-    my $dicmd= join ' ', @dicmdline;
-    my $hocmd= join ' ', @hocmdline;
-
-    setup_pxeboot($ho, <<END);
-serial 0 $c{Baud}
-timeout 5
-label overwrite
-	menu label ^Overwrite
-	menu default
-	kernel $kernel
-	append initrd=/$initrd $dicmd -- $hocmd
-	ipappend $ipappend
-	$dtbs
-default overwrite
-END
+    $xopts{ipappend} = $ipappend;
+    setup_pxeboot_di($ho, $kernel, "/$initrd", \@dicmdline, \@hocmdline,
+		     %xopts);
 }
 
 install();
-- 
2.1.4

  parent reply	other threads:[~2015-06-24 15:32 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 15:32 [PATCH OSSTEST v3 00/22] Initial support for ARM64 Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 01/22] mg-*: Add mgi-common with fetch and fail helpers Ian Campbell
2015-06-24 15:59   ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 02/22] mg-*: Make package fetching common in new mgi-debian Ian Campbell
2015-06-24 16:00   ` Ian Jackson
2015-06-25  9:17     ` Ian Campbell
2015-06-25 10:22       ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 03/22] Introduce mg-pxe-loader-update Ian Campbell
2015-06-24 16:02   ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 04/22] Debian: Preseed a EFI system partition during host install Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 05/22] ts-host-install: Split initrd out of @installcmdline Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 06/22] ts-host-install: split the "di" from the "host" command line Ian Campbell
2015-06-24 15:32 ` Ian Campbell [this message]
2015-06-24 16:04   ` [PATCH OSSTEST v3 07/22] Refactor pxelinux configuration Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 08/22] ts-host-install: Support UEFI PXE boot using grub.efi Ian Campbell
2015-06-24 16:06   ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 09/22] Enable chain loading to local disk for UEFI PXE systems Ian Campbell
2015-06-24 16:07   ` Ian Jackson
2015-06-24 17:58     ` Ian Campbell
2015-06-25 10:18       ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 10/22] Add arm64 build and test jobs Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 11/22] ts-kernel-build: Additional kernel options for Mustang Ian Campbell
2015-06-24 16:08   ` Ian Jackson
2015-06-26 11:05   ` Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 12/22] ts-kernel-build: Enable CONFIG_EFI_VARS Ian Campbell
2015-06-24 16:08   ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 13/22] ts-host-install: Set dtbs in the non-special kernel case too Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 14/22] Debian: Do not add Debian to UEFI boot order on install Ian Campbell
2015-06-24 16:11   ` Ian Jackson
2015-06-24 17:59     ` Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 15/22] standalone: Prefer ./local-config to $HOME/.xen-osstest/config Ian Campbell
2015-06-24 16:12   ` Ian Jackson
2015-06-24 15:32 ` [PATCH OSSTEST v3 16/22] Debian: grub2: Log full line range of menuentry and submenu entries Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 17/22] Debian: grub2: Use GRUB_CMDLINE_LINUX_XEN_REPLACE(_DEFAULT) Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 18/22] Collect xen.efi into xendist and install in appropriate place Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 19/22] Debian: Ignore xen-syms entries in grub.cfg Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 20/22] Debian: Collect kernel command line from grub.cfg Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 21/22] Debian: Arrange to be able to chainload a xen.efi from grub2 Ian Campbell
2015-06-25 10:33   ` Ian Jackson
2015-06-25 11:46     ` Ian Campbell
2015-06-25 12:36       ` Ian Jackson
2015-06-25 13:01         ` Ian Campbell
2015-06-25 13:02           ` Ian Jackson
2015-06-25 14:16             ` Ian Campbell
2015-06-25 17:31         ` Konrad Rzeszutek Wilk
2015-06-26  7:07           ` Ian Campbell
2015-06-24 15:32 ` [PATCH OSSTEST v3 22/22] Enable CONFIG_SPARSEMEM_VMEMMAP, arm64 seems to needs it (crashes) Ian Campbell
2015-06-26  8:53   ` Ian Campbell

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=1435159961-22292-7-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.