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< --------------------