Cobalt Qube 2 Network Appliance

My Cobalt Qube 2 So, my most recent hardware project has been obtaining and hacking a Cobalt Qube 2. I got interested in this little network appliance when I read this project that someone else did.

So, I bought myself one on ebay for USD200: 250MHz / 16MB / 10GB

The first thing you should do if you want to hack this machine is get your serial connection working so you can see what's going on.

Restoring the Operating System

If your machine didn't come with an OS or the person who sold it to you has a lot of crap on it or it just doesn't boot up or anything, you'll have to restore the OS from the restore CD. It's actually easier than it sounds given that the Qube doesn't actually have a CD-ROM drive :)

Since this thing is worthless without a network, and a network is useless with only one machine on it, I'll assume that you have another computer handy. Make sure that your network card is supported (pretty much anything made by 3Com and a few others -- I'll post those later), and then re-start that machine and boot from the restore CD. When it finishes booting up, you'll be asked to read and agree to the license agreement. Whatever. After that, you get some more instructions and you can't quit the program that shows you the instructions. What they don't tell you is that you don't have to do anything else with that machine. Go over to your Qube and netboot it.

If you're interested, you can watch the install process from either the LCD screen, which shows one message of progress every once in a while. Alternatively, you can watch it happen over the console via the serial interface. It's actually all automatic from there on out. Just let the Qube load its OS and go have a pizza.

When the installation is done, you can reboot the netboot host back into whatever operating system it usually runs -- you don't need it anymore. The Qube will say "Please turn off the power" when it's done loading the Cobalt Linux that it usually runs. Go ahead and shut off the machine and turn it back on whenever you are ready to play with it some more.

After OS installation

One of the cool things about this net appliance is that once the OS is on it, you pretty much never have to play with it on a command-line level. Just visit http://your.qube.host/ and it will walk you through the setup process for your network, etc. If you have a DHCP server on your network, it will automatically obtain an IP address, too.

Appendices

Getting more memory

I was able to find memory here: http://store.yahoo.com/valueram/128mb-cobalt-qube-2.html. Others have indicated that Cobalt Qube 2 - friendly memory can be found at these places, too:

www.ramjet.com: Go into the PC memory configurator, choose "Sun Cobalt" and they sell a 128 MB SIMM for $53.13.

Someone else suggested this place E*Plus in Virginia, but their web site isn't working. If you live near there, you might be able to get some RAM from them.

Wherever you go, you must make sure that the memory has these characteristics: 72-pin EDO Non-parity 3.3volt

When installing the memory, reemember that the bigger SIMM module must be in slot 0 (closer to the processor) than the smaller SIMM module.

Also, when you boot-up the Qube, you'll note that there are 4 banks of RAM, although only two SIMM slots on the board. Each side of the SIMM counts as a single bank, so my 128MB SIMM reports that I have 64MB in bank 0 and 64MB in bank 1. I had to do a double-take when I saw that to make sure that I had, in fact, added 128 whole Megabytes of memory.

Net Booting

In order to netboot the Qube, hold down both the "left" and "right" buttons on the back of the Qube while starting it up. Hold those buttons down until the lcd reads "Net booting", and the Qube will find another machine on the network that acts as a netboot host.

Notes on building various packages on Cobalt/NetBSD

I've found some interesting tidbits while trying to build various software packages on Colabt/NetBSD. Homefully, mentioning them here will make it easier for others to build their systems.

PERL (5.8.2)

Okay, I didn't have any problems build perl, except that it took like 4 hours on my little 250MHz Cobalt Qube 2 with only 16MB or RAM. Be prepared.

When I ran 'make test', I found that there were several tests that failed:

t/op/override........................ok
t/op/pack............................# Failed at op/pack.t line 484
# Failed at op/pack.t line 484
FAILED at test 187
t/op/pat.............................ok
.
.
.
lib/Locale/Maketext/t/03http.........ok
lib/Locale/Maketext/t/90utf8.........ok
lib/locale...........................FAILED at test 99
lib/Math/BigInt/t/bare_mbf...........ok
lib/Math/BigInt/t/bare_mbi...........ok
.
.
.

