From c46621b3f3fff89cce4dd5e24bd52a4337e44378 Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Sat, 5 Mar 2022 12:54:48 +0100 Subject: [PATCH 01/24] lantiq: xrx200: fix use after free bug The skb->len field is read after the packet is sent to the network stack. In the meantime, skb can be freed. This patch fixes this bug. Signed-off-by: Aleksander Jan Bajkowski --- ...lantiq-dma-increase-descritor-count.patch} | 0 ...iq_xrx200-increase-napi-poll-weigth.patch} | 0 ...-lantiq_xrx200-convert-to-build_skb.patch} | 0 ...lantiq_xrx200-fix-use-after-free-bug.patch | 30 +++++++++++++++++++ 4 files changed, 30 insertions(+) rename target/linux/lantiq/patches-5.10/{0713-MIPS-lantiq-dma-increase-descritor-count.patch => 0713-v5.17-MIPS-lantiq-dma-increase-descritor-count.patch} (100%) rename target/linux/lantiq/patches-5.10/{0714-net-lantiq_xrx200-increase-napi-poll-weigth.patch => 0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch} (100%) rename target/linux/lantiq/patches-5.10/{0715-net-lantiq_xrx200-convert-to-build_skb.patch => 0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch} (100%) create mode 100644 target/linux/lantiq/patches-5.10/0716-v5.17-net-lantiq_xrx200-fix-use-after-free-bug.patch diff --git a/target/linux/lantiq/patches-5.10/0713-MIPS-lantiq-dma-increase-descritor-count.patch b/target/linux/lantiq/patches-5.10/0713-v5.17-MIPS-lantiq-dma-increase-descritor-count.patch similarity index 100% rename from target/linux/lantiq/patches-5.10/0713-MIPS-lantiq-dma-increase-descritor-count.patch rename to target/linux/lantiq/patches-5.10/0713-v5.17-MIPS-lantiq-dma-increase-descritor-count.patch diff --git a/target/linux/lantiq/patches-5.10/0714-net-lantiq_xrx200-increase-napi-poll-weigth.patch b/target/linux/lantiq/patches-5.10/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch similarity index 100% rename from target/linux/lantiq/patches-5.10/0714-net-lantiq_xrx200-increase-napi-poll-weigth.patch rename to target/linux/lantiq/patches-5.10/0714-v5.17-net-lantiq_xrx200-increase-napi-poll-weigth.patch diff --git a/target/linux/lantiq/patches-5.10/0715-net-lantiq_xrx200-convert-to-build_skb.patch b/target/linux/lantiq/patches-5.10/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch similarity index 100% rename from target/linux/lantiq/patches-5.10/0715-net-lantiq_xrx200-convert-to-build_skb.patch rename to target/linux/lantiq/patches-5.10/0715-v5.17-net-lantiq_xrx200-convert-to-build_skb.patch diff --git a/target/linux/lantiq/patches-5.10/0716-v5.17-net-lantiq_xrx200-fix-use-after-free-bug.patch b/target/linux/lantiq/patches-5.10/0716-v5.17-net-lantiq_xrx200-fix-use-after-free-bug.patch new file mode 100644 index 0000000000..090b7e3111 --- /dev/null +++ b/target/linux/lantiq/patches-5.10/0716-v5.17-net-lantiq_xrx200-fix-use-after-free-bug.patch @@ -0,0 +1,30 @@ +From dd830aed23c6e07cd8e2a163742bf3d63c9add08 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sat, 5 Mar 2022 12:20:39 +0100 +Subject: net: lantiq_xrx200: fix use after free bug + +The skb->len field is read after the packet is sent to the network +stack. In the meantime, skb can be freed. This patch fixes this bug. + +Fixes: c3e6b2c35b34 ("net: lantiq_xrx200: add ingress SG DMA support") +Reported-by: Eric Dumazet +Signed-off-by: Aleksander Jan Bajkowski +Acked-by: Hauke Mehrtens +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/lantiq_xrx200.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/lantiq_xrx200.c ++++ b/drivers/net/ethernet/lantiq_xrx200.c +@@ -260,9 +260,9 @@ static int xrx200_hw_receive(struct xrx2 + + if (ctl & LTQ_DMA_EOP) { + ch->skb_head->protocol = eth_type_trans(ch->skb_head, net_dev); +- netif_receive_skb(ch->skb_head); + net_dev->stats.rx_packets++; + net_dev->stats.rx_bytes += ch->skb_head->len; ++ netif_receive_skb(ch->skb_head); + ch->skb_head = NULL; + ch->skb_tail = NULL; + ret = XRX200_DMA_PACKET_COMPLETE; From 4eefdc7adbbafbb3ed3c091ead20ba0a674a48da Mon Sep 17 00:00:00 2001 From: Sven Schwermer Date: Mon, 7 Mar 2022 22:08:32 +0100 Subject: [PATCH 02/24] ath79: Add green power LED to Airtight C-75 In addition to the missing green LED definition, the polarity of the amber power LED was incorrect which is fixed here. Signed-off-by: Sven Schwermer --- .../linux/ath79/dts/qca9550_airtight_c-75.dts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/target/linux/ath79/dts/qca9550_airtight_c-75.dts b/target/linux/ath79/dts/qca9550_airtight_c-75.dts index 0121753445..587610c6df 100644 --- a/target/linux/ath79/dts/qca9550_airtight_c-75.dts +++ b/target/linux/ath79/dts/qca9550_airtight_c-75.dts @@ -4,6 +4,7 @@ #include #include +#include / { model = "AirTight Networks C-75"; @@ -11,9 +12,10 @@ aliases { label-mac-device = ð0; - led-boot = &led_power; - led-failsafe = &led_power; - led-upgrade = &led_power; + led-boot = &led_power_amber; + led-running = &led_power_green; + led-failsafe = &led_power_amber; + led-upgrade = &led_power_amber; }; keys { @@ -29,10 +31,16 @@ leds { compatible = "gpio-leds"; - led_power: power { - label = "amber:power"; - gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; - default-state = "on"; + led_power_amber: power-amber { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_power_green: power-green { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; }; wlan2g { From 549f8694c308761c25690a519de724ea3ad2bd76 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 6 Mar 2022 11:56:15 +0200 Subject: [PATCH 03/24] ipq806x: provide ramoops for R7800/XR500 by default Add kmod-ramoops to the default set of device packages in R7800 and XR500, so that the ramoops kernel crash logs are provided by default for these routers. The capability was earlier defined by 97158fe1 and cf346dfa, but the feature was not yet turned on by default. The possible kernel crashes are stored into /sys/fs/pstore/* Signed-off-by: Hannu Nyman --- target/linux/ipq806x/image/generic.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk index 11592ad97e..819c73d338 100644 --- a/target/linux/ipq806x/image/generic.mk +++ b/target/linux/ipq806x/image/generic.mk @@ -304,7 +304,7 @@ define Device/netgear_r7800 PAGESIZE := 2048 BOARD_NAME := r7800 SUPPORTED_DEVICES += r7800 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct kmod-ramoops endef TARGET_DEVICES += netgear_r7800 @@ -318,7 +318,7 @@ define Device/netgear_xr500 NETGEAR_HW_ID := 29764958+0+256+512+4x4+4x4+cascade BLOCKSIZE := 128k PAGESIZE := 2048 - DEVICE_PACKAGES := ath10k-firmware-qca9984-ct + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct kmod-ramoops endef TARGET_DEVICES += netgear_xr500 From eb38af788180d624e5b37aa5db1fe3766b138dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Mon, 28 Feb 2022 11:34:43 +0100 Subject: [PATCH 04/24] ath79: add support for MikroTik RouterBOARD mAP lite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MikroTik RouterBOARD mAPL-2nd (sold as mAP Lite) is a small 2.4 GHz 802.11b/g/n PoE-capable AP. See https://mikrotik.com/product/RBmAPL-2nD for more info. Specifications: - SoC: Qualcomm Atheros QCA9533 - RAM: 64 MB - Storage: 16 MB NOR - Wireless: Atheros AR9531 (SoC) 802.11b/g/n 2x2:2, 1.5 dBi antenna - Ethernet: Atheros AR8229 (SoC), 1x 10/100 port, 802.3af/at PoE in - 4 user-controllable LEDs: · 1x power (green) · 1x user (green) · 1x lan (green) · 1x wlan (green) Flashing: TFTP boot initramfs image and then perform sysupgrade. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Note: following 781d4bfb397cdd12ee0151eb66c577f470e3377d The network setup avoids using the integrated switch and connects the single Ethernet port directly. This way, link speed (10/100 Mbps) is properly reported by eth0. Signed-off-by: Thibaut VARÈNE --- .../qca9533_mikrotik_routerboard-mapl-2nd.dts | 68 +++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 8 +++ .../mikrotik/base-files/etc/board.d/01_leds | 3 +- .../base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + 5 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts new file mode 100644 index 0000000000..e2442f0095 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-mapl-2nd.dts @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9533_mikrotik_routerboard-16m.dtsi" + +/ { + compatible = "mikrotik,routerboard-mapl-2nd", "qca,qca9533"; + model = "MikroTik RouterBOARD mAPL-2nD (mAP lite)"; + + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_power_pin &led_lan_pin>; + + power { + label = "green:power"; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + lan { + label = "green:lan"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + wlan { + label = "green:wlan"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + led_user: user { + label = "green:user"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +ð1 { + compatible = "syscon", "simple-mfd"; +}; + +&pinmux { + led_lan_pin: pinmux_led_lan_pin { + pinctrl-single,bits = <0x4 0x0 0xff>; + }; + + led_power_pin: pinmux_led_power_pin { + pinctrl-single,bits = <0x10 0x0 0xff00>; + }; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index ff3604f2fa..dccb05e45a 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -55,6 +55,14 @@ define Device/mikrotik_routerboard-lhg-5nd endef TARGET_DEVICES += mikrotik_routerboard-lhg-5nd +define Device/mikrotik_routerboard-mapl-2nd + $(Device/mikrotik_nor) + SOC := qca9533 + DEVICE_MODEL := RouterBOARD mAPL-2nD (mAP lite) + IMAGE_SIZE := 16256k +endef +TARGET_DEVICES += mikrotik_routerboard-mapl-2nd + define Device/mikrotik_routerboard-sxt-5nd-r2 $(Device/mikrotik_nand) SOC := ar9344 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index 25c0184568..ecc47e07c2 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -6,7 +6,8 @@ board_config_update board=$(board_name) case "$board" in -mikrotik,routerboard-lhg-2nd) +mikrotik,routerboard-lhg-2nd|\ +mikrotik,routerboard-mapl-2nd) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; mikrotik,routerboard-lhg-5nd) diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 1a205e439c..cc4121f93e 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -17,6 +17,7 @@ ath79_setup_interfaces() mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ + mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-g-5hact2hnd|\ mikrotik,routerboard-wapr-2nd) @@ -40,6 +41,7 @@ ath79_setup_macs() mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ + mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-g-5hact2hnd|\ mikrotik,routerboard-wapr-2nd) diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index abdabfb7c8..8b1b5f04dd 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -30,6 +30,7 @@ case "$FIRMWARE" in mikrotik,routerboard-wapr-2nd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 1) ;; + mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-wap-g-5hact2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 2) ;; From 62125c3ad51478c1bb9c237471ac04ea971bda6a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sun, 6 Mar 2022 22:47:20 +0800 Subject: [PATCH 05/24] ath79: fix button labels for WZR-HP-AG300H and WZR-600DHP These were present in ar71xx but overlooked when porting to ath79. Fixes: 480bf2827392 ("ath79: add support for Buffalo WZR-HP-AG300H") Signed-off-by: Jeffery To --- target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi index 006755e418..35e083bc61 100644 --- a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi +++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dtsi @@ -75,24 +75,28 @@ compatible = "gpio-keys"; reset { + label = "reset"; linux,code = ; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; usb { + label = "usb"; linux,code = ; gpios = <&gpio 3 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; aoss { + label = "aoss"; linux,code = ; gpios = <&gpio 5 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; router_auto { + label = "router_auto"; linux,code = ; linux,input-type = ; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; @@ -100,6 +104,7 @@ }; router_off { + label = "router_off"; linux,code = ; linux,input-type = ; gpios = <&gpio 7 GPIO_ACTIVE_LOW>; @@ -107,6 +112,7 @@ }; movie_engine { + label = "movie_engine"; linux,code = ; linux,input-type = ; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; From ed364cd4b03b289a7bb4b32c350c46eddeb6b6b9 Mon Sep 17 00:00:00 2001 From: Birger Koblitz Date: Mon, 7 Mar 2022 19:50:29 +0100 Subject: [PATCH 06/24] ramips: add support for Renkforce WS-WN530HP3-A MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds support for the Renkforce WS-WN530HP3-A ceiling- mountable Wireless Access Point, which is powered over PoE. Hardware: - SoC: Mediatek MT7621DAT - RAM: 128MiB on SoC - Flash: 16MiB GigaDevice GD25Q128C - 2.4Ghz Wifi: Mediatek MT603EN - 5GHz Wifi: MT613BEN - Ethernet: - 1x 1GBit WAN port, passive PoE capable - 2x 1GBit LAN ports LEDs: 1x Bi-Color LED (red/blue) Buttons: 1x Reset Button, 1x Power Button Installation: Power on the access point and immedately press the reset button for 10 seconds. Connect web-browser to 192.168.10.1 and upload sysupgrade image. Flash uploaded image and wait about 2 minutes for reboot. Signed-off-by: Birger Koblitz Signed-off-by: Petr Štetiar [fixed SoB] --- .../dts/mt7621_renkforce_ws-wn530hp3-a.dts | 159 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 11 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + 3 files changed, 171 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts diff --git a/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts b/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts new file mode 100644 index 0000000000..13e37d7124 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_renkforce_ws-wn530hp3-a.dts @@ -0,0 +1,159 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "renkforce,ws-wn530hp3-a", "mediatek,mt7621-soc"; + model = "Renkforce WS-WN530HP3-A"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: led_1 { + label = "red:led1"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + led_2 { + label = "blue:led2"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + 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 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xf30000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi0: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + }; +}; + +&pcie1 { + wifi1: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-2)>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan2"; + }; + + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(-1)>; + }; + }; +}; + +&state_default { + gpio { + groups = "uart2", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&xhci { + status = "disabled"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 1b7d095fc4..011a96a59e 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1359,6 +1359,17 @@ define Device/raisecom_msg1500-x-00 endef TARGET_DEVICES += raisecom_msg1500-x-00 +define Device/renkforce_ws-wn530hp3-a + $(Device/dsa-migration) + DEVICE_VENDOR := Renkforce + DEVICE_MODEL := WS-WN530HP3-A + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap + IMAGE/sysupgrade.bin := append-kernel | pad-to 65536 | append-rootfs | \ + check-size | append-metadata + IMAGE_SIZE := 15040k +endef +TARGET_DEVICES += renkforce_ws-wn530hp3-a + define Device/samknows_whitebox-v8 $(Device/dsa-migration) IMAGE_SIZE := 16064k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 3e934899bb..bd51f3638e 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -43,6 +43,7 @@ ramips_setup_interfaces() jcg,q20|\ lenovo,newifi-d1|\ mikrotik,routerboard-m33g|\ + renkforce,ws-wn530hp3-a|\ xiaomi,mi-router-3g|\ xiaomi,mi-router-3g-v2|\ xiaomi,mi-router-4|\ From e42764cc5fa364e9fa553903c56191484738965e Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 12 Feb 2022 17:01:31 +0900 Subject: [PATCH 07/24] build: image: use UTC for zip timestamp Zip uses DOS timestamp for mtime which is stored in local time and hence depends on the timezone of the build system. Force zip to use UTC timezone to make image builds more reproducible. Signed-off-by: Sungbo Eo --- include/image-commands.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 939f5ef2db..21f851d205 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -541,8 +541,7 @@ define Build/zip rm -rf $@.tmp mkdir $@.tmp mv $@ $@.tmp/$(word 1,$(1)) - - $(STAGING_DIR_HOST)/bin/zip -j -X \ + TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \ $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \ $(wordlist 2,$(words $(1)),$(1)) \ $@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@)) From 39d06472eb93d72940b2728d33e2dafa2676e47b Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 12 Feb 2022 17:01:31 +0900 Subject: [PATCH 08/24] tools: zip: fetch SOURCE_DATE_EPOCH directly Remove "--mtime" option introduced in commit 18c9faa03211 ("tools: zip: add option for reproducible archives") and instead fetch SOURCE_DATE_EPOCH environment variable directly in the code. Ref: https://sourceforge.net/p/infozip/patches/25/ Signed-off-by: Sungbo Eo --- include/image-commands.mk | 1 - ...add-option-for-reproducible-archives.patch | 145 ------------------ .../zip/patches/011-reproducible-mtime.patch | 41 +++++ 3 files changed, 41 insertions(+), 146 deletions(-) delete mode 100644 tools/zip/patches/011-add-option-for-reproducible-archives.patch create mode 100644 tools/zip/patches/011-reproducible-mtime.patch diff --git a/include/image-commands.mk b/include/image-commands.mk index 21f851d205..b6593c138b 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -542,7 +542,6 @@ define Build/zip mkdir $@.tmp mv $@ $@.tmp/$(word 1,$(1)) TZ=UTC $(STAGING_DIR_HOST)/bin/zip -j -X \ - $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \ $(wordlist 2,$(words $(1)),$(1)) \ $@ $@.tmp/$(if $(word 1,$(1)),$(word 1,$(1)),$$(basename $@)) rm -rf $@.tmp diff --git a/tools/zip/patches/011-add-option-for-reproducible-archives.patch b/tools/zip/patches/011-add-option-for-reproducible-archives.patch deleted file mode 100644 index 45b9d67e15..0000000000 --- a/tools/zip/patches/011-add-option-for-reproducible-archives.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 6d659fc87451c02c8777dc33f750b16834e4c715 Mon Sep 17 00:00:00 2001 -From: Mathias Kresin -Date: Sat, 12 Jan 2019 19:33:33 +0100 -Subject: [PATCH] add option for reproducible archives - -Add the option -mt/--mtime to pass a timestamp which is used as filedate -for the containing files. - -So far, it isn't used for anything written to the extra fields, -therefore requires the -X (eXclude eXtra file attributes) parameter to -be effective. - -Signed-off-by: Mathias Kresin ---- - globals.c | 1 + - util.c | 22 ++++++++++++++++++++++ - zip.c | 6 ++++++ - zip.h | 1 + - zipup.c | 4 +++- - 5 files changed, 33 insertions(+), 1 deletion(-) - ---- a/globals.c -+++ b/globals.c -@@ -205,6 +205,7 @@ uzoff_t bytes_this_split = 0; /* byt - int read_split_archive = 0; /* 1=scanzipf_reg detected spanning signature */ - int split_method = 0; /* 0=no splits, 1=seekable, 2=data desc, -1=no */ - uzoff_t split_size = 0; /* how big each split should be */ -+time_t timestamp = -1; /* fixed timestamp for archive content filedate */ - int split_bell = 0; /* when pause for next split ring bell */ - uzoff_t bytes_prev_splits = 0; /* total bytes written to all splits before this */ - uzoff_t bytes_this_entry = 0; /* bytes written for this entry across all splits */ ---- a/util.c -+++ b/util.c -@@ -1217,6 +1217,7 @@ int DisplayNumString(file, i) - return 0; - } - -+ - /* Read numbers with trailing size multiplier (like 10M) and return number. - 10/30/04 EG */ - -@@ -1279,6 +1280,29 @@ uzoff_t ReadNumString( numstring ) - } - - -+uzoff_t ReadNumStringUL( numstring ) -+ char *numstring; -+{ -+ zoff_t num = 0; -+ -+ /* check if valid number (currently no negatives) */ -+ if (numstring == NULL) { -+ zipwarn("Unable to read empty number in ReadNumString", ""); -+ return (uzoff_t)-1; -+ } -+ if (numstring[0] < '0' || numstring[0] > '9') { -+ zipwarn("Unable to read number (must start with digit): ", numstring); -+ return (uzoff_t)-1; -+ } -+ if (strlen(numstring) > 10) { -+ zipwarn("Number too long to read (10 characters max): ", numstring); -+ return (uzoff_t)-1; -+ } -+ -+ return (uzoff_t)atoll(numstring); -+} -+ -+ - /* Write the number as a string with a multiplier (like 10M) to outstring. - Always writes no more than 3 digits followed maybe by a multiplier and - returns the characters written or -1 if error. ---- a/zip.c -+++ b/zip.c -@@ -1942,6 +1942,7 @@ int set_filetype(out_path) - #ifdef UNICODE_TEST - #define o_sC 0x146 - #endif -+#define o_mt 0x255 - - - /* the below is mainly from the old main command line -@@ -2036,6 +2037,7 @@ struct option_struct far options[] = { - {"m", "move", o_NO_VALUE, o_NOT_NEGATABLE, 'm', "add files to archive then delete files"}, - {"mm", "", o_NO_VALUE, o_NOT_NEGATABLE, o_mm, "not used"}, - {"MM", "must-match", o_NO_VALUE, o_NOT_NEGATABLE, o_MM, "error if in file not matched/not readable"}, -+ {"mt", "mtime", o_REQUIRED_VALUE, o_NOT_NEGATABLE, o_mt, "use fixed timestamp for archive content filedate"}, - {"n", "suffixes", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'n', "suffixes to not compress: .gz:.zip"}, - {"nw", "no-wild", o_NO_VALUE, o_NOT_NEGATABLE, o_nw, "no wildcards during add or update"}, - #if defined(AMIGA) || defined(MACOS) -@@ -2440,6 +2442,7 @@ char **argv; /* command line - split_method = 0; /* 0=no splits, 1=update LHs, 2=data descriptors */ - split_size = 0; /* how big each split should be */ - split_bell = 0; /* when pause for next split ring bell */ -+ timestamp = -1; /* fixed timestamp for archive content filedate */ - bytes_prev_splits = 0; /* total bytes written to all splits before this */ - bytes_this_entry = 0; /* bytes written for this entry across all splits */ - noisy_splits = 0; /* be verbose about creating splits */ -@@ -2897,6 +2900,9 @@ char **argv; /* command line - dispose = 1; break; - case o_MM: /* Exit with error if input file can't be read */ - bad_open_is_error = 1; break; -+ case o_mt: /* fixed timestamp for archive content filedate */ -+ timestamp = ReadNumStringUL(value); -+ break; - case 'n': /* Don't compress files with a special suffix */ - special = value; - /* special = NULL; */ /* will be set at next argument */ ---- a/zip.h -+++ b/zip.h -@@ -502,6 +502,7 @@ extern uzoff_t bytes_this_split; /* byte - extern int read_split_archive; /* 1=scanzipf_reg detected spanning signature */ - extern int split_method; /* 0=no splits, 1=seekable, 2=data descs, -1=no */ - extern uzoff_t split_size; /* how big each split should be */ -+extern time_t timestamp; /* fixed timestamp for archive content filedate */ - extern int split_bell; /* when pause for next split ring bell */ - extern uzoff_t bytes_prev_splits; /* total bytes written to all splits before this */ - extern uzoff_t bytes_this_entry; /* bytes written for this entry across all splits */ -@@ -789,6 +790,7 @@ char *zip_fzofft OF((zoff_t, char - int DisplayNumString OF ((FILE *file, uzoff_t i)); - int WriteNumString OF((uzoff_t num, char *outstring)); - uzoff_t ReadNumString OF((char *numstring)); -+uzoff_t ReadNumStringUL OF((char *numstring)); - - /* returns true if abbrev is abbreviation for string */ - int abbrevmatch OF((char *, char *, int, int)); ---- a/zipup.c -+++ b/zipup.c -@@ -415,7 +415,6 @@ struct zlist far *z; /* zip entry to - char *tempextra = NULL; - char *tempcextra = NULL; - -- - #ifdef WINDLL - # ifdef ZIP64_SUPPORT - extern _int64 filesize64; -@@ -441,6 +440,9 @@ struct zlist far *z; /* zip entry to - if (tim == 0 || q == (zoff_t) -3) - return ZE_OPEN; - -+ if (timestamp > 0) -+ tim = unix2dostime(×tamp); -+ - /* q is set to -1 if the input file is a device, -2 for a volume label */ - if (q == (zoff_t) -2) { - isdir = 1; diff --git a/tools/zip/patches/011-reproducible-mtime.patch b/tools/zip/patches/011-reproducible-mtime.patch new file mode 100644 index 0000000000..6ce8445e83 --- /dev/null +++ b/tools/zip/patches/011-reproducible-mtime.patch @@ -0,0 +1,41 @@ +From 501ae4e93fd6fa2f7d20d00d1b011f9006802eae Mon Sep 17 00:00:00 2001 +From: "Bernhard M. Wiedemann" +Date: Fri, 3 May 2019 16:32:24 +0200 +Subject: [PATCH] Override mtime with zip -X + +with SOURCE_DATE_EPOCH +to allow for reproducible builds of .zip files + +See https://reproducible-builds.org/ for why this is good +and https://reproducible-builds.org/specs/source-date-epoch/ +for the definition of this variable. + +Uses clamping to keep older mtimes than SOURCE_DATE_EPOCH intact. +--- + zipup.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/zipup.c ++++ b/zipup.c +@@ -414,6 +414,7 @@ struct zlist far *z; /* zip entry to + ush tempcext = 0; + char *tempextra = NULL; + char *tempcextra = NULL; ++ const char *source_date_epoch; + + + #ifdef WINDLL +@@ -674,6 +675,13 @@ struct zlist far *z; /* zip entry to + + } /* strcmp(z->name, "-") == 0 */ + ++ if (extra_fields == 0 && (source_date_epoch = getenv("SOURCE_DATE_EPOCH")) != NULL) { ++ time_t epoch = strtoull(source_date_epoch, NULL, 10); ++ if (epoch > 0) { ++ ulg epochtim = unix2dostime(&epoch); ++ if (z->tim > epochtim) z->tim = epochtim; ++ } ++ } + if (extra_fields == 2) { + unsigned len; + char *p; From 4f3a565f5d23724cc46d9a32d76ad18425fe6e2d Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 12 Feb 2022 17:01:31 +0900 Subject: [PATCH 09/24] tools: zip: make encrypted archives reproducible Zip always try to generate new encryption header depending on execution time and process id, which is far from being reproducible. This commit changes the zip srand() seed to a predictable value to generate reproducible random bytes for the encryption header. This will compromise the goal of secure archive encryption, but it would not be a big problem for our purpose. Signed-off-by: Sungbo Eo --- ...make-encrypted-archives-reproducible.patch | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tools/zip/patches/012-make-encrypted-archives-reproducible.patch diff --git a/tools/zip/patches/012-make-encrypted-archives-reproducible.patch b/tools/zip/patches/012-make-encrypted-archives-reproducible.patch new file mode 100644 index 0000000000..a6259d30cb --- /dev/null +++ b/tools/zip/patches/012-make-encrypted-archives-reproducible.patch @@ -0,0 +1,75 @@ +From db9165814823401d57383a8f9e82642129cf4223 Mon Sep 17 00:00:00 2001 +From: Sungbo Eo +Date: Sat, 12 Feb 2022 16:42:14 +0900 +Subject: [PATCH] make encrypted archives reproducible + +Zip always try to generate new encryption header depending on execution +time and process id, which is far from being reproducible. This commit +changes the zip srand() seed to a predictable value to generate +reproducible random bytes for the encryption header. This will compromise +the goal of secure archive encryption, but it would not be a big problem +for our purpose. + +Signed-off-by: Sungbo Eo +--- + crypt.c | 8 ++++++-- + globals.c | 1 + + zip.h | 1 + + zipup.c | 2 +- + 4 files changed, 9 insertions(+), 3 deletions(-) + +--- a/crypt.c ++++ b/crypt.c +@@ -29,7 +29,6 @@ + version without encryption capabilities). + */ + +-#define ZCRYPT_INTERNAL + #include "zip.h" + #include "crypt.h" + #include "ttyio.h" +@@ -219,7 +218,12 @@ void crypthead(passwd, crc) + * often poorly implemented. + */ + if (++calls == 1) { +- srand((unsigned)time(NULL) ^ ZCR_SEED2); ++ unsigned zcr_seed1 = (unsigned)time(NULL); ++#ifndef ZCRYPT_INTERNAL ++ if (epoch > 0) ++ zcr_seed1 = (unsigned)epoch; ++#endif ++ srand(zcr_seed1 ^ ZCR_SEED2); + } + init_keys(passwd); + for (n = 0; n < RAND_HEAD_LEN-2; n++) { +--- a/globals.c ++++ b/globals.c +@@ -206,6 +206,7 @@ int read_split_archive = 0; /* 1=s + int split_method = 0; /* 0=no splits, 1=seekable, 2=data desc, -1=no */ + uzoff_t split_size = 0; /* how big each split should be */ + int split_bell = 0; /* when pause for next split ring bell */ ++time_t epoch = 0; /* timestamp from SOURCE_DATE_EPOCH */ + uzoff_t bytes_prev_splits = 0; /* total bytes written to all splits before this */ + uzoff_t bytes_this_entry = 0; /* bytes written for this entry across all splits */ + int noisy_splits = 0; /* note when splits are being created */ +--- a/zip.h ++++ b/zip.h +@@ -502,6 +502,7 @@ extern uzoff_t bytes_this_split; /* byte + extern int read_split_archive; /* 1=scanzipf_reg detected spanning signature */ + extern int split_method; /* 0=no splits, 1=seekable, 2=data descs, -1=no */ + extern uzoff_t split_size; /* how big each split should be */ ++extern time_t epoch; /* timestamp from SOURCE_DATE_EPOCH */ + extern int split_bell; /* when pause for next split ring bell */ + extern uzoff_t bytes_prev_splits; /* total bytes written to all splits before this */ + extern uzoff_t bytes_this_entry; /* bytes written for this entry across all splits */ +--- a/zipup.c ++++ b/zipup.c +@@ -676,7 +676,7 @@ struct zlist far *z; /* zip entry to + } /* strcmp(z->name, "-") == 0 */ + + if (extra_fields == 0 && (source_date_epoch = getenv("SOURCE_DATE_EPOCH")) != NULL) { +- time_t epoch = strtoull(source_date_epoch, NULL, 10); ++ epoch = strtoull(source_date_epoch, NULL, 10); + if (epoch > 0) { + ulg epochtim = unix2dostime(&epoch); + if (z->tim > epochtim) z->tim = epochtim; From 3c4810fecc65dfc36bf43438c07749e9efe1bcb5 Mon Sep 17 00:00:00 2001 From: Ray Wang Date: Thu, 10 Feb 2022 23:16:05 +0800 Subject: [PATCH 10/24] ramips: add support for Asus RT-AC1200 Asus RT-AC1200 is a 2.4/5GHz dual band AC router, based on MediaTek MT7628AN. Specification: * SoC: MT7628AN * RAM: DDR2 64 MiB * Flash: 16 MiB NOR (W25Q128BV) * Wi-Fi: * 2.4GHz: SoC Built-in * 5GHz: MT7612EN * Ethernet: 5x 100Mbps * Switch: SoC built-in * USB: 1x 2.0 Flash Layout: 0x0000000-0x0030000 : "bootloader" 0x0030000-0x0040000 : "nvram" 0x0040000-0x0050000 : "factory" 0x0050000-0x1000000 : "firmware" MAC address: LAN: factory 0x28 WAN: factory 0x22 2.4G: factory 0x4 5G: factory 0x8004 Installation via **recovery** mode: 1. Download the Asus recovery firmware (windows) tool from http://dlcdnet.asus.com/pub/ASUS/LiveUpdate/Release/Wireless/Rescue.zip 2. Set your ethernet IP manually 192.168.1.5 / 255.255.255.0 with NO gateway. 3. Plug in your ethernet to LAN port 1 on the router. 4. Load up the recovery software with the firmware file, but don't press "Upload" yet. 5. Plug in the router to power WHILE HOLDING the reset button in. While CONTINUING to hold the button, select "Upload" Continue to hold the reset button in until it finishes and verifies! 6. If that doesn't work try pressing "Upload" first just before you do step 5. At some point while holding reset the rescue tool will finally detect and upload the firmware. That's when you can let go of the reset button. 7. The router will reboot and not much will happen. Wait a minute or 2. 8. Power off and on the router again. Voila. Set everything your Ethernet IP back to DHCP (automatically) and you're good to go. Revert to stock firmware: 1. Install stock image via recovery mode. Tested-by: Ivan Pavlov Signed-off-by: Ray Wang --- .../ramips/dts/mt7628an_asus_rt-ac1200.dts | 157 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 9 + .../mt76x8/base-files/etc/board.d/02_network | 54 +++--- 3 files changed, 194 insertions(+), 26 deletions(-) create mode 100644 target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts diff --git a/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts new file mode 100644 index 0000000000..dbb8302b85 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_asus_rt-ac1200.dts @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +// Copyright (c) 2022 Ray Wang +// Copyright (c) 2022 Ivan Pavlov + +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "asus,rt-ac1200", "mediatek,mt7628an-soc"; + model = "Asus RT-AC1200"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "blue:power"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + usb { + label = "blue:usb"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + led-all { + gpio-export,name = "led_all"; + gpio-export,output = <0>; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "nvram"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "spi cs1", "refclk", "wled_an"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 49b3c860dc..4482a1e315 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -38,6 +38,15 @@ define Device/alfa-network_awusfree1 endef TARGET_DEVICES += alfa-network_awusfree1 +define Device/asus_rt-ac1200 + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Asus + DEVICE_MODEL := RT-AC1200 + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci \ + kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += asus_rt-ac1200 + define Device/asus_rt-n10p-v3 IMAGE_SIZE := 7872k DEVICE_VENDOR := Asus diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 00fb88aa3c..7791ee6be2 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -34,6 +34,29 @@ ramips_setup_interfaces() ucidef_add_switch_attr "switch0" "enable" "false" ucidef_set_interface_lan "eth0" ;; + asus,rt-ac1200|\ + hilink,hlk-7628n|\ + hilink,hlk-7688a|\ + hiwifi,hc5861b|\ + skylab,skw92a|\ + tplink,archer-c20-v4|\ + tplink,archer-c20-v5|\ + tplink,archer-c50-v3|\ + tplink,archer-c50-v4|\ + tplink,tl-mr3420-v5|\ + tplink,tl-wr840n-v4|\ + tplink,tl-wr840n-v5|\ + tplink,tl-wr841n-v13|\ + tplink,tl-wr841n-v14|\ + tplink,tl-wr842n-v5|\ + tplink,tl-wr850n-v2|\ + unielec,u7628-01-16m|\ + wrtnode,wrtnode2p|\ + wrtnode,wrtnode2r|\ + zyxel,keenetic-extra-ii) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" + ;; asus,rt-n10p-v3|\ asus,rt-n11p-b1|\ asus,rt-n12-vp-b1|\ @@ -69,28 +92,6 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan" "0:wan" "6@eth0" ;; - hilink,hlk-7628n|\ - hilink,hlk-7688a|\ - hiwifi,hc5861b|\ - skylab,skw92a|\ - tplink,archer-c20-v4|\ - tplink,archer-c20-v5|\ - tplink,archer-c50-v3|\ - tplink,archer-c50-v4|\ - tplink,tl-mr3420-v5|\ - tplink,tl-wr840n-v4|\ - tplink,tl-wr840n-v5|\ - tplink,tl-wr841n-v13|\ - tplink,tl-wr841n-v14|\ - tplink,tl-wr842n-v5|\ - tplink,tl-wr850n-v2|\ - unielec,u7628-01-16m|\ - wrtnode,wrtnode2p|\ - wrtnode,wrtnode2r|\ - zyxel,keenetic-extra-ii) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0" - ;; hiwifi,hc5761a) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "4:wan" "6@eth0" @@ -176,6 +177,11 @@ ramips_setup_macs() local label_mac="" case $board in + asus,rt-ac1200|\ + elecom,wrc-1167fs) + wan_mac=$(mtd_get_mac_binary factory 0x22) + label_mac=$wan_mac + ;; buffalo,wcr-1166ds) wan_mac=$(mtd_get_mac_ascii board_data "mac") lan_mac=$wan_mac @@ -198,10 +204,6 @@ ramips_setup_macs() zyxel,keenetic-extra-ii) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; - elecom,wrc-1167fs) - wan_mac=$(mtd_get_mac_binary factory 0x22) - label_mac=$wan_mac - ;; hiwifi,hc5661a|\ hiwifi,hc5761a|\ hiwifi,hc5861b) From 2876f7534fe84f047f02bdda2886a9aeedbb8e76 Mon Sep 17 00:00:00 2001 From: Kim Namu Date: Thu, 24 Feb 2022 00:14:37 +0900 Subject: [PATCH 11/24] ramips: mt7621: add support for Zbtlink ZBT-WG1608 Zbtlink ZBT-WG1608 is a Wi-Fi router intendent to use with WWAN (4G/5G) modems. Specifications: * SoC: MediaTek MT7621A * RAM: 256/512 MiB * Flash: 16/32 MiB (SPI NOR) * Wi-Fi: * MediaTek MT7603E : 2.4Ghz * MediaTek MT7613BE : 5Ghz * Ethernet: 10/100/1000 Mbps Ethernet x5 ports (4xLAN + WAN) * M.2: 1x slot with USB&SIM * EM7455/EM12-G/EM160R/RM500Q-AE * USB: 1x 3.0 Type-A port * External storage: 1x microSD (SDXC) slot * UART: console (115200 baud) * LED: * 1 power indicator * 1 WLAN 2.4G controlled (wlan 2G) * 3 SoC controlled (wlan 5G, wwan, internet) * 5 per Eth phy (4xLAN + WAN) MAC Addresses: * LAN : f8:5e:3c:xx:xx:e0 (Factory, 0xe000 (hex)) * WAN : f8:5e:3c:xx:xx:e1 (Factory, 0xe006 (hex)) * 2.4 GHz: f8:5e:3c:xx:xx:de (Factory, 0x0004 (hex)) * 5 GHz : f8:5e:3c:xx:xx:df (Factory, 0x8004 (hex)) Installation: * Vendor's firmware is OpenWrt (LEDE) based, so the sysupgrade image can be directly used to install OpenWrt. Firmware must be upgraded using the 'force' and 'do not save configuration' command line options (or correspondig web interface checkboxes) since the vendor firmware is from the pre-DSA era. Recovery Mode: * Press reset button, power up the device, wait for about 10sec. * Upload sysupgrade image through the firmware recovery mode web page at 192.168.1.1. Signed-off-by: Kim Namu --- .../dts/mt7621_zbtlink_zbt-wg1608-16m.dts | 12 + .../ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi | 228 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 12 + .../mt7621/base-files/etc/board.d/01_leds | 7 + 4 files changed, 259 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-16m.dts create mode 100644 target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-16m.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-16m.dts new file mode 100644 index 0000000000..9e6d939e1c --- /dev/null +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608-16m.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_zbtlink_zbt-wg1608.dtsi" + +/ { + compatible = "zbtlink,zbt-wg1608-16m", "zbtlink,zbt-wg1608", "mediatek,mt7621-soc"; + model = "Zbtlink ZBT-WG1608 (16M)"; +}; + +&firmware { + reg = <0x50000 0xfb0000>; +}; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi new file mode 100644 index 0000000000..d25217598e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg1608.dtsi @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "zbtlink,zbt-wg1608", "mediatek,mt7621-soc"; + + aliases { + led-boot = &led_internet; + led-failsafe = &led_internet; + led-running = &led_internet; + led-upgrade = &led_internet; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_internet: internet { + label = "green:internet"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + wwan { + label = "green:wwan"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,default-trigger = "usbport"; + trigger-sources = <&hub_port2>; + }; + + wifi5g { + label = "green:wifi5g"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + lan1 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + gpios = <&switch0 0 GPIO_ACTIVE_LOW>; + }; + + lan2 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + gpios = <&switch0 3 GPIO_ACTIVE_LOW>; + }; + + lan3 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + gpios = <&switch0 6 GPIO_ACTIVE_LOW>; + }; + + lan4 { + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + gpios = <&switch0 9 GPIO_ACTIVE_HIGH>; + }; + + wan { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&switch0 12 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + 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; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; + + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + gpio-controller; + #gpio-cells = <2>; + + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan4"; + }; + + port@4 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; + }; + }; +}; + +&state_default { + gpio { + groups = "wdt", "uart2", "jtag"; + function = "gpio"; + }; +}; + +&xhci_ehci_port1 { + #address-cells = <1>; + #size-cells = <0>; + + hub_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + + port@4 { + reg = <4>; + #trigger-source-cells = <0>; + }; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 011a96a59e..44b04dbefb 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1911,6 +1911,18 @@ define Device/zbtlink_zbt-wg1602-16m endef TARGET_DEVICES += zbtlink_zbt-wg1602-16m +define Device/zbtlink_zbt-wg1608-16m + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Zbtlink + DEVICE_MODEL := ZBT-WG1608 + DEVICE_VARIANT := 16M + DEVICE_PACKAGES := kmod-sdhci-mt7620 kmod-mt7603 kmod-mt7615e \ + kmod-mt7663-firmware-ap kmod-usb3 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += zbtlink_zbt-wg1608-16m + define Device/zbtlink_zbt-wg2626 $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 672c7b0668..29b29a1cfc 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -134,6 +134,13 @@ xiaomi,redmi-router-ac2100) youhua,wr1200js) ucidef_set_led_netdev "internet" "INTERNET" "green:wan" "wan" ;; +zbtlink,zbt-wg1608-16m) + ucidef_set_led_netdev "lan1" "LAN1" "green:lan-1" "lan1" + ucidef_set_led_netdev "lan2" "LAN2" "green:lan-2" "lan2" + ucidef_set_led_netdev "lan3" "LAN3" "green:lan-3" "lan3" + ucidef_set_led_netdev "lan4" "LAN4" "green:lan-4" "lan4" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" + ;; esac board_config_flush From 94d4269ec720db66ec8b92df1821ef19330897b1 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Thu, 24 Feb 2022 23:17:45 +0900 Subject: [PATCH 12/24] ramips: fix DEVICE_VENDOR for unbranded devices In commit ee66fe4ea9a6 ("ramips: convert DEVICE_TITLE to new variables"), DEVICE_VENDOR of some unbranded devices were set incorrectly: * WR512-3GN is not a dev board from Ralink. * "XDX-RN502J" is the whole model name and should be not split. This patch sets their DEVICE_VENDOR to "Unbranded", and changes their DTS model properties accordingly. Ref: d0bf15f23595 ("ramips: add support for A5-V11 board (resubmit)") Ref: 9085b05d9e71 ("ramips: rt305x: support for wr512-3gn-like routers") Ref: 0e486d2fd297 ("ramips: add support for unbranded XDX-RN502J board") Signed-off-by: Sungbo Eo --- .../linux/ramips/dts/rt3052_unbranded_wr512-3gn-4m.dts | 2 +- .../linux/ramips/dts/rt3052_unbranded_wr512-3gn-8m.dts | 2 +- .../linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts | 2 +- target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts | 2 +- target/linux/ramips/image/rt305x.mk | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-4m.dts b/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-4m.dts index d3393c0749..eee3ac9552 100644 --- a/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-4m.dts +++ b/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-4m.dts @@ -2,7 +2,7 @@ / { compatible = "unbranded,wr512-3gn-4m", "unbranded,wr512-3gn", "ralink,rt3052-soc"; - model = "WR512-3GN (4M)"; + model = "Unbranded WR512-3GN (4M)"; flash@1f000000 { compatible = "cfi-flash"; diff --git a/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-8m.dts b/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-8m.dts index ce25dc93b1..99693865cb 100644 --- a/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-8m.dts +++ b/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn-8m.dts @@ -2,7 +2,7 @@ / { compatible = "unbranded,wr512-3gn-8m", "unbranded,wr512-3gn", "ralink,rt3052-soc"; - model = "WR512-3GN (8M)"; + model = "Unbranded WR512-3GN (8M)"; flash@1f000000 { compatible = "cfi-flash"; diff --git a/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts b/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts index 1067e5cf8b..88c4c1fc89 100644 --- a/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts +++ b/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts @@ -5,7 +5,7 @@ / { compatible = "unbranded,xdx-rn502j", "ralink,rt3052-soc"; - model = "XDX RN502J"; + model = "Unbranded XDX-RN502J"; aliases { led-boot = &led_power; diff --git a/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts b/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts index 502ac60211..5f2bad2b89 100644 --- a/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts +++ b/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts @@ -5,7 +5,7 @@ / { compatible = "unbranded,a5-v11", "ralink,rt5350-soc"; - model = "A5-V11"; + model = "Unbranded A5-V11"; aliases { led-boot = &led_power; diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index d8ea1d5673..d0a0d6f85a 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -1071,7 +1071,7 @@ define Device/unbranded_a5-v11 IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ poray-header -B A5-V11 -F 4M - DEVICE_VENDOR := + DEVICE_VENDOR := Unbranded DEVICE_MODEL := A5-V11 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 SUPPORTED_DEVICES += a5-v11 @@ -1082,7 +1082,7 @@ TARGET_DEVICES += unbranded_a5-v11 define Device/unbranded_wr512-3gn-4m SOC := rt3052 IMAGE_SIZE := 3776k - DEVICE_VENDOR := Ralink + DEVICE_VENDOR := Unbranded DEVICE_MODEL := WR512-3GN DEVICE_VARIANT := 4M SUPPORTED_DEVICES += wr512-3gn-4M @@ -1093,7 +1093,7 @@ TARGET_DEVICES += unbranded_wr512-3gn-4m define Device/unbranded_wr512-3gn-8m SOC := rt3052 IMAGE_SIZE := 7872k - DEVICE_VENDOR := Ralink + DEVICE_VENDOR := Unbranded DEVICE_MODEL := WR512-3GN DEVICE_VARIANT := 8M SUPPORTED_DEVICES += wr512-3gn-8M @@ -1104,8 +1104,8 @@ define Device/unbranded_xdx-rn502j SOC := rt3052 BLOCKSIZE := 64k IMAGE_SIZE := 3776k - DEVICE_VENDOR := XDX - DEVICE_MODEL := RN502J + DEVICE_VENDOR := Unbranded + DEVICE_MODEL := XDX-RN502J SUPPORTED_DEVICES += xdxrn502j DEFAULT := n endef From 9d06f1a618530ecfbd945cf3fb46b610f9b52c86 Mon Sep 17 00:00:00 2001 From: Dmitry Chigiryov Date: Fri, 25 Feb 2022 12:41:12 +0300 Subject: [PATCH 13/24] ramips: allow USB power control on TP-Link MR3020v3 By switching EPHY_LED4_N_JTRST_N from EPHY_LED4_N to GPIO#39 we can control USB port power an all current revisions of MR3020v3. It was not a thing on some first revisions, pin was unused. But for now on all current MR3020v3 boards EPHY_LED4_N_JTRST_N pin is connected to USB power key. Also it was not used as EPHY indicator on any revision of the board. Signed-off-by: Dmitry Chigiryov [changed author address (used SoB one)] Signed-off-by: Sungbo Eo --- .../ramips/dts/mt7628an_tplink_tl-mr3020-v3.dts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-mr3020-v3.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-mr3020-v3.dts index 8860e53efc..3ffa732541 100644 --- a/target/linux/ramips/dts/mt7628an_tplink_tl-mr3020-v3.dts +++ b/target/linux/ramips/dts/mt7628an_tplink_tl-mr3020-v3.dts @@ -75,6 +75,17 @@ gpios = <&gpio 3 GPIO_ACTIVE_LOW>; }; }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; + }; + }; }; &spi0 { @@ -120,7 +131,7 @@ &state_default { gpio { - groups = "i2s", "refclk", "wdt", "p2led_an", "p1led_an", "p0led_an", "wled_an"; + groups = "i2s", "refclk", "wdt", "p4led_an", "p2led_an", "p1led_an", "p0led_an", "wled_an"; function = "gpio"; }; }; From 6b822189b11d0abb3a8618f7b9f73a9de50caabd Mon Sep 17 00:00:00 2001 From: Rui Salvaterra Date: Wed, 9 Feb 2022 15:18:45 +0000 Subject: [PATCH 14/24] toolchain: binutils: add support for version 2.38 While at it, also fix the download.xs4all.nl and add ftp.gnu.org to the GNU mirrors, as it seems to be updated faster. Deleted (upstreamed): 600-Close_the_file_descriptor.patch [1] [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5a98fb7513b559e20dfebdbaa2a471afda3b4742 Signed-off-by: Rui Salvaterra --- scripts/download.pl | 3 +- toolchain/binutils/Config.in | 4 ++ toolchain/binutils/Config.version | 4 ++ toolchain/binutils/Makefile | 4 ++ .../2.38/300-001_ld_makefile_patch.patch | 22 +++++++++++ .../400-mips_no_dynamic_linking_sym.patch | 18 +++++++++ ...e-default-emulation-for-mips64-linux.patch | 38 +++++++++++++++++++ 7 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch create mode 100644 toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch create mode 100644 toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch diff --git a/scripts/download.pl b/scripts/download.pl index ebb0d7af19..af13c0ae00 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -221,7 +221,8 @@ foreach my $mirror (@ARGV) { push @mirrors, "http://mirror.internode.on.net/pub/gnu/$1"; push @mirrors, "http://mirror.navercorp.com/gnu/$1"; push @mirrors, "ftp://mirrors.rit.edu/gnu/$1"; - push @mirrors, "ftp://download.xs4all.nl/pub/gnu/"; + push @mirrors, "ftp://download.xs4all.nl/pub/gnu/$1"; + push @mirrors, "https://ftp.gnu.org/gnu/$1"; } elsif ($mirror =~ /^\@SAVANNAH\/(.+)$/) { push @mirrors, "https://mirror.netcologne.de/savannah/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/nongnu/$1"; diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index e557f21f47..bf63cb969e 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -9,6 +9,10 @@ choice config BINUTILS_USE_VERSION_2_37 bool "Binutils 2.37" select BINUTILS_VERSION_2_37 + + config BINUTILS_USE_VERSION_2_38 + bool "Binutils 2.38" + select BINUTILS_VERSION_2_38 endchoice config EXTRA_BINUTILS_CONFIG_OPTIONS diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index 4c2dce176f..bb651541fd 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -3,6 +3,10 @@ config BINUTILS_VERSION_2_37 default y if !TOOLCHAINOPTS bool +config BINUTILS_VERSION_2_38 + bool + config BINUTILS_VERSION string default "2.37" if BINUTILS_VERSION_2_37 + default "2.38" if BINUTILS_VERSION_2_38 diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index d58f6662bb..d1961603c4 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -35,6 +35,10 @@ ifeq ($(PKG_VERSION),2.37) PKG_HASH:=820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c endif +ifeq ($(PKG_VERSION),2.38) + PKG_HASH:=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024 +endif + HOST_BUILD_PARALLEL:=1 PATCH_DIR:=./patches/$(PKG_VERSION) diff --git a/toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch new file mode 100644 index 0000000000..ecc9dd64e3 --- /dev/null +++ b/toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch @@ -0,0 +1,22 @@ +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch new file mode 100644 index 0000000000..070247ecf0 --- /dev/null +++ b/toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch @@ -0,0 +1,18 @@ +--- a/bfd/elfxx-mips.c ++++ b/bfd/elfxx-mips.c +@@ -8057,6 +8057,7 @@ _bfd_mips_elf_create_dynamic_sections (b + + name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; + bh = NULL; ++ if (0) { + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, + NULL, false, get_elf_backend_data (abfd)->collect, &bh))) +@@ -8069,6 +8070,7 @@ _bfd_mips_elf_create_dynamic_sections (b + + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return false; ++ } + + if (! mips_elf_hash_table (info)->use_rld_obj_head) + { diff --git a/toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch new file mode 100644 index 0000000000..0797f4dff9 --- /dev/null +++ b/toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch @@ -0,0 +1,38 @@ +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -928,12 +928,12 @@ case "${targ}" in + targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; + mips64*el-*-linux*) +- targ_defvec=mips_elf32_ntrad_le_vec +- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" ++ targ_defvec=mips_elf64_trad_le_vec ++ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" + ;; + mips64*-*-linux*) +- targ_defvec=mips_elf32_ntrad_be_vec +- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" ++ targ_defvec=mips_elf64_trad_be_vec ++ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" + ;; + mips*el-*-linux*) + targ_defvec=mips_elf32_trad_le_vec +--- a/ld/configure.tgt ++++ b/ld/configure.tgt +@@ -543,12 +543,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx + ;; + mips*-*-windiss) targ_emul=elf32mipswindiss + ;; +-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 +- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" ++mips64*el-*-linux-*) targ_emul=elf64ltsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" + targ_extra_libpath=$targ_extra_emuls + ;; +-mips64*-*-linux-*) targ_emul=elf32btsmipn32 +- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" ++mips64*-*-linux-*) targ_emul=elf64btsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" + targ_extra_libpath=$targ_extra_emuls + ;; + mips*el-*-linux-*) targ_emul=elf32ltsmip From a5eeac8033786a7a04b7569175e41e415b6579c0 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Wed, 9 Mar 2022 13:30:21 +0100 Subject: [PATCH 15/24] CI: move logs/ to GITHUB_WORKSPACE Artifacts can only be uploaded from inside the GITHUB_WORKSPACE. While the Linux CI jobs run inside that per default, a special case-sensitive mount outside the GITHUB_WORKSPACE is used for macOS builds. To make log artifacts work for both macOS and Linux, move logs/ folder to GITHUB_WORKSPACE on failures. Signed-off-by: Paul Spooren --- .github/workflows/tools.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 153db73625..76cbd30db7 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -121,9 +121,14 @@ jobs: cd "$WORKPATH" make tools/install -j$(nproc) BUILD_LOG=1 + - name: Move logs to GITHUB_WORKSPACE + if: failure() + run: | + cp -r "$WORKPATH/logs" "$GITHUB_WORKSPACE" + - name: Upload logs if: failure() uses: actions/upload-artifact@v2 with: name: ${{ matrix.os }}-logs - path: "$WORKPATH/logs" + path: "logs" From 289fbc5102a31e563d91cb8c99596bd63901406a Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 9 Mar 2022 13:00:42 +0800 Subject: [PATCH 16/24] iptables: add iptables-mod-socket Previously libxt_socket.so was included in iptables-mod-tproxy. It was missed out when trying to make kmod-ipt-socket and kmod-ipt-tproxy separate packages Fixes: 4f443c88 ("netfilter: separate packages for kmod-ipt-socket and kmod-ipt-tproxy") Signed-off-by: Yousong Zhou --- package/network/utils/iptables/Makefile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index 69bbb0237d..f978173c9f 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.8.7 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -388,6 +388,19 @@ iptables extension for triggering a LED. endef +define Package/iptables-mod-socket +$(call Package/iptables/Module, +kmod-ipt-socket) + TITLE:=Socket match iptables extensions +endef + +define Package/iptables-mod-socket/description +Socket match iptables extensions. + + Matches: + - socket + +endef + define Package/iptables-mod-tproxy $(call Package/iptables/Module, +kmod-ipt-tproxy) TITLE:=Transparent proxy iptables extensions @@ -396,9 +409,6 @@ endef define Package/iptables-mod-tproxy/description Transparent proxy iptables extensions. - Matches: - - socket - Targets: - TPROXY @@ -721,6 +731,7 @@ $(eval $(call BuildPlugin,iptables-mod-ulog,$(IPT_ULOG-m))) $(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m))) $(eval $(call BuildPlugin,iptables-mod-rpfilter,$(IPT_RPFILTER-m))) $(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m))) +$(eval $(call BuildPlugin,iptables-mod-socket,$(IPT_SOCKET-m))) $(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m))) $(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m))) $(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m))) From 802df0987328246a405b9183b92b7ac94838e8e2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 10 Mar 2022 17:53:01 +0000 Subject: [PATCH 17/24] kernel: wwan: add MeigLink SLM750 modem support Add patch found in Teltonika RUT9_R_00.07.01.4 GPL SDK download[1] adding USB IDs of the MeigLink SLM750 to the relevant kernel drivers. Newer versions of Teltonika's 2G/3G/4G RUT9XX WWAN router series come with this kind of modem. [1]: https://wiki.teltonika-networks.com/view/GPL Signed-off-by: Daniel Golle --- .../780-usb-net-MeigLink_modem_support.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch diff --git a/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch new file mode 100644 index 0000000000..cb6f46760b --- /dev/null +++ b/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch @@ -0,0 +1,33 @@ +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1024,6 +1024,7 @@ static const struct usb_device_id produc + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ ++ {QMI_MATCH_FF_FF_FF(0x05c6, 0xf601)}, /* MeigLink SLM750 */ + + /* 3. Combined interface devices matching on interface number */ + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -243,6 +243,8 @@ static void option_instat_callback(struc + #define UBLOX_PRODUCT_R6XX 0x90fa + /* These Yuga products use Qualcomm's vendor ID */ + #define YUGA_PRODUCT_CLM920_NC5 0x9625 ++/* These MeigLink products use Qualcomm's vendor ID */ ++#define MEIGLINK_PRODUCT_SLM750 0xf601 + + #define QUECTEL_VENDOR_ID 0x2c7c + /* These Quectel products use Quectel's vendor ID */ +@@ -1127,6 +1129,11 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), + .driver_info = RSVD(4) }, ++ /* Meiglink products using Qualcomm vendor ID */ ++ // Works OK. In case of some issues check macros that are used by Quectel Products ++ { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, MEIGLINK_PRODUCT_SLM750, 0xff, 0xff, 0xff), ++ .driver_info = NUMEP2 }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, MEIGLINK_PRODUCT_SLM750, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), + .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, From c8350dfb3cdee7653744bbb4ee3b0ac1b015912c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 10 Mar 2022 23:24:10 +0100 Subject: [PATCH 18/24] x86: legacy: enable pata_sis driver This driver is needed to boot from CompactFlash on the Siemens Futro S400. The device has an AMD NX1500 CPU, which seems to be unsupported by the geode subtarget, so it must use legacy. Signed-off-by: Matthias Schiffer --- target/linux/x86/legacy/config-5.10 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/x86/legacy/config-5.10 b/target/linux/x86/legacy/config-5.10 index 29d61139b1..310764d8e8 100644 --- a/target/linux/x86/legacy/config-5.10 +++ b/target/linux/x86/legacy/config-5.10 @@ -173,6 +173,7 @@ CONFIG_PATA_MPIIX=y CONFIG_PATA_OLDPIIX=y CONFIG_PATA_PLATFORM=y CONFIG_PATA_SC1200=y +CONFIG_PATA_SIS=y CONFIG_PATA_TIMINGS=y CONFIG_PATA_VIA=y CONFIG_PCIEAER=y From 25d1c85d1ad3bf48832634c6a37e981a4572a569 Mon Sep 17 00:00:00 2001 From: Piotr Dymacz Date: Thu, 10 Mar 2022 23:29:21 +0100 Subject: [PATCH 19/24] imx: fix USB support The ChipIdea USB kernel driver gained support for disabling glue drivers in 5.8, see upstream commmit: 95caa2ae70fd ("usb: chipidea: allow disabling glue drivers if EMBEDDED"). This enables 'CONFIG_USB_CHIPIDEA_IMX' in the 'imx' target kernel config which brings back USB support. Signed-off-by: Piotr Dymacz --- target/linux/imx/config-5.10 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/imx/config-5.10 b/target/linux/imx/config-5.10 index c3b5743a3a..038e8af573 100644 --- a/target/linux/imx/config-5.10 +++ b/target/linux/imx/config-5.10 @@ -396,6 +396,7 @@ CONFIG_UNWINDER_ARM=y CONFIG_USB=y CONFIG_USB_CHIPIDEA=y CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_CHIPIDEA_IMX=y CONFIG_USB_CHIPIDEA_UDC=y CONFIG_USB_COMMON=y CONFIG_USB_EHCI_HCD=y From 0d45e1ea96ef29649f080c54f99fb1c80482421b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 4 Mar 2022 09:39:04 +0100 Subject: [PATCH 20/24] uboot-bcm4908: add package with BCM4908 U-Boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New BCM4908 devices come with U-Boot instead of CFE. Firmwares for such devices has to include U-Boot. Signed-off-by: Rafał Miłecki --- package/boot/uboot-bcm4908/Makefile | 48 ++++++++++++++++ ...ow-to-complete-build-even-with-ad-ho.patch | 40 ++++++++++++++ ...00-configs-bcm94908-unset-CONFIG_SPL.patch | 38 +++++++++++++ ...rt-for-ATF-when-compiling-U-Boot-wit.patch | 55 +++++++++++++++++++ 4 files changed, 181 insertions(+) create mode 100644 package/boot/uboot-bcm4908/Makefile create mode 100644 package/boot/uboot-bcm4908/patches/100-check-config-allow-to-complete-build-even-with-ad-ho.patch create mode 100644 package/boot/uboot-bcm4908/patches/200-configs-bcm94908-unset-CONFIG_SPL.patch create mode 100644 package/boot/uboot-bcm4908/patches/201-Assume-TPL-support-for-ATF-when-compiling-U-Boot-wit.patch diff --git a/package/boot/uboot-bcm4908/Makefile b/package/boot/uboot-bcm4908/Makefile new file mode 100644 index 0000000000..489b4d69bf --- /dev/null +++ b/package/boot/uboot-bcm4908/Makefile @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://git.openwrt.org/project/bcm63xx/u-boot.git +PKG_SOURCE_DATE:=2022-03-03 +PKG_SOURCE_VERSION:=92e9eca819c9c898d9d2010e1a217726c42c8c47 +PKG_MIRROR_HASH:=11c37fe4c18d55e799153600d1cfd8ee9ca7da8326d0024c1d825f4a327c5f0d + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +define U-Boot/Default + BUILD_TARGET:=bcm4908 + UBOOT_IMAGE:=u-boot-nodtb.bin + DEFAULT:=y +endef + +define U-Boot/bcm4908 + NAME:=Broadcom's BCM4908 + UBOOT_CONFIG:=bcm94908 +endef + +UBOOT_TARGETS := \ + bcm4908 + +define Build/Prepare + $(call Build/Prepare/Default) + mkdir -p $(PKG_BUILD_DIR)/include/generated/ + ( cd $(PKG_BUILD_DIR)/board/broadcom/bcmbca/httpd/html/ && \ + xxd -i index.html > ../../../../../include/generated/index.h && \ + xxd -i flashing.html > ../../../../../include/generated/flashing.h && \ + xxd -i fail.html > ../../../../../include/generated/fail.h && \ + xxd -i 404.html > ../../../../../include/generated/404.h ) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE)/u-boot + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/u-boot/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/u-boot.dtb $(STAGING_DIR_IMAGE)/u-boot/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/arch/arm/dts/*.dtb $(STAGING_DIR_IMAGE)/u-boot/ +endef + +$(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-bcm4908/patches/100-check-config-allow-to-complete-build-even-with-ad-ho.patch b/package/boot/uboot-bcm4908/patches/100-check-config-allow-to-complete-build-even-with-ad-ho.patch new file mode 100644 index 0000000000..44aa4c17e6 --- /dev/null +++ b/package/boot/uboot-bcm4908/patches/100-check-config-allow-to-complete-build-even-with-ad-ho.patch @@ -0,0 +1,40 @@ +From: Masahiro Yamada +Date: Mon, 26 Sep 2016 13:05:02 +0900 +Subject: [PATCH] check-config: allow to complete build even with ad-hoc CONFIG + options + +Currently, the check-config.sh terminates the build when unknown +ad-hoc options are detected. I think it is too much because we may +want to patch config headers locally in a build/deployment project. + +So, let's relax check-config.sh to just warn even if it detects +options that are not in the whitelist. Instead, this check can be +done at the end of build, along with other checks. It will catch +more attention. + +Even with this change, the Buildman tool catches new warnings, +so Tom can give NACK to new ad-hoc options. + +Signed-off-by: Masahiro Yamada +--- + scripts/check-config.sh | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/scripts/check-config.sh ++++ b/scripts/check-config.sh +@@ -50,14 +50,13 @@ cat `find ${srctree} -name "Kconfig*"` |sed -n \ + |sort |uniq > ${ok} + comm -23 ${suspects} ${ok} >${new_adhoc} + if [ -s ${new_adhoc} ]; then +- echo >&2 "Error: You must add new CONFIG options using Kconfig" ++ echo >&2 "Warning: You must add new CONFIG options using Kconfig" + echo >&2 "The following new ad-hoc CONFIG options were detected:" + cat >&2 ${new_adhoc} + echo >&2 + echo >&2 "Please add these via Kconfig instead. Find a suitable Kconfig" + echo >&2 "file and add a 'config' or 'menuconfig' option." + # Don't delete the temporary files in case they are useful +- exit 1 + else + rm ${suspects} ${ok} ${new_adhoc} + fi diff --git a/package/boot/uboot-bcm4908/patches/200-configs-bcm94908-unset-CONFIG_SPL.patch b/package/boot/uboot-bcm4908/patches/200-configs-bcm94908-unset-CONFIG_SPL.patch new file mode 100644 index 0000000000..26189bc571 --- /dev/null +++ b/package/boot/uboot-bcm4908/patches/200-configs-bcm94908-unset-CONFIG_SPL.patch @@ -0,0 +1,38 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 4 Mar 2022 09:21:32 +0100 +Subject: [PATCH] configs: bcm94908: unset CONFIG_SPL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compiling SPL is always tricky as it needs to fit limited resources. +Fortunately in most cases there is no need to replace SPL or TPL while +flashing a new firmware. + +Compiling SPL for BCM4908 seems to fail with non-Broadcom toolchain: +aarch64-openwrt-linux-musl-ld.bfd: u-boot-spl section `.u_boot_list' will not fit in region `.sram' +aarch64-openwrt-linux-musl-ld.bfd: section .bss VMA [00000000822b9000,00000000822b93ef] overlaps section .u_boot_list VMA [00000000822b8f60,00000000822b9a87] +aarch64-openwrt-linux-musl-ld.bfd: region `.sram' overflowed by 2696 bytes + +It also requires hashtable.h which has to be generated using some +Broadcom's custom perl script that isn't integrated as this point. + +For now just disable SPL and use only last-stage U-Boot that must be +shipped with every firmware. + +Signed-off-by: Rafał Miłecki +--- + configs/bcm94908_defconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/configs/bcm94908_defconfig ++++ b/configs/bcm94908_defconfig +@@ -21,7 +21,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y + CONFIG_TPL_LIBCOMMON_SUPPORT=y + CONFIG_TPL_LIBGENERIC_SUPPORT=y + CONFIG_NR_DRAM_BANKS=1 +-CONFIG_SPL=y ++# CONFIG_SPL is not set + CONFIG_SPL_LIBDISK_SUPPORT=y + CONFIG_ENV_VARS_UBOOT_CONFIG=y + CONFIG_TPL_SYS_MALLOC_F_LEN=0x11000 diff --git a/package/boot/uboot-bcm4908/patches/201-Assume-TPL-support-for-ATF-when-compiling-U-Boot-wit.patch b/package/boot/uboot-bcm4908/patches/201-Assume-TPL-support-for-ATF-when-compiling-U-Boot-wit.patch new file mode 100644 index 0000000000..1e59705ac0 --- /dev/null +++ b/package/boot/uboot-bcm4908/patches/201-Assume-TPL-support-for-ATF-when-compiling-U-Boot-wit.patch @@ -0,0 +1,55 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 4 Mar 2022 09:23:34 +0100 +Subject: [PATCH] Assume TPL support for ATF when compiling U-Boot without TPL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Broadcom's U-Boot behaviour depends on compilation time check whether +TPL was compiled with or without ATF support. There is no proper runtime +check. + +When compiling just U-Boot (without SPL & TPL) there is no way to tell +if it's going to work with TPL with or without ATF support. + +Modify code to blindly assume ATF support in TPL in such cases. It seems +to be always true for Broadcom and we need some assumption as we don't +deal with compiling SPL or TPL. + +Signed-off-by: Rafał Miłecki +--- + arch/arm/mach-bcmbca/bcm4908/cpu.c | 2 +- + board/broadcom/bcmbca/board.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/arm/mach-bcmbca/bcm4908/cpu.c ++++ b/arch/arm/mach-bcmbca/bcm4908/cpu.c +@@ -138,7 +138,7 @@ int get_nr_cpus() + return nr_cpus; + } + +-#if !defined(CONFIG_TPL_ATF) ++#if defined(CONFIG_TPL) && !defined(CONFIG_TPL_ATF) + void boot_secondary_cpu(unsigned long vector) + { + uint32_t cpu, nr_cpus = QUAD_CPUS; +--- a/board/broadcom/bcmbca/board.c ++++ b/board/broadcom/bcmbca/board.c +@@ -103,7 +103,7 @@ void board_spinor_init(void) + + int board_init(void) + { +-#if !defined(CONFIG_TPL_ATF) ++#if defined(CONFIG_TPL) && !defined(CONFIG_TPL_ATF) + unsigned long vector; + #endif + board_sdk_init_e(); +@@ -121,7 +121,7 @@ int board_init(void) + printf("$Uboot: "BUILD_TAG" $\n"); + #endif + +-#if !defined(CONFIG_TPL_ATF) ++#if defined(CONFIG_TPL) && !defined(CONFIG_TPL_ATF) + #if defined(CONFIG_ARM64) + vector = (unsigned long)&_start; + #else From 34fd5e325af5cbcb64696c9b4b1660f22299790f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 4 Mar 2022 09:39:05 +0100 Subject: [PATCH 21/24] bcm4908: include U-Boot in images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a step forward in adding support for devices with U-Boot. Signed-off-by: Rafał Miłecki --- target/linux/bcm4908/image/bootfs-generic.its | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/target/linux/bcm4908/image/bootfs-generic.its b/target/linux/bcm4908/image/bootfs-generic.its index 3cde532d72..bd566d5d22 100644 --- a/target/linux/bcm4908/image/bootfs-generic.its +++ b/target/linux/bcm4908/image/bootfs-generic.its @@ -22,6 +22,20 @@ }; }; + uboot { + description = "U-Boot"; + data = /incbin/("${images_dir}/u-boot/u-boot-nodtb.bin"); + os = "U-Boot"; + arch = "arm64"; + compression = "none"; + load = <0x1000000>; + entry = <0x1000000>; + + hash-1 { + algo = "sha256"; + }; + }; + kernel { description = "Linux kernel"; data = /incbin/("${kernel}"); @@ -37,10 +51,9 @@ }; }; - fdt_linux_RAX220 { + fdt_uboot { description = "dtb"; - data = /incbin/("${dts_dir}/broadcom/bcm4908/bcm4908-netgear-raxe500.dtb"); - arch = "arm64"; + data = /incbin/("${images_dir}/u-boot/u-boot.dtb"); type = "flat_dt"; compression = "none"; @@ -48,9 +61,25 @@ algo = "sha256"; }; }; + + fdt_linux_RAX220 { + description = "dtb"; + data = /incbin/("${dts_dir}/broadcom/bcm4908/bcm4908-netgear-raxe500.dtb"); + arch = "arm64"; + type = "flat_dt"; + compression = "none"; + }; }; configurations { + default = "conf_uboot"; + + conf_uboot { + description = "BRCM 63xxx with uboot"; + fdt = "fdt_uboot"; + loadables = "atf", "uboot"; + }; + conf_lx_RAX220 { description = "BRCM 63xxx linux"; kernel = "kernel"; From c8a88118af4602e9eb1b57434d9e2e2c57667e53 Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Sat, 12 Mar 2022 01:50:53 +0100 Subject: [PATCH 22/24] uqmi: set CID during 'query-data-status' operation Modems used in ZTE mobile broadband routers require to query the data session status using the same CID as one used to establish the session, otherwise they will report the session as "disconnected" despite reporting correct PDH in previous step. Without this change, IPv6 connection on these modems doesn't establish properly. In IPv4 this bug is present as well, but for some reason querying of IPv4 status works using temporary CID, this however seems noncompliant with QMI specifications, so fix it as well. Signed-off-by: Lech Perczak --- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 156e57b135..ad577ea317 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -285,7 +285,7 @@ proto_qmi_setup() { fi # Check data connection state - connstat=$(uqmi -s -d "$device" --get-data-status) + connstat=$(uqmi -s -d "$device" --set-client-id wds,"$cid_4" --get-data-status) [ "$connstat" == '"connected"' ] || { echo "No data link!" uqmi -s -d "$device" --set-client-id wds,"$cid_4" --release-client-id wds > /dev/null 2>&1 @@ -322,7 +322,7 @@ proto_qmi_setup() { fi # Check data connection state - connstat=$(uqmi -s -d "$device" --get-data-status) + connstat=$(uqmi -s -d "$device" --set-client-id wds,"$cid_6" --get-data-status) [ "$connstat" == '"connected"' ] || { echo "No data link!" uqmi -s -d "$device" --set-client-id wds,"$cid_6" --release-client-id wds > /dev/null 2>&1 From 2a801ee562b52913ab90bc88b5d463de7f67a9b9 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 12 Mar 2022 11:07:27 +0000 Subject: [PATCH 23/24] uqmi: update to git HEAD 44dd095 uqmi: corrected too short received SMS Signed-off-by: Daniel Golle --- package/network/utils/uqmi/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index ee2add1573..088543e7e6 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git -PKG_SOURCE_DATE:=2022-02-02 -PKG_SOURCE_VERSION:=f254fc59c710d781eca3ec36e0bff2d8970370fa -PKG_MIRROR_HASH:=350fd627150dde0601a96ff313a76f7a827b0199e7ee9ab86e4f2f96280edad5 +PKG_SOURCE_DATE:=2022-03-12 +PKG_SOURCE_VERSION:=44dd095794a5327611d0ee1a58b0a6333d397b64 +PKG_MIRROR_HASH:=1f7890c659981e1da5c6d73911c30e24722818ff52d58f41d80cc96b62d53311 PKG_MAINTAINER:=Matti Laakso PKG_LICENSE:=GPL-2.0 From 9851d4b6ce6e89d164a04803817625a9041b060a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 1 Mar 2022 18:46:27 +0100 Subject: [PATCH 24/24] base-files: call "sync" after initial setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenWrt uses a lot of (b)ash scripts for initial setup. This isn't the best solution as they almost never consider syncing files / data. Still this is what we have and we need to try living with it. Without proper syncing OpenWrt can easily get into an inconsistent state on power cut. It's because: 1. Actual (flash) inode and data writes are not synchronized 2. Data writeback can take up to 30 seconds (dirty_expire_centisecs) 3. ubifs adds extra 5 seconds (dirty_writeback_centisecs) "delay" Some possible cases (examples) for new files: 1. Power cut during 5 seconds after write() can result in all data loss 2. Power cut happening between 5 and 35 seconds after write() can result in empty file (inode flushed after 5 seconds, data flush queued) Above affects e.g. uci-defaults. After executing some migration script it may get deleted (whited out) without generated data getting actually written. Power cut will result in missing data and deleted file. There are three ways of dealing with that: 1. Rewriting all user-space init to proper C with syncs 2. Trying bash hacks (like creating tmp files & moving them) 3. Adding sync and hoping for no power cut during critical section This change introduces the last solution that is the simplest. It reduces time during which things may go wrong from ~35 seconds to probably less than a second. Of course it applies only to IO operations performed before /etc/init.d/boot . It's probably the stage when the most new files get created. All later changes are usually done using smarter C apps (e.g. busybox or uci) that creates tmp files and uses rename() that is expected to be atomic. Signed-off-by: Rafał Miłecki Acked-by: Hauke Mehrtens Acked-by: Sergey Ryazanov --- package/base-files/files/etc/init.d/boot | 1 + 1 file changed, 1 insertion(+) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index e1c60c1c2f..749d9e9711 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -48,6 +48,7 @@ boot() { /bin/config_generate uci_apply_defaults + sync # temporary hack until configd exists /sbin/reload_config