Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NSLU2 won't boot 5.0



* Andy Ruhl <acruhl%gmail.com@localhost> [2009-02-21 10:36]:
> On Sat, Feb 21, 2009 at 10:23 AM, Donald T Hayford 
> <don%donhayford.com@localhost> wrote:
> > Dude!  Welcome to the club.  I know now that at least three people have
> > booted NetBSD on their Slug.

Here's number four :-)

> If so, I could have a script that does the ping, the telnet with the
> break, and maybe get expect to handle doing the tftp boot.

FWIW, I use the following script which does the ping/telnet/break and
then reads the RedBoot commands to execute from the file(s) specified on
the command line or from the standard input:

  -------------- 8< ------------------------------ 8< --------------------
  #!/usr/bin/env perl
  #
  # See: http://www.nslu2-linux.org/wiki/HowTo/TelnetIntoRedBoot

  use strict;
  use warnings;
  use Net::Ping;
  use Net::Telnet;

  $| = 1;

  my $host = '192.168.0.1';     # The Slug.
  my $port = 9000;
  my $p = new Net::Ping('icmp', 0.2);
  my $t = new Net::Telnet(Port => $port, Timeout => 300);

  sub talk_telnet ($$) {
        my ($send, $expect) = @_;

        if (defined($send)) {
                print $send unless -t ARGV;
                $t->put($send);
        }
        if (defined($expect)) {
                my ($received, $prompt) = $t->waitfor($expect);
                print $received, $prompt;
        }
  }

  while (1) {
        last if $p->ping($host);
  }
  $p->close();

  print "Connecting to $host:$port.\n";
  $t->open($host);
  talk_telnet(undef, '/enter \^C to abort/');
  talk_telnet(chr(3), '/RedBoot> /');   # Send "<Control>+C".
  talk_telnet($_, $_ =~ /^(?:go|reset)/ ? undef : '/RedBoot> /') while <>;
  $t->close();
  -------------- 8< ------------------------------ 8< --------------------

So, given the script was saved as /usr/local/sbin/telnetslug, I could do
the following in order to boot netbsd-sd0.bin from 192.168.0.2:

  -------------- 8< ------------------------------ 8< --------------------
  $ cat >boot.cmd <<EOF
  ip_address -h 192.168.0.2
  load -r -b 0x200000 netbsd-sd0.bin
  go
  EOF
  $ su root -c '/usr/local/sbin/telnetslug boot.cmd'
  -------------- 8< ------------------------------ 8< --------------------

Holger


Home | Main Index | Thread Index | Old Index