Skip to contentSkip to conversation

Do armhf kernel builds on amd64

PATCH Superseded Ian Jackson 3 participants 21 messages Apr 26, 2019 – Apr 29, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Do armhf kernel builds on amd64

Cross building this will be much much faster and help with our severe armhf resource shortage. To achieve this it is necessary to clean up some technical debt, so that we can separately control host architecture, rather than just using the job's main $r{arch}.

Ian Jackson (15):
TestSupport: target_var: Refactor to allow for another host case
TestSupport: target_var: Use host_V for host variables arch replumbing: ts-host-install: Move $kern_arch_info setting arch replumbing: Provide $ho->{Arch} and $gho->{Arch} arch replumbing: ts-debian-di-install: Remove unidiomatic { } arch replumbing: ts-memdisk-try-append: Remove unidiomatic " " arch replumbing: Replace many $r{arch} with $[g]ho->{Arch} arch replumbing: make-flight: Fix $r{arch} comment arch replumbing: ts-debian-di-install: Use $gho->{Arch}
ts-kernel-build: Introduce cmd()
cross builds: ts-kernel-build: Support cross target armhf cross builds: mfi-common: Break out set_build_hostflags cross builds: mfi-common: Prepare for kernel cross building cross builds: Build armhf kernels on amd64 hosts
ts-kernel-build: Move main program to bottom of script

 Osstest/Debian.pm      | 14 +++++------
 Osstest/TestSupport.pm | 26 +++++++++++++-------
 make-flight            |  4 ++--
 mfi-common             | 39 ++++++++++++++++++++++++++----
 ts-debian-di-install   |  6 ++---
 ts-debian-install      |  2 +-
 ts-freebsd-build       |  2 +-
 ts-host-install        | 24 ++++++++++++-------
 ts-kernel-build        | 64 +++++++++++++++++++++++++++++++++-----------------
 ts-memdisk-try-append  |  2 +-
 ts-xen-build-prep      |  4 ++--
 ts-xen-install         |  8 +++----
 12 files changed, 132 insertions(+), 63 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/15 TestSupport: target_var: Refactor to allow for another host case

Make an explicit list of the prefixes and a loop to walk over them. No functional change.

---
 Osstest/TestSupport.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
