NSLU2-Linux
view · edit · print · history

FriendlyDocumentation.README-RedbootTelnetAccess History

Hide minor edits - Show changes to markup

July 11, 2007, at 11:24 PM by Bluechip --
Added lines 17-29:

Dual Firmware Primer [Bluechip]

The NSLU2 has TWO firmwares. When the unit is switched on, a firmware called "Redboot" is executed - the primary purpose of Redboot is to start the Main Firmware [Ie. Linksys; Unslung; Debian; OpenWrt.org; etc.] Each of the two firmwares has an IP address, and these are not necessarily the same.

It IS possible to [url]modify the Redboot IP address[/url], but not trivial.

Although each type of Main firmware is different, it is generally simple to change the Main Firmware IP address ...via a web interface or such.

The default IP address used by Redboot is 192.168.0.1 The default IP address used by the Linksys Main Firmware is 192.168.0.77

If you have changed your Main Firmware IP address, note: Your Redboot IP address remains untouched (failure to understand this cost me a couple of hours)

February 20, 2006, at 02:13 PM by JonRB --
Changed lines 38-39 from:

su to root and execute the command route add 192.168.0.1 eth0

to:

su to root and execute the command route add 192.168.0.1 eth0

Changed lines 41-42 from:

try sudo route add 192.168.0.1 -interface en0 on an OS X box.

to:

try sudo route add 192.168.0.1 -interface en0 on an OS X box.

Changed lines 54-55 from:

sudo arping -f 192.168.0.1; telnet 192.168.0.1 9000

to:

sudo arping -f 192.168.0.1; telnet 192.168.0.1 9000

Changed line 69 from:

At the command prompt type ping -t -w 10 192.168.0.1

to:

At the command prompt type ping -t -w 10 192.168.0.1

September 04, 2005, at 04:26 PM by philipjohnson -- Added.
Added lines 1-197:

philipjohnson: Recieved text in email. It's gonna be a pain in the arse to reformat it, so everybody is going to have to take my word that it's done :).

Here's the unformatted mess when pasted actually, anyway:

HEADING: Working with Redboot

What is Redboot?

Redboot is a bootloader. The job of the bootloader is to load things into the memory and start up Linux used by the NSLU2.

RedBoot is quite sophisticated. It has a user interface that can be accessed by telnet or serial. Redboot can be used to load things into memory by TFTP, write to flash, and similar tasks. Due to the sophistication of Redboot and the nature of things which can be done with it, users should be confident in what they are doing or risk potential problems. Users must ensure access to Redboot at the start of the unslug process.

What is Redboot's purpose and why is it critical to telnet in?

The purpose of this information is to help you gain access to the Redboot bootloader. Access to this bootloader will allow you to recover from almost any bad flash. By ensuring you can telnet into redboot you will help to ensure that if something goes wrong you have a way of correcting it.

Telneting Preparations

Ethernet Cable Linkage

Since 192.168.0.1 could conflict with other equipment on many people's LANs?, it is often easier to access Redboot if it is setup either on its own dedicated network or directly to your computer with a crossover cable.

However, if you have a fancy network card with auto-MDI (i.e. you don't need to worry about your Ethernet cable wiring, as with all new Macs, for instance) you may end up missing the brief telnet window as your computer's Ethernet card tries to work out what sex it should be.

An easy way to get around this is by connecting via a cheap hub which doesn't have such hang-ups.

If you try to use an Ethernet switch, make sure that it can appear as any other device in the subnet other than 192.168.0.1.

You could also try to force your Ethernet card to not allow auto-MDI, but this may be hard to do and may complicate your life in the future if you forget to turn it back on.

IP Address Setup

Your computer might not also be setup to talk on the 192.168.0.x network.

If your computer is not on the 192.168.0.x subnet, you can either change its address temporarily or add a new route.

1. Linux su to root and execute the command route add 192.168.0.1 eth0

2. OS X try sudo route add 192.168.0.1 -interface en0 on an OS X box.

3. Windows (similar route commands)

  • TIP: For ease of installation on Linksys and other networks use default settings. Such as NSLU2's IP address as 192.168.1.77 on port 80. When using non-default settings consult the wiki at www.nslu2-linux.org for help.***

Steps to telneting into Redboot

 Using .nix

An easy way to "catch" the telnet window is:

sudo arping -f 192.168.0.1; telnet 192.168.0.1 9000

then, the telnet starts trying as soon as the IP address on the slug will respond, and all you have to do is remember to press Ctrl+C. :)

If your arping doesn't understand -f, you probably have the standalone "arping" package. Install the version from iputils instead. (For Debian: apt-get install iputils-arping)

What you do need to be ready with is your fingers to type Ctrl-C, as when the RedBoot prompt appears you will have between 2 and 0.1 of a second to hit it. It's something of a reaction test - hold down control after you start the above command, and be ready to mash C as soon as anything appears on the screen.

If you're successful, you should then get a RedBoot> prompt that you can type at.

If you miss it, simply pull the power on the slug and try again.

Using Windows

Open a Windows command prompt (ie by typing cmd at the start and run prompt) At the command prompt type ping -t -w 10 192.168.0.1 Do this process a couple more times and arrange the windows so that they're all visible.

