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
lsblk
# assuming flash drive is /dev/sdb
# WARNING CONFIRM LETTER OF FLASH DRIVE DO NOT COPY+PASTE

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

lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
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

dhcp
chain http://10.3.2.1/ipxe/boot.ipxe

# proceed with iPXE goodness

Some additional reading and references:
http://www.yeasoft.com/site/article:apup1
http://pcengines.info/forums/?page=post&id=4F6D1B63-9BB7-4743-8FC8-6FF14532884A