使用固件选择器编译 ac88u 的固件,同时自定义参数

流程导图
老机器 ac88u 刷的原版openwrt 快照版的。固件是在线编译的,uci-defaults 配置自定义的参数。

代码相当的小白,因为我就小白。很简单,很容易看懂。

自己使用的配置应该都能使用 uci-defaults 配置好,这样编译的出的固件可以免后期配置,直接使用。后期有调整可以随时更改。

刷机有风险,执行需谨慎。仅供参考。

设备备份

自行论坛查找方法

设备刷写

自行论坛查找方法

在线固件(原版及自定义)

ac88u 原版在线定制

Packages

分为三部分:原版默认包,其它包,openclash 所需的包。

不想要的包,可删掉,或者新添一项加个-号。
比如默认包有dnsmasq,但是 openclash 需要dnsmasq-full这两个包只能用一个,不然报错。所以使用-dnsmasq取消掉默认包。

其它包中有 dockerd 。刷入固件后软件包页面显示可用 40M ,因此需要挂载 u 盘。通过 uci-defaults 直接执行挂载。

1
2
3
4
5
base-files brcmfmac-firmware-4366b1-pcie brcmfmac-firmware-4366c0-pcie busybox ca-bundle dnsmasq dropbear firewall4 fstools iwinfo kmod-brcmfmac kmod-brcmfmac kmod-gpio-button-hotplug kmod-leds-gpio kmod-nft-offload kmod-phy-bcm-ns-usb2 kmod-phy-bcm-ns-usb3 kmod-usb-ledtrig-usbport kmod-usb-ohci kmod-usb2 kmod-usb3 libc libgcc libustream-mbedtls logd luci mtd netifd nftables nvram odhcp6c odhcpd-ipv6only opkg osafeloader oseama otrx ppp ppp-mod-pppoe procd procd-seccomp procd-ujail uci uclient-fetch urandom-seed urngd wpad-basic-mbedtls wpad-basic-mbedtls

-dnsmasq block-mount blockd cfdisk docker-compose dockerd e2fsprogs fdisk kmod-fs-ext4 kmod-fs-ntfs kmod-fs-vfat kmod-usb-storage luci-i18n-attendedsysupgrade-zh-cn luci-i18n-base-zh-cn luci-i18n-ddns-zh-cn luci-i18n-dockerman-zh-cn luci-i18n-filebrowser-zh-cn luci-i18n-firewall-zh-cn luci-i18n-ksmbd-zh-cn luci-i18n-opkg-zh-cn luci-i18n-ttyd-zh-cn mount-utils mtd ntfs-3g kmod-lp kmod-usb-printer luci-i18n-p910nd-zh-cn blkid lsblk

coreutils-nohup bash dnsmasq-full curl ca-certificates ipset ip-full libcap libcap-bin ruby ruby-yaml kmod-tun kmod-inet-diag unzip kmod-nft-tproxy luci-compat luci luci-base

uci-defaults

分为两部分:

  • 开头结尾的两行(编译时用来在/etc/uci-defaults/文件创建名为99-custom的开机启动文件。此文件执行成功,就会自动删掉。如果重启后还存在就是脚本没有执行)
  • 中间的为需要执行的代码。
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
cat << "EOF" > /etc/uci-defaults/99-custom

# Beware! This script will be in /rom/etc/uci-defaults/ as part of the image.
# Uncomment lines to apply:

##########################################################
###################私人配置,分享要改#######################
# 密码
root_password="XXXXXXXXXXX"
# wan 拨号 pppoe 协议
#pppoe_username="XXXXXXXXXXX"
#pppoe_password="XXXXXXXXXXX"
# openclash 订阅地址
clash_rules="http://XXXXXXXXXXX"
# ddns
ddns_host='XXXXXXXXXXX'
ddns_username='XXXXXXXXXXX'
ddns_password='XXXXXXXXXXX'
# wifi 名称及密码
wlan_name="XXXXXXXXXXX"
wlan_password="XXXXXXXXXXX"
wlan_name_5G="XXXXXXXXXXX"
wlan_password_5G="XXXXXXXXXXX"
##########################################################

