]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - novaboot
Add support for $NB_MYIP in --uboot-init
[novaboot.git] / novaboot
index c3392fbb28c66ea83996251600b145e3a97cb063..76b48bcbf060cccc3f7c12459d1d83759ac2bad4 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -988,6 +988,11 @@ if (defined $uboot) {
                 [qr/Hit any key to stop autoboot:/, sub { $exp->send("\n"); exp_continue; }],
                 $uboot_prompt) || die "No uBoot prompt deteceted";
     foreach my $cmd (@uboot_init) {
+       if ($cmd =~ /\$NB_MYIP/) {
+           my $ip = (grep /inet /, `ip addr show eth0`)[0] || die "Problem determining our IP address";
+           $ip =~ s/\s*inet ([0-9.]*).*/$1/;
+           $cmd =~ s/\$NB_MYIP/$ip/g;
+       }
        chomp($cmd);
        $exp->send("$cmd\n");
        $exp->expect(10, $uboot_prompt) || die "uBoot prompt timeout";
@@ -1006,8 +1011,8 @@ if (defined $uboot) {
 
        $exp->send("tftp $kern_addr $kbin\n");
        $exp->expect(10,
-                    [qr/#/, sub { exp_continue; }],
-                    $uboot_prompt) || die "Kernel load failed";
+                    [qr/##/, sub { exp_continue; }],
+                    $uboot_prompt) || die "No U-Boot prompt deteceted";
        if (defined $dtb) {
            $dtb_addr = '7f0000';
            $exp->send("tftp $dtb_addr $dtb\n");
@@ -1545,6 +1550,9 @@ Command(s) to send the U-Boot bootloader before loading the images and
 booting them. This option can be given multiple times. After sending
 commands from each option novaboot waits for U-Boot I<prompt>.
 
+If the command contains string I<$NB_MYIP> then this string is
+replaced by IPv4 address of eth0 interface.
+
 =back
 
 =head2 Target interaction phase