From 82756f48f907670a5c999ccb73a3edb5e2cbd066 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Sun, 27 Dec 2020 17:44:33 +0800 Subject: [PATCH 1/7] Update 901-arm-boot-add-dts-files.patch --- .../linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index 7df34a8f..15b90859 100755 --- a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -66,7 +66,7 @@ Signed-off-by: John Crispin + qcom-ipq4029-gl-b1300.dtb \ + qcom-ipq4029-gl-s1300.dtb \ + qcom-ipq4029-mr33.dtb \ - qcom-ipq4019-r619ac-64m.dtb \ ++ qcom-ipq4019-r619ac-64m.dtb \ + qcom-ipq4019-r619ac-128m.dtb \ + qcom-ipq4019-l1000.dtb \ qcom-ipq8064-ap148.dtb \ From a061b71fe11d3e17d3a2b128b47c71d22d4fe3c9 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Sun, 27 Dec 2020 17:53:13 +0800 Subject: [PATCH 2/7] Update 11-ath10k-caldata --- .../etc/hotplug.d/firmware/11-ath10k-caldata | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 10362f78..08930b9c 100755 --- a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -60,7 +60,7 @@ case "$FIRMWARE" in glinet,gl-s1300 |\ linksys,ea6350v3 |\ mobipromo,cm520-79f |\ - p2w,r619ac-64m |\ + p2w,r619ac-64m |\ p2w,r619ac-128m |\ qcom,ap-dk01.1-c1) caldata_extract "ART" 0x1000 0x2f20 @@ -137,7 +137,7 @@ case "$FIRMWARE" in caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) ;; - pangu,l1000) + pangu,l1000) caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) ;; @@ -170,7 +170,7 @@ case "$FIRMWARE" in glinet,gl-s1300 |\ linksys,ea6350v3 |\ mobipromo,cm520-79f |\ - p2w,r619ac-64m |\ + p2w,r619ac-64m |\ p2w,r619ac-128m |\ qcom,ap-dk01.1-c1) caldata_extract "ART" 0x5000 0x2f20 @@ -247,15 +247,15 @@ case "$FIRMWARE" in caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) ;; - pangu,l1000) - caldata_extract "ART" 0x5000 0x2f20 - ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) - ;; meraki,mr33) caldata_extract_ubi "ART" 0x5000 0x2f20 caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3) ;; + pangu,l1000) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) + ;; netgear,ex6100v2 |\ netgear,ex6150v2) caldata_extract "ART" 0x5000 0x2f20 From 93a344acacae14229a431a804477554b1fd4313b Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Mon, 28 Dec 2020 11:17:29 +0800 Subject: [PATCH 3/7] Update 901-arm-boot-add-dts-files.patch --- .../linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index 15b90859..11811f27 100755 --- a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -837,11 +837,61 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -837,11 +837,60 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -18,7 +18,6 @@ Signed-off-by: John Crispin + qcom-ipq4018-ap120c-ac.dtb \ + qcom-ipq4018-dap-2610.dtb \ + qcom-ipq4018-cs-w3-wd1200g-eup.dtb \ -+ qcom-ipq4018-magic-2-wifi-next.dtb \ + qcom-ipq4018-ea6350v3.dtb \ + qcom-ipq4018-eap1300.dtb \ + qcom-ipq4018-ecw5211.dtb \ From 210c4e54322814a02c8e29c8c532dc418d844f86 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Mon, 28 Dec 2020 13:59:08 +0800 Subject: [PATCH 4/7] Create 999-ipq40xx-unlock-cpu-frequency.patch --- .../999-ipq40xx-unlock-cpu-frequency.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch diff --git a/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch b/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch new file mode 100644 index 00000000..dd654f88 --- /dev/null +++ b/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch @@ -0,0 +1,57 @@ +From: William +Subject: [PATCH] ipq40xx: improve CPU clock +Date: Tue, 15 Dec 2020 15:28:10 +0800 + +This patch will match the clock-latency-ns values in the device tree +for those found inside the OEM device tree and kernel source code and +unlock 896Mhz CPU operating points. + +Signed-off-by: William +--- +--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi ++++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi +@@ -121,23 +121,28 @@ + opp-48000000 { + opp-hz = /bits/ 64 <48000000>; + opp-microvolt = <1100000>; +- clock-latency-ns = <256000>; ++ clock-latency-ns = <100000>; + }; + opp-200000000 { + opp-hz = /bits/ 64 <200000000>; + opp-microvolt = <1100000>; +- clock-latency-ns = <256000>; ++ clock-latency-ns = <100000>; + }; + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + opp-microvolt = <1100000>; +- clock-latency-ns = <256000>; ++ clock-latency-ns = <100000>; + }; + opp-716000000 { + opp-hz = /bits/ 64 <716000000>; + opp-microvolt = <1100000>; +- clock-latency-ns = <256000>; ++ clock-latency-ns = <100000>; + }; ++ opp-896000000 { ++ opp-hz = /bits/ 64 <896000000>; ++ opp-microvolt = <1100000>; ++ clock-latency-ns = <100000>; ++ }; + }; + + pmu { +--- a/drivers/clk/qcom/gcc-ipq4019.c ++++ b/drivers/clk/qcom/gcc-ipq4019.c +@@ -587,6 +587,9 @@ static const struct freq_tbl ftbl_gcc_ap + F(632000000, P_DDRPLLAPSS, 1, 0, 0), + F(672000000, P_DDRPLLAPSS, 1, 0, 0), + F(716000000, P_DDRPLLAPSS, 1, 0, 0), ++ F(768000000, P_DDRPLLAPSS, 1, 0, 0), ++ F(823000000, P_DDRPLLAPSS, 1, 0, 0), ++ F(896000000, P_DDRPLLAPSS, 1, 0, 0), + { } + }; + \ No newline at end of file From 4ade942da43042278a6533930aa5099aea4f6804 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Mon, 28 Dec 2020 13:59:56 +0800 Subject: [PATCH 5/7] Update 999-ipq40xx-unlock-cpu-frequency.patch --- .../999-ipq40xx-unlock-cpu-frequency.patch | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch b/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch index dd654f88..c08658bb 100644 --- a/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch +++ b/root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch @@ -1,6 +1,6 @@ From: William Subject: [PATCH] ipq40xx: improve CPU clock -Date: Tue, 15 Dec 2020 15:28:10 +0800 +Date: Tue, 15 Dec 2020 15:26:35 +0800 This patch will match the clock-latency-ns values in the device tree for those found inside the OEM device tree and kernel source code and @@ -10,42 +10,38 @@ Signed-off-by: William --- --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi -@@ -121,23 +121,28 @@ +@@ -114,20 +114,24 @@ + opp-48000000 { opp-hz = /bits/ 64 <48000000>; - opp-microvolt = <1100000>; - clock-latency-ns = <256000>; + clock-latency-ns = <100000>; }; opp-200000000 { opp-hz = /bits/ 64 <200000000>; - opp-microvolt = <1100000>; - clock-latency-ns = <256000>; + clock-latency-ns = <100000>; }; opp-500000000 { opp-hz = /bits/ 64 <500000000>; - opp-microvolt = <1100000>; - clock-latency-ns = <256000>; + clock-latency-ns = <100000>; }; opp-716000000 { opp-hz = /bits/ 64 <716000000>; - opp-microvolt = <1100000>; - clock-latency-ns = <256000>; + clock-latency-ns = <100000>; }; + opp-896000000 { + opp-hz = /bits/ 64 <896000000>; -+ opp-microvolt = <1100000>; + clock-latency-ns = <100000>; + }; }; - pmu { + memory { --- a/drivers/clk/qcom/gcc-ipq4019.c +++ b/drivers/clk/qcom/gcc-ipq4019.c -@@ -587,6 +587,9 @@ static const struct freq_tbl ftbl_gcc_ap +@@ -579,6 +579,9 @@ static const struct freq_tbl ftbl_gcc_ap F(632000000, P_DDRPLLAPSS, 1, 0, 0), F(672000000, P_DDRPLLAPSS, 1, 0, 0), F(716000000, P_DDRPLLAPSS, 1, 0, 0), From c2659e07e13e3cd05ca9d492f118db803406da47 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Mon, 28 Dec 2020 17:08:56 +0800 Subject: [PATCH 6/7] Update 901-arm-boot-add-dts-files.patch --- .../linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index 11811f27..badd99bb 100755 --- a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -837,11 +837,60 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -837,11 +837,59 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -27,7 +27,6 @@ Signed-off-by: John Crispin + qcom-ipq4018-ex6100v2.dtb \ + qcom-ipq4018-ex6150v2.dtb \ + qcom-ipq4018-fritzbox-4040.dtb \ -+ qcom-ipq4018-gl-ap1300.dtb \ + qcom-ipq4018-jalapeno.dtb \ + qcom-ipq4018-meshpoint-one.dtb \ + qcom-ipq4018-nbg6617.dtb \ From d130b2575f9e58718c5ad7ee2e668cb083ea57ea Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Fri, 8 Jan 2021 00:56:48 +0800 Subject: [PATCH 7/7] fix --- .../base-files/files/bin/config_generate | 149 +++++------------- .../files/etc/board.d/99-default_network | 16 ++ 2 files changed, 54 insertions(+), 111 deletions(-) create mode 100755 root/package/base-files/files/etc/board.d/99-default_network diff --git a/root/package/base-files/files/bin/config_generate b/root/package/base-files/files/bin/config_generate index 5f73d3df..53cad27a 100755 --- a/root/package/base-files/files/bin/config_generate +++ b/root/package/base-files/files/bin/config_generate @@ -7,35 +7,6 @@ CFG=/etc/board.json [ -s $CFG ] || /bin/board_detect || exit 1 [ -s /etc/config/network -a -s /etc/config/system ] && exit 0 -generate_bridge() { - local name=$1 - local macaddr=$2 - uci -q batch <<-EOF - set network.$name=device - set network.$name.name=$name - set network.$name.type=bridge - EOF - if [ -n "$macaddr" ]; then - uci -q batch <<-EOF - set network.$name.macaddr=$macaddr - EOF - fi -} - -bridge_vlan_id=0 -generate_bridge_vlan() { - local name=$1_vlan - local device=$2 - local ports="$3" - local vlan="$4" - uci -q batch <<-EOF - set network.$name=bridge-vlan - set network.$name.device='$device' - set network.$name.vlan='$vlan' - set network.$name.ports='$ports' - EOF -} - generate_static_network() { uci -q batch <<-EOF delete network.loopback @@ -44,21 +15,17 @@ generate_static_network() { set network.loopback.proto='static' set network.loopback.ipaddr='127.0.0.1' set network.loopback.netmask='255.0.0.0' + delete network.globals + set network.globals='globals' + set network.globals.ula_prefix='auto' EOF - [ -e /proc/sys/net/ipv6 ] && { - uci -q batch <<-EOF - delete network.globals - set network.globals='globals' - set network.globals.ula_prefix='auto' - EOF - } if json_is_a dsl object; then json_select dsl if json_is_a atmbridge object; then json_select atmbridge - local vpi vci encaps payload nameprefix - json_get_vars vpi vci encaps payload nameprefix + local vpi vci encaps payload + json_get_vars vpi vci encaps payload uci -q batch <<-EOF delete network.atm set network.atm='atm-bridge' @@ -66,7 +33,6 @@ generate_static_network() { set network.atm.vci='$vci' set network.atm.encaps='$encaps' set network.atm.payload='$payload' - set network.atm.nameprefix='$nameprefix' EOF json_select .. fi @@ -91,31 +57,35 @@ generate_static_network() { addr_offset=2 generate_network() { - local ifname macaddr protocol type ipaddr netmask vlan - local bridge=$2 + local ifname macaddr protocol type ipaddr netmask json_select network json_select "$1" - json_get_vars ifname macaddr protocol ipaddr netmask vlan + json_get_vars ifname macaddr protocol ipaddr netmask json_select .. json_select .. [ -n "$ifname" ] || return - # force bridge for multi-interface devices (and lan) - case "$1:$ifname" in - *\ * | lan:*) type="bridge" ;; + case "$1" in + # hack (see /etc/board.d/02_network) + none) return ;; + lan*) proto=${proto:-static} ;; + wan*) proto=${proto:-dhcp} ;; esac - [ -n "$bridge" ] && { - if [ -z "$vlan" ]; then - bridge_vlan_id=$((bridge_vlan_id + 1)) - vlan=$bridge_vlan_id - fi - generate_bridge_vlan $1 $bridge "$ifname" $vlan - ifname=$bridge.$vlan - type="" - } + if [ -n "$macaddr" ]; then + type=macvlan # useless, only for legacy + uci -q batch <<-EOF + delete network.${1}_dev + set network.${1}_dev='device' + set network.${1}_dev.name='$1' + set network.${1}_dev.type='$type' + set network.${1}_dev.ifname='$ifname' + set network.${1}_dev.macaddr='$macaddr' + EOF + ifname=$1 + fi uci -q batch <<-EOF delete network.$1 @@ -125,17 +95,6 @@ generate_network() { set network.$1.proto='none' EOF - if [ -n "$macaddr" ]; then - for name in $ifname; do - uci -q batch <<-EOF - delete network.$1_${name/./_}_dev - set network.$1_${name/./_}_dev='device' - set network.$1_${name/./_}_dev.name='$name' - set network.$1_${name/./_}_dev.macaddr='$macaddr' - EOF - done - fi - case "$protocol" in static) local ipad @@ -150,23 +109,17 @@ generate_network() { set network.$1.proto='static' set network.$1.ipaddr='$ipad' set network.$1.netmask='$netm' + set network.$1.ip6assign='60' EOF - [ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60' ;; dhcp) # fixup IPv6 slave interface if parent is a bridge [ "$type" = "bridge" ] && ifname="br-$1" - uci set network.$1.proto='dhcp' - [ -e /proc/sys/net/ipv6 ] && { - uci -q batch <<-EOF - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='$ifname' - set network.${1}6.proto='dhcpv6' - EOF - } + uci -q batch <<-EOF + set network.$1.proto='dhcp' + EOF ;; pppoe) @@ -174,16 +127,12 @@ generate_network() { set network.$1.proto='pppoe' set network.$1.username='username' set network.$1.password='password' + set network.$1.ipv6='1' + delete network.${1}6 + set network.${1}6='interface' + set network.${1}6.ifname='@${1}' + set network.${1}6.proto='dhcpv6' EOF - [ -e /proc/sys/net/ipv6 ] && { - uci -q batch <<-EOF - set network.$1.ipv6='1' - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='@${1}' - set network.${1}6.proto='dhcpv6' - EOF - } ;; esac } @@ -257,8 +206,7 @@ generate_switch() { json_select switch json_select "$key" - json_get_vars enable reset blinkrate cpu_port \ - ar8xxx_mib_type ar8xxx_mib_poll_interval + json_get_vars enable reset blinkrate cpu_port uci -q batch <<-EOF add network switch @@ -266,8 +214,6 @@ generate_switch() { set network.@switch[-1].reset='$reset' set network.@switch[-1].enable_vlan='$enable' set network.@switch[-1].blinkrate='$blinkrate' - set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type' - set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval' EOF generate_switch_vlans_ports "$1" @@ -276,6 +222,7 @@ generate_switch() { json_select .. } + generate_static_system() { uci -q batch <<-EOF delete system.@system[0] @@ -303,13 +250,6 @@ generate_static_system() { uci -q set "system.@system[-1].hostname=$hostname" fi - local compat_version - if json_get_var compat_version compat_version; then - uci -q set "system.@system[-1].compat_version=$compat_version" - else - uci -q set "system.@system[-1].compat_version=1.0" - fi - if json_is_a ntpserver array; then local keys key json_get_keys keys ntpserver @@ -419,12 +359,11 @@ generate_led() { ;; switch) - local port_mask speed_mask mode - json_get_vars port_mask speed_mask mode + local port_mask speed_mask + json_get_vars port_mask speed_mask uci -q batch <<-EOF set system.$cfg.port_mask='$port_mask' set system.$cfg.speed_mask='$speed_mask' - set system.$cfg.mode='$mode' EOF ;; @@ -472,24 +411,12 @@ generate_gpioswitch() { json_init json_load "$(cat ${CFG})" -umask 077 - if [ ! -s /etc/config/network ]; then - bridge_name="" touch /etc/config/network generate_static_network - json_get_vars bridge - [ -n "$bridge" ] && { - json_select bridge - json_get_vars name macaddr - generate_bridge "$name" "$macaddr" - json_select .. - bridge_name=$name - } - json_get_keys keys network - for key in $keys; do generate_network $key $bridge_name; done + for key in $keys; do generate_network $key; done json_get_keys keys switch for key in $keys; do generate_switch $key; done diff --git a/root/package/base-files/files/etc/board.d/99-default_network b/root/package/base-files/files/etc/board.d/99-default_network new file mode 100755 index 00000000..55d5d79a --- /dev/null +++ b/root/package/base-files/files/etc/board.d/99-default_network @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Copyright (C) 2013-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +json_is_a network object && exit 0 + +ucidef_set_interface_lan 'eth0' + +board_config_flush + +exit 0