]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
ts-xen-install: setup xen on arm platforms
authorIan Campbell <ian.campbell@citrix.com>
Fri, 6 Sep 2013 14:22:32 +0000 (15:22 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 6 Sep 2013 14:22:32 +0000 (15:22 +0100)
Support for generating a u-boot boot.scr which loads Xen

Support per-host xen console settings.

Osstest/Debian.pm
README
ts-xen-install

index cacb4ea28b260456bb94c821265273e41a9a86e9..b8d96b05a08d3a2af931ebb902ec85a58f978356 100644 (file)
@@ -70,7 +70,9 @@ sub debian_boot_setup ($$$$;$) {
     }
 
     my $bootloader;
-    if ($ho->{Suite} =~ m/lenny/) {
+    if ( $ho->{Flags}{'need-uboot-bootscr'} ) {
+       $bootloader= setupboot_uboot($ho, $want_kernver, $xenhopt, $kopt);
+    } elsif ($ho->{Suite} =~ m/lenny/) {
         $bootloader= setupboot_grub1($ho, $want_kernver, $xenhopt, $kopt);
     } else {
         $bootloader= setupboot_grub2($ho, $want_kernver, $xenhopt, $kopt);
@@ -109,6 +111,74 @@ sub bl_getmenu_open ($$$) {
     return $f;
 }
 
+sub lvm_lv_name($$) {
+    my ($ho, $lv) = @_;
+
+    my $vg = "$ho->{Name}";
+    # Dashes are escaped in the VG name
+    $vg =~ s/-/--/g;
+    return "/dev/mapper/$vg-$lv";
+}
+
+sub setupboot_uboot ($$$$) {
+    my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_;
+    my $bl= { };
+
+    $bl->{UpdateConfig}= sub {
+
+       my $xen = "xen";
+       my $kern = "vmlinuz-$want_kernver";
+       my $initrd = "initrd.img-$want_kernver";
+
+       my $root= lvm_lv_name($ho,"root");
+
+       target_cmd_root($ho, <<END);
+if test ! -f /boot/$kern ; then
+    exit 1
+fi
+# Save a copy of the original
+cp -n /boot/boot /boot/boot.bak
+cp -n /boot/boot.scr /boot/boot.scr.bak
+
+xen=`readlink /boot/$xen`
+
+cat >/boot/boot <<EOF
+
+mw.l 800000 0 10000
+scsi scan
+
+fdt addr \\\${fdt_addr}
+fdt resize
+
+ext2load scsi 0 0x600000 \$xen
+setenv bootargs $xenhopt
+
+ext2load scsi 0 \\\${kernel_addr_r} $kern
+fdt mknod /chosen module\@0
+fdt set /chosen/module\@0 compatible "xen,linux-zimage"
+fdt set /chosen/module\@0 reg <\\\${kernel_addr_r} \\\${filesize}>
+fdt set /chosen/module\@0 bootargs "$xenkopt ro root=$root"
+
+ext2load scsi 0 \\\${ramdisk_addr_r} $initrd
+fdt mknod /chosen module\@1
+fdt set /chosen/module\@1 compatible "xen,linux-initrd"
+fdt set /chosen/module\@1 reg < \\\${ramdisk_addr_r} \\\${filesize} >
+
+bootz 0x600000 - 0x1000
+EOF
+mkimage -A arm -T script -d /boot/boot /boot/boot.scr
+END
+    };
+
+    $bl->{GetBootKern}= sub {
+       return "vmlinuz-$want_kernver";
+    };
+
+    $bl->{PreFinalUpdate}= sub { };
+
+    return $bl;
+}
+
 sub setupboot_grub1 ($$$) {
     my ($ho,$want_kernver,$xenhopt,$xenkopt) = @_;
     my $bl= { };
@@ -495,10 +565,7 @@ END
     }
 
     if ( $ho->{Flags}{'need-uboot-bootscr'} ) {
-       my $vg = "$ho->{Name}";
-
-       $vg =~ s/-/--/g; # Escape the dashes
-       my $root="/dev/mapper/$vg-root";
+       my $root=lvm_lv_name($ho,"root");
 
        preseed_hook_command($ho, 'late_command', $sfx, <<END);
 #!/bin/sh
@@ -514,9 +581,9 @@ cat >\$r/boot/boot <<EOF
 setenv bootargs console=ttyAMA0 root=$root
 mw.l 800000 0 10000
 scsi scan
-ext2load scsi 0 0x800000 \$kernel
-ext2load scsi 0 0x1000000 \$initrd
-bootz 0x800000 0x1000000:\\\${filesize} 0x1000
+ext2load scsi 0 \\\${kernel_addr_r} \$kernel
+ext2load scsi 0 \\\${ramdisk_addr_r} \$initrd
+bootz \\\${kernel_addr_r} \\\${ramdisk_addr_r}:\\\${filesize} 0x1000
 EOF
 
 in-target mkimage -A arm -T script -d /boot/boot /boot/boot.scr
diff --git a/README b/README
index 5106083562ada78d4e91d11205ff48776be6166a..06e2fcf00993673fd2caed93cd6e93d0967123ca 100644 (file)
--- a/README
+++ b/README
@@ -89,9 +89,18 @@ HostProp_<testbox>_Ether
    to use the osstest host and Xen installer.
 
 HostProp_<testbox>_LinuxSerialConsole
-   Set to the serial console device on the platform. Defaults to
-   ttyS0. If set to "NONE" then the system will use VGA console
-   instead.
+   Set to Linux's name for the serial console device on the
+   platform. Defaults to ttyS0. If set to "NONE" then the system will
+   use VGA console instead.
+
+HostProp_<testbox>_XenSerialConsole
+   Set to Xen's name for the serial console device on the
+   platform. Defaults to com1.
+
+HostProp_<testbox>_DTUARTPath
+   If XenSerialConsole is "dtuart" then this specifies the path in the
+   DTB to the device to use. Can also specify an alias defined in the
+   platforms DTB.
 
 HostProp_<testbox>_DIFrontend
    Configure the frontend used by Debian installer. Default in osstest
index 9204be4acf7a42d6ceef8f66936f2b056160977f..78684946e3cf5f4f03184f440be06a18904b9ac2 100755 (executable)
@@ -121,8 +121,19 @@ sub adjustconfig () {
 }
 
 sub setupboot () {
-    my $xenhopt= "com1=$c{Baud},8n1 console=com1,vga gdb=com1 conswitch=x".
-        " watchdog";
+    my $xenhopt= "conswitch=x watchdog";
+
+    my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
+
+    if ( $cons eq "com1" ) {
+       $xenhopt .= " com1=$c{Baud},8n1 console=com1,vga gdb=com1";
+    } elsif ( $cons eq "dtuart" ) {
+       $xenhopt .= " console=dtuart";
+       my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
+       $xenhopt .= " dtuart=$dtuart" if $dtuart;
+    } else {
+       mlog("No Xen console device defined for host");
+    }
     if (toolstack()->{Dom0MemFixed}) {
         $xenhopt .= " dom0_mem=512M,max:512M";
     }