]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Execute --uboot-cmd even if there are no files to boot
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 15 Dec 2014 12:35:44 +0000 (13:35 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 15 Dec 2014 12:35:44 +0000 (13:35 +0100)
This is useful in certain situations, for example when we want to
execute custom U-Boot command end exit novaboot without waiting for next
U-Boot prompt.

We also wrap kernel loading in an if block to suppress Perl warnings
about undefined $kbin.

novaboot

index 42a9fe420a452664dad64d7971000f551ceb6756..2b38717b4ae5f5ae1d39313025538df75b49cce2 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -1083,17 +1083,20 @@ if (defined $uboot) {
     }
 
     # Boot the system if there are some load lines in the script
-    if (scalar(@$modules) > 0 && !$variables->{NO_BOOT}) {
+    if ((scalar(@$modules) > 0 && !$variables->{NO_BOOT}) ||
+       defined $uboot_cmd) {
        my ($kbin, $kcmd) = split(' ', shift(@$modules), 2);
        my $dtb;
        @$modules = map { if (/\.dtb$/) { $dtb=$_; (); } else { $_ } } @$modules;
        my $initrd = shift @$modules;
 
-       die "No '--uboot-addr kernel' given" unless $uboot_addr{kernel};
-       $exp->send("tftpboot $uboot_addr{kernel} $prefix$kbin\n");
-       $exp->expect(10,
-                    [qr/##/, sub { exp_continue; }],
-                    $uboot_prompt) || die "Kernel load timeout";
+       if (defined $kbin) {
+           die "No '--uboot-addr kernel' given" unless $uboot_addr{kernel};
+           $exp->send("tftpboot $uboot_addr{kernel} $prefix$kbin\n");
+           $exp->expect(10,
+                        [qr/##/, sub { exp_continue; }],
+                        $uboot_prompt) || die "Kernel load timeout";
+       }
        if (defined $dtb) {
            die "No '--uboot-addr fdt' given" unless $uboot_addr{fdt};
            $exp->send("tftpboot $uboot_addr{fdt} $prefix$dtb\n");