]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - novaboot
Add an option to disable reseting of the target
[novaboot.git] / novaboot
index cddb8718d6bfa48d93a14bf2c76105e8fc88bd25..ec60ffe0fe2c9e2b8ee3e160e1eac56465a00dd3 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -107,11 +107,12 @@ read_config($_) foreach $cfg or @cfgs;
 my $explicit_target;
 GetOptions ("target|t=s" => \$explicit_target);
 
-my ($amt, @append, $bender, @chainloaders, $concat, $config_name_opt, $dhcp_tftp, $dump_opt, $dump_config, @exiton, @expect_raw, $gen_only, $grub_config, $grub_prefix, $grub_preamble, $grub2_prolog, $grub2_config, $help, $ider, $iprelay, $iso_image, $interactive, $kernel_opt, $make, $man, $no_file_gen, $off_opt, $on_opt, $pulsar, $pulsar_root, $qemu, $qemu_append, $qemu_flags_cmd, $remote_cmd, $remote_expect, $reset_cmd, $rom_prefix, $rsync_flags, @scriptmod, $scons, $serial, $server, $stty, $tftp, $tftp_port, $uboot, %uboot_addr, @uboot_init);
+my ($amt, @append, $bender, @chainloaders, $concat, $config_name_opt, $dhcp_tftp, $dump_opt, $dump_config, @exiton, @expect_raw, $gen_only, $grub_config, $grub_prefix, $grub_preamble, $grub2_prolog, $grub2_config, $help, $ider, $iprelay, $iso_image, $interactive, $kernel_opt, $make, $man, $no_file_gen, $off_opt, $on_opt, $pulsar, $pulsar_root, $qemu, $qemu_append, $qemu_flags_cmd, $remote_cmd, $remote_expect, $reset, $reset_cmd, $rom_prefix, $rsync_flags, @scriptmod, $scons, $serial, $server, $stty, $tftp, $tftp_port, $uboot, %uboot_addr, @uboot_init);
 
 $rsync_flags = '';
 $rom_prefix = 'rom://';
 $stty = 'raw -crtscts -onlcr 115200';
+$reset = 1;                    # Reset target by default
 
 my @expect_seen = ();
 sub handle_expect
@@ -169,6 +170,7 @@ my %opt_spec;
     "qemu-flags|q=s" => \$qemu_flags_cmd,
     "remote-cmd=s"   => \$remote_cmd,
     "remote-expect=s"=> \$remote_expect,
+    "reset!"         => \$reset,
     "reset-cmd=s"    => \$reset_cmd,
     "rsync-flags=s"  => \$rsync_flags,
     "scons:s"       => \$scons,
@@ -976,7 +978,7 @@ if (defined $ider) {
 
 ### Reset target (IP relay, AMT, ...)
 
-if (defined $target_reset) {
+if (defined $target_reset && $reset) {
     print "novaboot: Reseting the test box... ";
     &$target_reset();
     print "done\n";
@@ -1015,14 +1017,14 @@ if (defined $uboot) {
        $exp->send("tftpboot $uboot_addr{kernel} $prefix$kbin\n");
        $exp->expect(10,
                     [qr/##/, sub { exp_continue; }],
-                    $uboot_prompt) || die "No U-Boot prompt deteceted";
+                    $uboot_prompt) || die "Kernel load timeout";
        if (defined $dtb) {
            die "No '--uboot-addr fdt' given" unless $uboot_addr{fdt};
            $fdt_addr = $uboot_addr{fdt};
            $exp->send("tftpboot $fdt_addr $prefix$dtb\n");
            $exp->expect(10,
                         [qr/##/, sub { exp_continue; }],
-                        $uboot_prompt) || die "Device tree load failed";
+                        $uboot_prompt) || die "Device tree load timeout";
        }
        if (defined $initrd) {
            die "No '--uboot-addr ramdisk' given" unless $uboot_addr{ramdisk};
@@ -1030,9 +1032,16 @@ if (defined $uboot) {
            $exp->send("tftpboot $ramdisk_addr $prefix$initrd\n");
            $exp->expect(10,
                         [qr/#/, sub { exp_continue; }],
-                        $uboot_prompt) || die "Initrd load failed";
+                        $uboot_prompt) || die "Initrd load timeout";
+       }
+       $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->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";
@@ -1548,6 +1557,10 @@ Replace the default qemu flags (QEMU_FLAGS variable or C<-cpu coreduo
 
 Command that resets the target.
 
+=item --no-reset, --reset
+
+Disable/enable reseting of the target.
+
 =back
 
 =head2 Interaction with the bootloader on the target