Osstest/TestSupport.pm +12 -4
index ec867e4f..fcbde0a2 100644
@@ -2471,10 +2471,18 @@ sub target_var_prefix ($) {
 
 sub target_var ($$) {
     my ($ho,$vn) = @_;
-    my $pfx = target_var_prefix($ho);
-    my $allthing = exists $ho->{Guest} ? "guest" : "host";
-    return $r{ $pfx. $vn } //
-           $r{ "all_${allthing}_${vn}" };
+    my @prefixes;
+    push @prefixes, target_var_prefix($ho);
+    if (exists $ho->{Guest}) {
+	push @prefixes, 'all_guest_';
+    } else {
+	push @prefixes, 'all_host_';
+    }
+    foreach my $prefix (@prefixes) {
+	my $v = $r{ $prefix.$vn };
+	return $v if defined $v;
+    }
+    return undef;
 }
 
 sub target_kernkind_check ($) {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH 2/15 TestSupport: target_var: Use host_V for host variables

In reply to Ian Jackson

Change target_var' to set IDENT_V' rather than just V. For compatibility with older flights and older flight construction, look for plain V too when looking up the variable.

And, we now look at all_host_V before V. This has no functional change with existing flights, because existing flights only have
all_host_suite
all_host_di_version
all_host_os
and we never set the corresponding V form of those variables.

So with existing flights the only functional change is a change to synth runvars, to add HOST_ to the name.

---
 Osstest/TestSupport.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Osstest/TestSupport.pm +2 -2
index fcbde0a2..6ab64d56 100644
@@ -2465,8 +2465,7 @@ sub guest_await ($$) {
 
 sub target_var_prefix ($) {
     my ($ho) = @_;
-    if (exists $ho->{Guest}) { return $ho->{Guest}.'_'; }
-    return '';
+    return (exists $ho->{Guest} ? $ho->{Guest} : $ho->{Ident}).'_';
 }
 
 sub target_var ($$) {
@@ -2477,6 +2476,7 @@ sub target_var ($$) {
 	push @prefixes, 'all_guest_';
     } else {
 	push @prefixes, 'all_host_';
+	push @prefixes, '';
     }
     foreach my $prefix (@prefixes) {
 	my $v = $r{ $prefix.$vn };
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

PATCH 3/15 arch replumbing: ts-host-install: Move $kern_arch_info setting

In reply to Ian Jackson

We are going to want to do this after selecthost.

No functional change.

---
 ts-host-install | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
ts-host-install +13 -7
index 45f04764..3c14f171 100755
@@ -31,7 +31,7 @@ my $debconf_priority;
 my $poweron_test_only;
 
 our %xopts;
-our $kern_arch_info;
+our $build;
 
 while (@ARGV and $ARGV[0] =~ m/^-/) {
     $_= shift @ARGV;
@@ -43,12 +43,7 @@ while (@ARGV and $ARGV[0] =~ m/^-/) {
     } elsif  (m/^--rescue$/) {
 	$xopts{RescueMode}= 1;
     } elsif  (m/^--build$/) {
-	if ($r{arch} eq 'i386') {
-	    $kern_arch_info = {
-                Kernel_Debian => 'amd64',
-                Userland_setarch => 'i386',
-            };
-	}
+	$build = 1;
     } else {
 	die "$_ $!";
     }
@@ -63,6 +58,17 @@ exit 0 if $ho->{SharedReady};
 our %timeout= qw(ReadPreseed  350
                  Sshd        2400);
 
+our $kern_arch_info;
+
+if ($build) {
+    if ($r{arch} eq 'i386') {
+	$kern_arch_info = {
+	    Kernel_Debian => 'amd64',
+	    Userland_setarch => 'i386',
+	};
+    }
+}
+
 sub install () {
     my ($ps_url,$ps_file)= preseed_create
         ($ho, '',
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw

PATCH 4/15 arch replumbing: Provide $ho->{Arch} and $gho->{Arch}

In reply to Ian Jackson

With existing flights these are $r{arch} and GUEST_arch. Nothing uses these yet.

---
 Osstest/TestSupport.pm | 2 ++
 1 file changed, 2 insertions(+)
Osstest/TestSupport.pm +2 -0
index 6ab64d56..16c17e37 100644
@@ -1164,6 +1164,7 @@ sub selecthost ($) {
         NestingLevel => 0,
         Info => [],
     };
+    $ho->{Arch} = target_var($ho, 'arch') or warn "unknown arch for $ident";
     if (defined $job) {
 	$ho->{Suite} = target_var($ho, "suite") // $c{DebianSuite};
 	$ho->{DiVersion} = target_var($ho, "di_version")
@@ -1795,6 +1796,7 @@ sub selectguest ($$) {
 	Host => $ho,
 	Suite => $r{"${gn}_suite"},
     };
+    $ho->{Arch} = target_var($ho, 'arch') or warn "unknown arch for $gn";
     foreach my $opt (guest_var_commalist($gho,'options')) {
         $gho->{Options}{$opt}++;
     }
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

PATCH 5/15 arch replumbing: ts-debian-di-install: Remove unidiomatic { }

In reply to Ian Jackson

No functional change.

---
 ts-debian-di-install | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ts-debian-di-install +2 -2
index 361a1710..5cb3d35d 100755
@@ -152,10 +152,10 @@ sub setup_netboot($$$)
 	die if $r{ "$gho->{Guest}_netboot_kernel" }
 	||     $r{ "$gho->{Guest}_netboot_ramdisk" };
 
-	my $di_path = $c{TftpPath}.'/'.$gho->{Tftp}{DiBase}.'/'.${arch}.'/'.
+	my $di_path = $c{TftpPath}.'/'.$gho->{Tftp}{DiBase}.'/'.$arch.'/'.
 	    debian_guest_di_version($gho).'-'.$gho->{Suite};
 
-        if (${arch} =~ m/amd64|i386/) {
+        if ($arch =~ m/amd64|i386/) {
 	    $kernel = "$di_path/vmlinuz-xen";
 	    $ramdisk = "$di_path/initrd.gz-xen";
         } else {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

PATCH 6/15 arch replumbing: ts-memdisk-try-append: Remove unidiomatic " "

In reply to Ian Jackson

No functional change.

---
 ts-memdisk-try-append | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ts-memdisk-try-append +1 -1
index 67c250bd..f6ec2fd5 100755
@@ -23,7 +23,7 @@ arch=`perl -e '
                 use Osstest::TestSupport;
 
                 tsreadconfig();
-                print $r{"arch"} or die $!;
+                print $r{arch} or die $!;
               '`
 
 case "$arch" in
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw

PATCH 7/15 arch replumbing: Replace many $r{arch} with $[g]ho->{Arch}

In reply to Ian Jackson

No functional change with existing flights. But the effect is that now, generally, ts-* scripts and the support code will honour host_arch, if it is set, in preference to arch.

This patch contains only replacements of $r{arch} with $ho->{Arch} or $gho->{Arch}. In fact, perhaps surprisingly, there were no locations where $gho was wanted rather than $ho (I have double checked this).

Exceptions, where we left $r{arch} alone, are:

* make-flight: a comment, which we are about to deal with;

* ts-kernel-build: we are going to support cross building and $r{arch} is going to be the architecture of the kernel we want rather than of the build host.

---
 Osstest/Debian.pm      | 14 +++++++-------
 Osstest/TestSupport.pm |  4 ++--
 ts-freebsd-build       |  2 +-
 ts-host-install        |  6 +++---
 ts-memdisk-try-append  |  2 +-
 ts-xen-build-prep      |  4 ++--
 ts-xen-install         |  8 ++++----
 7 files changed, 20 insertions(+), 20 deletions(-)
Osstest/Debian.pm +7 -7
index 8abd6aed..911d8905 100644
@@ -444,7 +444,7 @@ sub setupboot_grub2 ($$$$) {
     # Grub2 on jessie/stretch ARM* doesn't do multiboot, so we must chainload.
     my $need_uefi_chainload =
         get_host_property($ho, "firmware", "") eq "uefi" &&
-        $ho->{Suite} =~ m/jessie|stretch/ && $r{arch} =~ m/^arm/;
+        $ho->{Suite} =~ m/jessie|stretch/ && $ho->{Arch} =~ m/^arm/;
 
     my $parsemenu= sub {
         my $f= bl_getmenu_open($ho, $rmenu, "$stash/$ho->{Name}--grub.cfg.1");
@@ -749,7 +749,7 @@ END
 sub preseed_microcode($$)
 {
     my ($ho,$sfx) = @_;
-    my $prop = "MicrocodeUpdate".ucfirst($r{arch});
+    my $prop = "MicrocodeUpdate".ucfirst($ho->{Arch});
     return unless $c{$prop};
     logm("ucode=$prop $c{$prop}");
     my $ucode = get_filecontents("$c{Images}/$c{$prop}");
@@ -1134,7 +1134,7 @@ sub di_installer_path ($) {
     # useable for constructing host paths as well as guest paths
     my ($ho) = @_;
 
-    return $ho->{Tftp}{DiBase}.'/'.$r{arch}.'/'.
+    return $ho->{Tftp}{DiBase}.'/'.$ho->{Arch}.'/'.
 	($ho->{DiVersion} // cfg_tftp_di_version($ho->{Suite}))
 	.'-'.$ho->{Suite};
 }
@@ -1340,8 +1340,8 @@ END
     #    Userland_setarch  personality to restore using setarch
     my $kern_arch = $kern_arch_info->{Kernel_Debian};
     if ($kern_arch &&
-	$ho->{Flags}{"arch-$r{arch}"} && !$ho->{Flags}{"arch-$kern_arch"}) {
-	# We check the flag for $r{arch} because for various reasons
+	$ho->{Flags}{"arch-$ho->{Arch}"} && !$ho->{Flags}{"arch-$kern_arch"}) {
+	# We check the flag for $ho->{Arch} because for various reasons
 	# it may not be set.  For example, in standalone mode it is
 	# currently not normally necessary to set any arch hostflags.
 	# In that situation we bet that the kern arch can be used;
@@ -1356,7 +1356,7 @@ END
     }
     if ($kern_arch) {
 	my $setarch = "setarch $kern_arch_info->{Userland_setarch}";
-	logm("Using $kern_arch kernel for $r{arch} userland ($setarch)");
+	logm("Using $kern_arch kernel for $ho->{Arch} userland ($setarch)");
 	preseed_hook_command($ho, 'late_command', $sfx, <<END);
 #!/bin/sh
 set -ex
@@ -1366,7 +1366,7 @@ exec $setarch /usr/sbin/sshd.distrib "\$@"
 ENDW
 chmod a+x /target/usr/sbin/sshd.osstest-wrap
 in-target sh -xec '
-    # the $r{arch} kernels end up being the default so shuffle them
+    # the $ho->{Arch} kernels end up being the default so shuffle them
     # where update-grub will not find them
     for f in /boot/vmlinu*; do
         dpkg-divert --rename --divert "/boot/~disable~\${f##*/}" "\$f"
Osstest/TestSupport.pm +2 -2
index 16c17e37..18617d98 100644
@@ -2904,8 +2904,8 @@ sub setup_netboot_local_uefi ($) {
     # i386 is X64 because when we are trying to install i386
     # on a UEFI box, it's actually an amd64-capable UEFI box
     # which expects a 64-bit EFI loader
-    die "EFI arch" unless $efi_archs{ $r{arch} };
-    my $efi = $efi_archs{ $r{arch} };
+    die "EFI arch" unless $efi_archs{ $ho->{Arch} };
+    my $efi = $efi_archs{ $ho->{Arch} };
     setup_netboot_bootcfg($ho, <<END);
 set default=0
 set timeout=5
ts-freebsd-build +1 -1
index bdf666eb..3cdf15cb 100755
@@ -83,7 +83,7 @@ sub build () {
     my $target = "bootonly";
     my $prefix = <<END;
 export MAKEOBJDIRPREFIX=$builddir/obj
-export TARGET=$r{arch}
+export TARGET=$ho->{Arch}
 END
 
     # Build process as documented in the handbook:
ts-host-install +3 -3
index 3c14f171..4bfa2f5e 100755
@@ -61,7 +61,7 @@ our %timeout= qw(ReadPreseed  350
 our $kern_arch_info;
 
 if ($build) {
-    if ($r{arch} eq 'i386') {
+    if ($ho->{Arch} eq 'i386') {
 	$kern_arch_info = {
 	    Kernel_Debian => 'amd64',
 	    Userland_setarch => 'i386',
@@ -262,7 +262,7 @@ END
     push @dicmdline, "domain=$c{TestHostDomain}";
     push @dicmdline,
         get_host_property($ho, "install-append $ho->{Suite}", ''),
-        get_host_property($ho, "install-append $ho->{Suite} $r{arch}", '');
+        get_host_property($ho, "install-append $ho->{Suite} $ho->{Arch}", '');
 
     my $console = get_host_native_linux_console($ho);
 
@@ -280,7 +280,7 @@ END
 
     push @hocmdline,
         get_host_property($ho, "linux-boot-append $ho->{Suite}", ''),
-        get_host_property($ho, "linux-boot-append $ho->{Suite} $r{arch}", '');
+        get_host_property($ho, "linux-boot-append $ho->{Suite} $ho->{Arch}", '');
 
     $xopts{ipappend} = $ipappend;
     setup_netboot_di($ho, $kernel, "/$initrd", \@dicmdline, \@hocmdline,
ts-memdisk-try-append +1 -1
index f6ec2fd5..ce39d5a7 100755
@@ -23,7 +23,7 @@ arch=`perl -e '
                 use Osstest::TestSupport;
 
                 tsreadconfig();
-                print $r{arch} or die $!;
+                print $ho->{Arch} or die $!;
               '`
 
 case "$arch" in
ts-xen-build-prep +2 -2
index c38ab36d..0f07648e 100755
@@ -246,7 +246,7 @@ END
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
         target_install_packages($ho, 'libfdt-dev');
     }
-    if ($r{arch} eq 'amd64' && $ho->{Suite} !~ m/squeeze|lenny/) {
+    if ($ho->{Arch} eq 'amd64' && $ho->{Suite} !~ m/squeeze|lenny/) {
         target_install_packages($ho, 'libc6-dev-i386');
     }
 }
@@ -269,4 +269,4 @@ if (!$ho->{Flags}{'no-reinstall'}) {
     gitcache_setup($ho);
 }
 
-host_shared_mark_ready($ho, "build-".$ho->{Suite}."-".$r{arch});
+host_shared_mark_ready($ho, "build-".$ho->{Suite}."-".$ho->{Arch});
ts-xen-install +4 -4
index 9f78a75f..2d3c644d 100755
@@ -64,7 +64,7 @@ sub packages () {
     if ($ho->{Suite} !~ m/lenny|squeeze/) {
         target_install_packages($ho, qw(libfdt1));
     }
-    if ($r{arch} eq 'i386') {
+    if ($ho->{Arch} eq 'i386') {
 	target_install_packages($ho, qw(libc6-xen));
     }
     target_install_packages($ho, @{toolstack($ho)->{ExtraPackages}})
@@ -92,7 +92,7 @@ sub some_extradebs ($) {
 	    target_install_packages($ho, qw(rsync)) unless $rsync_installed++;
 	    target_putfile_root($ho,300, "$path/.", $ontarget, '-r');
 	} elsif ($path =~ m{\.deb$}) {
-	    $path =~ s{_\.deb}{ "_$r{arch}.deb" }e;
+	    $path =~ s{_\.deb}{ "_$ho->{Arch}.deb" }e;
 	    logm("$cfgvar: installing $path");
 	    $ontarget = basename($path);
 	    $dpkgopts = '-iB';
@@ -115,7 +115,7 @@ sub extradebs () {
 
     # $c{ DebianExtraPackages_<firmware>_<arch>_<suite> }
     my $firmware = get_host_property($ho, "firmware", "bios");
-    some_extradebs([ 'DebianExtraPackages', $firmware, $r{arch}, $suite ]);
+    some_extradebs([ 'DebianExtraPackages', $firmware, $ho->{Arch}, $suite ]);
 }
 
 sub extract () {
@@ -193,7 +193,7 @@ sub setupboot () {
     my $xenhopt= "conswitch=x watchdog noreboot async-show-all";
 
     my $cons= get_host_property($ho, 'XenSerialConsole',
-				$r{arch} =~ m/^arm/ ? 'dtuart'
+				$ho->{Arch} =~ m/^arm/ ? 'dtuart'
 				: 'com1');
 
     if ( $cons eq "com1" ) {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

PATCH 8/15 arch replumbing: make-flight: Fix $r{arch} comment

In reply to Ian Jackson

This comment was lamenting the very problem we are fixing now. It would now be possible to test i386->amd64 tools migration, by writing an appropriate test job with different src_host_arch and dst_host_arch etc.

---
 make-flight | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
make-flight +2 -2
index c5411412..020ad5f1 100755
@@ -833,8 +833,8 @@ test_matrix_do_one () {
                       all_hostflags="$hf"
       fi
       # TODO it would be nice to test i386->amd64 tools migration too (for
-      # Xen >= 4.6), but currently $r{arch} is used in several places,
-      # which would need looking at.
+      # Xen >= 4.6).  Previously $r{arch} was used in several places,
+      # which made this more complicated, but this is now fixed.
   fi
 
   if [ x$test_pvh = xy -a $xenarch = amd64 -a $dom0arch = amd64 ]; then
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw

PATCH 9/15 arch replumbing: ts-debian-di-install: Use $gho->{Arch}

In reply to Ian Jackson

This is just tidying up. The only effect is that now these would honour $r{all_guest_arch} as a fallback. But right now, $r{GUEST_arch} will always be set, and that is what ends up in $gho->{Arch}.

---
 ts-debian-di-install | 2 +-
 ts-debian-install    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ts-debian-di-install +1 -1
index 5cb3d35d..9abb4956 100755
@@ -174,7 +174,7 @@ END
 }
 
 sub ginstall () {
-    my $arch= $r{"$gho->{Guest}_arch"};
+    my $arch= $gho->{Arch};
     my $method= $r{"$gho->{Guest}_method"};
 
     my $tmpdir= "/root/$flight-$job-di";
ts-debian-install +1 -1
index 5bbaead0..f07dd676 100755
@@ -47,7 +47,7 @@ sub prep () {
 }
 
 sub ginstall () {
-    my $arch= $r{"$gho->{Guest}_arch"};
+    my $arch= $gho->{Arch};
     my $archarg= defined($arch) ? "--arch $arch" : '';
     my $gsuite= debian_guest_suite($gho);
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw

PATCH 10/15 ts-kernel-build: Introduce cmd()

In reply to Ian Jackson

Right now this is a simple wrapper around target_cmd_build.

No functional change.

---
 ts-kernel-build | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
ts-kernel-build +13 -8
index 3dad7d36..72ca98a1 100755
@@ -48,6 +48,11 @@ my $parms = $archparms->{ $r{arch} };
 
 sub enable_xen_config ();
 
+sub cmd ($$) {
+    my ($timeout, $script) = @_;
+    target_cmd_build($ho, $timeout, $builddir, $script);
+}
+
 sub checkout () {
     return if $reuse;
 
@@ -58,7 +63,7 @@ sub checkout () {
     if (length($r{tree_pq_linux})) {
         build_clone($ho, 'pq_linux', $builddir, 'linux/.hg/patches');
         
-        target_cmd_build($ho, 1000, $builddir, <<END);
+        cmd(1000, <<END);
             cd $builddir/linux
             hg qpush -a
 END
@@ -346,7 +351,7 @@ END
 
     my $defconfig = $parms->{DefConfig} ?
 	$parms->{DefConfig}."_defconfig" : "defconfig";
-    target_cmd_build($ho, 1000, $builddir, <<END);
+    cmd(1000, <<END);
         ed <$edscript enable-xen-config
         chmod +x enable-xen-config
         cd linux
@@ -364,7 +369,7 @@ sub config_create_config_sh () {
 
     my $xta = $r{arch} eq "amd64" ? "x86_64" : "x86_32";
 
-    target_cmd_build($ho, 1000, $builddir, <<END);
+    cmd(1000, <<END);
         cd linux
 	sh buildconfigs/create_config.sh .config "-xen" $xta
 	if [ x$xta = xx86_32 ] ; then
@@ -382,7 +387,7 @@ sub config () {
 }
 
 sub build () {
-    target_cmd_build($ho, 9000, $builddir, <<END);
+    cmd(9000, <<END);
 	cd linux
         (make $makeflags all modules 2>&1 && touch ../build-ok-stamp) |tee ../log
         test -f ../build-ok-stamp
@@ -400,7 +405,7 @@ sub kinstall () {
     my $dtbs_install = '';
     $dtbs_install = 'dtbs_install' if $parms->{Dtbs};
 
-    target_cmd_build($ho, 300, $builddir, <<END);
+    cmd(300, <<END);
 	rm -rf dist
 	mkdir -p dist/boot dist/lib/modules
 	cd linux
@@ -421,7 +426,7 @@ END
 
     store_runvar('kernel_ver',$kernver);
 
-    target_cmd_build($ho, 100, $builddir, <<END);
+    cmd(100, <<END);
 	cd dist/boot
 	for f in vmlinuz System.map config; do
 		mv \$f \$f-$kernver
@@ -430,7 +435,7 @@ END
 }
 
 sub fwbuild () {
-    target_cmd_build($ho, 500, $builddir, <<END);
+    cmd(500, <<END);
 	cd linux-firmware
 	make SHELL=/bin/bash all
         echo ok.
@@ -438,7 +443,7 @@ END
 }
 
 sub fwinstall () {
-    target_cmd_build($ho, 500, $builddir, <<END);
+    cmd(500, <<END);
 	cd linux-firmware
 	make SHELL=/bin/bash DESTDIR=$builddir/dist install
 	echo ok.
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw

PATCH 11/15 cross builds: ts-kernel-build: Support cross target armhf

In reply to Ian Jackson
CC Julien Grall <[email protected]>
CC Stefano Stabellini <[email protected]>
---
 ts-kernel-build | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
ts-kernel-build +18 -1
index 72ca98a1..29c6c43d 100755
@@ -21,6 +21,7 @@ BEGIN { unshift @INC, qw(.); }
 use Osstest;
 use Osstest::TestSupport;
 use Osstest::BuildSupport;
+use Carp;
 
 tsreadconfig();
 
@@ -48,9 +49,24 @@ my $parms = $archparms->{ $r{arch} };
 
 sub enable_xen_config ();
 
+our $arch_envvars = '';
+
 sub cmd ($$) {
     my ($timeout, $script) = @_;
-    target_cmd_build($ho, $timeout, $builddir, $script);
+    target_cmd_build($ho, $timeout, $builddir, $arch_envvars.$script);
+}
+
+sub checkarch () {
+    return if $r{arch} eq $ho->{Arch};
+    my $cc = 'gcc';
+    if ($r{arch} eq 'armhf') {
+	target_install_packages($ho, "crossbuild-essential-$r{arch}");
+	$arch_envvars = <<END;
+    export ARCH=arm HOSTCC=$cc CROSS_COMPILE=arm-linux-gnueabihf-
+END
+    } else {
+	confess "unknown cross target (gnu 'host') $r{arch}";
+    }
 }
 
 sub checkout () {
@@ -450,6 +466,7 @@ sub fwinstall () {
 END
 }
 
+checkarch();
 checkout();
 config();
 build();
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw

Re: [OSSTEST PATCH 11/15] cross builds: ts-kernel-build: Support cross target armhf

Hi Ian,

Thank you for looking into this.

Quoted 28 lines · Ian Jackson
CC Julien Grall <[email protected]>
CC Stefano Stabellini <[email protected]>
---
  ts-kernel-build | 19 ++++++++++++++++++-
  1 file changed, 18 insertions(+), 1 deletion(-)
ts-kernel-build +3 -1
index 72ca98a1..29c6c43d 100755
@@ -21,6 +21,7 @@ BEGIN { unshift @INC, qw(.); }
  use Osstest;
  use Osstest::TestSupport;
  use Osstest::BuildSupport;
+use Carp;
 
  tsreadconfig();
 
@@ -48,9 +49,24 @@ my $parms = $archparms->{ $r{arch} };
 
  sub enable_xen_config ();
 
+our $arch_envvars = '';
+
  sub cmd ($$) {
      my ($timeout, $script) = @_;
-    target_cmd_build($ho, $timeout, $builddir, $script);

ts-kernel-build my $parms = $archparms->{ $r{arch} }; · line 65

Quoted 10 lines
ts-kernel-build +10 -0
+    target_cmd_build($ho, $timeout, $builddir, $arch_envvars.$script);
+}
+
+sub checkarch () {
+    return if $r{arch} eq $ho->{Arch};
+    my $cc = 'gcc';
+    if ($r{arch} eq 'armhf') {
+	target_install_packages($ho, "crossbuild-essential-$r{arch}");
+	$arch_envvars = <<END;
+    export ARCH=arm HOSTCC=$cc CROSS_COMPILE=arm-linux-gnueabihf-

NIT: HOSTCC is not necessary. It will be default to gcc if not passed.

Otherwise, the export looks write to me.

Quoted 9 lines
ts-kernel-build +4 -0
+END
+    } else {
+	confess "unknown cross target (gnu 'host') $r{arch}";
+    }
  }
 
  sub checkout () {

ts-kernel-build sub fwinstall () { · line 472

Quoted 7 lines
ts-kernel-build +1 -0
@@ -450,6 +466,7 @@ sub fwinstall () {
  END
  }
 
+checkarch();
  checkout();
  config();
  build();

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by
#13 lore raw

Re: [OSSTEST PATCH 11/15] cross builds: ts-kernel-build: Support cross target armhf

Quoted 42 lines · Julien Grall

Hi Ian,

Thank you for looking into this.

Quoted 24 lines · Ian Jackson
CC Julien Grall <[email protected]>
CC Stefano Stabellini <[email protected]>

---
  ts-kernel-build | 19 ++++++++++++++++++-

  1 file changed, 18 insertions(+), 1 deletion(-)
ts-kernel-build +3 -1
index 72ca98a1..29c6c43d 100755
@@ -21,6 +21,7 @@ BEGIN { unshift @INC, qw(.); }
   use Osstest;
   use Osstest::TestSupport;
   use Osstest::BuildSupport;
+use Carp;
   tsreadconfig();
@@ -48,9 +49,24 @@ my $parms = $archparms->{ $r{arch} };
   sub enable_xen_config ();
+our $arch_envvars = '';
+
   sub cmd ($$) {
       my ($timeout, $script) = @_;
-    target_cmd_build($ho, $timeout, $builddir, $script);

ts-kernel-build my $parms = $archparms->{ $r{arch} }; · line 63

Quoted 10 lines
ts-kernel-build +10 -0
+    target_cmd_build($ho, $timeout, $builddir, $arch_envvars.$script);
+}
+
+sub checkarch () {
+    return if $r{arch} eq $ho->{Arch};
+    my $cc = 'gcc';
+    if ($r{arch} eq 'armhf') {
+    target_install_packages($ho, "crossbuild-essential-$r{arch}");
+    $arch_envvars = <<END;
+    export ARCH=arm HOSTCC=$cc CROSS_COMPILE=arm-linux-gnueabihf-

NIT: HOSTCC is not necessary. It will be default to gcc if not passed.

Quoted 1 line

Otherwise, the export looks write to me.

I forgot to mention that you can add my ack one in any case:

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#14 lore raw

Re: [OSSTEST PATCH 11/15] cross builds: ts-kernel-build: Support cross target armhf

Julien Grall writes ("Re: [OSSTEST PATCH 11/15] cross builds: ts-kernel-build: Support cross target armhf"):

Quoted 2 lines · Julien Grall
Quoted 1 line

NIT: HOSTCC is not necessary. It will be default to gcc if not passed.

I will drop it.

Quoted 1 line
Quoted 1 line

Otherwise, the export looks write to me.

Thanks for the review.

Quoted 3 lines

I forgot to mention that you can add my ack one in any case:

:-).

Regards,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw

PATCH 12/15 cross builds: mfi-common: Break out set_build_hostflags

In reply to Ian Jackson

No functional change.

Verified with standalone-generate-dump-flight-runvars.

---
 mfi-common | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
mfi-common +6 -1
index f91156fe..dad03e39 100644
@@ -216,6 +216,11 @@ create_xen_build_job () {
     $extra_runvars
 }
 
+set_build_hostflags () {
+  # set_build_hostflags HOST_ARCH
+  build_hostflags="share-build-$suite-$1,arch-$1,suite-$suite,purpose-build"
+}
+
 create_build_jobs () {
 
   local arch
@@ -342,7 +347,7 @@ create_build_jobs () {
         arch_runvars=\"\$ARCH_RUNVARS_$arch\"
     "
 
-    build_hostflags=share-build-$suite-$arch,arch-$arch,suite-$suite,purpose-build
+    set_build_hostflags $arch
 
     for enable_xsm in $(xsm_variants $arch) ; do
       if [ x$enable_xsm = xtrue ] ; then
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#16 lore raw

PATCH 13/15 cross builds: mfi-common: Prepare for kernel cross building

In reply to Ian Jackson

Introduce job_create_build_crossable, which takes a target->host architecture map in its arguments, and use it for build-kern, passing an empty architecture map.

Overall functional change is only to add
host_arch=$arch
to the kernel build jobs, which has no ultimate effect because it's the same as the arch=$arch. (Difference in flight construction verified with standalone-generate-dump-flight-runvars.)

---
 mfi-common | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)
mfi-common +29 -3
index dad03e39..7b5c894f 100644
@@ -216,6 +216,32 @@ create_xen_build_job () {
     $extra_runvars
 }
 
+job_create_build_crossable () {
+  # job_create_build_crossable \
+  #     JOBNAME RECIPE ARCH \
+  #     [TARGARCH1 HOSTARCH1 [TARGARCH2 HOSTARCH2 ...]]] - \
+  #     [RUNVAR1 [RUNVAR2 ...]]
+  local name=$1; shift
+  local recipe=$1; shift
+  local arch=$1; shift
+  local match_arch=$arch
+  local host_arch=$arch
+  while true; do
+    local t_targarch=$1; shift;  if [ x$t_targarch = x- ]; then break; fi
+    local t_hostarch=$1; shift
+    if [ x$match_arch = x$t_targarch ]; then
+        host_arch=$t_hostarch
+        match_arch=X # prevents us mapping again, which would be a bit mad
+    fi
+  done
+  local build_hostflags
+  set_build_hostflags $host_arch
+  job_create_build $name $recipe                        \
+                   arch=$arch host_arch=$host_arch      \
+                   host_hostflags=$build_hostflags      \
+                   "$@"
+}
+
 set_build_hostflags () {
   # set_build_hostflags HOST_ARCH
   build_hostflags="share-build-$suite-$1,arch-$1,suite-$suite,purpose-build"
@@ -397,11 +423,11 @@ create_build_jobs () {
                 revision_qemuu=$REVISION_QEMU_UPSTREAM
     fi
 
-    job_create_build build-$arch-pvops build-kern                            \
-                arch=$arch kconfighow=xen-enable-xen-config                  \
+    job_create_build_crossable build-$arch-pvops build-kern $arch            \
+                -                                                            \
+                kconfighow=xen-enable-xen-config                             \
                 $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS $arch_runvars   \
                 $hostos_runvars                                              \
-                host_hostflags=$build_hostflags                              \
                 $pvops_kernel $pvops_kconfig_overrides                       \
                 ${TREEVCS_LINUX:+treevcs_linux=}${TREEVCS_LINUX}             \
                 tree_linuxfirmware=$TREE_LINUXFIRMWARE                       \
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#17 lore raw

PATCH 14/15 cross builds: Build armhf kernels on amd64 hosts

In reply to Ian Jackson

Our armhf hosts are devboards and very slow, as well as scarce. It 5takes 17ks or so for a kernel build. This will go *much* faster on an amd64 box and we have lots of those too.

standalone-generate-dump-flight-runvars shows that the only change is to change host_arch from armhf to amd64 in build-armhf-pvops jobs.

CC Julien Grall <[email protected]>
CC Stefano Stabellini <[email protected]>
---
 mfi-common | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mfi-common +1 -1
index 7b5c894f..30f2692d 100644
@@ -424,7 +424,7 @@ create_build_jobs () {
     fi
 
     job_create_build_crossable build-$arch-pvops build-kern $arch            \
-                -                                                            \
+                armhf amd64 -                                                \
                 kconfighow=xen-enable-xen-config                             \
                 $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS $arch_runvars   \
                 $hostos_runvars                                              \
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 14/15
#18 lore raw

Re: [OSSTEST PATCH 14/15] cross builds: Build armhf kernels on amd64 hosts

Hi Ian,

Quoted 2 lines · Ian Jackson

Our armhf hosts are devboards and very slow, as well as scarce. It 5takes 17ks or so for a kernel build. This will go *much* faster on

NIT: s/5takes/takes/

Quoted 8 lines

an amd64 box and we have lots of those too.

standalone-generate-dump-flight-runvars shows that the only change is to change host_arch from armhf to amd64 in build-armhf-pvops jobs.

CC Julien Grall <[email protected]>
CC Stefano Stabellini <[email protected]>

FWIW:

Quoted 10 lines
---
  mfi-common | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
mfi-common +0 -0
index 7b5c894f..30f2692d 100644

mfi-common create_build_jobs () { · line 430

Quoted 8 lines
mfi-common +1 -1
@@ -424,7 +424,7 @@ create_build_jobs () {
      fi
 
      job_create_build_crossable build-$arch-pvops build-kern $arch            \
-                -                                                            \
+                armhf amd64 -                                                \
                  kconfighow=xen-enable-xen-config                             \
                  $RUNVARS $BUILD_RUNVARS $BUILD_LINUX_RUNVARS $arch_runvars   \
                  $hostos_runvars                                              \

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#19 lore raw

Re: [OSSTEST PATCH 14/15] cross builds: Build armhf kernels on amd64 hosts

Julien Grall writes ("Re: [OSSTEST PATCH 14/15] cross builds: Build armhf kernels on amd64 hosts"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

Our armhf hosts are devboards and very slow, as well as scarce. It 5takes 17ks or so for a kernel build. This will go *much* faster on

NIT: s/5takes/takes/

Thanks, fixed.

Quoted 2 lines

FWIW:

Thanks.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#20 lore raw

PATCH 15/15 ts-kernel-build: Move main program to bottom of script

In reply to Ian Jackson

Having it in the middle makes it quite hard to find !

No functional change.

---
 ts-kernel-build | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
ts-kernel-build +14 -14
index 29c6c43d..b9ba9ef5 100755
@@ -466,20 +466,6 @@ sub fwinstall () {
 END
 }
 
-checkarch();
-checkout();
-config();
-build();
-kinstall();
-if ($r{tree_linuxfirmware}) {
-    fwbuild();
-    fwinstall();
-}
-built_stash($ho, $builddir, 'dist', 'kerndist');
-built_stash_debugfile($ho, $builddir, 'vmlinux', 'linux/vmlinux');
-built_compress_stashed('vmlinux');
-built_stash_debugfile($ho, $builddir, 'config', 'linux/.config');
-
 sub enable_xen_config () {
     return <<'END';
 #!/bin/sh
@@ -633,3 +619,17 @@ setopt CONFIG_TEGRA_HOST1X n
 exit 0
 END
 }
+
+checkarch();
+checkout();
+config();
+build();
+kinstall();
+if ($r{tree_linuxfirmware}) {
+    fwbuild();
+    fwinstall();
+}
+built_stash($ho, $builddir, 'dist', 'kerndist');
+built_stash_debugfile($ho, $builddir, 'vmlinux', 'linux/vmlinux');
+built_compress_stashed('vmlinux');
+built_stash_debugfile($ho, $builddir, 'config', 'linux/.config');
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel