Booting NetBSD on HP 620LX

Few weeks ago I got an opportunity to buy HP 620LX handheld PC. It is a small device based on Hitachi SH7709 SH-3 ~75MHz SoC with 16MB RAM, one CompactFlash slot and one CardBus (PCMCIA) slot. It also has an option to connect serial cable (cable comes with the device). The default operating system is Windows CE 2.0 (or 2.11 if you are lucky to find the ROM upgrade).

System was untested and didn’t have original power adapter, however was packaged in original box with most accessories available. Fortunately, the system booted successfully using 12V 1A adapter (the original adapter provides 2A if I am not mistaken), giving me an opportunity to test NetBSD on it. HP 620LX is supported by hpcsh port, which aims to run on various handheld devices based on SH-3/4 SoCs.

Installation process is not completely trivial on this type of devices. One important point is that booting NetBSD will completely reset Windows CE device, loosing all configuration and data, thus backup is required, if it contains something important to the user (not in my case). There’s no sysinst(8) support, CF memory card should be prepared in advance on another NetBSD system. The instructions are available here, even more detailed instructions can be found here (thanks @uwe for pointing this document in the mailing list). To make the long story short: two partitions should be prepared: one DOS partition of the “small” size (20-30MB), and at least one FFS partition for NetBSD root partition. The DOS partition needs to include kernel file and a boot loader application. Distribution sets should be extracted to the NetBSD partition(s) (at least base, etc IMHO), and initial configuration can be done for /etc/rc.conf, /etc/fstab, etc.

Once everything is ready, hpcboot.exe needs to be executed from Windows CE. Choosing the right bootloader executable appeared to be the first challenge though. Installation directory in the port’s distribution contains sh3-hpcboot.exe and sh4-hpcboot.exe with seemingly the obvious choice for SH-3 based device. The caveat is that the binary is build for Windows CE 2.11 and above, and it fails to run on Windows CE 2.0. My initial fear was that I would need to build one myself with the right tools. Fortunately, I found one in the NetBSD code instead. It is uuencoded, thus should be decoded first by running command uudecode -o hpcboot.exe hpcboot200.exe.uue. The bootloader program allows to choose the device and several boot flags, and after few seconds NetBSD boot messages appear on the screen. On initial boot I faced the second issue, related to disk labels. The main reason was that my FFS partition was not labeled as wd0a. It appeared to be an easy fix sudo disklabel -e /dev/rsd3 (rsd3 may differ on your device) and just edit and save label from f->a (in my case) in the opened editor. Soon after I had a properly booting system and could successfully login to the system. Here the final configuration can be performed, like creation of users, setting the passwords, etc.

What’s next? First of all, I plan to add hpc200.exe to distribution files. After, I would like to enable some of my pcmcia devices (wifi card and SATA card), test network, test serial, and just to keep port a little bit more alive! Time will tell.

Enjoy dmesg below for now:

NetBSD 10.99.9 on HP 620LX

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.

NetBSD 10.99.9 (GENERIC) #0: Wed Oct 4 07:51:36 UTC 2023
HP 620LX
total memory = 16384 KB
avail memory = 12896 KB
timecounter: Timecounters tick every 15.625 msec
mainbus0 (root)
cpu0 at mainbus0: SH3 73.728 MHz PCLOCK 18.432 MHz
cpu0: 16KB/16B 4-way set-associative I/D-unified cache.
cpu0: U0, P0, P3 write-back; P1 write-through
cpu0: 4-way set-associative 128 TLB entries
cpu0: VPN mode, multiple virtual storage mode
btnmgr0 at mainbus0
wskbd2 at btnmgr0 mux 1
shb0 at mainbus0
rtc0 at shb0
scif0 at shb0
adc0 at shb0
j6x0tp0 at adc0
wsmouse0 at j6x0tp0 mux 0
wskbd1 at j6x0tp0 mux 1
j6x0lcd0 at shb0: brightness 21, contrast 21
hd64461if0 at shb0
hd64461video0 at hd64461if0: frame buffer = 512 KB , console
hpcfb0 at hd64461video0: 640×240 pixels, 256 colors, 80×24 chars
wsdisplay0 at hpcfb0 kbdmux 1: console (std, vt100 emulation)
wsmux1: connecting to wsdisplay0
wskbd2: connecting to wsdisplay0
wskbd1: connecting to wsdisplay0
hpcfb: 640×240 pixels, 256 colors, 80×24 chars
hpcfb: 640×240 pixels, 256 colors, 80×24 chars
hpcfb: 640×240 pixels, 256 colors, 80×24 chars
wsdisplay0: screen 1-3 added (std, vt100 emulation)
hd64461pcmcia0 at hd64461if0
com0 at hd64461if0autoconfiguration error: : device problem. don’t attach.
pfckbd0 at mainbus0
hpckbd0 at pfckbd0
wskbd0 at hpckbd0: console keyboard, using wsdisplay0
hpcapm0 at mainbus0: pseudo power management module
apmdev0 at hpcapm0: Power Management spec V1.2
timecounter: Timecounter “tmu_pclock_4” frequency 4608075 Hz quality 0
timecounter: Timecounter “clockinterrupt” frequency 64 Hz quality 0
pcmcia0 at hd64461pcmcia0
pcmcia1 at hd64461pcmcia0
wdc0 at pcmcia1 function 0:
wdc0: memory mapped mode
WARNING: system needs entropy for security; see entropy(7)
atabus0 at wdc0 channel 0
wd0 at atabus0 drive 0
wd0: drive supports 1-sector PIO transfers, LBA addressing
wd0: 488 MB, 993 cyl, 16 head, 63 sec, 512 bytes/sect x 1000944 sectors
wd0: 32-bit data port
swwdog0: software watchdog initialized
WARNING: 1 error while detecting hardware; check system log.
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
entropy: best effort