Linux on my Ultra 5 box

 :linux:drawing_00.png Since more than 6 month my server is a Sun Ultra5 running linux. My first exotic linux box was a Playstation 2, a very good and fun experience but I undoubtedly think that the gaming console hardware is not intended to be used 24/24h every days. That’s the reason why I bought a cheap second hand Ultra5.

I’ve drawn this funny character by using Inkscape on my Ultra 5.

Why an Ultra5 ? First of all I looked for a non X86 hardware (linux on X86 is not fun at all... too easy). And this sun harware uses cheap interfaces for expansion boards and disk drives. The Ultra 5 has PCI slots, IDE drives and standard DB9 VGA output. Very good for a cheap server (that I was looking for) and for purists, you can probably manage to have a PCI scsi interface working.

Nevertheless, after few months I found this box very interesting and I use it very often to listen to music, for watching videos, even for running some graphics softwares and especially to write code.

I wrote this page to give more details on this workstation. Note that this article also applies to the Sun Ultra 10.

Base hardware and first boot

Genuine Sun hardware in my box :

  • CPU UltraSparc IIi at 360MHz
  • 192Mo Ram (60ns)
  • Genuine 8GB Seagate HDD
  • 10/100Mbits integrated ethernet I/F (Sun Happy Meal Ethernet)
  • ATI 3D Rage pro Turbo PCI graphics
  • Crystal CS4231 (sbus) sound chip
  • 200W ATX supply

These are the main features, for detailed information please go to the Sun documentation website.

First boot issues

If you does not see any picture on the screen try to tweak a parameter in the OpenBoot PROM (OBP).

(I had this problem since I plugged a very cheap unbranded CRT monitor on my Ultra 5 box)

enter the prom by pressing (STOP + A) on the keyboard. the ‘STOP key’ is the same as ‘L1 key’, depending of your keyboard.

Try to blind enter the following command :

setenv output-device screen:r1024x768x75

or at least, your monitor should support the following parameters:

setenv output-device screen:r640x480x60

Tip : to be sure you can access the OBP, press STOP + L1 wait few seconds, type ‘reboot’ and the machine should restart.

All useful commands can be easily found on the web.


The famous /proc/cpuinfo file...

stellae@spark:~$ cat /proc/cpuinfo
cpu             : TI UltraSparc IIi (Sabre)
fpu             : UltraSparc IIi integrated FPU
promlib         : Version 3 Revision 31
prom            : 3.31.0
type            : sun4u
ncpus probed    : 1
ncpus active    : 1
Cpu0Bogo        : 719.25
Cpu0ClkTck      : 0000000015752a00
MMU Type        : Spitfire

and the /proc/interrupts

stellae@spark:~$ cat /proc/interrupts 
  0:    7379854  timer:dead
  4:     693106  su(mouse):7ea, ide0:7e0
  5:    6460957  eth1:7e1
  9:      29919  su(kbd):7e9
 12:          0  serial(sab82532):7eb
 13:          0  cs4231:7e3
 14:     432637  cs4231:7e4
 15:         32  SABRE UE:7ee, SABRE CE:7ef, SABRE PCIERR:7f0, power:7e5


Watch movies with VLC (Video: mpeg4, yuv420p, 320×240, q=2-31, 768 kb/s, 29.97 fps Audio: aac, 24000 Hz, stereo, 64 kb/s), play with gnuboy (game boy emulator) and even have a look at the ascii world cup (Germany wcup 2006 streamed in ascii through telnet), yes you can do it with an Ultra 5.

Working Applications

For the moment, I’m running a Debian Sarge with the following kernel :

Linux spark 2.4.27-2-sparc64 #1 Mon Aug 22 21:07:44 UTC 2005 sparc64 GNU/Linux

Debian support for the Ultra 5 is very complete.

Most interesting applications built from source :

(Obviously, I only mention here apps I’ve build which are not included in the Debian package repository)

  • cris-axis linux sdk
  • gbdk (game boy C compiler)
  • GP2X official toolchain (successfully compiled but not yet tested)
  • Seti-Boinc & cpulimit (but I no longer use it since the ultra 5 is not the ultimate “MIPSful” machine for seti)

Sound on the Ultra5

Add “cs4231” at the and of your /etc/modules file (for debian users)

Check if all users have access to the /dev/dsp : “chmod it” if necessary.

To select audio output :

