Skip to content

NanoPC T4在线编译固件参数

软件包

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 

初始化脚本

#!/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