[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [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.

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

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;
 
-- 
2.1.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.