audioctl -w play.port=1
play.port: -> 0x1 (speaker (0x1))
audioctl -w play.port=2
play.port: -> 0x2 (headphone (0x2)

Note that you can’t install ALSA with the Debian 2.4.27-2-sparc64 kernel but it works with a 2.6 kernel (since it includes some snd-*.ko modules required for ALSA).

Extra hardware

I’ve added this hardware to my workstation.

  • 2 x brand new 3com PCI 10/100Mbit Ethernet (3c905C-TX/TX-M [Tornado] (rev 78)) handled by the 3c59x driver (directly installed by Debian, not fun at all...)

I use mainly this workstation as ftp/http server but I plan to add more networking functionalities (gateway/router/dns cache/wifi AP...).

  • An extra HDD (a cheap Maxtor IDE ATA 80GB/8MB cache)

Here is an extract of the “hdparm -i” command

Model=Maxtor 6L080P0, FwRev=BAJ41G20, SerialNo=L212FKDG
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
 BuffType=DualPortCache, BuffSize=8192kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=160086528
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 *mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 udma6 
 AdvancedPM=yes: disabled (255) WriteCache=enabled

Note that ‘cfdisk’ is not included in the debian boot disk and and don’t clearly understand why... Nevertheless, I’ve build it from source and it’s work great (I use it for my 80GB hdd)

You can download my “sparc fdisk binary” : fdisk_shared (requires ncurses)

libncurses.so.5 => /lib/libncurses.so.5 (0x7002c000)
libc.so.6 => /lib/libc.so.6 (0x70084000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000)
  • USB pci cards are also know too work but I’ve not tried for the momment.

Writing kernel modules on the ultra 5

The Ultra 5 has a 64bits CPU which can also run native 32bits application. The linux kernel space is in 64bits whereas application in the user space are 32bits executables.

You can see this difference by using the “file” command :

on a kernel module

stellae@spark:/lib/modules/2.4.27-2-sparc64/kernel/drivers/ide$ file ./ide-disk.o 
./ide-disk.o: ELF 64-bit MSB relocatable, SPARC V9, version 1 (SYSV), not stripped

and on an executable binary file

stellae@spark:/bin$ file ./ls
./ls: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), for GNU/Linux 2.2.0,
dynamically linked (uses shared libs), stripped

That the reason why you have to use the “-m64” compiler flag to build modules (Note that the “-m64” can’t work for building executables...).

You can try this example (the Makefile is just right after the source code).

 *  hello-1.c - The simplest kernel module.
#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */
#define DRIVER_AUTHOR "Peiter Jay Salzman <p@dirac.org>"
#define DRIVER_DESC   "A sample driver"
int init_module(void);
void cleanup_module(void);
int init_module(void)
        printk(KERN_INFO "Hello world 1.\n");
         * A non 0 return means init_module failed; module can't be loaded. 
        return 0;
void cleanup_module(void)
        printk(KERN_INFO "Goodbye world 1.\n");
/*  You can use strings, like this:
 *   */
MODULE_LICENSE("GPL");           // Get rid of taint message by declaring code as GPL.
/*  Or with defines, like this:
 *   */
MODULE_AUTHOR(DRIVER_AUTHOR);    // Who wrote this module?
MODULE_DESCRIPTION(DRIVER_DESC); // What does this module do?
/*  This module uses /dev/testdevice.  The MODULE_SUPPORTED_DEVICE macro might be used in
 *   *  the future to help automatic configuration of modules, but is currently unused other
 *    *  than for documentation purposes.
 *     */

and the associated Makefile

# linux sparc64 basic module makefile example
# rem for sparc64 by N. Lemouel 
WARN    := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CC      := gcc-3.3
OBJS    := ${patsubst %.c, %.o, ${wildcard *.c}}
all: ${OBJS}
.PHONY: all
            rm -rf *.o

You can now test your basic module, as root execute the following commands :

spark:/home/stellae/devels/module/basic# insmod ./hello-1.o 
spark:/home/stellae/devels/module/basic# rmmod hello-1  
spark:/home/stellae/devels/module/basic# cat /var/log/messages | tail -n 5
Nov  3 00:46:13 localhost kernel:   MII transceiver found at address 24, status 7809.
Nov  3 00:46:13 localhost kernel:   Enabling bus-master transmits and whole-frame receives.
Nov  3 00:46:13 localhost kernel: 02:01.0: scatter/gather enabled. h/w checksums enabled
Nov  3 00:46:22 localhost kernel: Hello world 1.
Nov  3 00:46:33 localhost kernel: Goodbye world 1.

Article by Stellae (N. Lemouël) November, 2nd 2006 website@stellae.fr

linux/sun4u_en.txt · Dernière modification: 2006/12/22 08:45
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki