Apu2c4 an Openbsd Hacking Project

Aug 22, 2018  

I ran into some trouble tracking down reliable info about getting my APU2 setup from scratch as a newcomer to this particular series of board. They are great little boards with 4 GB of ram and a quad core jaguar AMD processor.

Note: these instructions may be incomplete, and you’ll need to rely on your own technical prowess and hacker spirit to complete the exercise outlined below. This post is mostly for my own reference later.

The build

Component Source Link Price
APU.2C4 system board (GX-412TC quad core / 4GB / 3 Intel GigE / 2 miniPCI express / mSATA / USB / RTC battery) PC Engines apu2c4 $122
Enclosure (3 LAN, black, USB) PC Engines case1d2blku $10
AC adapter 12V 2A US plug PC Engines ac12veur2 $4.40
SSD M-Sata 16GB MLC, Phison S9 controller PC Engines msata16d $17
SD card 4GB pSLC Phison (MLC flash running in SLC mode) PC Engines, anywhere sd4b $6.6
Compex WLE200NX 802.11a/b/g/n miniPCI express wireless card PC Engines wle200nx $19
Pigtail cable I-PEX -> reverse SMA PC Engines pigsma 2 x $1.5
Antenna reverse SMA dual band PC Engines antsmadb 2 x $2.05
USB to DB9F adapter PC Engines USB-2920 $8.00
8GB USB Flash Drive Amazon, anywhere CZ50 $4.29

My Total: $202.68 USD plus shipping.

Create a bootable TinyCore USB BiosFlashing Key

I would recommend dedicating a stick to this so you can just add roms to it and then boot, flash, and go on with life.

Install the TinyCore flash image from here SHA256sum: 4b834077ec5da535b07ab7e17215eb8d64b71dbcfd3f9076d51252a0f7158f3c

The steps below for fdisk after the flash will setup a second partition that fills the remaining size of the usb key. This is necessary to warehouse the roms.

sudo dd if=apu-tinycore6.4.img of=/dev/sdb1 bs=1M progress=status
sudo fdisk /dev/sdb
p
n
p
[enter accepting default]
[enter accepting default]
w

Copy the ROM files to the flasher key

Now that you have a secondary partition filling the remainder of the USB key. Download and extract your ROM file to the secondary partition

ROM Download from PCEngines

sudo mkdir -p /mnt/apu-usb
sudo mount /dev/sdb2 /mnt/apu-usb
cp apu2_160311.img /mnt/apu-usb
sudo umount /dev/sdb2

Attach serial and boot

Serial via USB on OpenBSD

sudo pkg_add picocom
sudo picocom -b 115200 /dev/cuaU0

Serial via USB on Linux

sudo apt-get install picocom
sudo picocom /dev/ttyUSB0 115200

Update the BIOS

If the BIOS needs updating - the version displayed during boot is not the latest that’s on the PC Engines website - follow these steps:

  1. Power off the APU2
  2. Insert the USB flash drive to one of the APU2’s USB slots
  3. Connect the serial console cable
  4. Power on the APU2
  5. Press F10 to enter the APU2 boot menu. In the boot menu, opt to boot from the USB flash drive (usually option number 1)
  6. Once you get to a prompt, use flashrom to update the BIOS. Mount your usb parition found with lsblk
    • mkdir -p /mnt/roms && mount /dev/sdb2 /mnt/roms
    • The ROM file will be in /mnt/roms: flashrom -p internal -w /mnt/roms/apu2_160311.rom
  7. When verification is done, reboot the APU2 so changes take effect

Install OpenBSD

Bootable OpenBSD installation USB flash drive

  1. Download the OpenBSD installer, amd64/install63.fs (SHA256 fingerprint), file-system image (not ISO!) from one of the mirrors
  2. Insert the USB flash drive to the Mac, figure out which device it is (with lsblk, let’s assume it’s /dev/sdb2) and unmount it (sudo umount /dev/sdb2)
  3. Write the installer image to the flash drive: sudo dd if=install59.fs of=/dev/sdb2 bs=1M
  4. Eject the USB flash drive

Serial console settings for OpenBSD

Note: When prompted during OpenBSD installation, allow it to set com0 as the primary output.

Install OpenBSD

  1. Power off the APU2
  2. Insert the bootable OpenBSD installer USB flash drive to one of the USB slots on the APU2
  3. Power on the APU2, press F10 to get to the boot menu, and choose to boot from USB (usually option number 1)
  4. Also at the boot> prompt, press Enter to start the installer
  5. Follow the installation instructions

Firmware update

The driver used for wireless networking is athn(4). It might not work properly out of the box. Once OpenBSD is installed, run fw_update with no arguments. It will figure out which firmware updates are required and will download and install them. When it finishes, reboot.

Protip

Puchase or make your own USB disk caddy. Label these usb keys and file them away for future use should you need to reconstruct one of your creations.

USB Key Caddy hardshell case shot with labeled USB keys

Obligatory Hardware Shots

note: when i took this shot i had not realized the wifi card was in the msata slot. whoops :) plan accordingly and read the board labels.