From: Michal Sojka Date: Mon, 15 Dec 2014 12:35:44 +0000 (+0100) Subject: Execute --uboot-cmd even if there are no files to boot X-Git-Tag: 20141215~6 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/novaboot.git/commitdiff_plain/ec03313b05f52f743b4068fe8881d77c23a2dc42 Execute --uboot-cmd even if there are no files to boot 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. --- diff --git a/novaboot b/novaboot index 42a9fe4..2b38717 100755 --- 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");