NetBSD and the IBM Z50


NEWS FLASH (April 2002): The latest NetBSD kernel supports audio, LCD blanking and suspend operations on the Z50!!! Thanks to the NetBSD developers, you can now hear sound on the Z50 and save even more battery power! Download the kernel here at Greg Hughes' NetBSD page.

This page includes tips and tricks you can use to enhance your NetBSD experience on IBM Z50. You'll see some example screenshots of NetBSD in action, how to install NetBSD, how to enable the use of cursor keys when using X11, and how to enable audio under the NetBSD 1.5.1 distribution.

The Z50 is an NEC MIPS board, and handily runs a 'true' UNIX , the hpcmips version of the NetBSD port of BSD UNIX. This operating system will use nearly all available installed RAM (42984KB; 4MB of the 48MB RAM is for video at 640x480 at 16bpp)... you can also use Linux, which also supports sound, but not all the installed RAM.

This page also contains information on how to install and set up X and wireless networking on the Z50. You'll also find tips on how to quickly configure a laptop running Linux and using a compatible wireless PCMCIA card.

NetBSD and many of its programs will fit on a 96MB CF card, but perhaps the best is the 340MB microdrive... a complete install of NetBSD 1.5.1 requires 203MB, but includes compiler, man pages, games, and more; nearly 700 programs!;there are 1300 additional software packages available in the packages directory here (choose the hpcmips directory).

When running, NetBSD and X only require 15-17MBs of RAM... a swap file of 32-80MB is more than sufficient (i've only touched swap once, and that was when loading mozilla natively on the Z50)

What Does NetBSD and X Look Like on the Z50?

Here's a desktop screenshot of the twm window manager, along with some default clients (generated by my .xinitrc listing below).

Here's a screenshot of my favorite xmahjongg client.

Here's a screenshot when using my favorite text-based newsreader,slrn .

Here's a screenshot of Netscape running on the Z50 via wireless Ethernet; Netscape's X resource file was hacked to display tiny menus for
more screen real estate (simply edit Netscape.ad and change all occurrences of '120' to '80,' then copy the file to .Xdefaults in your home directory.

Here's a screenshot playing the ubiquitous UNIX game of hack.

Here's a screenshot of StarOffice 5.2 on the Z50 via wireless Ethernet.

The small titlebars for windows during the z50's NetBSD and X sessions were created by editing the default values in the tvtwm's resource file, system.tvtwmrc, which should be copied from /usr/X11R6/lib/X11/twm to your home directory as .tvtwmrc

My Setup

Z50 w/32MB upgrade (you may find one on Ebay for $100(US) or less).

IBM microdrive (340MB and 1GB, which allows swapping OSs)
[i also keep a Linux distribution on a 128MB CF card when i feel like using Linux]

D-Link DWL-650 (wireless LAN PCMCIA adapter). BTW, a nice feature of the newest NetBSD kernel (as of April 2002), allows you to suspend the Z50 by pressing its power button. The LCD will blank and the D-Link will turn off. When you press the power button again, your wireless connection is restored!

Linksys WPC11 (wireless LAN PCMCIA adapter also works as it uses a similar chipset to the D-Link card)

Adaptec 1460D SCSI PCMIA w/Yamaha 8424CDRW external drive

Xircom CF Ethernet adapter

Sandisk 192MB CF storage card

Kingston 128MB CF storage card

Installation

I downloaded and burned a CDR containing the hpcmips port of NetBSD 1.5.1 from www.netbsd.org; the base installation only requires 70MB of compressed files (and if you only use a 96MB compactflash, there is a ' tiny' base install that works well in less than 64MB); the files, in .tgz format (compressed tarballs) simply reside in the top level of the CD's directory

- take the microdrive and create a 20MB DOS partition and a partition of any type for the remainder of the disk (hint: make sure the partitions are formatted! under Linux:

[insert card]

fdisk /dev/hdX

(where X is the microdrive or CF device, such as )


[create the partitions]


mkfs -t msdos /dev/hdX1

mkfs -t ext2 /dev/hdX2
mount -t msdos /dev/hdX1 /mymountpoint
cp pbsdboot.exe /mymountpoint
cp nameofnetbsdinstallkernel /mymountpoint
cp nameofgregsz50netbsdkernel /mymountpoint
umount /mymountpoint
sync

[remove card]

- copy pbsdboot.exe, the NetBSD install kernel, and Greg Hughe's NetBSD w/trackpoint, audio and LCD blanking and suspend support onto the DOS partition (as above, perhaps using Linux)

- insert the microdrive into the Z50

- launch pbsdboot.exe , then select the NetBSD install kernel (it should be uncompressed, and 7MB or so in size); you should have enough memory allocated under CE by default (about 14MB) for RAM

- select the IBM Z50 workpad in the pbsdboot dialog (the boot utility supports many different CE devices); scroll through the list

- click the boot button; a memory map will be created, the kernel will load, and NetBSD will boot to an install

- follow the prompts to install (i'm not going to go into how to install NetBSD, because there are lots of directions available through www.netbsd.org - for specifics, download the netbsd user's guide in PostScript, Rtf, or HTML) here:

A 340MB microdrive is *perfect* (costs about $100 new on ebay)

If you use a 1GB microdrive, you'll need to make the root partition ('/') use nearly the entire drive, leaving 80-100 MB for swap; for some reason, the hpcmips port won't/can't use /dev/wd0b as swap if /usr is on /dev/wd0e... (hint: to resize, set the other partitions to type of 'unused')

After partitioning, make sure the CD-ROM is turned on, then insert the Adaptec PCMCIA card... NetBSD will recognize the card... select the cdrom install... change the directory to '/', and the installer will load the files from CD-ROM (note: there are other ways to install, such as using a Xircom CF card; if you have broadband access, you can actually install onto the z50 via the Internet by configuring the card for your LAN and using the proper gateway and DNS IP addresses!)

- after the install finishes (the files copied to the drive, creating a root password, setting the timezone, etc.), remove the adapter, and reboot...

HINT: hold down the Shift key while rebooting to avoid the insipid CE setup screens)

- launch pbsdboot, but this time, select greg hughe's kernel

- login as root

- launch an X session like this:

startx -- -dev /dev/ttyE0

(note: for some people, 

startx -- -dev=/dev/ttyE0

also seems to work)

ENJOY!!!

10 Tips for NetBSD on the IBM Z50

1. Need more info on using NetBSD? check out the user's guide .

2. Don't use CE on the Z50? Just take out the two AAA batteries! You don't need them!

3. Here's how to configure a D-LINK DWL-650 card for wireless operation (assuming /etc/resolv.conf, /etc/mygate and /etc/hosts are configured for your LAN; i routinely use my Z50 even with Linux, BSD and Windows 'puters on the LAN; use SAMBA utilities to mount shared windows volumes, transfer files, and print):

wiconfig wi0 -p 3 -f 3 -n LINUX -t 3
ifconfig wi0 192.168.1.5 netmask 255.255.255.0 up

(the -n entry sets the net name to "LINUX"; the device is not eth0 (like under Linux), but wi0 under NetBSD)

4. Here's a script you can make executable that shows how to set up two pcmcia cards in a laptop running Linux to forward packets so you can browse the Internet wirelessly on the Z50:

# first, take down the wired pcmcia ethernet adapter on the LAN
ifconfig eth0 down
# now bring up eth0 using the laptop's hostname
ifconfig eth0 laptop_hostname up
# now set the default gateway (which should be forwarding packets)
route add default gw your_gateway
# now take down the D-Link or Linksys wireless LAN card
ifconfig eth1 down
# configure the card
iwconfig eth1 essid "YOURNETNAME"
# put the card in ad-hoc mode
iwconfig eth1 mode Ad-hoc
# attempt to set a rate (you can also use 'auto')
iwconfig eth1 rate 11M
# display settings
iwconfig eth1
# now bring card up using the below IP
ifconfig eth1 192.168.1.4 netmask 255.255.255.0 up
# ensure ipchains service is available
/etc/rc.d/init.d/ipchains start
# enable forwarding
echo 1 >/proc/sys/net/ipv4/ip_forward
# forward packets to the wireless LAN
ipchains -A forward -s 192.168.1.0/24 -j MASQ

(of course, you might be using iptables instead!)

5. here's a nice .xinitrc file for starting X11:

# set the background/root window to a favorite picture
xpmroot $HOME/graphics/640x480.xpm

# launch clock face in upper right corner of display
exec xclock -geometry 120x120-0+0 -fg yellow -bg red -hd yellow -hl yellow -update 1&

# create current month's calendar below clock
exec cal | xmessage -geometry +502+145 -fn 6x9 -bg yellow -file - -title "Calendar" &

# be a 'show off,' and freak out CE users
exec xlogo -geometry 65x65+570+395 -shape -fg red &

# put up a system monitor: ram, cpu, disk, serial activity
exec xosview -disk -font 5x7 -geometry 135x94+502+277 &

# a terminal window
exec rxvt -ls -geometry 80x32+0+0 -fn 6x13 -bg lightyellow &

# launch the X window manager
exec twm

6. Here are two ways to enable cursor key use. A 'quick and dirty' approach is to modify the function keys:

Put the following into the .Xmodmap file in your home directory. These entries map the z50's cursor keys to function keys F9-F12:

           keycode 95 = Up
       keycode 75 = Left
       keycode 76 = Right
       keycode 96 = Down

A second and better way is to use the xkbcomp X client in .xinitrc (which resides in your home directory) BEFORE starting your X window manager (i use twm as it is easy on system resources):

        xkbcomp -R/usr/X11R6/lib/X11/xkb/ $HOME/.mykeymap :0

This uses .xinitrc to load a custom keymap to remap the cursor keys; this is all standard X stuff, but here's how to get your cursor keys working using the above .xinitrc entry (note that key repeat is not implemented, sorry)...

- put the following into a file named .mykeymap:

default xkb_keymap "us" {
    xkb_keycodes        { include "xfree86"             };
    xkb_types           { include "default"             };
    xkb_compatibility   { include "default"             };
    xkb_symbols         { include "us(pc105)"           };
    xkb_geometry        { include "pc"                  };
};

- next, edit the file /usr/X11R6/lib/X11/xkb/keycodes/xfree86 and change:

maximum= 134;

to:

maximum= 217;

and:

<UP>   =  98;
<LEFT> = 100;
<DOWN> = 104;
<RGHT> = 102;

to:

<UP>   =  208;
<LEFT> = 211;
<DOWN> = 216;
<RGHT> = 213;

- save the file and use the xkbcomp line as shown above in your .xinitrc file... when you start X, the server will zap the new keyboard into your session, and your Z50's cursor keys will work!

7. Various Hardware Tips

- the full NetBSD install (with X, compiler, development libraries, games, manual pages) will leave 110MB free on a 340MB microdrive; take into consideration that I use a 10MB VFAT partition for on the drive for the initial install kernel and the audio-enabled kernel.

- com0 is recognized as a serial port; wd0 is the drive

- the Targus CF to serial I/O card works

- various PCMCIA modem cards work (although it is probably best to use low-power CF-type cards to save battery power)

- a Xircom CF Ethernet adapter is best (for CE or NetBSD); insert the adapter, then use ifconfig to configure the card; it takes three seconds - unlike windows, etc. there is no rebooting; everything is done 'on-the-fly'

- to get around the 640x480 screen size limitation you can use the tvtwm window manager to get a 1280x960 X11 desktop on the z50!

- i routinely use StarOffice on my z50 wirelessly via the LAN!

8. copy Netscape's Netscape.ad file and edit all instances of '120' to '80,' then copy it as .Xdefaults on your server box... when you launch Netscape off your server like this:

       netscape -geometry 640x480 &

You'll have a perfect browser window with 'tiny' menus... use the View menu to remove unwanted menu bars, and set Netscape under Preference to use text instead of icons - you'll get a *lot* more screen real estate... use 630x470 to leave a little room for access to twm's menu... [you need a blank area of desktop when you click the mouse]. Note that this won't work for Mozilla (I'm working on a fix).

9. Here's how to get audio working on the 1.5.1 NetBSD distribution. You'll need to install 1.5.1, then download Greg's Trackpoint/LCD suspend/audio kernel (link is at top of this page). After installation, use the following command lines to create the missing audio devices:

su -
cd /dev
mknod audio0 c 48 128
mknod audioctl0 c 48 192
mknod mixer0 c 48 16
mknod sound0 c 48 0

Use the chmod command to change the device permissions to 666 to allow regular users to play sound.

10. OK, this one isn't about NetBSD, but you should know that Linux is supported on the z50 (even audio for playing mp3s!), but at this time, only supports and will only use 16MB of RAM, even if you have 48MB installed (4MB is a video ram 'hole' in memory); however, if you only use Linux as an X terminal, there's no need for much memory, as applications are launched off the server, use the server's cpu, disk and RAM, but display on the z50... Linux also supports the Xircom network card, but the latest distribution i've been able to find does not support any wireless card operation.  I have a fairly complete distribution, and it fits on a 128MB compact flash card.

I prefer NetBSD on the Z50, because i can do MIPS development, rebuild the kernel, compile programs, test portability applications, and port clients to NetBSD on the z50...

As you can see, the z50 is *much,* *much* more than an outdated CE HPC, and is truly a hacker's dream tool! if i had the money, i'd snarf every one i could get my hands on, because of the display, keyboard, and the fact that it can do things that IBM said were 'impossible,' such as using an external drive...

Hope this information helps someone using NetBSD on the Z50!

Links:

Here's my experience   using a simple, but effective design for building a 2.4Ghz vertical collinear omnidirectional antenna for my wireless lan.


Here's a precompiled binary compressed tarball of fetchmail (install as root from the root directory; e.g. cd /;tar xvzf fetchmail.tgz)


Here's a precompiled binary compressed tarball of xmahjongg (install as root from the root directory; e.g. cd /;tar xvzf xmahjongg.tgz)

(hint: launch xmahjongg like this: xmahjonng -t small to size the board perfectly for the Z50)

The IBM hardware manual for the Z50 may be found here . (along with other information

Here's a talking clock for the new NetBSD Z50 audio-enabled kernel.

Here's my homepage .

Questions? Mail to:

main(){int j=-1;char t[]="rfnqyt?%ggfqqEyz}3twl\n";
while(t[j]!='\n'){putchar(t[++j]-'\05');}return 0;}
 

(you should know how to use the above to reach me)