This increases the number of pings and gives you a better chance of seeing the very short reply window you have to work with. Open hyper terminal and set this to connect via winsocks to 192.168.0.1 on port 9000 Set both windows so you can see them, set the ping running and have hyperterminal in the foreground. With your right hand on the mouse button and the mouse cursor over the connect button in hyperterminal, turn on the NSLU. Hold down the control key with your pinky and be ready to hit the C button with your other. Watch the CMD windows. In about 5 seconds with the Ready light Amber colored. At this time you should see a ping from 192.168.0.1 When you see a ping reply click the mouse button over the connect button on the hyperterminal and immediately push the ctrl C. You should instantly see a Redboot prompt.

If the Ready light starts to flash Green let the NSUL2? load. Shut it off and try again. Using Perl Script

Here is a perl script to automate the entire process.

Uses upslug (installed in /usr/local/bin) to reset the slug. Assumes you have done ifconfig eth0:1 192.168.0.2 or something similar so you can reach the 192.168.0 net. Assumes you are running as root. Tosses you into a telnet session after aborting the boot sequence. NOTE: Looks like the parameter for upslug has changed from --reset to -r (repvik)

 #!/usr/bin/perl -w
 # telnet_redboot.pl - ./upslug --reset;arping -f 192.168.0.1;telnet 192.168.0.1 9000

 use Net::Telnet ();

 my $host = '192.168.0.1';

 system("/usr/local/bin/upslug -r");
 printf("NSLU2 reset\n");
 system("/sbin/arping -f $host");
 printf("NSLU2 arping response\n");

 my $t = new Net::Telnet (Port => 9000, Timeout => 30);
 if(!defined($t)){
     print "new Net::Telnet failed\n";
     exit(1);
 } # if
 my $ok;
 $ok = $t->errmode("return");
 $ok = $t->open($host);
 if(!defined($ok)){
     print "open('$host') failed\n";
     $t->close();
     exit(1);
 } # if

 # == Executing boot script in 1.930 seconds - enter ^C to abort

 my $line;
 while($line = $t->getline()){
        $line =~ s/[\r\n]//;
        print "-> $line\n";
        if($line =~ m/enter \^C to abort/){
                $t->put(chr(3)); # send ^C
                print "<- \^C\n";
                $t->close();
                sleep(1);
                system("telnet $host 9000");
                exit(0);
        } # if
 } # while
 $t->close();

Redhat Linux

You have to do the "control+C" really really quick.

 [root@dual root]# arping -f 192.168.0.1;telnet 192.168.0.1 9000
 ARPING 192.168.0.1 from 192.168.1.253 eth0
 Unicast reply from 192.168.0.1 [00:0F:66:7B:FE:96]  9.641ms
 Sent 7 probes (7 broadcast(s))
 Received 1 response(s)
 Trying 192.168.0.1...
 Connected to 192.168.0.1 (192.168.0.1).
 Escape character is '^]'.
 == Executing boot script in 1.820 seconds - enter ^C to abort
 ^C
 RedBoot> help 
 go to assign mode 
    assign 
 Set/Query the system console baud rate 
    baudrate [-b <rate>] 
 sercomm boot flow 
    boot 
 Manage machine caches 
    cache [ON | OFF] 
 Display/switch console channel 
    channel [-1|<channel number>] 
 Compute a 32bit checksum [POSIX algorithm] for a range of memory 
    cksum -b <location> -l <length> 
 Display (hex dump) a range of memory 
    dump -b <location> [-l <length>] [-s] [-1|2|4] 
 Execute an image - with MMU off 
    exec [-w timeout] [-b <load addr> [-l <length>]] 
         [-r <ramdisk addr> [-s <ramdisk length>]] 
         [-c "kernel command line"] [<entry_point>] 
 Manage FLASH images 
    fis {cmds} 
 Execute code at a location 
    go [-w <timeout>] [entry] 
 Help about help? 
    help [<topic>]
 Set/change IP addresses
    ip_address [-l <local_ip_address>] [-h <server_address>]
 Load a file
    load [-r] [-v] [-d] [-h <host>] [-m <varies>] [-c <channel_number>]
         [-b <base_address>] <file_name>
 Compare two blocks of memory
    mcmp -s <location> -d <location> -l <length> [-1|-2|-4]
 Fill a block of memory with a pattern
    mfill -b <location> -l <length> -p <pattern> [-1|-2|-4]
 move kernel&ramdisk to ram
    move
 Network connectivity test
    ping [-v] [-n <count>] [-l <length>] [-t <timeout>] [-r <rate>]
         [-i <IP_addr>] -h <IP_addr>
 Reset the system
    reset
 Set/Read MAC address for NPE ethernet ports
    set_npe_mac [-p <portnum>] [xx:xx:xx:xx:xx:xx]
 go to upgrade mode
    upgrade
 Display RedBoot version information
    version
 Display (hex dump) a range of memory
    x -b <location> [-l <length>] [-s] [-1|2|4]
 RedBoot>
view · edit · print · history · Last edited by Bluechip.
Based on work by JonRB.
Originally by philipjohnson.
Page last modified on July 11, 2007, at 11:24 PM