I can't say that I'm too happy about any of those failed tests, especially the 'pack' test, which I'm sure gets used occasionally... whatever. I installed it anyway. Please let me know if you know how to fix this.

openssl (0.9.6l)

Okay, this didn't even have a chance out of the box:

# make
+ rm -f libcrypto.so.0
+ rm -f libcrypto.so
+ rm -f libcrypto.so.0.9.6
+ rm -f libssl.so.0
+ rm -f libssl.so
+ rm -f libssl.so.0.9.6
making all in crypto...
gcc -I. -I../include -fPIC -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3
   -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN  -c cryptlib.c
cc1: Invalid option `v8'
*** Error code 1

Stop.

I figure that the -mv8 option is something that the compiler doesn't like on this platform. It detected my platform as 'cobalt-whatever-netbsd', which wasn't too encouraging. At least it for the architecture and the UNIX flavor correct. It must just not properly detect the compiler.

-mv8 is a SPARC architecture chooser -- apparently is chooses SuperSPARC instead of UltraSPARC. Since I have neither processor, this option is utterly worthless and makes it hard to compile.

I checked the other architectures and OSs supported and it looks like OpenBSD/mips is a good bet:

# ./Configure --prefix=/usr no-threads OpenBSD-mips
.
.
.

# make
.
.
(works :)

Now I get another one:

LD_LIBRARY_PATH=..:$LD_LIBRARY_PATH  gcc -o openssl -DMONOLITH -I../include
   -fPIC -DDSO_DLFCN -DHAVE_DLFCN_H -O2 -DL_ENDIAN openssl.o verify.o
   asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o
   ca.o pkcs7.o crl2p7.o crl.o  rsa.o rsautl.o dsa.o dsaparam.o  x509.o
   genrsa.o gendsa.o s_server.o s_client.o speed.o  s_time.o apps.o s_cb.o
   s_socket.o app_rand.o version.o sess_id.o  ciphers.o nseq.o pkcs12.o
   pkcs8.o spkac.o smime.o rand.o  -L.. -lssl -L.. -lcrypto BN_LLONG
   MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC2 DES_PTR BF_PTR
gcc: BN_LLONG: No such file or directory
gcc: MD2_CHAR: No such file or directory
gcc: RC4_INDEX: No such file or directory
gcc: RC4_CHAR: No such file or directory
gcc: DES_UNROLL: No such file or directory
gcc: DES_RISC2: No such file or directory
gcc: DES_PTR: No such file or directory
gcc: BF_PTR: No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/src/openssl-0.9.6l/apps
*** Error code 1

Stop.
make: stopped in /usr/src/openssl-0.9.6l

D'oh! I'm going to bed.

openssh (3.7.1p2)

Apparently, there's a bug in the optimization code in gcc that emits a bogus opcode to the assembler. Here's the error message I got:

gcc -g -O2 -Wall -Wpointer-arith -Wno-uninitialized -I. -I.  -DSSHDIR=\"/usr/etc
\"  -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\"  -D_PATH_SSH_ASKPASS_DEFAULT=\"/usr/lib
exec/ssh-askpass\"  -D_PATH_SFTP_SERVER=\"/usr/libexec/sftp-server\"  -D_PATH_SS
H_KEY_SIGN=\"/usr/libexec/ssh-keysign\"  -D_PATH_SSH_PIDDIR=\"/var/run\"  -D_PAT
H_PRIVSEP_CHROOT_DIR=\"/var/empty\"  -DSSH_RAND_HELPER=\"/usr/libexec/ssh-rand-h
elper\" -DHAVE_CONFIG_H -c channels.c
/var/tmp/ccrjwhoS.s: Assembler messages:
/var/tmp/ccrjwhoS.s:5360: Error: illegal operands `sw'
*** Error code 1

