OpenBSD 3.7 on WRAP

OpenBSD 3.7

This is supposed to be a HOWTO for OpenBSD 3.7 on a PC Engines WRAP, a small single board computer optimized for wireless access and network routing applications, similar to the Soekris net4801. I have just started playing around with my WRAP board, so expect more information on this page in the next days and weeks...

There will be an update for OpenBSD 3.9 in a couple of weeks.

Index

  1. Hardware
  2. Installation
  3. Hardware
  4. Files
  5. Weblinks
  6. Credits

1. Hardware

I have bought the WRAP.1E revision of the board, which has the following specifications:

PC Engines WRAP.1E-2

2. Installation

I'm using a 512MB Kingston Elite PRO CompactFlash card to do a "normal" full OpenBSD installation on the WRAP. I you want to use a small CompactFlash card, you can also use a stripped down version of OpenBSD, like OpenSoekris or Flashdist.

2.1 Installation on a CompactFlash card

This is a very short version of the installation on a CF card, I will write a better one in the next days:

  1. Get at least a 256MB CompactFlash card, 512MB is recommended.
  2. Get a CF card reader, connect it to your computer (typically via the USB) and insert the CF card.
  3. Boot the first OpenBSD installation CD-ROM.
  4. TODO: Explain how to use disklabel(8) and set the geometry of the CF card. This is a bit tricky sometimes.
  5. Install OpenBSD on /dev/sd0.
  6. When prompted if you want to redirect the serial console to com0 enter yes and choose a baud rate of 38400.
  7. The installer used /dev/sd0 as the CF device, but the WRAP board detects the card as /dev/wd0, so you have to modify /etc/fstab:
    # echo '/dev/wd0a / ffs rw 1 1' > /mnt/etc/fstab
  8. Halt the WRAP and connect the serial port with another computer.
  9. Start a terminal emulation like tip or minicom, configure it to 38400 baud and boot your WRAP. You should see the WRAP BIOS and the OpenBSD boot message:
    PC Engines WRAP.1C v1.03
    640 KB Base Memory
    130048 KB Extended Memory
    
    01F0 Master 848A SAMSUNG CF/ATA
    Phys C/H/S 1010/16/63 Log C/H/S 1010/16/63
    
    01F0 Master 848A SAMSUNG CF/ATA
    Phys C/H/S 1010/16/63 Log C/H/S 1010/16/63
    Using drive 0, partition 3;
    Loading;...
    probing: pc0 com0 com1 pci mem[640K 63M a20=on]
    disk: hd0
    >> OpenBSD/i386 BOOT 2.06
    -
    com0: 38400 baud
    switching console to com0
    
    [...]
    
  10. The basic installation is now finished and we can continue with more advanced configuration.

2.2 Memory based file system

Consumer CompactFlash cards are not built for many write cycles, so you will damage your card, if you use it like a normal hard disk. The solution is to use a memory based file system for /tmp, /var and /dev. Therefore, we create a prototype directory for /var, copy /var to /proto/var and create a new /prot/dev directory. To save some space, we do not need an extra partition for /tmp, instead we symlink it to /var/tmp.

# mkdir /proto
# cp -rp /var /proto/var

# mkdir /proto/dev
# cp /dev/MAKEDEV /proto/dev
# cd /proto/dev
# ./MAKEDEV all

# rm -rf /tmp
# ln -s /var/tmp /tmp

Now we have to edit the /etc/fstab to mount the memory file systems and to set the "noatime" option for /. (When you have configured your system and installed all packages you need, you can also mount / read only.) Your /etc/fstab should look like that:

/dev/wd0a    /        ffs    rw,noatime                                               1 1
swap         /var     mfs    rw,-P=/proto/var,-s=65535,noexec,nosuid,nodev,noauto     0 0
swap         /dev     mfs    rw,-P=/proto/dev,-s=1200,-i=128,noexec,nosuid            0 0

The `noauto' option for /var in /etc/fstab was nescessary, because it was double mounted through /etc/rc. More infos on Jonathan's blog...

You can reboot your WRAP now. OpenBSD should now use a copy of /proto/var and /proto/dev to /var and /dev on every mount. Be aware that /var is lost after every umount or reboot!

If you want, you can resync /var with /proto/var on shutdown. Just install rsync(1) and put the following line into your /etc/rc.shutdown:

/usr/local/bin/rsync -va /var/ /proto/var/

When you have to reboot your machine, you will no longer loose your /var data on the memory based filesystem, because everything is synced with /proto/var on shutdown. This will not help you on system crashes and power loss. If you want to make sure not to loose the whole current data on /var, just install a cronjob that syncs the two directories regulary.

2.3 BIOS update

OpenBSD 3.7 detects only 64MB of the available 128MB RAM, because of a bug in WRAP's BIOS (version 1.03 is the default for the WRAP.1E). This was fixed with firmware version 1.07 (1.08 is the newest version, status quo on 2005-05-15), which is available from PC Engines. This is the boot message with the old 1.03 BIOS:

PC Engines WRAP.1C v1.03
640 KB Base Memory
130048 KB Extended Memory

01F0 Master 848A SAMSUNG CF/ATA
Phys C/H/S 1010/16/63 Log C/H/S 1010/16/63

01F0 Master 848A SAMSUNG CF/ATA
Phys C/H/S 1010/16/63 Log C/H/S 1010/16/63
Using drive 0, partition 3;
Loading;...
probing: pc0 com0 com1 pci mem[640K 63M a20=on]
disk: hd0
>> OpenBSD/i386 BOOT 2.06
-
com0: 38400 baud
switching console to com0

[ using 465076 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2005 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 3.7 (GENERIC) #50: Sun Mar 20 00:01:57 MST 2005
deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by National Semi ("Geode by NSC" 586-class) 267 MHz
cpu0: FPU,TSC,MSR,CX8,CMOV,MMX
cpu0: TSC disabled
real mem  = 66695168 (65132K)
avail mem = 53452800 (52200K)
using 839 buffers containing 3436544 bytes (3356K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(ac) BIOS, date 07/13/04, BIOS32 rev. 0 @ 0xfc554
pcibios0 at bios0: rev 2.1 @ 0xf0000/0x10000
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
[...]
Mon May 16 11:24:41 CEST 2005

OpenBSD/i386 (krypton.intra.kaschwig.net) (tty00)

login:

Now I will describe how to update the BIOS via the XMODEM protocol over the serial port. I used Debian Sarge, the `minicom' terminal emulation and `sx' (included in the RZSZ package) which is available for most Unix-like systems, but of course you can use your favourite OS and terminal program. Make sure to use XMODEM upload with 128 byte or 1 kbyte packet size in CRC mode. As a nice side effect of the BIOS update, my WRAP with the new firmware v1.08 now supports PXE network booting.

  1. Get the firmware update from PC Engines (http://www.pcengines.ch/wbios108.zip).
  2. Install the `lrzsz' package.
  3. Extract the ZIP file (wbios108.zip).
  4. Start `minicom'.
  5. Configure the file transfer protocol options of `minicom' (CTRL-A O, then select `File transfer protocols', press `C' and configure `sx' to "/usr/bin/sx -X --1k -vv").
  6. Boot or reboot your WRAP.
  7. Press `S' during the memory test to enter setup.
  8. Press `X' in the setup menu.
  9. Enter `CTRL-Z S' for file transfer.
  10. Choose `xmodem' upload.
  11. In the file menu, go to the directory where you have extracted the firmware ZIP-file and choose the file `WRAP1.UPD'.
  12. Now the firmware upgrade should start.

The whole procedure should look like this:

PC Engines WRAP.1C v1.03
640 KB Base Memory
130048 KB Extended Memory

01F0 Master 848A SAMSUNG CF/ATA
Phys C/H/S 1010/16/63 Log C/H/S 1010/16/63

WRAP setup

(9) 9600 baud *3* 38400 baud (5) 57600 baud
*C* CHS mode (L) LBA mode
(X) Xmodem upload (Q) Quit
Start XMODEM transmission... C.
OK
WRAP flash update
Flash ID
Erase Program Verify
Flash updated successfully.
(9) 9600 baud *3* 38400 baud (5) 57600 baud
*C* CHS mode (L) LBA mode
(X) Xmodem upload (Q) Quit

(9) 9600 baud *3* 38400 baud (5) 57600 baud
*C* CHS mode (L) LBA mode
(X) Xmodem upload (Q) Quit
Save changes Y/N ?
Writing setup to flash... OK

PC Engines WRAP.1C/1D/1E v1.08
640 KB Base Memory
130048 KB Extended Memory

01F0 Master 848A SAMSUNG CF/ATA
Phys C/H/S 1010/16/63 Log C/H/S 1010/16/63
ROM segment 0xe000 length 0x8000 reloc 0x00020000
Etherboot 5.3.12 (GPL) http://etherboot.org
Drivers: NATSEMI   Images: NBI PXE   Exports: PXE
Relocating _text from: [00089370,0009b230) to [07eee140,07f00000)
Boot from (N)etwork (D)isk or (Q)uit?

Using drive 0, partition 3;
Loading;...
probing: pc0 com0 pci mem[640K 127M a20=on]
disk: hd0
>> OpenBSD/i386 BOOT 2.06
-
com0: 38400 baud
switching console to com0

[ using 465076 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2005 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 3.7 (GENERIC) #50: Sun Mar 20 00:01:57 MST 2005
deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by National Semi ("Geode by NSC" 586-class) 267 MHz
cpu0: FPU,TSC,MSR,CX8,CMOV,MMX
cpu0: TSC disabled
real mem  = 133804032 (130668K)
avail mem = 115597312 (112888K)
using 1658 buffers containing 6791168 bytes (6632K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(fa) BIOS, date 05/02/05, BIOS32 rev. 0 @ 0xfc5f2
pcibios0 at bios0: rev 2.1 @ 0xf0000/0x10000
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xe0000/0x8000
[...]
Mon May 16 12:36:56 CEST 2005

OpenBSD/i386 (krypton.intra.kaschwig.net) (tty00)

login:

3. WRAP special features

3.1 GPIO pins

You can read and write the GPIO pins of the WRAP with gpioctl(8) to activate or deactivate the three LEDs and read the state of the button on the front of the WRAP board.

LED 1

Activate LED 1:

# gpioctl -c 2 pp out
Turn LED 1 on:
# gpioctl 2 0
Turn LED 1 off:
# gpioctl 2 1

LED 2

Activate LED 2:

# gpioctl -c 3 pp out
Turn LED 2 on:
# gpioctl 3 0
Turn LED 2 off:
# gpioctl 3 1

LED 3

Activate LED 3:

# gpioctl -c 18 pp out
Turn LED 3 on:
# gpioctl 18 0
Turn LED 3 off:
# gpioctl 18 1

Button

You can read the state of the small button on the front of the WRAP with gpioctl(8). A state of `0' means, that the button is pressed.

# gpioctl 40
pin 40: state 1

# gpioctl 40
pin 40: state 0

3.2 LM77 thermal sensor

You can get the actual cpu temperature with sysctl(8):

# sysctl -n hw.sensors.0
lmtemp0, TEMP, temp, 38.00 degC / 100.40 degF

3.3 Hardware watchdog

The GEODE CPU includes a hardware watchdog that reboots the machine when it hangs. Read watchdog(4) for more information. If you want to use the watchdog timer of your WRAP, just enter kern.watchdog.auto=1 and kern.watchdog.period=60 into /etc/sysctl.conf. The CPU will reboot the WRAP if it hasn't heard from the kernel in 60 seconds. You can also activate the watchdog timer with sysctl(8):

# sysctl -w kern.watchdog.auto=1
# sysctl -w kern.watchdog.period=60

4. Files

5. Weblinks

6. Credits

I'd like to thank: Jonathan Weiss, Johan Fredin


Author:      Thomas Kaschwig <thomas (at) kaschwig (dot) net>
Created:     Sat May 14 11:26:42 CEST 2005
Last update: Sun Jul 09 17:44:23 CEST 2006
This page is available under the terms of the GNU Free Documentation License.