0%

TP-Link TL-WDR4310 v1 编译 OpenWRT 小记

修改编译目标

执行 make menuconfig 后如下配置:

1
2
3
4
5
6
7
8
9
Target System
X Atheros ATH79
Subtarget
X Generic
Target Profile
X TP-Link TL-WDR4310 v1
Target Images
* ramdisk
* squashfs

修改 LAN 默认网段

执行 make menuconfig 后如下配置:

1
2
3
4
5
6
Image configuration > Preinit configuration options > IP address for preinit network messages
i 192.168.8.1
Image configuration > Preinit configuration options > Netmask for preinit network messages
i 255.255.255.0
Image configuration > Preinit configuration options > Broadcast address for preinit network messages
i 192.168.8.255

修改仓库为清华镜像源

执行 make menuconfig 后如下配置(修改 https://downloads.openwrt.org/releases/xx.xx.xhttps://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/xx.xx.x):

1
2
3
4
5
Image configuration
* Version configuration options
Image configuration > Version configuration options > Release repository
d https://downloads.openwrt.org/releases/22.03.2
i https://mirrors.tuna.tsinghua.edu.cn/openwrt/releases/22.03.2

开启 FEED 仓库

执行 make menuconfig 后如下配置:

1
2
3
4
5
6
7
Image configuration
* Separate feed repositories
Image configuration > Separate feed repositories
* Enable feed packages
* Enable feed luci
* Enable feed routing
* Enable feed telephony

添加默认 CA 证书

执行 make menuconfig 后如下配置:

1
2
Base system 
* ca-certificates

切换 wolfssl 为 openssl 模块

执行 make menuconfig 后如下配置:

1
2
3
4
5
6
7
8
9
Network > WirelessAPD
* wpad-basic-openssl
- wpad-basic-wolfssl
Libraries
* libustream-openssl
- libustream-wolfssl
Libraries > SSL
* libopenssl
- libwolfssl

开启 luci 等功能

执行 make menuconfig 后如下配置:

1
2
3
4
5
6
7
8
LuCI > 1. Collections
* luci
* luci-ssl-openssl
LuCI > 2. Modules > Translations
* Chinese Simplified (zh_Hans)
LuCI > 3. Applications
* luci-app-ddns
* luci-app-wol

开放 cloudflare / dnspod 自带 DDNS 脚本

执行 make menuconfig 后如下配置:

1
2
3
4
5
Network > IP Addresses and Names
* ddns-scripts
* ddns-scripts-services
* ddns-scripts-cloudflare
* ddns-scripts-dnspod

集成 aliyun 外部 DDNS 脚本

拷贝文件: feeds/packages/net/ddns-scripts/files/usr/share/ddns/default/aliyun.com.json
拷贝文件: feeds/packages/net/ddns-scripts/files/usr/lib/ddns/update_aliyun_com.sh
修改文件: feeds/packages/net/ddns-scripts/Makefile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
define Package/ddns-scripts-services/install
$(INSTALL_DIR) $(1)/usr/share/ddns/default
$(INSTALL_DATA) ./files/usr/share/ddns/default/* \
$(1)/usr/share/ddns/default

# Remove special services
rm $(1)/usr/share/ddns/default/cloudflare.com-v4.json
rm $(1)/usr/share/ddns/default/freedns.42.pl.json
rm $(1)/usr/share/ddns/default/godaddy.com-v1.json
rm $(1)/usr/share/ddns/default/digitalocean.com-v2.json
rm $(1)/usr/share/ddns/default/dnspod.cn.json
rm $(1)/usr/share/ddns/default/no-ip.com.json
rm $(1)/usr/share/ddns/default/bind-nsupdate.json
rm $(1)/usr/share/ddns/default/route53-v1.json
rm $(1)/usr/share/ddns/default/cnkuai.cn.json
rm $(1)/usr/share/ddns/default/gandi.net.json
rm $(1)/usr/share/ddns/default/pdns.json
rm $(1)/usr/share/ddns/default/transip.nl.json
rm $(1)/usr/share/ddns/default/ns1.com.json
rm $(1)/usr/share/ddns/default/one.com.json
+ rm $(1)/usr/share/ddns/default/aliyun.com.json
endef

...
define Package/ddns-scripts-dnspod/description
Dynamic DNS Client scripts extension for dnspod.cn API (require curl)
endef
+
+define Package/ddns-scripts-aliyun
+ $(call Package/ddns-scripts/Default)
+ TITLE:=Extension for aliyun.com API
+ DEPENDS:=ddns-scripts +curl +openssl-util
+endef
+
+define Package/ddns-scripts-aliyun/description
+ Dynamic DNS Client scripts extension for aliyun.com API (require curl)
+endef

...

define Package/ddns-scripts-dnspod/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/ddns stop
fi
exit 0
endef
+
+define Package/ddns-scripts-aliyun/install
+ $(INSTALL_DIR) $(1)/usr/lib/ddns
+ $(INSTALL_BIN) ./files/usr/lib/ddns/update_aliyun_com.sh \
+ $(1)/usr/lib/ddns
+
+ $(INSTALL_DIR) $(1)/usr/share/ddns/default
+ $(INSTALL_DATA) ./files/usr/share/ddns/default/aliyun.com.json \
+ $(1)/usr/share/ddns/default/
+endef
+
+define Package/ddns-scripts-aliyun/prerm
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+ /etc/init.d/ddns stop
+fi
+exit 0
+endef

...

$(eval $(call BuildPackage,ddns-scripts))
$(eval $(call BuildPackage,ddns-scripts-services))
$(eval $(call BuildPackage,ddns-scripts-cloudflare))
$(eval $(call BuildPackage,ddns-scripts-freedns))
$(eval $(call BuildPackage,ddns-scripts-godaddy))
$(eval $(call BuildPackage,ddns-scripts-digitalocean))
$(eval $(call BuildPackage,ddns-scripts-dnspod))
$(eval $(call BuildPackage,ddns-scripts-noip))
$(eval $(call BuildPackage,ddns-scripts-nsupdate))
$(eval $(call BuildPackage,ddns-scripts-route53))
$(eval $(call BuildPackage,ddns-scripts-cnkuai))
$(eval $(call BuildPackage,ddns-scripts-gandi))
$(eval $(call BuildPackage,ddns-scripts-pdns))
$(eval $(call BuildPackage,ddns-scripts-transip))
$(eval $(call BuildPackage,ddns-scripts-ns1))
$(eval $(call BuildPackage,ddns-scripts-one))
+$(eval $(call BuildPackage,ddns-scripts-aliyun))

修改后先执行 ./scripts/feeds install -f ddns-scripts, 再执行 make menuconfig 后如下配置:

1
2
3
4
Network > IP Addresses and Names
* ddns-scripts-aliyun
Utilities
* openssl-util

修改分区和固件为16M

修改文件: target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi

1
2
3
4
5
6
7
8
9
10
11
12
13
...
partition@20000 {
compatible = "tplink,firmware";
label = "firmware";
reg = <0x020000 0xfd0000>;
};

art: partition@ff0000 {
label = "art";
reg = <0xff0000 0x010000>;
read-only;
};
...

修改文件: target/linux/ath79/image/generic-tp-link.mk

1
2
3
4
5
6
7
8
9
10
11
12
...
define Device/tplink_tl-wdr4310-v1
$(Device/tplink-16mlzma)
SOC := ar9344
DEVICE_MODEL := TL-WDR4310
DEVICE_VARIANT := v1
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
TPLINK_HWID := 0x43100001
SUPPORTED_DEVICES += tl-wdr4300
endef
TARGET_DEVICES += tplink_tl-wdr4310-v1
...
  • 本文作者: 6x
  • 本文链接: https://6xyun.cn/article/155
  • 版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-ND 许可协议。转载请注明出处!