build openwrt 19.07.2 for tplink wr841n-v8 under macOS using docker

Table of Contents

Download source

download openwrt 19.07.2 source code

build in docker

docker image: ubuntu 18.04

building in docker using volume may encounter problem like:

OpenWrt can only be built on a case-sensitive filesystem

so, just build in some inner directory in docker

# prepare build env
apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial unzip wget

# prepare source
cd /root
tar xf openwrt-19.07.2.tar.gz
cd openwrt-19.07.2

./scripts/feeds update -a
./scripts/feeds install -a

Target System –> Atheros AR71xxx/AR9xxx

Subtarget –> Devices with small flash

Target Profile –> TP-LINK TL-WR841N/ND v8

Base system –> unselect urandom-seed

Troubleshooting

opkg_install_cmd: Cannot install package urandom-seed

ar71xx/etc/._init.d But that file is already provided by package * base-files

Solution: just unselect urandom-seed in Base system

[mktplinkfw] * error: images are too big by 210462 bytes

/root/openwrt-19.07.2/staging_dir/host/bin/mktplinkfw -H 0x08410008 -W 0x1 -F 4Mlzma -N OpenWrt -V r10947-65030d81f3 -m 1 -k /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tl-wr841-v8-kernel.bin -r /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin -o /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin.new -j -X 0x40000 -a 0x4 -s && mv /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin.new /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin || rm -f /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin

[mktplinkfw] rootfs offset aligned to 0x1335176

[mktplinkfw] * error: images are too big by 210462 bytes

cp /root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin /root/openwrt-19.07.2/bin/targets/ar71xx/tiny/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin

cp: cannot stat '/root/openwrt-19.07.2/build_dir/target-mips_24kc_musl/linux-ar71xx_tiny/tmp/openwrt-ar71xx-tiny-tl-wr841-v8-squashfs-sysupgrade.bin': No such file or directory

Solution: edit target/linux/ar71xx/image/tiny-tp-link.mk

define Device/tl-wr841-v8
  $(Device/tplink-4mlzma)
  DEVICE_TITLE := TP-LINK TL-WR841N/ND v8
  BOARDNAME := TL-WR841N-v8
  DEVICE_PROFILE := TLWR841
  TPLINK_HWID := 0x08410008
endef
TARGET_DEVICES += tl-wr841-v8

change tplink-4mlzma into tplink-8mlzma

Author: sanye

Exported At 2021-02-24 Wed 23:51. Created by Emacs 26.1 (Org mode 9.4)