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

+

[[w: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 pre-ARM LinkStation (LS1,LS2,LS-HG) owners with UBoot 1.2.0 installed, it provides one with "NetConsole" connectivity and 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 [http://netcat.sourceforge.net/ here].

+

'''Note:Currently the stock UBoot 1.1.1 that Buffalo/Melco/Revogear provides on ARM-based machines (like the LS-Pro and KuroPro, for instance) was compiled with the '-tiny' flag, so it doesn't provide some of the features that we enjoy on the custom UBoot ported to LinkStations back in mid-2006 by linuxnotincluded. Several developers here may be working on an upgrade to the stock UBoot on these ARM-based boxes. If and when such a new UBoot is developed and released, it will be announced here in the Forum, most likely. Until then, if you want to control UBoot behavior, your options are probably limited to Serial Port access and using the "nvram" program that is in the stock firmware. As is the case with any alterations to your LinkStation, proceed with caution, double-check what you are doing, and have a backup plan.'''

−

=Getting Netcat and Installing it for Use with UBoot & LinkStations=

+

==Getting Netcat and Installing it for Use with UBoot & LinkStations==

+

Netcat for:

+

*[http://www.vulnwatch.org/netcat/ Windows] (everything later than NT)

+

*OS X (included in Tiger 10.4)

+

*[http://netcat.sourceforge.net/ Linux] (already included in many Linux distros)

−

+

==Using Netcat w/ UBoot to control the boot process==

−

=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.)

−

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, then adjust accordingly.)

+

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

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

Line 15:

Line 19:

nc -u -p 6666 -v 192.168.11.150 6666

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:

*right after that (within seconds) turn your LS on and wait for something like this to appear:

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.) These three examples are for illustrative purposes, not because they are the easiest way.

+

+

+

===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 in /boot + 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

+

+

'''Note:'''The easy way to do these from the UBoot command line is with bootcmd3, bootcmd2 and bootcmd1, as these are values that were predefined by LinuxNotIncluded. Read the output of

+

?

+

for more details on the default env var values.

+

+

==Changing Environment Variables for Network Convenience==

+

+

'''Note:'''It is possible to brick one's Kuro/LS by tampering with UBoot. Proceed at your own risk and with caution!

+

+

The version of UBoot that I downloaded and installed for my HG and KuroHG has 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.

+

+

The original Network env vars were these:

+

ipaddr=192.168.11.150

+

serverip=192.168.11.149

+

ncip=192.168.11.149

+

To change these and make the new values persistent, I did the following:

which basically makes a mini-script of four commands. The name of the env var was then changeip, and its value was a sequence of four commands. The first three commands would set new IP addresses as I wanted, and the last command (saveenv) would make all the current env var values persistent. To execute it, I just did:

+

run changeip

+

I lost my connection (expected) but when I rebooted the KuroHG attached to the 10.0.1.0 network, it came up where I wanted it to be:

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 pre-ARM LinkStation (LS1,LS2,LS-HG) owners with UBoot 1.2.0 installed, it provides one with "NetConsole" connectivity and 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.

Note:Currently the stock UBoot 1.1.1 that Buffalo/Melco/Revogear provides on ARM-based machines (like the LS-Pro and KuroPro, for instance) was compiled with the '-tiny' flag, so it doesn't provide some of the features that we enjoy on the custom UBoot ported to LinkStations back in mid-2006 by linuxnotincluded. Several developers here may be working on an upgrade to the stock UBoot on these ARM-based boxes. If and when such a new UBoot is developed and released, it will be announced here in the Forum, most likely. Until then, if you want to control UBoot behavior, your options are probably limited to Serial Port access and using the "nvram" program that is in the stock firmware. As is the case with any alterations to your LinkStation, proceed with caution, double-check what you are doing, and have a backup plan.

Getting Netcat and Installing it for Use with UBoot & LinkStations

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:

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.) These three examples are for illustrative purposes, not because they are the easiest way.

Note:The easy way to do these from the UBoot command line is with bootcmd3, bootcmd2 and bootcmd1, as these are values that were predefined by LinuxNotIncluded. Read the output of

?

for more details on the default env var values.

Changing Environment Variables for Network Convenience

Note:It is possible to brick one's Kuro/LS by tampering with UBoot. Proceed at your own risk and with caution!

The version of UBoot that I downloaded and installed for my HG and KuroHG has 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.

The original Network env vars were these:

ipaddr=192.168.11.150
serverip=192.168.11.149
ncip=192.168.11.149

To change these and make the new values persistent, I did the following:

which basically makes a mini-script of four commands. The name of the env var was then changeip, and its value was a sequence of four commands. The first three commands would set new IP addresses as I wanted, and the last command (saveenv) would make all the current env var values persistent. To execute it, I just did:

run changeip

I lost my connection (expected) but when I rebooted the KuroHG attached to the 10.0.1.0 network, it came up where I wanted it to be: