Flash BIOS of APU2c4

Updated for March 2017 BIOS

I recently purchased the latest version of the venerable PCEngines APU: the apu2c4.

The coreboot BIOS is still WIP, and the device I received had BIOS version 160307. I need PXE or iPXE support to kickstart CentOS 7.2, and luckily the latest BIOS version available (160311) supports iPXE.

Here is my rough guide to flash the APU2c4 BIOS, using Fedora 23 to make a flash drive.

sudo dnf install syslinux
# insert flash drive; find physical address
# assuming flash drive is /dev/sdb

sudo parted /dev/sdb mklabel msdos
sudo parted /dev/sdb mkpart primary fat16 2048s 2G
sudo mkfs.vfat /dev/sdb1
sudo dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb
sudo syslinux --install /dev/sdb1
sudo parted /dev/sdb set 1 boot on
cd ~; mkdir temp
sudo mount /dev/sdb1 temp/
cd temp/
sudo wget http://pcengines.ch/file/apu2-tinycore6.4.tar.bz2
sudo wget https://www.pcengines.ch/file/apu2_v4.0.7.rom.zip
sudo tar --no-same-owner xvf apu2-tinycore6.4.tar.bz2
sudo unzip apu2_v4.0.7.rom.zip
sudo rm -vf apu2-tinycore6.4.tar.bz2 apu2_v4.0.7.rom.zip
cd ..
sudo umount ./temp

# unplug flash drive from computer
# plug flash drive in to apu
# attach usb keyboard to apu
# power on apu

# press f10
# boot from usb drive
# you may notice some errors about autostart.sh and FAT partition, safe to ignore

sdb      8:16   1  14.8G  0 disk 
`-sdb1   8:17   1   1.9G  0 part /media/usbhd-sdb1

cd /media/usbhd-sdb1
flashrom -p internal -w apu2_v4.0.7.rom

# reboot after completion
# power on, press f10, choose iPXE


# proceed with iPXE goodness

Some additional reading and references:

APU1C4 serial to usb console

During an upgrade from pfsense 2.1.5 (FreeBSD 8) to pfsense 2.2 (FreeBSD 10), my AMD APU router became unresponsive using tools such as ping and ssh. It required connecting via serial console. Here’s a quick overview.

Model number of the board: PCEnginges APU1C4 T40E
USB to male serial: TRENDnet USB to RS-232 DB9 Serial Converter
Null model cable: DB9 RS232 Serial Null Modem Cable F/F (SCNM9FF)
Build reference: Unpacking and Assembling PC Engines APU

I have an older Lenovo Thinkpad T400 acting as a server running CentOS 7 that provides lightweight services such as DHCP, DNS, and iPXE to my LAN. To gain access to the router’s console, I plugged in the serial converter above to the Thinkpad and attached it to the null-modem cable that was hooked up to the router.

I verified on the laptop that everything was detected via dmesg | tail -10 and ls -l /dev/ttyUSB?, which showed the following:

$ dmesg | tail -25
[4643071.873119] usb 6-2: new full-speed USB device number 2 using uhci_hcd
[4643072.019109] usb 6-2: New USB device found, idVendor=067b, idProduct=2303
[4643072.019119] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[4643072.019126] usb 6-2: Product: USB-Serial Controller D
[4643072.019131] usb 6-2: Manufacturer: Prolific Technology Inc.
[4643072.128738] usbcore: registered new interface driver pl2303
[4643072.128766] usbserial: USB Serial support registered for pl2303
[4643072.128785] pl2303 6-2:1.0: pl2303 converter detected
[4643072.140519] usb 6-2: pl2303 converter now attached to ttyUSB0

$ ls -l /dev/ttyUSB?
crw-rw----. 1 root dialout 188, 0 Jan 24 17:59 /dev/ttyUSB0

To connect to the console, I used the following command:

screen /dev/ttyUSB0 115200

From there I was able to troubleshoot and debug as necessary on the pfsense shell.