diff mbox

[Xen-devel,RFC,OSSTEST,06/19] ts-host-install: Refactor code to construct a Linux console= for a host

Message ID 1412942554-752-6-git-send-email-ian.campbell@citrix.com
State New
Headers show

Commit Message

Ian Campbell Oct. 10, 2014, 12:02 p.m. UTC
And reuse it in when writing the u-boot script for initial boot. This was
previously hardcoded to ttyAMA which matches the production host DB for the
current set of hosts which use this script.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Debian.pm      |  4 +++-
 Osstest/TestSupport.pm | 10 ++++++++++
 ts-host-install        |  6 +++---
 3 files changed, 16 insertions(+), 4 deletions(-)

Comments

Ian Jackson Oct. 10, 2014, 2:02 p.m. UTC | #1
Ian Campbell writes ("[PATCH RFC OSSTEST 06/19] ts-host-install: Refactor code to construct a Linux console= for a host"):
> And reuse it in when writing the u-boot script for initial boot. This was
> previously hardcoded to ttyAMA which matches the production host DB for the
> current set of hosts which use this script.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
diff mbox

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index ab09abb..29dec3b 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -660,6 +660,8 @@  END
 
     if ( $ho->{Flags}{'need-uboot-bootscr'} ) {
 	my $root=target_guest_lv_name($ho,"root");
+	my $console = get_host_native_linux_console($ho);
+	my $consolecmd = "console=$console" unless $console eq "NONE";
 
 	preseed_hook_command($ho, 'late_command', $sfx, <<END);
 #!/bin/sh
@@ -671,7 +673,7 @@  kernel=`readlink \$r/vmlinuz | sed -e 's|boot/||'`
 initrd=`readlink \$r/initrd.img | sed -e 's|boot/||'`
 
 cat >\$r/boot/boot <<EOF
-setenv bootargs console=ttyAMA0 root=$root
+setenv bootargs $consolecmd root=$root
 mw.l 800000 0 10000
 scsi scan
 ext2load scsi 0 \\\${kernel_addr_r} \$kernel
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 1d77933..d66708e 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -65,6 +65,7 @@  BEGIN {
                       contents_make_cpio file_simple_write_contents
 
                       selecthost get_hostflags get_host_property
+                      get_host_native_linux_console
                       power_state power_cycle power_cycle_time
                       serial_fetch_logs
                       propname_massage
@@ -863,6 +864,15 @@  sub get_host_property ($$;$) {
     return defined($val) ? $val : $defval;
 }
 
+sub get_host_native_linux_console ($) {
+    my ($ho) = @_;
+
+    my $console = get_host_property($ho, "LinuxSerialConsole", "ttyS0");
+    return $console if $console eq 'NONE';
+
+    return "$console,$c{Baud}n8";
+}
+
 sub get_host_method_object ($$$) {
     my ($ho, $kind, $meth) = @_;
     my (@meth) = split /\s+/, $meth;
diff --git a/ts-host-install b/ts-host-install
index ca26f95..cf9506d 100755
--- a/ts-host-install
+++ b/ts-host-install
@@ -210,9 +210,9 @@  END
 
     push @installcmdline, qw(--);
 
-    my $console = get_host_property($ho, "LinuxSerialConsole", "ttyS0");
-    push @installcmdline, "console=$console,$c{Baud}n8"
-        unless $console eq "NONE";
+    my $console = get_host_native_linux_console($ho);
+
+    push @installcmdline, "console=$console" unless $console eq "NONE";
 
     my $installcmdline= join ' ', @installcmdline;