This commit is contained in:
lean 2020-12-24 21:32:20 +08:00
commit dd9feccea4
6 changed files with 421 additions and 375 deletions

View File

@ -10,134 +10,135 @@ DNSMASQ_RESTART=N
DNS_SERVER="114.114.114.114,114.114.115.115" DNS_SERVER="114.114.114.114,114.114.115.115"
pdnsd_genconfig() { pdnsd_genconfig() {
DNS_SERVER=$(uci get flowoffload.@flow[0].dns_server 2>/dev/null) DNS_SERVER=$(uci get flowoffload.@flow[0].dns_server 2>/dev/null)
[ -d /var/etc ] || mkdir -p /var/etc [ -d /var/etc ] || mkdir -p /var/etc
if [ ! -f /var/dnscache/pdnsd.cache ]; then if [ ! -f /var/dnscache/pdnsd.cache ]; then
mkdir -p /var/dnscache mkdir -p /var/dnscache
echo -ne "pd13\000\000\000\000" > /var/dnscache/pdnsd.cache echo -ne "pd13\000\000\000\000" >/var/dnscache/pdnsd.cache
chown -R nobody.nogroup /var/dnscache chown -R nobody.nogroup /var/dnscache
fi fi
cat > /var/etc/dnscache.conf <<EOF cat <<-EOF >/var/etc/dnscache.conf
global { global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大 perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置 cache_dir="/var/dnscache"; # 缓存文件的位置
pid_file = /var/run/dnscache.pid; pid_file = /var/run/dnscache.pid;
server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡 run_as="nobody";
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可 server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡
status_ctl = on; server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求 status_ctl = on;
query_method=udp_only; paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
neg_domain_pol = off; query_method=udp_only;
par_queries = 400; # 最多同时请求数 neg_domain_pol = off;
min_ttl = 1h; # DNS结果最短缓存时间 par_queries = 400; # 最多同时请求数
max_ttl = 1w; # DNS结果最长缓存时间 min_ttl = 1h; # DNS结果最短缓存时间
timeout = 10; # DNS请求超时时间单位秒 max_ttl = 1w; # DNS结果最长缓存时间
} timeout = 10; # DNS请求超时时间单位秒
}
server { server {
label = "routine"; label = "routine";
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址 ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间 timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
74.125.155.102, 74.125.155.102,
74.125.39.102, 74.125.39.102,
74.125.39.113, 74.125.39.113,
209.85.229.138, 209.85.229.138,
128.121.126.139, 128.121.126.139,
159.106.121.75, 159.106.121.75,
169.132.13.103, 169.132.13.103,
192.67.198.6, 192.67.198.6,
202.106.1.2, 202.106.1.2,
202.181.7.85, 202.181.7.85,
203.161.230.171, 203.161.230.171,
203.98.7.65, 203.98.7.65,
207.12.88.98, 207.12.88.98,
208.56.31.43, 208.56.31.43,
209.145.54.50, 209.145.54.50,
209.220.30.174, 209.220.30.174,
209.36.73.33, 209.36.73.33,
211.94.66.147, 211.94.66.147,
213.169.251.35, 213.169.251.35,
216.221.188.182, 216.221.188.182,
216.234.179.13, 216.234.179.13,
243.185.187.39, 243.185.187.39,
37.61.54.158, 37.61.54.158,
4.36.66.178, 4.36.66.178,
46.82.174.68, 46.82.174.68,
59.24.3.173, 59.24.3.173,
64.33.88.161, 64.33.88.161,
64.33.99.47, 64.33.99.47,
64.66.163.251, 64.66.163.251,
65.104.202.252, 65.104.202.252,
65.160.219.113, 65.160.219.113,
66.45.252.237, 66.45.252.237,
69.55.52.253, 69.55.52.253,
72.14.205.104, 72.14.205.104,
72.14.205.99, 72.14.205.99,
78.16.49.15, 78.16.49.15,
8.7.198.45, 8.7.198.45,
93.46.8.89, 93.46.8.89,
37.61.54.158, 37.61.54.158,
243.185.187.39, 243.185.187.39,
190.93.247.4, 190.93.247.4,
190.93.246.4, 190.93.246.4,
190.93.245.4, 190.93.245.4,
190.93.244.4, 190.93.244.4,
65.49.2.178, 65.49.2.178,
189.163.17.5, 189.163.17.5,
23.89.5.60, 23.89.5.60,
49.2.123.56, 49.2.123.56,
54.76.135.1, 54.76.135.1,
77.4.7.92, 77.4.7.92,
118.5.49.6, 118.5.49.6,
159.24.3.173, 159.24.3.173,
188.5.4.96, 188.5.4.96,
197.4.4.12, 197.4.4.12,
220.250.64.24, 220.250.64.24,
243.185.187.30, 243.185.187.30,
249.129.46.48, 249.129.46.48,
253.157.14.165; 253.157.14.165;
reject_policy = fail; reject_policy = fail;
} }
server { server {
label = "special"; # 这个随便写 label = "special"; # 这个随便写
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址 ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持 port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
proxy_only = on; proxy_only = on;
timeout = 5; timeout = 5;
} }
source { source {
owner=localhost; owner=localhost;
// serve_aliases=on; // serve_aliases=on;
file="/etc/hosts"; file="/etc/hosts";
} }
rr { rr {
name=localhost; name=localhost;
reverse=on; reverse=on;
a=127.0.0.1; a=127.0.0.1;
owner=localhost; owner=localhost;
soa=localhost,root.localhost,42,86400,900,86400,86400; soa=localhost,root.localhost,42,86400,900,86400,86400;
} }
EOF EOF
[ -d /var/sbin ] || mkdir -p /var/sbin [ -d /var/sbin ] || mkdir -p /var/sbin
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache [ -f /var/sbin/dnscache ] || ln -s /usr/sbin/pdnsd /var/sbin/dnscache
echo "Start DNS Cache" echo "Start DNS Cache"
} }
stop_pdnsd() { stop_pdnsd() {
kill $(pidof dnscache) >/dev/null 2>&1 || kill -9 $(ps | grep dnscache | grep -v grep | awk '{print $1}') >/dev/null 2>&1 kill $(pidof dnscache) >/dev/null 2>&1 || kill -9 $(ps | grep dnscache | grep -v grep | awk '{print $1}') >/dev/null 2>&1
echo "Stop DNS Cache" echo "Stop DNS Cache"
} }
change_dns() { change_dns() {
uci delete dhcp.@dnsmasq[0].server >/dev/null 2>&1 uci delete dhcp.@dnsmasq[0].server >/dev/null 2>&1
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5333 uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5333
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0 uci set dhcp.@dnsmasq[0].noresolv=0
@ -151,49 +152,50 @@ revert_dns() {
uci commit dhcp uci commit dhcp
} }
start_service(){ start_service() {
dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null) dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null)
bbr=$(uci get flowoffload.@flow[0].bbr 2>/dev/null) bbr=$(uci get flowoffload.@flow[0].bbr 2>/dev/null)
if [ $dns -eq 1 ]; then if [ $dns -eq 1 ]; then
pdnsd_genconfig pdnsd_genconfig
procd_open_instance procd_open_instance
procd_set_param command "$PDNSD_BIN" -c /var/etc/dnscache.conf procd_set_param command "$PDNSD_BIN" -c /var/etc/dnscache.conf
procd_set_param respawn procd_set_param respawn
procd_set_param stderr 1 procd_set_param stderr 1
procd_close_instance procd_close_instance
change_dns change_dns
fi else
if [ $bbr -eq 1 ]; then revert_dns
sysctl -w net.ipv4.tcp_congestion_control=bbr fi
else if [ $bbr -eq 1 ]; then
sysctl -w net.ipv4.tcp_congestion_control=cubic sysctl -w net.ipv4.tcp_congestion_control=bbr
fi else
uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading) sysctl -w net.ipv4.tcp_congestion_control=cubic
uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw) fi
uci commit firewall uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading)
if [ "$DNSMASQ_RESTART" = N ]; then uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw)
/etc/init.d/dnsmasq restart && echo "DNSMASQ change" uci commit firewall
/etc/init.d/firewall restart >/dev/null 2>&1 if [ "$DNSMASQ_RESTART" = N ]; then
fi /etc/init.d/dnsmasq restart && echo "DNSMASQ change"
/etc/init.d/firewall restart >/dev/null 2>&1
fi
} }
stop_service(){ stop_service() {
dns=$(uci get firewall.@defaults[0].dns 2>/dev/null) dns=$(uci get firewall.@defaults[0].dns 2>/dev/null)
revert_dns revert_dns
uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading) uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading)
uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw) uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw)
uci commit firewall uci commit firewall
if [ "$DNSMASQ_RESTART" = N ]; then if [ "$DNSMASQ_RESTART" = N ]; then
/etc/init.d/dnsmasq restart && echo "DNSMASQ revert" /etc/init.d/dnsmasq restart && echo "DNSMASQ revert"
/etc/init.d/firewall restart >/dev/null 2>&1 /etc/init.d/firewall restart >/dev/null 2>&1
fi fi
} }
restart(){ restart() {
DNSMASQ_RESTART=Y DNSMASQ_RESTART=Y
stop stop
start start
/etc/init.d/dnsmasq restart && echo "DNSMASQ restart" /etc/init.d/dnsmasq restart && echo "DNSMASQ restart"
/etc/init.d/firewall restart >/dev/null 2>&1 /etc/init.d/firewall restart >/dev/null 2>&1
} }

