Difference between revisions of "NetCat-A UBoot-Friendly Network Utility"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
Line 1: Line 1:
{{Template:Articles|Development|Linkstation Variants|Projects|LS1|HG|LSPro}}
+
{{Template:Articles|Development|Linkstation Variants|Projects|LS1|HG|HS}}
  
 
==What is Netcat?==
 
==What is Netcat?==

Revision as of 10:35, 16 March 2007


Contents

What is Netcat?

Netcat is a flexible network utility for network access to ports on computer systems. It can connect to a variety of ports, by either TCP or UDP. For PPC LinkStation owners with UBoot installed, it provides one with the means to do a variety of tasks, including controlling the boot process, altering environmental variables, and flashing data/images to ROM. The official site for Netcat is here.

Getting Netcat and Installing it for Use with UBoot & LinkStations

Netcat for:

  • Windows
  • OS X
  • Linux (already included in many Linux distros)


Using Netcat w/ UBoot to control the boot process

First, get your network adjusted so that the ip addresses are what UBoot expects them to be. Your desktop/laptop must have an IP address of 192.168.11.149. Your LS needs to be at 192.168.11.150. The network should be 192.168.11.0 and the subnet mask 255.255.255.0, though these last two seem to take care of themselves. (Note: If your version of UBoot was custom made with a different IP range for a network like 10.0.1.0, then adjust accordingly.)

To connect to your UBoot-equipped LS during its boot process, do the following almost simultaneously:

  • execute the following command
nc -u -p 6666 -v 192.168.11.150 6666
  • right after that (within seconds) turn your LS on and wait for something like this to appear:
nc -u -p 6666 -v 192.168.11.150 6666
192.168.11.150: inverse host lookup failed: Unknown host
(UNKNOWN) [10.0.1.6] 6666 (?) open

U-Boot 1.1.4 LiSt 2.1.0 (Nov 15 2006 - 18:03:28) LinkStation HG / KuroBox HG
stdin :   nc
stdout:   nc
stderr:   nc
IDE:   Bus 0: OK 
  Device 0: Model: Maxtor 6L300R0 Firm: BAJ41G20 Ser#: L6318AEG
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 286188.8 MB = 279.4 GB (586114704 x 512)
Boot in 07 seconds ('s' to stop)...s

If you press "s" and enter, then the boot process will stop.

Alternatives to the Miniconsole 1-2-3-Flashes Method

PPC UBoot users already know that you can choose to boot to:

  • EM mode by choosing 3 red flashes
  • the 2.4 kernel in your firmimg.bin + the hddrootfs by choosing 2 red flashes
  • whatever UBoot-compatible kernel is at / + the hddrootfs by choosing 1 red flash

It is possible to chose which of these three mode you boot into by passing boot arguements to specify which kernel and which file system you want. (A slightly easier but much less instructive way will be pointed out at the end.)


EM-Mode

emboot=setenv bootargs root=/dev/ram0;bootm ffc00000
=> setenv bootargs root=/dev/ram0;bootm ffc00000
setenv bootargs root=/dev/ram0;bootm ffc00000
## Booting image at ffc00000 ...

******* Product Information *******
----------------------------------
Product Name: HD-HGLAN(IEMITSU)
         VER: 2.08
        Date: 2006/2/9 12:0:6
----------------------------------
Verifying checksum... OK
Uncompressing kernel...done.
Loading Ramdisk at 0x07C6C000, end 0x07E6E31A ... OK
Booting the kernel


2.4 Kernel in firmimg.bin + hddrootfs

flboot=setenv bootargs root=/dev/hda1;bootm ffc00000
=> setenv bootargs root=/dev/hda1;bootm ffc00000
setenv bootargs root=/dev/hda1;bootm ffc00000
## Booting image at ffc00000 ...

******* Product Information *******
----------------------------------
Product Name: HD-HGLAN(IEMITSU)
         VER: 2.08
        Date: 2006/2/9 12:0:6
----------------------------------
Verifying checksum... OK
Uncompressing kernel...done.
Loading Ramdisk at 0x07C6C000, end 0x07E6E31A ... OK
Booting the kernel


UBoot-compatible Kernel at / + hddrootfs

=> boot
boot
Loading 0:1:boot/vmlinux.UBoot

3391686 bytes read
## Booting image at 00800000 ...
   Image Name:   2.6.20.2-hg-uboot-v60
   Image Type:   PowerPC Linux Kernel Image (uncompressed)
   Data Size:    3391622 Bytes =  3.2 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
OK


Changing Environment Variables for Network Convenience

My own UBoot for my HG and KuroHG had the 192.168.11.x setup as its defaults. Since my home network is set up with 10.0.1.x IP addresses, I decided to use Netcat and UBoot to change my env vars so that I wouldn't have to switch the KuroHG (my lab rat) to the 2nd port on my computer (with 192.168.11.x address). I could just leave it on the main network all of the time, and get Netcat-UBoot control whenever I wanted it.

Original Network env vars:


New Network env vars:



Links and References