[PATCH master 06/14] test: emulate.pl: fix firmware use with non-tuxmake out-of-tree build

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 11 00:14:28 PDT 2023


The YAMLs may contain URLs for firmware that needs to be fetched before
starting Qemu. This firmware needs to be installed where Qemu will find
it, which is _not_ the source directory for out-of-tree builds. This
adjust the path.

Fixes: 7271ce78d0fc ("test: add emulate.pl, a runner for barebox on emulated targets")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 test/emulate.pl | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/test/emulate.pl b/test/emulate.pl
index b5e2188b86dd..a4ca6b7aee6e 100755
--- a/test/emulate.pl
+++ b/test/emulate.pl
@@ -18,6 +18,17 @@ my @QEMU_INTERACTIVE_OPTS = qw(-serial mon:stdio -trace file=/dev/null);
 
 my %targets;
 
+my $LG_BUILDDIR;
+
+if (exists $ENV{KBUILD_OUTPUT}) {
+    $LG_BUILDDIR = $ENV{KBUILD_OUTPUT};
+} elsif (-d 'build') {
+    $LG_BUILDDIR = 'build';
+} else {
+    $LG_BUILDDIR = getcwd();
+}
+
+
 for my $arch (glob dirname(__FILE__) . "/*/") {
     for my $cfg (glob "$arch/*.yaml") {
 	my $linkdest = readlink $cfg // '';
@@ -152,7 +163,7 @@ sub process {
 		    or die "Failed to download resource `$v': $?\n";
 	    }
 
-	    symlink_force("$dir/$k", "$k") unless $tuxmake;
+	    symlink_force("$dir/$k", "$LG_BUILDDIR/$k") unless $tuxmake;
 	}
 
 	if ($shell) {
@@ -388,20 +399,11 @@ sub rel2abs {
 
 sub abs_configpath {
     my ($path, $args) = @_;
-    my $LG_BUILDDIR;
 
     return unless defined $path;
     $path = $args->{target}{images}{$path};
     return unless defined $path;
 
-    if (exists $ENV{KBUILD_OUTPUT}) {
-	$LG_BUILDDIR = $ENV{KBUILD_OUTPUT};
-    } elsif (-d 'build') {
-	$LG_BUILDDIR = 'build';
-    } else {
-	$LG_BUILDDIR = getcwd();
-    }
-
     $path =~ s/\$LG_BUILDDIR\b/$LG_BUILDDIR/g;
 
     return rel2abs($path, $args->{builddir})
-- 
2.39.2




More information about the barebox mailing list