View File

@ -10,128 +10,129 @@ DNSMASQ_RESTART=N
DNS_SERVER="114.114.114.114,114.114.115.115" DNS_SERVER="114.114.114.114,114.114.115.115"
pdnsd_genconfig() { pdnsd_genconfig() {
DNS_SERVER=$(uci get sfe.config.dns_server 2>/dev/null) DNS_SERVER=$(uci get sfe.config.dns_server 2>/dev/null)
[ -d /var/etc ] || mkdir -p /var/etc [ -d /var/etc ] || mkdir -p /var/etc
if [ ! -f /var/dnscache/pdnsd.cache ]; then if [ ! -f /var/dnscache/pdnsd.cache ]; then
mkdir -p /var/dnscache mkdir -p /var/dnscache
echo -ne "pd13\000\000\000\000" > /var/dnscache/pdnsd.cache echo -ne "pd13\000\000\000\000" >/var/dnscache/pdnsd.cache
chown -R nobody.nogroup /var/dnscache chown -R nobody.nogroup /var/dnscache
fi fi
cat > /var/etc/dnscache.conf <<EOF cat <<-EOF >/var/etc/dnscache.conf
global { global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大 perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置 cache_dir="/var/dnscache"; # 缓存文件的位置
pid_file = /var/run/dnscache.pid; pid_file="/var/run/dnscache.pid";
server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡 run_as="nobody";
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可 server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡
status_ctl = on; server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求 status_ctl = on;
query_method=udp_only; paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
neg_domain_pol = off; query_method=udp_only;
par_queries = 400; # 最多同时请求数 neg_domain_pol = off;
min_ttl = 1h; # DNS结果最短缓存时间 par_queries = 400; # 最多同时请求数
max_ttl = 1w; # DNS结果最长缓存时间 min_ttl = 1h; # DNS结果最短缓存时间
timeout = 10; # DNS请求超时时间单位秒 max_ttl = 1w; # DNS结果最长缓存时间
} timeout = 10; # DNS请求超时时间单位秒
}
server { server {
label = "routine"; label = "routine";
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址 ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间 timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
74.125.155.102, 74.125.155.102,
74.125.39.102, 74.125.39.102,
74.125.39.113, 74.125.39.113,
209.85.229.138, 209.85.229.138,
128.121.126.139, 128.121.126.139,
159.106.121.75, 159.106.121.75,
169.132.13.103, 169.132.13.103,
192.67.198.6, 192.67.198.6,
202.106.1.2, 202.106.1.2,
202.181.7.85, 202.181.7.85,
203.161.230.171, 203.161.230.171,
203.98.7.65, 203.98.7.65,
207.12.88.98, 207.12.88.98,
208.56.31.43, 208.56.31.43,
209.145.54.50, 209.145.54.50,
209.220.30.174, 209.220.30.174,
209.36.73.33, 209.36.73.33,
211.94.66.147, 211.94.66.147,
213.169.251.35, 213.169.251.35,
216.221.188.182, 216.221.188.182,
216.234.179.13, 216.234.179.13,
243.185.187.39, 243.185.187.39,
37.61.54.158, 37.61.54.158,
4.36.66.178, 4.36.66.178,
46.82.174.68, 46.82.174.68,
59.24.3.173, 59.24.3.173,
64.33.88.161, 64.33.88.161,
64.33.99.47, 64.33.99.47,
64.66.163.251, 64.66.163.251,
65.104.202.252, 65.104.202.252,
65.160.219.113, 65.160.219.113,
66.45.252.237, 66.45.252.237,
69.55.52.253, 69.55.52.253,
72.14.205.104, 72.14.205.104,
72.14.205.99, 72.14.205.99,
78.16.49.15, 78.16.49.15,
8.7.198.45, 8.7.198.45,
93.46.8.89, 93.46.8.89,
37.61.54.158, 37.61.54.158,
243.185.187.39, 243.185.187.39,
190.93.247.4, 190.93.247.4,
190.93.246.4, 190.93.246.4,
190.93.245.4, 190.93.245.4,
190.93.244.4, 190.93.244.4,
65.49.2.178, 65.49.2.178,
189.163.17.5, 189.163.17.5,
23.89.5.60, 23.89.5.60,
49.2.123.56, 49.2.123.56,
54.76.135.1, 54.76.135.1,
77.4.7.92, 77.4.7.92,
118.5.49.6, 118.5.49.6,
159.24.3.173, 159.24.3.173,
188.5.4.96, 188.5.4.96,
197.4.4.12, 197.4.4.12,
220.250.64.24, 220.250.64.24,
243.185.187.30, 243.185.187.30,
249.129.46.48, 249.129.46.48,
253.157.14.165; 253.157.14.165;
reject_policy = fail; reject_policy = fail;
} }
server { server {
label = "special"; # 这个随便写 label = "special"; # 这个随便写
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址 ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持 port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
proxy_only = on; proxy_only = on;
timeout = 5; timeout = 5;
} }
source { source {
owner=localhost; owner=localhost;
// serve_aliases=on; // serve_aliases=on;
file="/etc/hosts"; file="/etc/hosts";
} }
rr { rr {
name=localhost; name=localhost;
reverse=on; reverse=on;
a=127.0.0.1; a=127.0.0.1;
owner=localhost; owner=localhost;
soa=localhost,root.localhost,42,86400,900,86400,86400; soa=localhost,root.localhost,42,86400,900,86400,86400;
} }
EOF EOF
[ -d /var/sbin ] || mkdir -p /var/sbin [ -d /var/sbin ] || mkdir -p /var/sbin
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache [ -f /var/sbin/dnscache ] || ln -s /usr/sbin/pdnsd /var/sbin/dnscache
} }
change_dns() { change_dns() {
uci delete dhcp.@dnsmasq[0].server >/dev/null 2>&1 uci delete dhcp.@dnsmasq[0].server >/dev/null 2>&1
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5333 uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5333
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0 uci set dhcp.@dnsmasq[0].noresolv=0
@ -146,61 +147,63 @@ revert_dns() {
} }
start_service() { start_service() {
enable=$(uci get sfe.config.enabled 2>/dev/null) enable=$(uci get sfe.config.enabled 2>/dev/null)
wifi=$(uci get sfe.config.wifi) wifi=$(uci get sfe.config.wifi)
ipv6=$(uci get sfe.config.ipv6) ipv6=$(uci get sfe.config.ipv6)
dns=$(uci get sfe.config.dns 2>/dev/null) dns=$(uci get sfe.config.dns 2>/dev/null)
bbr=$(uci get sfe.config.bbr 2>/dev/null) bbr=$(uci get sfe.config.bbr 2>/dev/null)
if [ $enable -eq 1 ]; then if [ $enable -eq 1 ]; then
! (lsmod | grep fast_classifier >/dev/null) && (modprobe fast_classifier) ! (lsmod | grep fast_classifier >/dev/null) && (modprobe fast_classifier)
if [ $wifi -eq 1 ] ; then if [ $wifi -eq 1 ]; then
echo 1 > /sys/fast_classifier/skip_to_bridge_ingress echo 1 >/sys/fast_classifier/skip_to_bridge_ingress
else else
echo 0 > /sys/fast_classifier/skip_to_bridge_ingress echo 0 >/sys/fast_classifier/skip_to_bridge_ingress
fi fi
if [ $ipv6 -eq 1 ]; then if [ $ipv6 -eq 1 ]; then
sfe_ipv6=$(cat /sys/sfe_ipv6/debug_dev) sfe_ipv6=$(cat /sys/sfe_ipv6/debug_dev)
[ ! -f /dev/sfe_ipv6 ] && mknod /dev/sfe_ipv6 c $sfe_ipv6 0 [ ! -f /dev/sfe_ipv6 ] && mknod /dev/sfe_ipv6 c $sfe_ipv6 0
else else
rm -f /dev/sfe_ipv6 rm -f /dev/sfe_ipv6
fi fi
else else
rmmod fast_classifier >/dev/null 2>&1 rmmod fast_classifier >/dev/null 2>&1
fi fi
if [ $dns -eq 1 ]; then if [ $dns -eq 1 ]; then
pdnsd_genconfig pdnsd_genconfig
procd_open_instance procd_open_instance
procd_set_param command "$PDNSD_BIN" -c /var/etc/dnscache.conf procd_set_param command "$PDNSD_BIN" -c /var/etc/dnscache.conf
procd_set_param respawn procd_set_param respawn
procd_set_param stderr 1 procd_set_param stderr 1
procd_close_instance procd_close_instance
change_dns change_dns
fi else
revert_dns
fi
if [ $bbr -eq 1 ]; then if [ $bbr -eq 1 ]; then
sysctl -w net.ipv4.tcp_congestion_control=bbr sysctl -w net.ipv4.tcp_congestion_control=bbr
else else
sysctl -w net.ipv4.tcp_congestion_control=cubic sysctl -w net.ipv4.tcp_congestion_control=cubic
fi fi
if [ "$DNSMASQ_RESTART" = N ]; then if [ "$DNSMASQ_RESTART" = N ]; then
/etc/init.d/dnsmasq restart /etc/init.d/dnsmasq restart
fi fi
} }
stop_service(){ stop_service() {
enable=$(uci get sfe.config.enabled 2>/dev/null) enable=$(uci get sfe.config.enabled 2>/dev/null)
[ $enable -ne 1 ] && rmmod fast_classifier >/dev/null 2>&1 [ $enable -ne 1 ] && rmmod fast_classifier >/dev/null 2>&1
revert_dns revert_dns
if [ "$DNSMASQ_RESTART" = N ]; then if [ "$DNSMASQ_RESTART" = N ]; then
/etc/init.d/dnsmasq restart /etc/init.d/dnsmasq restart
fi fi
} }
restart(){ restart() {
DNSMASQ_RESTART=Y DNSMASQ_RESTART=Y
stop stop
start start
/etc/init.d/dnsmasq restart && echo "DNSMASQ restart" /etc/init.d/dnsmasq restart && echo "DNSMASQ restart"
} }

View File

@ -1,12 +1,55 @@
/dts-v1/; /dts-v1/;
#include "mt7621_phicomm_k2p_default.dtsi" #include "mt7621_phicomm_k2p.dtsi"
/ { / {
compatible = "phicomm,k2p-32m", "phicomm,k2p", "mediatek,mt7621-soc"; compatible = "phicomm,k2p-32m", "phicomm,k2p", "mediatek,mt7621-soc";
model = "Phicomm K2P (32M)"; model = "Phicomm K2P 32M";
}; };
&firmware { &spi0 {
reg = <0xa0000 0x1f60000>; status = "okay";
m25p80@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
broken-flash-reset;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "permanent_config";
reg = <0x50000 0x50000>;
read-only;
};
partition@a0000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0xa0000 0x1f60000>;
};
};
};
}; };

