Compile Openwrt firmware with docker (e.g. macOS or Windows)
Official Openwrt no longer supports all legacy hardware after 17.01 (some after 18.06). However, as you might've modded your hardware as I did, let's compile openwrt oursleves to fit our own hardware mods.
The Dockerfile here is used to merely create a linux environement (ubuntu).
docker build -t docker-openwrt:latest .
Once docker container is launched from the image being built via the Dockerfile, you can choose which script to run according to your needs.
docker run --rm --name openwrt-compiler -it docker-openwrt
Each version is supported via a shell script named after their version number. By executing the script, a commandline menu will be shown for one to tweak build preferences (e.g., target system, subtarget (generic, tiny, nand, etc.), target images (which hardware is one building the image for), kernel modules, various packages).
Note.
- You may be asked to choose the correct time zone.
- For v19.07, one shall choose
Atheros AR7xxx/AR9xxx
underTarget System
instead ofAtheros ATH79 (DTS)
- some
Target Profiles
(e.g., tp-wr703n, tp-wr740n) can be found by choosingDevices with small flash
(aka. tiny) inSubtarget
. - remember to enable the web GUI for easy management (disabled for tiny targets by default)
luci
underLuCI -> Collections
luci-theme-openwrt-2020
underLuCI -> Themes
- consider take out PPPoE related choices if never needed:
ppp, ppp-mod-pppoe
underNetwork
kmod-ppp, kmod-pppoe, kmod-pppox
underKernel modules -> Network Support
./v19_07_10.sh
or
./v22_03_0.sh
After configuring build parameters (, also ), choose Exit
and one will be asked if preferences shall be saved, go ahead and confirm. At this point, one can enter the source code folder (aka. openwrt), and do the compilation.
cd openwrt
make -j $(nproc)
Once done building, you can find the kernel, manifest, factory.bin and sysupgrade.bin inside the folder /openwrt/bin/targets/ar71xx/tiny/ (or /openwrt/bin/targets/ath79/tiny/), which can be then copied out at the docker host's terminal with command
docker cp openwrt-compiler:*FILE_PATH* *LOCAL_PATH*
ps. Your can clean up docker leftovers after compile work
docker system prune -a
Hardware | Flash(NAND)/RAM now | Openwrt version |
---|---|---|
TP-Link TL-WR703N | 8MB (winbond 25Q64FVSIG) / 64MB (ELPIDA D5116AFTA-5B-E) | 22.03.0 |
TP-Link TL-WR740N | 8MB (winbond 25Q64FVSIG) / 64MB (ELPIDA D5116AFTA-5B-E) | 22.03.0 |