OpenWRT installation instructions for APU2 and APU3 boards
OpenWRT (now known as LEDE) doesn't have a typicall installation process like pfSense or IPFire. OpenWRT needs to be "flashed" on the disk.
Easy, step by step instructions:
- Prepare debian bootable USB
- Connect your debian USB to APU board and boot
- download OpenWRT image onto the debian USB
- Flash the SSD drive with the OpenWRT image
- Resize the OpenWRT partition to use entire disk space
- Boot OpenWRT from the SSD
Prepare bootable debian USB
It doesn't need to be debian, you can use Ubuntu or any other linux distribution. We are recoomending debian because we have already prepared debian installation instructions for APU board. Any bootable USB with linux will work for this step.
Download OpenWRT image onto the debian USB
Now you should boot the debian USB and login either via ssh or through the serial cable. Make sure you have the WAN cable connected so you have connection to the internet.
Here are the latest LEDE/OpenWRT images as of writing this article.
http://downloads.lede-project.org/releases/17.01.4/targets/x86/64/ we need the image called "combined-ext4.img.gz". Make sure you get the ext4 image, otherwise you won't be able to resize the partition and use the entire disk space.
From the debian console run:
root@debian:~# wget http://downloads.lede-project.org/releases/17.01.4/targets/x86/64/lede-17.01.4-x86-64-combined-squashfs.img
This should go relatively quickly since the image is only 273M.
Flash the SSD drive with the OpenWRT image
Once you have the image downloaded, you can flash it on the SSD with the following command:
root@debian:~# dd if=lede-17.01.4-x86-64-combined-squashfs.img of=/dev/sda bs=4M; sync;
This will take only a second or two because the SSD is relatively fast.
Output you are looking for looks like this:
root@debian:~# dd if=lede-17.01.4-x86-64-combined-squashfs.img of=/dev/sda bs=4M; sync; 4+1 records in 4+1 records out 19852146 bytes (20 MB, 19 MiB) copied, 0.73956 s, 26.8 MB/s
At this point you have a bootable OpenWRT installation. Power off, remove the USB and boot your APU.
Rezise the OpenWRT partition to use the entire disk space
This is an optional step, but you probably want to do this. When we flashed the OpenWRT image, the partition table was already set to about 270M partition for system. Since we have a 16G disk, we would like to use the entire space.
Make sure you have parted installed (apt-get install parted) .
Boot your debian USB and issue the following command to see your patition table:
root@debian:~# parted /dev/sda print Model: ATA SATA SSD (scsi) Disk /dev/sda: 16.0GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 262kB 17.0MB 16.8MB primary ext2 boot 2 17.3MB 286MB 268MB primary
There are 2 partitions, one for boot and the other one for the data/system. We want to resize the latter partition to use the entire space.
Issue the following command to resize the partition:
root@debian:~# parted /dev/sda resizepart 2 16G Information: You may need to update /etc/fstab.
One this completes, run the previous command again to verify that the entire space is now allocated to the partition
root@debian:~# parted /dev/sda print Model: ATA SATA SSD (scsi) Disk /dev/sda: 16.0GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 262kB 17.0MB 16.8MB primary ext2 boot 2 17.3MB 16.0GB 16.0GB primaryAnd now the last step is to extend the filesystem on this partition. Run:
root@debian:~# resize2fs /dev/sda2 resize2fs 1.43.4 (31-Jan-2017) Resizing the filesystem on /dev/sda2 to 3902026 (4k) blocks. The filesystem on /dev/sda2 is now 3902026 (4k) blocks long.
LEDE/OpenWRT sometimes gets confused during the installation and detects WAN on port 1, and LAN on port 0. If you are unable to connect, switch the cables around and see if that helps. You can reconfigure the network interfaces through the web once you are able to connect.