Difference between revisions of "Connect to a modified router"

From Embedded Xinu
Jump to navigation Jump to search
(→‎Steps to Connect to the Router: powering up shouldn't happen until after things are set up)
Line 17: Line 17:
 
== Steps to Connect to the Router ==
 
== Steps to Connect to the Router ==
  
=== Task One: Power up the Router ===
+
=== Task One: Connect Serial (& Optionally Network) Cable(s) ===
 +
 
 +
Ensure that the connection is going from UART0 (the first serial port--you ''did'' label them didn't you?) as this is where the console will be running.  If you are connecting a standard PC serial port (a DTE) to your router, use a straight serial cable.  Other arrangements may require a [[Null Modem]]; check your transmit/receive line polarities to be sure.
 +
 
 +
Also, because the goal is to upload custom code to the router, it would be a good idea to connect the router to your network by wiring it up via one of the numbered LAN ports on the back of the router (NOT the Internet/WAN port).
 +
 
 +
=== Task Two: Configure your Serial Communication Software ===
 +
 
 +
The connection used by the router's serial port is fairly standard: 115200bps, with 8 data bits, no parity bit, and 1 stop bit, or 8N1.  Set your software to connect using these settings.
 +
 
 +
=== Task Three: Power up the Router ===
  
 
Yes, that means plug it in.
 
Yes, that means plug it in.
  
=== Task Two: Connect Serial (& Optionally Network) Cable(s) ===
+
With serial communications software listening, you should see something like the following output:
  
Ensure that the connection is going from UART0 (the first serial port--you ''did'' label them didn't you?) as this is where the console will be running. If you are connecting a standard PC serial port (a DTE) to your router, use a straight serial cableOther arrangements may require a [[Null Modem]]; check your transmit/receive line polarities to be sure.
+
<pre>CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
 +
Build Date: Mon Nov 14 18:06:25 CST 2005 (root@localhost.localdomain)
 +
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
 +
 
 +
Initializing Arena
 +
Initializing Devices.
 +
 
 +
No DPN
 +
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.37.0
 +
CPU type 0x29008: 200MHz
 +
Total memory: 16384 KBytes
 +
 
 +
Total memory used by CFE: 0x80300000 - 0x803A39C0 (670144)
 +
Initialized Data:          0x803398D0 - 0x8033BFE0 (10000)
 +
BSS Area:                  0x8033BFE0 - 0x8033D9C0 (6624)
 +
Local Heap:                0x8033D9C0 - 0x803A19C0 (409600)
 +
Stack Area:                0x803A19C0 - 0x803A39C0 (8192)
 +
Text (code) segment:      0x80300000 - 0x803398D0 (235728)
 +
Boot area (physical):      0x003A4000 - 0x003E4000
 +
Relocation Factor:        I:00000000 - D:00000000
 +
 
 +
Boot version: v3.7
 +
The boot is CFE
  
Also, because the goal is to upload custom code to the router, it would be a good idea to connect the router to your network by wiring it up via one of the numbered LAN ports on the back of the router (NOT the Internet/WAN port).
+
mac_init(): Find mac [00:18:39:6F:78:15] in location 0
 +
Nothing...
  
=== Task Three: Configure your Serial Communication Software ===
+
eou_key_init(): Find key pair in location 0
 +
The eou device id is same
 +
The eou public key is same
 +
The eou private key is same
 +
Device eth0:  hwaddr 00-18-39-6F-78-15, ipaddr 192.168.1.1, mask 255.255.255.0
 +
        gateway not set, nameserver not set
 +
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
 +
Loading: ...... 1601536 bytes read
 +
Entry at 0x80001000
 +
Closing network.
 +
Starting program at 0x80001000
 +
CPU revision is: 00029008
 +
Primary instruction cache 16kb, linesize 16 bytes (2 ways)
 +
Primary data cache 8kb, linesize 16 bytes (2 ways)
 +
Linux version 2.4.20 (root@localhost.localdomain) (gcc version 3.2.3 with Broadcom modifications)
 +
...
 +
(snip)
 +
...
 +
Hit enter to continue...
 +
</pre>
  
The connection used by the router's serial port is fairly standard: 115200bps, with 8 data bits, no parity bit, and 1 stop bit, or 8N1.
+
Pressing enter will give you a root shell:
 +
<pre>BusyBox v0.60.0 (2005.11.14-09:45+0000) Built-in shell (msh)
 +
Enter 'help' for a list of built-in commands.
  
In our setup, once running Kermit on the external machine, we connected by typing in:<br/>
+
#
{| border="0" cellspacing="0" cellpadding="0"
+
</pre>
| <code>set line /dev/tty000</code>
 
| &nbsp;&nbsp;&nbsp;&nbsp;
 
| to select the serial device that is connected to the router*.
 
|-
 
| <code>set serial 8n1</code>
 
| &nbsp;&nbsp;&nbsp;&nbsp;
 
| which is not really necessary since this is default.
 
|-
 
| <code>set speed 115200</code>
 
| &nbsp;&nbsp;&nbsp;&nbsp;
 
| as given to us in the router specifications.
 
|-
 
|}
 
(* - Your device is probably different.  Check your O/S documentation to figure out the name of your computer's relevant serial port.)
 
  
 
=== Task Four: Access the Common Firmware Environment CLI ===
 
=== Task Four: Access the Common Firmware Environment CLI ===

Revision as of 21:13, 11 July 2007

Summary

This will explain how to connect to the serial ports on a modified LinkSys WRT54G using serial communication software such as the open source Kermit.

Before Starting

Expose a serial port on the router

You must have successfully modified a LinkSys WRT54G to expose at least its first serial port in such a way that you can connect it to another machine with serial communications software. If you have not done so yet, please see HOWTO:Modify the Linksys hardware

Acquire serial communication software

There is a freely available software package for serial communication on almost every major platform. A solid open source suite of communication software known as Kermit has served us well as a method of communicating with the WRT54GL. C-Kermit is the UNIX compatible implementation, and a Windows version, Kermit 95, is available as well.

Alternatively, if you are building multiple backends to be made available as a pool, our suite of XINU Console Tools includes a basic serial console utility called tty-connect.

Steps to Connect to the Router

Task One: Connect Serial (& Optionally Network) Cable(s)

Ensure that the connection is going from UART0 (the first serial port--you did label them didn't you?) as this is where the console will be running. If you are connecting a standard PC serial port (a DTE) to your router, use a straight serial cable. Other arrangements may require a Null Modem; check your transmit/receive line polarities to be sure.

Also, because the goal is to upload custom code to the router, it would be a good idea to connect the router to your network by wiring it up via one of the numbered LAN ports on the back of the router (NOT the Internet/WAN port).

Task Two: Configure your Serial Communication Software

The connection used by the router's serial port is fairly standard: 115200bps, with 8 data bits, no parity bit, and 1 stop bit, or 8N1. Set your software to connect using these settings.

Task Three: Power up the Router

Yes, that means plug it in.

With serial communications software listening, you should see something like the following output:

CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: Mon Nov 14 18:06:25 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.

Initializing Arena
Initializing Devices.

No DPN
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.37.0
CPU type 0x29008: 200MHz
Total memory: 16384 KBytes

Total memory used by CFE:  0x80300000 - 0x803A39C0 (670144)
Initialized Data:          0x803398D0 - 0x8033BFE0 (10000)
BSS Area:                  0x8033BFE0 - 0x8033D9C0 (6624)
Local Heap:                0x8033D9C0 - 0x803A19C0 (409600)
Stack Area:                0x803A19C0 - 0x803A39C0 (8192)
Text (code) segment:       0x80300000 - 0x803398D0 (235728)
Boot area (physical):      0x003A4000 - 0x003E4000
Relocation Factor:         I:00000000 - D:00000000

Boot version: v3.7
The boot is CFE

mac_init(): Find mac [00:18:39:6F:78:15] in location 0
Nothing...

eou_key_init(): Find key pair in location 0
The eou device id is same
The eou public key is same
The eou private key is same
Device eth0:  hwaddr 00-18-39-6F-78-15, ipaddr 192.168.1.1, mask 255.255.255.0
        gateway not set, nameserver not set
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: ...... 1601536 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
CPU revision is: 00029008
Primary instruction cache 16kb, linesize 16 bytes (2 ways)
Primary data cache 8kb, linesize 16 bytes (2 ways)
Linux version 2.4.20 (root@localhost.localdomain) (gcc version 3.2.3 with Broadcom modifications)
...
(snip)
...
Hit enter to continue...

Pressing enter will give you a root shell:

BusyBox v0.60.0 (2005.11.14-09:45+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

#

Task Four: Access the Common Firmware Environment CLI

This will be filled in, but here's the basics:

  • Make sure boot_wait is on (this should be added to the Install OpenWRT HOWTO)
  • Reboot the router (reboot or power cycle).
  • Hit CTRL+C on your serial console.
  • You're in.

What to do next?