Stop.

Someone else had the same problem, and the question was answered on the mailing list: http://mail-index.netbsd.org/port-cobalt/2003/10/04/0003.html.

The short answer is that you just have to re-execute the failed command with a different optimization flag: change -O2 to -O0 (note that it's "dash oh zero", there). After this one-liner, you can run 'make' again and it completed the build after that.

NetBSD

In order to help debug the boot loader, I had to get the '-current' version of NetBSD's 'sys' package. I tried getting it from the FTP site, but the archive was always broken whenever I got it. :(

So, I decided to use anonymous CVS. Here are the settings:

$ export CVSROOT=:pserver:anoncvs@netbsd.stevens-tech.edu:/cvsroot
$ cvs login
CVS Password: anoncvs

(Note that I used these servers because they are closest to me. To find yours, consult this page for anonymous CVS or this page for FTP access.)

In order to get the sources, I had to figure out the 'project' name, and after playing around for a bit, I found that executing:

$ cvs checkout src/sys

That did the trick.

bash (2.05b)

bash was looking good until I saw this:

gcc -c  -DHAVE_CONFIG_H -DSHELL  -I. -I../.. -I../.. -I../../include -I../../lib
   -g -O2 smatch.c
smatch.c: In function `is_wcclass':
smatch.c:297: `wctype_t' undeclared (first use in this function)
smatch.c:297: (Each undeclared identifier is reported only once
smatch.c:297: for each function it appears in.)
smatch.c:297: parse error before `desc'
smatch.c:300: parse error before `0'
smatch.c:323: `desc' undeclared (first use in this function)
smatch.c:326: parse error before `0'
*** Error code 1

Stop.

It turns out that there's no wctype.h on the system. So, I found a system that had one and took the most reasonable definition and placed it at the top of smatch.c

typedef unsigned long int wctype_t;

That allowed my to compile the rest of the way, but I got a linker error:

./lib/glob/libglob.a(smatch.o): In function `rangecmp_wc':
/usr/src/bash-2.05b/lib/glob/smatch.c:256: undefined reference to `wcscoll'
./lib/glob/libglob.a(smatch.o): In function `is_wcclass':
/usr/src/bash-2.05b/lib/glob/smatch.c:302: undefined reference to `wctype'
/usr/src/bash-2.05b/lib/glob/smatch.c:306: undefined reference to `wctob'
/usr/src/bash-2.05b/lib/glob/smatch.c:325: undefined reference to `wctype'
/usr/src/bash-2.05b/lib/glob/smatch.c:332: undefined reference to `iswctype'
/usr/src/bash-2.05b/lib/glob/smatch.c:334: undefined reference to `iswctype'
./lib/glob/libglob.a(smatch.o): In function `wscompare':
/usr/src/bash-2.05b/lib/glob/sm_loop.c:592: undefined reference to `wcscoll'
*** Error code 1

Stop.
make: stopped in /usr/src/bash-2.05b

Fuck.

MySQL

I didn't actually do this. But someone else did.

Samba (v3.0.1)

# ./configure
(takes along time)
# make
(also takes a long time)

Samba took 36 hours to compile on my 16MB Qube 2. Wow, that's long. However, it did compile without any errors -- only a few warnings which I considered reasonable.

The problem now is that I'm having problems getting anything to connect to it. This includes its own command-line usilities, on the same box. :(

If anyone has any words of wisdom, I'd appreciate them. I have several other Linux machines running Samba on my network without a problem, and the configuration of the Qube is very similar to those.

I tried re-compiling this after I upgraded to 144MB RAM, just to see. Here are my results. I left in the configure warnings in case any of them might pose a problem.

# cd samba-3.0.1.source
# time ./configure
(snip)
configure: WARNING: net/if.h: present but cannot be compiled
configure: WARNING: net/if.h: check for missing prerequisite headers?
configure: WARNING: net/if.h: proceeding with the preprocessor's result
(snip)
configure: WARNING: rpcsvc/yp_prot.h: present but cannot be compiled
configure: WARNING: rpcsvc/yp_prot.h: check for missing prerequisite headers?
configure: WARNING: rpcsvc/yp_prot.h: proceeding with the preprocessor's result
(snip)
configure: WARNING: sys/mount.h: present but cannot be compiled
configure: WARNING: sys/mount.h: check for missing prerequisite headers?
configure: WARNING: sys/mount.h: proceeding with the preprocessor's result
(snip)
configure: WARNING: netinet/ip.h: present but cannot be compiled
configure: WARNING: netinet/ip.h: check for missing prerequisite headers?
configure: WARNING: netinet/ip.h: proceeding with the preprocessor's result
(snip)
configure: WARNING: Sufficient support for iconv function was not found.
    Install libiconv from http://freshmeat.net/projects/libiconv/ for better charset compatibility!
(snip)
configure: WARNING: ldap.h is needed for LDAP support
(snip)
configure: WARNING: Active Directory Support requires LDAP support

real    13m3.247s
user    3m38.897s
sys     10m30.566s

# time make
/usr/local/src/samba-3.0.1/source/tdb/tdbutil.c: In function `make_tdb_data':
/usr/local/src/samba-3.0.1/source/tdb/tdbutil.c:45:
   warning: assignment discards qualifiers from pointer target type
/usr/local/src/samba-3.0.1/source/tdb/tdbutil.c:
   In function `tdb_chainlock_with_timeout_internal':
/usr/local/src/samba-3.0.1/source/tdb/tdbutil.c:59:
   warning: passing arg 1 of `tdb_set_lock_alarm' discards qualifiers from pointer target type
(snip)
/usr/local/src/samba-try-again/samba-3.0.1/source/client/client.c:
   In function `do_get':
/usr/local/src/samba-try-again/samba-3.0.1/source/client/client.c:694:
   warning: passing arg 4 of `cli_getattrE' from incompatible pointer type
/usr/local/src/samba-try-again/samba-3.0.1/source/client/client.c:
   In function `do_put':
/usr/local/src/samba-try-again/samba-3.0.1/source/client/client.c:1070:
   warning: passing arg 4 of `cli_getattrE' from incompatible pointer type
/usr/local/src/samba-try-again/samba-3.0.1/source/client/client.c:
   In function `do_host_query':
/usr/local/src/samba-try-again/samba-3.0.1/source/client/client.c:2669:
   warning: passing arg 1 of `list_servers' discards qualifiers from pointer target type

My musings whilst playing with the Qube

Here are my musings during my adventures with Cobalt Linux. It's kind of a stream-of-consciousness and it's been cut and pasted and hacked, etc. so please don't complain if it's not exactly the best example of English prose.

Anyhow, I then proceeded to wipe the machine and start again by netbooting from the restore CD that came with the box. The CD looked a bit sketchy, so I got myself an ISO image from Sun just in case. The shady-looking CD ended up being okay.

I applied several patches from Sun's Cobalt site and now it's time to play with the sucker. First of all, it needs more RAM! I'm going to have a hard time finding memory available for this thing, so I'll write more once I have some. In the meantime, here's some quick, unannotated system info:

[admin@qube admin]$ cat /proc/cpuinfo 
cpu                     : MIPS
cpu model               : Nevada V10.0
system type             : Cobalt Networks Server
BogoMIPS                : 249.86
byteorder               : little endian
unaligned accesses      : 52
wait instruction        : yes
microsecond timers      : yes
extra interrupt vector  : yes
hardware watchpoint     : no
[admin@qube /proc]$ cat meminfo 
        total:    used:    free:  shared: buffers:  cached:
Mem:  15179776 11841536  3338240 11112448   286720  3727360
Swap: 133885952  5488640 128397312
MemTotal:     14824 kB
MemFree:       3260 kB
MemShared:    10852 kB
Buffers:        280 kB
Cached:        3640 kB
SwapTotal:   130748 kB
SwapFree:    125388 kB
[admin@qube /proc]$ cat version
Linux version 2.0.34C53_SK (root@brainy.cobaltnet.com) (gcc version 2.7.2) #1 Tue May 9 14:57:21 PDT 2000
[admin@qube /proc]$ cat pci 
PCI devices found:
  Bus  0, device  12, function  0:
    Ethernet controller: DEC DC21142 (rev 65).
      Medium devsel.  Fast back-to-back capable.  IRQ 13.  Master Capable.  Latency=64.  Min Gnt=20.Max Lat=40.
      I/O at 0x10101000.
      Non-prefetchable 32 bit memory at 0xd00800.
  Bus  0, device   9, function  2:
    USB Controller: VIA Technologies VT 82C586 Apollo USB (rev 2).
      Medium devsel.  Master Capable.  Latency=22.  
      I/O at 0x300.
  Bus  0, device   9, function  1:
    IDE interface: VIA Technologies VT 82C586 Apollo IDE (rev 6).
      Medium devsel.  Fast back-to-back capable.  IRQ 14.  Master Capable.  Latency=64.  
      I/O at 0xcc00.
  Bus  0, device   9, function  0:
    ISA bridge: VIA Technologies VT 82C586 Apollo ISA (rev 39).
      Medium devsel.  Master Capable.  No bursts.  
  Bus  0, device   7, function  0:
    Ethernet controller: DEC DC21142 (rev 65).
      Medium devsel.  Fast back-to-back capable.  IRQ 4.  Master Capable.  Latency=64.  Min Gnt=20.Max Lat=40.
      I/O at 0x10100000.
      Non-prefetchable 32 bit memory at 0x490c000.
  Bus  0, device   0, function  0:
    Memory: Galileo GT64011 (rev 17).
      Medium devsel.  Fast back-to-back capable.  Master Capable.  Latency=64.  
      Non-prefetchable 32 bit memory at 0x1000000.
      Non-prefetchable 32 bit memory at 0x1c000000.
      Non-prefetchable 32 bit memory at 0x1f000000.
      Non-prefetchable 32 bit memory at 0x14000000.
      I/O at 0x14000000.

NetBSD sounds like a good idea, so I decided to give that a try. It seems to be a very popular replacement for the old version of Linux that ships with the Qube. It appears to be RedHat Linux 5.2 which has been hacked to work on a MIPS processor with no standard display and I/O (i.e. keyboard and mouse).

I fired up the NetBSD 1.6.1 boot image on a machine I had handy and netbooted the Qube. Bam! Instant NetBSD server, right?

Wrong. After it rebooted itself, it never loaded the kernel :(

So, after playing around for a while, I decided to check out the 1.6 version instead of the 1.6.1 version and that seemed to work! It's nice finding out that your hardware isn't completely broken.

It turns out that running NetBSD 1.6.1 is possible, but you have to play around a bit to get it running. You have to tell the Cobalt PROM command interpreter that you want to run a different kernel:

Cobalt Microserver Diagnostics - 'We serve it, you surf it'
Built Tue May 25 15:58:41 PDT 1999

 1.LCD Test................................PASS
 2.Controller Test.........................PASS
 5.Bank 0:.................................16M
 6.Bank 1:.................................0M
 7.Bank 2:.................................0M
 8.Bank 3:.................................0M
 9.Serial Test.............................PASS
10.PCI Expansion Slot....................**EMPTY**
12.IDE Test................................PASS
13.Ethernet Test...........................PASS
16.RTC Test................................PASS

Cobalt: bfd /boot/netbsd.gz
Decompressing done
Executing bootloader kernel...

After that, it boots up normally. Not only that, but it starts mingetty right there on the serial interface, so you can login directly through the serial port!

USB Controller?

Hey! Anyone notice this in their startup messages:

VIA Technologies VT83C572 USB Controller (USB serial bus, revision 0x02) at pci0 dev 9 function 2 not configured

That right there is a driver detecting a USB host controller. That's pretty cool. It's right there on the PCI bus. I wonder how to use it.

If anyone has any information about how to utilize this device, let me know.

Serial Connection

The first time I hooked is up, I stupidly forgot a null modem adapter, and my terminal program just stared me in the face, not doing anything. If you don't have a null-modem adapter for your serial cable or a null modem cable lying around, go out to Radio Shack and buy one. If you're cheap or like that sort of thing, you can make your own null-modem cable.

Now, you need a terminal-emulation program. I used plain-old HyperTerminal on my windoze box, but you can pretty much use anything that can talk to a serial port (try Microcom on UNIX). Here are the settings that you need to use in order to connect:

115200 bps
8 bits
N parity
1 stop bit

I used basic TTY as the terminal type at first, but found that VT100 also works and has a bit more functionality when it comes to the arrow keys, etc. Make sure that you have the correct serial port selected (usually COM1) and that all your serial cables are plugged-in.

When you're ready to fire-up your Qube, have a pencil or something similarly pokie lying around. I used the stylus from my old-skool Palm III, which I still use. It works just fine.

Make sure you have easy access to the back of the Qube, since you'll be juggling several things at once. Read this whole paragraph before trying to do it. Start-up the machine with the pencil or stylus stuck into the small pencil-hole above the Serial port. As it it starting up, the LCD display will either say "Console ON" or "Console OFF". If it says "Consule OFF", then immediately turn off the machine and repeat the process. It should go to "Console ON" mode the second time.

Rear-view of the Qube 2
Rear-view of the Cobalt Qube 2. You can see the power, ethernet, and serial connections.

When the Qube boots, it emits some POST info to the console. It should look something like this:

Cobalt Microserver Diagnostics - 'We serve it, you surf it'
Built Tue May 25 15:58:41 PDT 1999

 1.LCD Test................................PASS
 2.Controller Test.........................PASS
 5.Bank 0:.................................16M
 6.Bank 1:.................................0M
 7.Bank 2:.................................0M
 8.Bank 3:.................................0M
 9.Serial Test.............................PASS
10.PCI Expansion Slot....................**EMPTY**
12.IDE Test................................PASS
13.Ethernet Test...........................PASS
16.RTC Test................................PASS

Of course, if you have more memory or something sitting in the PCI slot, then your startup message might be a bit different. The important point is that your serial serup is correct, and this'll help a lot when you want to know what's *really* going on.

If you press the space bar during the POST, you'll get this:

Cobalt:

There are several things you can do from this prompt, but the first one to know is:

Cobalt: ?
?                       - This menu
r[b,w,l] address        - Read byte, word, or long from address
w[b,w,l] address data   - Write byte, word, or long data to address
dm address n            - Display n bytes of memory from address
readrtc                 - Read time and date from the RTC
writertc YYMMDDWHHmmSS  - Write time and date to the RTC
                          YY: Year      MM: Month   W: Day of week (Sunday = 1)
                          HH: Hour (24) mm: Minute SS: Second
loadkernel              - load kernel image from serial port
boot                    - jump into loaded kernel
rm address              - loop read from address (reset to kill)
wm address data         - loop write to address (reset to kill)
wrm address data        - loop write/read from address (reset to kill)
bfd                     - boot kernel from DISK image
lcd [on,off,reset,clear]- lcd on, off, reset, clear
lcdr address            - Read DD RAM from address
lcdw address data       - Write byte to DD RAM address
br                      - Read the buttons
exp                     - Test the PCI Expansion Slot
setbfd, clearbfd        - Set or clear flag to bfd next reset
setlcd, clearlcd        - Set or clear flag to lcd test next reset
reset                   - Reset Board

The '?' command will print out all the commands that the PROM understands.