跳过正文
  1. 全部文章/

NanoPC-T4在线编译固件参数

目录

手上有一块 NanoPC-T4,RK3399 的芯片,拿来当软路由用。 OpenWrt 在线编译的时候每次都要重新选软件包,烦得不行,干脆把参数记下来。 顺便把初始化脚本也贴上,刷完固件跑一遍就配好了。

软件包
#

1
autocore base-files bash block-mount brcmfmac-firmware-4356-sdio brcmfmac-nvram-4356-sdio busybox ca-bundle coremark curl dnsmasq-full dropbear ds-lite e2fsprogs fdisk firewall fstools htop iwinfo kmod-brcmfmac kmod-drm-rockchip kmod-gpio-button-hotplug kmod-ipt-nat kmod-ipt-nat6 kmod-lib-zstd kmod-tcp-bbr libc libgcc libustream-mbedtls logd lsblk luci-app-autoreboot luci-app-cpufreq luci-app-firewall luci-app-opkg luci-app-upnp luci-base luci-compat luci-lib-fs luci-lib-ipkg mkf2fs mtd nano netifd odhcp6c odhcpd-ipv6only openssh-sftp-server opkg partx-utils ppp ppp-mod-pppoe procd procd-seccomp resolveip swconfig uboot-envtools uci uclient-fetch urandom-seed urngd wget-ssl wpad-basic-mbedtls zram-swap luci-app-argon-config luci-app-diskman luci-app-fileassistant luci-app-statistics kmod-usb-net-rtl8152 kmod-r8169 r8169-firmware r8152-firmware luci-i18n-base-zh-cn luci-app-ttyd tailscale btop

初始化脚本
#

 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

#!/bin/sh

# 基础设定
uci set system.@system[0].hostname='NanoPC_T4'
uci set system.@system[0].timezone='CST-8'
uci set system.@system[0].zonename='Asia/Shanghai'
uci set luci.main.lang='zh_cn'
uci commit system
uci commit luci
/etc/init.d/uhttpd restart
echo -n 'root' | passwd root

# 配置 LAN 桥接设备
uci set network.@device[0]=device
uci set network.@device[0].name='br-lan'
uci set network.@device[0].type='bridge'
uci add_list network.@device[0].ports='eth1'
uci del_list network.@device[0].ports='eth0'

# 配置 LAN 接口
uci set network.lan=interface
uci set network.lan.device='br-lan'
uci set network.lan.proto='static'
uci set network.lan.ipaddr='192.168.1.1'
uci set network.lan.netmask='255.255.255.0'
uci set network.lan.ipv6='off'

# 配置 WAN 接口
uci set network.wan=interface
uci set network.wan.proto='dhcp'
uci set network.wan.ipv6='off'
uci set network.wan.device='eth0'

# 设置无线网络
uci set wireless.@wifi-device[0].disabled='0'  # 启用无线设备
uci set wireless.@wifi-iface[0].device='radio0'
uci set wireless.@wifi-iface[0].mode='ap'
uci set wireless.@wifi-iface[0].network='lan'
uci set wireless.@wifi-iface[0].ssid='OpenWrt'
uci set wireless.@wifi-iface[0].encryption='psk2'
uci set wireless.@wifi-iface[0].key='password'

# 禁用所有接口的 IPv6
uci set network.globals.ula_prefix=''
uci set network.lan.ipv6='off'
uci set network.wan.ipv6='off'

# 禁用 odhcpd 和 dhcpv6 服务
uci set dhcp.lan.dhcpv6='disabled'
uci set dhcp.lan.ra='disabled'
uci set dhcp.wan.dhcpv6='disabled'
uci set dhcp.wan.ra='disabled'

# 禁用 IPv6 转发
sysctl -w net.ipv6.conf.all.forwarding=0
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.forwarding=0
sysctl -w net.ipv6.conf.default.disable_ipv6=1

# 提交配置更改
uci commit network
uci commit wireless

# 重新加载网络和无线配置以应用更改
/etc/init.d/network reload
wifi reload

# 禁用 Rebind Protection
uci set dhcp.@dnsmasq[0].rebind_protection='0'

# 提交 DHCP 配置更改
uci commit dhcp

# 重启 dnsmasq 服务以应用配置
/etc/init.d/dnsmasq restart

# RK3399设定最高频率
uci set cpufreq.cpufreq.maxfreq0='1800000'
uci set cpufreq.cpufreq.maxfreq4='2208000'
uci set cpufreq.global.set='1'

# 删除脚本本身,使其不会在下一次启动时再次运行
rm -f /etc/uci-defaults/99_custom_defaults

相关文章