# 主机名,时区
host_name="OpenWrt-AC88U"
zone_name="Asia/Shanghai"

# lan 静态协议地址/lan 其它协议
lan_ip_address="10.0.0.1"
lan_netmask="255.255.255.0"
#lan_proto="dhcp"

# wan 其它协议
wan_proto="dhcp"

# 终端自动登录
ttyd_login="/bin/login -f root"

# log potential errors
exec >/tmp/setup.log 2>&1

# 文件共享
k_smbd="1"

# 磁盘挂载 1:/mnt 2:/
mnt_disk="2"

# 开放端口
echo -e "
config rule
option name 'ALLOW_PORT_OUT'
option dest 'wan'
option target 'ACCEPT'

config rule
option name 'ALLOW_PORT_IN'
option src 'wan'
option target 'ACCEPT'" >> firewall_port

# 端口转发
echo -e "
config redirect
option dest 'lan'
option target 'DNAT'
option name 'alist'
option src 'wan'
option src_dport '5678'
option dest_ip '$lan_ip_address'
option dest_port '5678'" >> firewall_port_Forwards

# ddns
echo -e "
config service 'ddns'
option service_name 'google.com'
option use_ipv6 '0'
option enabled '1'
option lookup_host '$ddns_host'
option domain '$ddns_host'
option username '$ddns_username'
option password '$ddns_password'
option ip_source 'interface'
option interface 'pppoe-wan'
option use_syslog '2'
option check_unit 'minutes'
option force_unit 'minutes'
option retry_unit 'seconds'
option ip_interface 'pppoe-wan'" >> d_dns

funAc88u(){
# 主机名
if [ -n "$host_name" ]; then
uci set system.@system[0].hostname="$host_name"
uci commit system
/etc/init.d/system reload
fi

# 时区
if [ -n "$zone_name" ]; then
uci set system.@system[0].zonename="$zone_name"
uci set system.@system[0].timezone='UTC-8'
uci commit system
/etc/init.d/system reload
fi

# root密码
if [ -n "$root_password" ]; then
(echo "$root_password"; sleep 1; echo "$root_password") | passwd > /dev/null
fi

# WLAN
# More options: https://openwrt.org/docs/guide-user/network/wifi/basic#wi-fi_interfaces
if [ -n "$wlan_name" -a -n "$wlan_password" -a ${#wlan_password} -ge 8 ]; then
uci set wireless.radio0.channel='11'
uci set wireless.radio0.band='2g'
uci set wireless.radio0.htmode='HT40'
uci set wireless.default_radio0.device='radio0'
uci set wireless.default_radio0.network='lan'
uci set wireless.default_radio0.mode='ap'
uci set wireless.default_radio0.ssid="$wlan_name"
uci set wireless.default_radio0.encryption='psk2'
uci set wireless.default_radio0.key="$wlan_password"

uci set wireless.radio1.channel='48'
uci set wireless.radio1.band='5g'
uci set wireless.radio1.htmode='VHT80'
uci set wireless.default_radio1.device='radio1'
uci set wireless.default_radio1.network='lan'
uci set wireless.default_radio1.mode='ap'
uci set wireless.default_radio1.ssid="$wlan_name_5G"
uci set wireless.default_radio1.encryption='psk2'
uci set wireless.default_radio1.key="$wlan_password_5G"

uci delete wireless.radio0.disabled='1'
uci delete wireless.radio1.disabled='1'

uci commit wireless
/etc/init.d/wireless reload
fi

# 终端自动登录
if [ -n "$ttyd_login" ]; then
uci set ttyd.@ttyd[0].command="$ttyd_login"
uci commit ttyd
/etc/init.d/ttyd reload
fi

# ddns
if [ -n "$ddns_host" ]; then
cat d_dns >> /etc/config/ddns
uci commit ddns
/etc/init.d/ddns reload
rm d_dns
fi

# 开放端口(选择 test 用)
if [ -f firewall_port ]; then
cat firewall_port >> /etc/config/firewall
uci commit firewall
/etc/init.d/firewall reload
rm firewall_port
fi

# 端口转发
if [ -f firewall_port_Forwards ]; then
cat firewall_port_Forwards >> /etc/config/firewall
rm firewall_port_Forwards
uci commit firewall
/etc/init.d/firewall reload
fi


if [ -n "$clash_rules" ]; then
#openclash
#uci set openclash.config.enable='1'
uci set openclash.config.dashboard_password='OpenClash8517'
uci set openclash.@authentication[0].password='OpenClash8517'
uci commit openclash
/etc/init.d/openclash reload

uci add openclash config_subscribe
uci set openclash.@config_subscribe[-1]=config_subscribe
uci set openclash.@config_subscribe[-1].enabled='1'
uci set openclash.@config_subscribe[-1].name='clash-rules'
uci set openclash.@config_subscribe[-1].address="$clash_rules"
uci set openclash.@config_subscribe[-1].sub_ua='Clash'
uci set openclash.@config_subscribe[-1].sub_convert='0'
uci commit openclash
/etc/init.d/openclash reload
fi

# LAN 静态协议
# More options: https://openwrt.org/docs/guide-user/base-system/basic-networking
if [ -n "$lan_ip_address" ]; then
uci set network.lan.proto='static'
uci set network.lan.ipaddr="$lan_ip_address"
uci set network.lan.netmask="$lan_netmask"
uci commit network
/etc/init.d/network reload
fi

# LAN 其它协议
# More options: https://openwrt.org/docs/guide-user/base-system/basic-networking
if [ -n "$lan_proto" ]; then
uci set network.lan.proto="$lan_proto"
uci commit network
/etc/init.d/network reload
fi

# Wan pppoe 协议
# More options: https://openwrt.org/docs/guide-user/network/wan/wan_interface_protocols#protocol_pppoe_ppp_over_ethernet
if [ -n "$pppoe_username" -a "$pppoe_password" ]; then
uci set network.wan.proto=pppoe
uci set network.wan.username="$pppoe_username"
uci set network.wan.password="$pppoe_password"
uci delete network.wan6
uci commit network
/etc/init.d/network reload
fi

# WAN 其它协议
if [ -n "$wan_proto" ]; then
uci set network.wan.proto="$wan_proto"
uci commit network
/etc/init.d/network reload
fi

# 文件共享
uuid=$(blkid -s UUID -o value /dev/sd*)
device1=$(blkid -U $uuid)
device2=$(echo $(blkid -U $uuid) | sed 's/dev/mnt/')

case $mnt_disk in
"1")
dockerd_dir="$device2/opt/docker"
ksmbd_dir="/mnt"
;;
"2")
dockerd_dir="/opt/docker"
ksmbd_dir="/opt"
re_boot=1
;;
*)
ksmbd_dir='/etc'
esac

if [ -n "$k_smbd" ]; then
uci set ksmbd.@globals[0].interface='lan wan'
uci add ksmbd share
uci set ksmbd.@share[-1]=share
uci set ksmbd.@share[-1].name='ac88u'
uci set ksmbd.@share[-1].path="$ksmbd_dir"
uci set ksmbd.@share[-1].force_root='1'
uci set ksmbd.@share[-1].read_only='no'
uci set ksmbd.@share[-1].guest_ok='yes'
uci set ksmbd.@share[-1].create_mask='0666'
uci set ksmbd.@share[-1].dir_mask='0777'
uci commit ksmbd
/etc/init.d/ksmbd reload
fi

# dockerd 根目录
#匹配替换整行
sed -i "/data_root/c\ option data_root \'$dockerd_dir\'" /etc/config/dockerd
#sed -i 's/opt\/docker/$dockerd_dir/' /etc/config/dockerd
uci commit dockerd
/etc/init.d/dockerd reload

#磁盘挂载
case $mnt_disk in
"1")
#mount /dev/sda1 /mnt/sda1
#rm -rf /mnt/sda1/lost+found /mnt/sda1/upper /mnt/sda1/work
#mkfs.ext4 /dev/sda1
uci add fstab mount
uci set fstab.@mount[-1]=mount
uci set fstab.@mount[-1].target="$device2"
uci set fstab.@mount[-1].uuid="$uuid"
uci set fstab.@mount[-1].enabled='1'
uci commit fstab
/etc/init.d/fstab reload
;;
"2")
mkdir -p /tmp/introot
mkdir -p /tmp/extroot
mount --bind / /tmp/introot
mount "$device1" /tmp/extroot
tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
wait
umount /tmp/introot
umount /tmp/extroot

uci add fstab mount
uci set fstab.@mount[-1]=mount
uci set fstab.@mount[-1].target="/"
uci set fstab.@mount[-1].uuid="$uuid"
uci set fstab.@mount[-1].enabled='1'
uci commit fstab
/etc/init.d/fstab reload
esac

if [ -n "$re_boot" ]; then
reboot
fi
}

main(){
funAc88u
}
main "$@"

EOF

主机名,时区

密码

wan 拨号 pppoe 协议

openclash 订阅地址

ddns

wifi 名称及密码

lan 静态协议地址/lan 其它协议

wan 其它协议

终端自动登录

文件共享

磁盘挂载 1:/mnt 2:/

其它不在赘述,我在OpenWrt在线编译(官方网址)及自定义(openclash,设备名,密码等等)文章中已经摘出来了,可以参考下,大部分都相同。

openclash 订阅地址的自定义,因为没有安装 ipk 文件,所以不会成功。但是在磁盘挂载中选择为挂载为根目录,就会生效,不只生效还会在添加相同的一项。其它还会重复添加的还有共享目录等。首次可以启用,往后编译可以将这几项注释掉。

在执行挂载为根目录时,会将分区中的文件复制一份到 u盘,其它文件还会存在。u盘中之前已安装 openclash ,刷好固件后 openclash 还存在,免去了重新安装。我感觉很方便。

挂载为根目录,收传输速度影响,时间很长,耐心等待吧。

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
# 磁盘挂载 1:/mnt 2:/
mnt_disk="2"

# 文件共享
uuid=$(blkid -s UUID -o value /dev/sd*)
device1=$(blkid -U $uuid)
device2=$(echo $(blkid -U $uuid) | sed 's/dev/mnt/')

#磁盘挂载
case $mnt_disk in
"1")
#mount /dev/sda1 /mnt/sda1
#rm -rf /mnt/sda1/lost+found /mnt/sda1/upper /mnt/sda1/work
#mkfs.ext4 /dev/sda1
uci add fstab mount
uci set fstab.@mount[-1]=mount
uci set fstab.@mount[-1].target="$device2"
uci set fstab.@mount[-1].uuid="$uuid"
uci set fstab.@mount[-1].enabled='1'
uci commit fstab
/etc/init.d/fstab reload
;;
"2")
mkdir -p /tmp/introot
mkdir -p /tmp/extroot
mount --bind / /tmp/introot
mount "$device1" /tmp/extroot
tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
wait
umount /tmp/introot
umount /tmp/extroot

uci add fstab mount
uci set fstab.@mount[-1]=mount
uci set fstab.@mount[-1].target="/"
uci set fstab.@mount[-1].uuid="$uuid"
uci set fstab.@mount[-1].enabled='1'
uci commit fstab
/etc/init.d/fstab reload
esac

if [ -n "$re_boot" ]; then
reboot
fi

刷机完成后

状态页面

视频或文章链接

bili 视频 OpenWrt在线编译(官方网址)及自定义

路由器cmcc-cr8808(8818)取消运营商限制,开启 telnet,ssh

openclash 自定义的本地节点转换(subconverter)

OpenWrt在线编译(官方网址)及自定义(openclash,设备名,密码等等)

RAX3000M 修改配置文件,刷 u-boot 及 openwrt 固件

openwrt 默认配置编译(密码 语言 IP))

自用的节点商,对于非常高清的视频没有需求可以试试,关键便宜,一个月十几块。
闪电

文件下载

暂无

Q群:290979342(聚焦单车交流群)

Q群:977922094(聚焦 openwrt 路由器交流)