]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
U-Boot: Extend kernel command line handling
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 30 Jul 2014 14:27:15 +0000 (16:27 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 30 Jul 2014 14:27:27 +0000 (16:27 +0200)
In order to be compatible with a standard U-Boot way of having
variables containin U-Boot commands and using 'run' to expand variable
references in them, we check kernel command line if it starts with
'setenv bootargs'. If yes, we simply run this command, otherwise, we
preprend 'setenv bootargs' ourselves.

Examples:

1) Novaboot script contains:

       load linux console=${console} quiet

   U-Boot is instructed to run:

       setenv bootargs console=${console} quiet

2) Novaboot script contains:

       load linux ${netargs} quiet

   and the U-Boot variable netargs contsins "setenv bootargs console=${console}"
   U-Boot is instructed to run:

       setenv bootargs console=${console} quiet

Note that in case 1) novaboot prepends "setenv bootargs" itselv
whereas in 2) inly executes the command line as is.

novaboot

index cddb8718d6bfa48d93a14bf2c76105e8fc88bd25..ddcb1d5e95fdc9103bdbf537c1643301b9297f9c 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -1032,7 +1032,14 @@ if (defined $uboot) {
                         [qr/#/, sub { exp_continue; }],
                         $uboot_prompt) || die "Initrd load failed";
        }
-       $exp->send("setenv bootargs $kcmd\n");
+       $exp->send("echo $kcmd\n");
+       $exp->expect(1, '-re', qr{echo .*\n(.*)\n$uboot_prompt})  || die "Command line test timeout";
+       my $args = ($exp->matchlist)[0];
+       if ($args =~ /^setenv\s+bootargs/) {
+           $exp->send("$args\n");
+       } else {
+           $exp->send("setenv bootargs $kcmd\n");
+       }
        $exp->expect(5, $uboot_prompt)  || die "U-Boot prompt timeout";
        $exp->send("bootm $uboot_addr{kernel} $ramdisk_addr $fdt_addr\n");
        $exp->expect(5, "\n")  || die "U-Boot command timeout";