Preface

Recently the campus mobile broadband ISP started “doing things”: traffic hijacking and poisoned downloads—basically joining the ranks of the usual suspects. This semester I also can’t do multi-dial anymore; the system detects it and blocks the connection for half an hour.
Last summer, a senior (George) gave me a router, OYE-0001. I’ve used it for over half a year. Software-wise it’s quite stable, but the ports are too loose—if you bump it accidentally, it disconnects.

The modded TP-Link WR845N I flashed with Hackpascal’s firmware would crash periodically. Since I can’t multi-dial anymore, I decided to switch back to the original router and flash something more stable (official firmware). Also, I’m not living in the dorm now, so I don’t have strict traffic-control requirements.
But it looks like the vendor has abandoned the WR845N V4. I couldn’t find the firmware download anymore, and firmware for other versions won’t boot after flashing.
So I decided to try compiling it myself—hit quite a few potholes along the way.
Here are the steps I recorded.
Preparation
Start by reading the OpenWrt GitHub repo.
Prepare a build environment with the following components:
gcc, binutils, bzip2, flex, python, perl, make,
find, grep, diff, unzip, gawk, getopt, subversion, libz-dev and libc headers
System environment
- OS: Arch Linux
- Kernel: x86_64 Linux 4.9.8-1-ARCH
Use the trunk version directly:
git clone https://github.com/openwrt/openwrt
Run feeds to fetch and install all predefined packages. For more details, see OpenWrt Feeds.
./scripts/feeds update -a
./scripts/feeds install -a
Build
Start the configuration menu:
make menuconfig
Use arrow keys up/down to move in a column, left/right to switch columns. Press Space to select. M means build as a module, * means built into the firmware image.

Because this is an 8-pin SPI flash, set Subtarget to Generic. See The OpenWrt Flash Layout.
Set Target Profile to TP-LINK TL-WR842N/ND because the hardware is similar (both are QCA953X).
Set Target Images to squashfs. See SquashFS.
Keep other settings as default. Because storage is limited, don’t add extra components. Next, go to LuCI → Collections and select the default one:

Modules ---> Translations
Select Chinese and English.
Under Applications, choose the apps you need (you can refer to the apps bundled in PandoraBox firmware). Under Themes, choose the nicest one: luci-theme-material.

Then save. The file name must be .config—do not change it.

Now start building. My CPU has 2 cores / 4 threads, so I used -j4. Adding V=99 shows verbose output:
make -j4 V=99
The build process downloads packages from the internet. If your network can’t reach some mirrors, use a proxy.
If the build fails due to network issues, clean first and then build through proxychains4:
make clean
pc4 make -j4 V=99
After compilation, firmware images and packages will be generated under ./bin/ar71xx/. Find the correct image and flash it via Breed.

Boot succeeded—and I found the signal was still full even in the bathroom.

Firmware download: