This guide should be considered as a simple walk-through for using APU3 platform in some generic use-cases. I’m trying to explain how to work with the device and use it in a generic manner. There is a part about the coreboot firmware, which could be used as a reference of how to start customizing it for own purposes.

Configuring the hardware

At first, let’s figure out some basic requirements for our new device:

  1. It will be wireless router with some advenced functionality provided by OpenWRT.
  2. In order for it to be wireless, we need to add WiFi network adapters.
  3. I want it to be dual-band simultaneous connection, so we will need 2 separate WiFi adapters.
  4. Operating system will be placed on ?SD card.
  5. There will be an additional storage in the form of mSata disk.

APU3 has 3 mPcie slots. Unfortunately it supports PCI express only on slot mPCIe 1, so WiFi card has to use it. For the second WiFi card, we could use mPCIe 2 slot, but we would need USB only type, which are rare. Instead I’m using some cheap Ralink RT5370 based USB dongle WiFi adapter. mPCIe 3 slot will be used for mSata drive.

apu3_overall

For the OS drive, I’ll use some generic ?SD card with adapter.

mPCIe 2 slot could be used in future for GSM modem or some other kind of USB device in the form of mPcie card.

Getting the sources

We will use latest stable version which is Chaos Calmer, in order to be compatible with upstream packages. Thanks to that we can just use the opkg to download new version of packages from the main OpenWRT’s repositories.

The sources we need are located on github.

Let’s clone the needed version:

Building

To build our first image we first need to configure the OpenWRT:

Our target is APU system, which has AMD x86_64 CPU. So let’s use generic settings:

  • Target System > x86
  • Subtarget > x86_64

… and then Exit and make.

After compilation our image is in bin/x86 dir. We need a SD card to burn the image and boot the system on the target platform. On my host system, card is present under the device file /dev/sde.

Warning! Carefully check the device the card is present on your system. This is potentially dangerous operation and can lead to lost data, when used wrong device!

First boot

Default username after first boot is root and no password. Password should be set using passwd.

To make the first boot we need some kind of serial adapter (USB to RS232) and null-modem cable. There is a RS232 port on the back of the APU board. We need to connect it there.

To make the connection, I’m using screen, but other kind could be used (e.g. minicom). Default parameters for COM port are 115200 8N1. This is the command I’m using:

Immediately after powering the device, the coreboot welcome string should be seen and one could enter simple boot menu. Default configuration should be ok and SD card will have priority over different devices (it can be changed).

First OpenWRT boot will most propably hang on this string:

Problem lies here: [ 2.455798] Waiting for root device PARTUUID=6c097903-02...

SDHCI controller issue

After short investigation it appears, that we don’t have support for the SDHCI controller on APU board, so we need to enable it. We need to modify the kernel configuration, so we use this command:

In the config we need to select those drivers:

  • Device Drivers > MMC/SD/SDIO card support:
    • MMC block device driver
    • Secure Digital Host Controller Interface support
    • SDHCI support on PCI bus

Now the system should boot without problems.

Network problems

After booting the systems it appears we don’t have any connectivity (ethernet nor wifi). When trying ifconfig -a we can see only the lo interface.

Let’s install some additional packages, which should help us investigate

  • Base system > busybox > Customize busybox options > Linux System Utilities:
    • lspci
    • lsusb
  • Base system > wireless-tools

When the image is built and system is booted on target we can use lspci -k to check which devices have kernel modules assigned to them and which don’t. This lspci flavour is pretty poor, compared to usual one, supplied with main Linux distributions, but should be enough for our uses.

Among others, we can find these devices (VID:DID), which look interesting:

According to this page we’re looking for these devices:

  • 8086:1539 – this is Intel Ethernet controller (I211 Gigabit Network Connection)
  • 168c:003c – this is Atheros QCA986x/988x 802.11ac Wireless Network Adapter

We need to find drivers for those. It seems, that Intel is using CONFIG_IGB kernel option for its driver. Module for Atheros card is in OpenWRT. Let’s deal first with ethernet controllers:

Need to mark this driver:

  • Device Drivers > Network device support > Ethernet driver support:
    • Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support

As for the rest:

First let’s mark the driver for our wireless card: * Kernel modules > Wireless Drivers: * kmod-ath10k

And also some packages we’ll need to set up the access-point: * Network: * hostapd * wpa_supplicant

Unfortunately, during my build I got and error. After rerunning make V=s it appears that kernel hasn’t got the full configuration it wants. I managed get by this problem checking this option in make kernel_menuconfig:

  • Power management and ACPI options:
    • ACPI (Advanced Configuration and Power Interface) Support

After successful build and boot. I got:

So I’ve got the network.

Basic configuration

It’s good idea to set the default password using passwd utility. Thanks to this we can login using the SSH connection.

If you want to add your public key to authorized_keys file, which is usually placed under .ssh dir in user’s home dir, it has to be placed in /etc/dropbear/ dir or it will be ignored. Make sure that permissions to the file are also set right (600).

We can also set some other IP address for the ethernet connection, if our host computer occupies the one or is using other mask. In my case, my host computer has static address, which happens to be the same as the default one in OpenWRT.

Here’s short example how to change it:

We also want to enable the AP using the wifi adapter:

After a while you can establish a connection with SSID YourSSID and password key123.

Second wireless interface

The second adapter is connected to the USB port on the back of the device. It’s some cheap Ralink RT5370 based chip, which are popular and in nice form factor (small footprint and removable antenna).

apu3_wifi_adapter

Using the lsusb it’s detected like that:

In order to enable it, we need additional kernel module, which is available in OpenWRT:

  • Kernel modules > Wireless Drivers > kmod-rt2800-usb

After building and booting the new image, interface should be available by checking ifconfig -a.

Unfortunately we don’t have the new interface in OpenWRT’s configuration system. Right now the /etc/config/wireless file looks like that:

In order to add new device, I found that it’s easiest to generate generic one, with all interfaces detected and add the new one to the file. We can do it this way:

There is an additional section with the new adapter (radio1 and wifi-iface for radio1). We can copy this section to /etc/config/wireless and change the options we need. After that, we can run wifi command to accept the settings and enable all radios.

Some bandwidth results

Here are some results I’ve got when done some tests using iperf3.

802.11a (the WLE600VX card)

VHT80 mode

HT40 mode

802.11n (the Ralink’s RT5370 adapter)

HT20 mode

Completed setup

apu3_complete

Summary

We hope you have enjoyed reading this article. If you have faced problems installing your system of choice on any PC Engines platform, please let us know by using comments below or by social media channels. We would be glad, to help you solve your issues. If you are in need of a professional support, we are always open for new challenges, so do not hesitate to drop us an email at contact@3mdeb.com