View File

@ -1,7 +1,54 @@
/dts-v1/; /dts-v1/;
#include "mt7621_phicomm_k2p_default.dtsi" #include "mt7621_phicomm_k2p.dtsi"
&firmware { / {
reg = <0xa0000 0xf60000>; compatible = "phicomm,k2p", "mediatek,mt7621-soc";
model = "Phicomm K2P";
};
&spi0 {
status = "okay";
m25p80@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "permanent_config";
reg = <0x50000 0x50000>;
read-only;
};
partition@a0000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0xa0000 0xf60000>;
};
};
};
}; };

View File

@ -5,9 +5,6 @@
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
/ { / {
compatible = "phicomm,k2p", "mediatek,mt7621-soc";
model = "Phicomm K2P";
aliases { aliases {
led-boot = &led_blue; led-boot = &led_blue;
led-failsafe = &led_blue; led-failsafe = &led_blue;
@ -49,52 +46,6 @@
}; };
}; };
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "permanent_config";
reg = <0x50000 0x50000>;
read-only;
};
firmware: partition@a0000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0xa0000 0xf60000>;
};
};
};
};
&pcie { &pcie {
status = "okay"; status = "okay";
}; };

View File

@ -825,7 +825,7 @@ define Device/phicomm_k2p-32m
$(Device/phicomm_k2p) $(Device/phicomm_k2p)
IMAGE_SIZE := 32128k IMAGE_SIZE := 32128k
DEVICE_VARIANT := 32M DEVICE_VARIANT := 32M
SUPPORTED_DEVICES += k2p-32M SUPPORTED_DEVICES += k2p-32m
endef endef
TARGET_DEVICES += phicomm_k2p-32m TARGET_DEVICES += phicomm_k2p-32m