From 2f14c17501fda87c7d608af0ce56be88d98f337e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 29 Nov 2022 15:26:25 +0000 Subject: [PATCH 01/28] build: make sure that $(STAGING_DIR_IMAGE) exists Call 'mkdir -p $(STAGING_DIR_IMAGE)' before trying to store files in this potentially non-existing folder. Signed-off-by: Daniel Golle --- include/image-commands.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/image-commands.mk b/include/image-commands.mk index 1f6ba1c15a..41e1c96948 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -53,6 +53,7 @@ define Build/append-image-stage cp "$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)" "$@.stripmeta" fwtool -s /dev/null -t "$@.stripmeta" || : fwtool -i /dev/null -t "$@.stripmeta" || : + mkdir -p "$(STAGING_DIR_IMAGE)" dd if="$@.stripmeta" of="$(STAGING_DIR_IMAGE)/$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(DEVICE_NAME)-$(1)" dd if="$@.stripmeta" >> "$@" rm "$@.stripmeta" From a224412bbc3ab62cbaacb5a3e5e0a8f16ce5da5f Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Wed, 30 Nov 2022 22:10:57 +0900 Subject: [PATCH 02/28] ramips: use ARTIFACTS for initramfs-factory of I-O DATA WN-AX1167GR Use ARTIFACTS to generate initramfs-based factory image of I-O DATA WN-AX1167GR instead of redundant recipe which generate on KERNEL_INITRAMFS. Note: WN-AX1167GR has 2x OS images on stock firmware. stock log: flash manufacture id: c2, device id 20 18 MX25L12805D(c2 2018c220) (16384 Kbytes) mtd .name = raspi, .size = 0x01000000 (16M) .erasesize = 0x00010000 (64K) .numeraseregions = 0 Creating 10 MTD partitions on "raspi": 0x000000000000-0x000001000000 : "ALL" 0x000000000000-0x000000030000 : "Bootloader" 0x000000030000-0x000000040000 : "Config " 0x000000040000-0x000000050000 : "Factory" 0x000000050000-0x000000060000 : "iNIC_rf" 0x000000060000-0x0000007e0000 : "Kernel" 0x000000800000-0x000000f80000 : "app" 0x000000f90000-0x000000fa0000 : "Key" 0x000000fa0000-0x000000fb0000 : "backup" 0x000000fb0000-0x000001000000 : "storage" 1st image is "Kernel" and 2nd is "app" when booted from 1st image. In OpenWrt, those 2x partitions are combined to "firmware" with undefined (empty) areas (0x7e0000-0x7fffff, 0xf80000-0xf8ffff). The size of an OS image partition is 0x780000 (7680 KiB = 7.5 MiB), so check-size for initramfs-factory image needs to be called with the size. Signed-off-by: INAGAKI Hiroshi --- target/linux/ramips/image/mt7621.mk | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 82b4731bb5..23aa46de35 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -49,23 +49,6 @@ define Build/haier-sim_wr1800k-factory $(CP) $(1) $(BIN_DIR)/ endef -define Build/iodata-factory - $(eval fw_size=$(word 1,$(1))) - $(eval fw_type=$(word 2,$(1))) - $(eval product=$(word 3,$(1))) - $(eval factory_bin=$(word 4,$(1))) - if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \ - $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \ - $(STAGING_DIR_HOST)/bin/mksenaofw \ - -r 0x30a -p $(product) -t $(fw_type) \ - -e $(factory_bin) -o $(factory_bin).new; \ - mv $(factory_bin).new $(factory_bin); \ - $(CP) $(factory_bin) $(BIN_DIR)/; \ - else \ - echo "WARNING: initramfs kernel image too big, cannot generate factory image (actual $$(stat -c%s $@); max $(fw_size))" >&2; \ - fi -endef - define Build/iodata-mstc-header ( \ data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | gzip -c | \ @@ -972,10 +955,11 @@ define Device/iodata_wn-ax1167gr $(Device/dsa-migration) $(Device/uimage-lzma-loader) IMAGE_SIZE := 15552k - KERNEL_INITRAMFS := $$(KERNEL) | \ - iodata-factory 7864320 4 0x1055 $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.bin DEVICE_VENDOR := I-O DATA DEVICE_MODEL := WN-AX1167GR + ARTIFACTS := initramfs-factory.bin + ARTIFACT/initramfs-factory.bin := append-image-stage initramfs-kernel.bin | \ + check-size 7680k | senao-header -r 0x30a -p 0x1055 -t 4 DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 endef TARGET_DEVICES += iodata_wn-ax1167gr From 0579d9f5bc4b3a3d1b32526c71a6b77c4888bfcb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 2 Dec 2022 12:54:52 +0000 Subject: [PATCH 03/28] trusted-firmware-a.mk: fix build with binutils 2.39 Starting from version 2.39 binutils now warns about sections with rwx permissions. While this is generally desirable it breaks building ARM TrustedFirmware-A bl2 which treats warnings as errors. Disable the warning/error for now to fix build. Signed-off-by: Daniel Golle --- include/trusted-firmware-a.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index 46fc52b15e..0b37c0f943 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -81,6 +81,7 @@ define Build/Compile/Trusted-Firmware-A $(if $(DTC),DTC="$(DTC)") \ PLAT=$(PLAT) \ BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ + $(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \ $(TFA_MAKE_FLAGS) endef From 83f20fc9f732cc9eaca7b70b470a28ed6fad8fa6 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 5 Dec 2022 23:10:29 +0000 Subject: [PATCH 04/28] mediatek: mt7623: build mt6577_auxadc driver into kernel Set CONFIG_MT6577_AUXADC=y as otherwise reading temperature of the thermal-zone doesn't work on MT7623 (it does work fine without this driver on MT7622 and MT7986). Fixes: f2ae4e2f8c ("mediatek: clean up platform kernel modules") Signed-off-by: Daniel Golle --- target/linux/mediatek/modules.mk | 2 +- target/linux/mediatek/mt7623/config-5.15 | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/modules.mk b/target/linux/mediatek/modules.mk index f46a6ad2ff..8480123725 100644 --- a/target/linux/mediatek/modules.mk +++ b/target/linux/mediatek/modules.mk @@ -29,7 +29,7 @@ $(eval $(call KernelPackage,btmtkuart)) define KernelPackage/iio-mt6577-auxadc TITLE:=Mediatek AUXADC driver - DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623||TARGET_mediatek_filogic) + DEPENDS:=@(TARGET_mediatek_mt7622||TARGET_mediatek_filogic) KCONFIG:=CONFIG_MEDIATEK_MT6577_AUXADC FILES:= \ $(LINUX_DIR)/drivers/iio/adc/mt6577_auxadc.ko diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index e787539d6d..898e721df4 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -266,6 +266,7 @@ CONFIG_I2C_BOARDINFO=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y +CONFIG_IIO=y CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_INPUT_EVDEV=y @@ -319,6 +320,7 @@ CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y CONFIG_MDIO_GPIO=y CONFIG_MEDIATEK_GE_PHY=y +CONFIG_MEDIATEK_MT6577_AUXADC=y CONFIG_MEDIATEK_WATCHDOG=y CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y From 7ea965b57803ceec20222279377e611652ac217f Mon Sep 17 00:00:00 2001 From: John Thomson Date: Thu, 10 Nov 2022 09:55:11 +1000 Subject: [PATCH 05/28] ramips: mt7621: mikrotik 760igs (hEX S) fix SFP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This device uses an AR8031/AR8033 chip to convert SoC gmac1 RGMII to 1000base-x or sgmii for the SFP fibre cage. The SFP cage requires phy-mode rgmii-rxid, and without it will not recieve any packets: ethtool -S sfp rx_fcs_errors will increase when packets should be being received, but no other _rx counters will change. Fixes: c77858aa792 ("ramips: mt7621-dts: change phy-mode of gmac1 to rgmii") Reviewed-by: Robert Marko Reviewed-by: Arınç ÜNAL Signed-off-by: John Thomson --- target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts index ed0b4e52cf..8b88cfe0a3 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts @@ -49,6 +49,7 @@ status = "okay"; label = "sfp"; + phy-mode = "rgmii-rxid"; phy-handle = <&ephy7>; }; From 25ede5170d5fbfd233ba21f7a294ec3a2ddeb635 Mon Sep 17 00:00:00 2001 From: Joonhyuk Song Date: Mon, 21 Nov 2022 11:37:36 +0900 Subject: [PATCH 06/28] ramips: mt7621: enable lzma-loader for netis WF2881 Fixes boot loader LZMA decompression issues (LZMA ERROR 1) Signed-off-by: Joonhyuk Song --- target/linux/ramips/image/mt7621.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 23aa46de35..18ac8ac136 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1664,6 +1664,7 @@ TARGET_DEVICES += netgear_wndr3700-v5 define Device/netis_wf2881 $(Device/dsa-migration) + $(Device/uimage-lzma-loader) BLOCKSIZE := 128k PAGESIZE := 2048 FILESYSTEMS := squashfs @@ -1671,7 +1672,7 @@ define Device/netis_wf2881 IMAGE_SIZE := 129280k UBINIZE_OPTS := -E 5 UIMAGE_NAME := WF2881_0.0.00 - KERNEL_INITRAMFS := $(KERNEL_DTB) | netis-tail WF2881 | uImage lzma + KERNEL_INITRAMFS := $$(KERNEL) | netis-tail WF2881 IMAGES += factory.bin IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ From 86b8e245c8ee223e1ed826342cbbaa09b70adbf6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 23 Nov 2022 14:15:19 +0100 Subject: [PATCH 07/28] ucode: update to latest Git HEAD 46d93c9 tests: fixup testcases 4c654df types: adjust double printing format eac2add compiler: fix bytecode for logical assignments of properties 3903b18 fs: add `realpath()` function 8366102 math: add isnan() function eef83d3 tests: relax sleep() test 394e901 lib: uc_json(): accept trailing whitespace when parsing strings 1867c8b uloop: terminate parent uloop in task child processes d2cc003 uci: auto-load package in `ctx.foreach()` and `ctx.get_first()` 6c5ee53 compiler: ensure that arrow functions with block bodies return no value fdc9b6a compiler: fix `??=`, `||=` and `&&=` logical assignment semantics 88dcca7 add cmake to install requires for debian Signed-off-by: Jo-Philipp Wich --- package/utils/ucode/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index eccf4aab32..fafc449090 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2022-10-18 -PKG_SOURCE_VERSION:=00af065057a0e9c10ce6a6475acc47920790c2a9 -PKG_MIRROR_HASH:=58077503b6cabe70334fca8f33f0e443c60de31a1aaadef7079d5d103c547fe1 +PKG_SOURCE_DATE:=2022-12-02 +PKG_SOURCE_VERSION:=46d93c9cc5da6fce581df86159bd0fc4357de41c +PKG_MIRROR_HASH:=970a47f1bef719f056d40d17398db492bd4de92b98ef9aba4582cb18b4c9b270 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 84183f0d98c5da8d3b8e509a9d750f71e4b934e2 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 5 Dec 2022 15:58:41 +0100 Subject: [PATCH 08/28] firewall4: update to latest Git HEAD 700a925 fw4: prevent null access when no ipsets are defined 6443ec7 config: drop input traffic by default 119ee1a ruleset: drop ctstate invalid traffic for masq-enabled zones Signed-off-by: Jo-Philipp Wich --- package/network/config/firewall4/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index 47c2cc5bf3..47b4e060c0 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git -PKG_SOURCE_DATE:=2022-10-18 -PKG_SOURCE_VERSION:=7ae5e14bbd7265cc67ec870c3bb0c8e197bb7ca9 -PKG_MIRROR_HASH:=ce190e526df915df65b40aa24fadf2a1b5badc57ab4e564d5f44575b11d18e26 +PKG_SOURCE_DATE:=2022-11-29 +PKG_SOURCE_VERSION:=700a925fd9c1f1ff404e6b125cd5347ad7c45668 +PKG_MIRROR_HASH:= PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 7dbac3433fef1af0f76a515e962db450c3407c19 Mon Sep 17 00:00:00 2001 From: Alex Hansen Date: Thu, 13 Oct 2022 14:36:40 -0400 Subject: [PATCH 09/28] mediatek: add support for reyee AX3200-E5 This is yet another model of the Ruijie RG-EW3200GX PRO with a slightly different flash layout, install process is the same. Specifications: SoC: MT7622B RAM: 256MB Flash: XMC XM25QH128C or Winbond WQ25Q128JVSQ 16MB SPI NOR Ethernet: 5x1GbE Switch: MT7531BE WiFi: 2.4G: MT7622 5G: MT7915AN+MT7975AN 3LEDs: System LED(blue) + Mesh LED(green) + Mesh LED(red) 2Keys: Mesh button + Reset button UART: Marked J19 on board. 3.3v, 115200n1 Power: 12V 2.5A Flash instruction: 1. Serve the initramfs.img using a TFTP server with address 10.10.10.3. 2. Interrupt the uboot startup process via UART. 3. Select "System Load Linux to SDRAM via TFTP" item. 4. (important) Back up firmware(mtd7) partitions with: dd if=/dev/mtd7 of=/tmp/firmware.bin and then download the firmware.bin image via SCP. 5. Flash the OpenWrt sysupgrade firmware. Recovery stock firmware: 1. Transfer the firmware.bin image to the device. 2. Flash the image with: mtd write firmware.bin firmware Signed-off-by: Alex Hansen Signed-off-by: Daniel Golle --- .../mediatek/dts/mt7622-reyee-ax3200-e5.dts | 78 +++++ .../mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi | 325 ++++++++++++++++++ .../dts/mt7622-ruijie-rg-ew3200gx-pro.dts | 256 +------------- target/linux/mediatek/image/mt7622.mk | 9 + .../mt7622/base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + 6 files changed, 416 insertions(+), 255 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts create mode 100644 target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi diff --git a/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts new file mode 100644 index 0000000000..c4ae63e800 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7622-ruijie-rg-ew3200.dtsi" + +/ { + model = "reyee AX3200 E5"; + compatible = "reyee,ax3200-e5", "mediatek,mt7622"; +}; + +&nor_flash { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_nor_pins>; + + 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 = "Preloader"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "ATF"; + reg = <0x20000 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot"; + reg = <0x30000 0x80000>; + read-only; + }; + + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x90000>; + }; + + factory: partition@90000 { + label = "Factory"; + reg = <0x90000 0xd0000>; + read-only; + }; + + partition@d0000 { + label = "product_info"; + reg = <0xd0000 0xe0000>; + read-only; + }; + + partition@e0000 { + label = "kdump"; + reg = <0xe0000 0xf0000>; + read-only; + }; + + partition@f0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0xf0000 0x1000000>; + }; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi new file mode 100644 index 0000000000..86ef475733 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi @@ -0,0 +1,325 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7622.dtsi" +#include "mt6380.dtsi" + +/ { + aliases { + ethernet0 = &gmac0; + label-mac-device = &gmac0; + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n1"; + bootargs = "console=ttyS0,115200n1 swiotlb=512"; + }; + + cpus { + cpu@0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + + cpu@1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + mesh_green { + label = "green:mesh"; + gpios = <&pio 79 GPIO_ACTIVE_LOW>; + }; + + mesh_red { + label = "red:mesh"; + gpios = <&pio 82 GPIO_ACTIVE_LOW>; + }; + + led_system: system_blue { + label = "blue:system"; + gpios = <&pio 81 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; +}; + +ð { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-connection-type = "2500base-x"; + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&pio>; + interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + wan: port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pcie0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; +}; + +&slot0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,disable-radar-background; + }; +}; + +&pio { + epa_elna_pins: epa-elna-pins { + mux { + function = "antsel"; + groups = "antsel0", "antsel1", "antsel2", "antsel3", + "antsel4", "antsel5", "antsel6", "antsel7", + "antsel8", "antsel9", "antsel12", "antsel13", + "antsel14", "antsel15", "antsel16", "antsel17"; + }; + }; + + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_0_waken", + "pcie0_0_clkreq"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + spi_nor_pins: spi-nor-pins { + mux { + function = "flash"; + groups = "spi_nor"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx"; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&pwrap { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; +}; + +&nor_flash { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_nor_pins>; + + 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 = "Preloader"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "ATF"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "u-boot"; + reg = <0x60000 0x50000>; + read-only; + }; + + partition@B0000 { + label = "u-boot-env"; + reg = <0xb0000 0x20000>; + }; + + factory: partition@D0000 { + label = "Factory"; + reg = <0xd0000 0x80000>; + read-only; + }; + + partition@150000 { + label = "product_info"; + reg = <0x150000 0x10000>; + read-only; + }; + + partition@160000 { + label = "kdump"; + reg = <0x160000 0x10000>; + read-only; + }; + + partition@170000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x170000 0xe90000>; + }; + }; + }; +}; + +&rtc { + status = "disabled"; +}; + +&uart0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; +}; + +&watchdog { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; +}; + +&wmac { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&epa_elna_pins>; + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts index fba9a1b8f7..dacd5bed5f 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts @@ -1,239 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include - -#include "mt7622.dtsi" -#include "mt6380.dtsi" +#include "mt7622-ruijie-rg-ew3200.dtsi" / { model = "Ruijie RG-EW3200GX PRO"; compatible = "ruijie,rg-ew3200gx-pro", "mediatek,mt7622"; - - aliases { - ethernet0 = &gmac0; - label-mac-device = &gmac0; - led-boot = &led_system; - led-failsafe = &led_system; - led-running = &led_system; - led-upgrade = &led_system; - serial0 = &uart0; - }; - - chosen { - stdout-path = "serial0:115200n1"; - bootargs = "console=ttyS0,115200n1 swiotlb=512"; - }; - - cpus { - cpu@0 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; - }; - - cpu@1 { - proc-supply = <&mt6380_vcpu_reg>; - sram-supply = <&mt6380_vm_reg>; - }; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - }; - - wps { - label = "wps"; - linux,code = ; - gpios = <&pio 102 GPIO_ACTIVE_LOW>; - }; - }; - - gpio-leds { - compatible = "gpio-leds"; - - mesh_green { - label = "green:mesh"; - gpios = <&pio 79 GPIO_ACTIVE_LOW>; - }; - - mesh_red { - label = "red:mesh"; - gpios = <&pio 82 GPIO_ACTIVE_LOW>; - }; - - led_system: system_blue { - label = "blue:system"; - gpios = <&pio 81 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - }; - - memory { - reg = <0 0x40000000 0 0x40000000>; - }; -}; - -ð { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <ð_pins>; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-connection-type = "2500base-x"; - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - - mdio: mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - switch@0 { - compatible = "mediatek,mt7531"; - reg = <0>; - reset-gpios = <&pio 54 GPIO_ACTIVE_HIGH>; - - interrupt-controller; - #interrupt-cells = <2>; - interrupt-parent = <&pio>; - interrupts = <53 IRQ_TYPE_LEVEL_HIGH>; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "lan1"; - }; - - port@1 { - reg = <1>; - label = "lan2"; - }; - - port@2 { - reg = <2>; - label = "lan3"; - }; - - port@3 { - reg = <3>; - label = "lan4"; - }; - - wan: port@4 { - reg = <4>; - label = "wan"; - }; - - port@6 { - reg = <6>; - label = "cpu"; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; - }; - }; - }; -}; - -&pcie0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pcie0_pins>; -}; - -&slot0 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x5000>; - ieee80211-freq-limit = <5000000 6000000>; - mediatek,disable-radar-background; - }; -}; - -&pio { - epa_elna_pins: epa-elna-pins { - mux { - function = "antsel"; - groups = "antsel0", "antsel1", "antsel2", "antsel3", - "antsel4", "antsel5", "antsel6", "antsel7", - "antsel8", "antsel9", "antsel12", "antsel13", - "antsel14", "antsel15", "antsel16", "antsel17"; - }; - }; - - eth_pins: eth-pins { - mux { - function = "eth"; - groups = "mdc_mdio", "rgmii_via_gmac2"; - }; - }; - - pcie0_pins: pcie0-pins { - mux { - function = "pcie"; - groups = "pcie0_pad_perst", - "pcie0_0_waken", - "pcie0_0_clkreq"; - }; - }; - - pmic_bus_pins: pmic-bus-pins { - mux { - function = "pmic"; - groups = "pmic_bus"; - }; - }; - - spi_nor_pins: spi-nor-pins { - mux { - function = "flash"; - groups = "spi_nor"; - }; - }; - - uart0_pins: uart0-pins { - mux { - function = "uart"; - groups = "uart0_0_tx_rx"; - }; - }; - - watchdog_pins: watchdog-pins { - mux { - function = "watchdog"; - groups = "watchdog"; - }; - }; -}; - -&pwrap { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pmic_bus_pins>; }; &nor_flash { @@ -301,29 +73,3 @@ }; }; }; - -&rtc { - status = "disabled"; -}; - -&uart0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins>; -}; - -&watchdog { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&watchdog_pins>; -}; - -&wmac { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&epa_elna_pins>; - mediatek,mtd-eeprom = <&factory 0x0>; -}; diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index f9cd18fd41..9760097ee4 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -237,6 +237,15 @@ define Device/ruijie_rg-ew3200gx-pro endef TARGET_DEVICES += ruijie_rg-ew3200gx-pro +define Device/reyee_ax3200-e5 + DEVICE_VENDOR := reyee + DEVICE_MODEL := AX3200 E5 + DEVICE_DTS := mt7622-reyee-ax3200-e5 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e +endef +TARGET_DEVICES += reyee_ax3200-e5 + define Device/totolink_a8000ru DEVICE_VENDOR := TOTOLINK DEVICE_MODEL := A8000RU diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index 7781fcd435..5312bf5c56 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ mediatek_setup_interfaces() linksys,e8450-ubi|\ mediatek,mt7622-rfb1|\ mediatek,mt7622-rfb1-ubi|\ + reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; @@ -53,6 +54,7 @@ mediatek_setup_macs() local label_mac="" case $board in + reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) lan_mac=$(macaddr_add $(get_mac_label) 1) ;; diff --git a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 00ed12cd2f..f8639e9f40 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/mt7622/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -13,6 +13,7 @@ case "$board" in bananapi,bpi-r64) [ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress ;; + reyee,ax3200-e5|\ ruijie,rg-ew3200gx-pro) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress From 60e335b76ea0aeedd9f8e01d247f9aaa617076da Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 6 Dec 2022 00:17:35 +0100 Subject: [PATCH 10/28] e2fsprogs: Fix CVE-2022-1304 This fixes CVE-2022-1304: An out-of-bounds read/write vulnerability was found in e2fsprogs 1.46.5. This issue leads to a segmentation fault and possibly arbitrary code execution via a specially crafted filesystem. Signed-off-by: Hauke Mehrtens --- package/utils/e2fsprogs/Makefile | 2 +- ...-sanity-check-to-extent-manipulation.patch | 50 +++++++++++++++++++ tools/e2fsprogs/Makefile | 2 +- ...-sanity-check-to-extent-manipulation.patch | 50 +++++++++++++++++++ 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch create mode 100644 tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index b131cdccac..2ece58f315 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=e2fsprogs PKG_VERSION:=1.46.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ diff --git a/package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch b/package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch new file mode 100644 index 0000000000..e5a76161f2 --- /dev/null +++ b/package/utils/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch @@ -0,0 +1,50 @@ +From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001 +From: Lukas Czerner +Date: Thu, 21 Apr 2022 19:31:48 +0200 +Subject: libext2fs: add sanity check to extent manipulation + +It is possible to have a corrupted extent tree in such a way that a leaf +node contains zero extents in it. Currently if that happens and we try +to traverse the tree we can end up accessing wrong data, or possibly +even uninitialized memory. Make sure we don't do that. + +Additionally make sure that we have a sane number of bytes passed to +memmove() in ext2fs_extent_delete(). + +Note that e2fsck is currently unable to spot and fix such corruption in +pass1. + +Signed-off-by: Lukas Czerner +Reported-by: Nils Bars +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113 +Addresses: CVE-2022-1304 +Addresses-Debian-Bug: #1010263 +Signed-off-by: Theodore Ts'o +--- + lib/ext2fs/extent.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/lib/ext2fs/extent.c ++++ b/lib/ext2fs/extent.c +@@ -495,6 +495,10 @@ retry: + ext2fs_le16_to_cpu(eh->eh_entries); + newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max); + ++ /* Make sure there is at least one extent present */ ++ if (newpath->left <= 0) ++ return EXT2_ET_EXTENT_NO_DOWN; ++ + if (path->left > 0) { + ix++; + newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block); +@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte + + cp = path->curr; + ++ /* Sanity check before memmove() */ ++ if (path->left < 0) ++ return EXT2_ET_EXTENT_LEAF_BAD; ++ + if (path->left) { + memmove(cp, cp + sizeof(struct ext3_extent_idx), + path->left * sizeof(struct ext3_extent_idx)); diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index 004a04ea26..a8bd745afb 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=e2fsprogs PKG_CPE_ID:=cpe:/a:e2fsprogs_project:e2fsprogs PKG_VERSION:=1.46.5 PKG_HASH:=2f16c9176704cf645dc69d5b15ff704ae722d665df38b2ed3cfc249757d8d81e -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/tytso/e2fsprogs/v$(PKG_VERSION)/ diff --git a/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch b/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch new file mode 100644 index 0000000000..e5a76161f2 --- /dev/null +++ b/tools/e2fsprogs/patches/004-CVE-2022-1304-libext2fs-add-sanity-check-to-extent-manipulation.patch @@ -0,0 +1,50 @@ +From ab51d587bb9b229b1fade1afd02e1574c1ba5c76 Mon Sep 17 00:00:00 2001 +From: Lukas Czerner +Date: Thu, 21 Apr 2022 19:31:48 +0200 +Subject: libext2fs: add sanity check to extent manipulation + +It is possible to have a corrupted extent tree in such a way that a leaf +node contains zero extents in it. Currently if that happens and we try +to traverse the tree we can end up accessing wrong data, or possibly +even uninitialized memory. Make sure we don't do that. + +Additionally make sure that we have a sane number of bytes passed to +memmove() in ext2fs_extent_delete(). + +Note that e2fsck is currently unable to spot and fix such corruption in +pass1. + +Signed-off-by: Lukas Czerner +Reported-by: Nils Bars +Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113 +Addresses: CVE-2022-1304 +Addresses-Debian-Bug: #1010263 +Signed-off-by: Theodore Ts'o +--- + lib/ext2fs/extent.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/lib/ext2fs/extent.c ++++ b/lib/ext2fs/extent.c +@@ -495,6 +495,10 @@ retry: + ext2fs_le16_to_cpu(eh->eh_entries); + newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max); + ++ /* Make sure there is at least one extent present */ ++ if (newpath->left <= 0) ++ return EXT2_ET_EXTENT_NO_DOWN; ++ + if (path->left > 0) { + ix++; + newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block); +@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_exte + + cp = path->curr; + ++ /* Sanity check before memmove() */ ++ if (path->left < 0) ++ return EXT2_ET_EXTENT_LEAF_BAD; ++ + if (path->left) { + memmove(cp, cp + sizeof(struct ext3_extent_idx), + path->left * sizeof(struct ext3_extent_idx)); From 48025b8ac9c62ead241ea1daf1092993fb94aeac Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 20 Nov 2022 21:35:54 +0100 Subject: [PATCH 11/28] kernel: ca8210: Fix crash by zero initializing data This fixes crashes at bootup on pistachio. Signed-off-by: Hauke Mehrtens --- ...-Fix-crash-by-zero-initializing-data.patch | 30 +++++++++++++++++++ ...-Fix-crash-by-zero-initializing-data.patch | 30 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch create mode 100644 target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch diff --git a/target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch b/target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch new file mode 100644 index 0000000000..3f14988d9a --- /dev/null +++ b/target/linux/generic/pending-5.10/870-ca8210-Fix-crash-by-zero-initializing-data.patch @@ -0,0 +1,30 @@ +From 1e24c54da257ab93cff5826be8a793b014a5dc9c Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 21 Nov 2022 01:22:01 +0100 +Subject: ca8210: Fix crash by zero initializing data + +The struct cas_control embeds multiple generic SPI structures and we +have to make sure these structures are initialized to default values. +This driver does not set all attributes. When using kmalloc before some +attributes were not initialized and contained random data which caused +random crashes at bootup. + +Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") +Signed-off-by: Hauke Mehrtens +Link: https://lore.kernel.org/r/20221121002201.1339636-1-hauke@hauke-m.de +Signed-off-by: Stefan Schmidt +--- + drivers/net/ieee802154/ca8210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ieee802154/ca8210.c ++++ b/drivers/net/ieee802154/ca8210.c +@@ -926,7 +926,7 @@ static int ca8210_spi_transfer( + + dev_dbg(&spi->dev, "%s called\n", __func__); + +- cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC); ++ cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC); + if (!cas_ctl) + return -ENOMEM; + diff --git a/target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch b/target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch new file mode 100644 index 0000000000..1fbf78dd3d --- /dev/null +++ b/target/linux/generic/pending-5.15/870-ca8210-Fix-crash-by-zero-initializing-data.patch @@ -0,0 +1,30 @@ +From 1e24c54da257ab93cff5826be8a793b014a5dc9c Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Mon, 21 Nov 2022 01:22:01 +0100 +Subject: ca8210: Fix crash by zero initializing data + +The struct cas_control embeds multiple generic SPI structures and we +have to make sure these structures are initialized to default values. +This driver does not set all attributes. When using kmalloc before some +attributes were not initialized and contained random data which caused +random crashes at bootup. + +Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") +Signed-off-by: Hauke Mehrtens +Link: https://lore.kernel.org/r/20221121002201.1339636-1-hauke@hauke-m.de +Signed-off-by: Stefan Schmidt +--- + drivers/net/ieee802154/ca8210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ieee802154/ca8210.c ++++ b/drivers/net/ieee802154/ca8210.c +@@ -927,7 +927,7 @@ static int ca8210_spi_transfer( + + dev_dbg(&spi->dev, "%s called\n", __func__); + +- cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC); ++ cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC); + if (!cas_ctl) + return -ENOMEM; + From f72be4524d2c74a34eaea67edb45fbe745b48bba Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Tue, 6 Dec 2022 12:33:58 +0200 Subject: [PATCH 12/28] tools/cmake: update to 3.25.1 Update cmake to version 3.25.1 * refresh patches Signed-off-by: Hannu Nyman --- tools/cmake/Makefile | 4 ++-- tools/cmake/patches/120-curl-fix-libressl-linking.patch | 2 +- tools/cmake/patches/130-bootstrap_parallel_make_flag.patch | 2 +- tools/cmake/patches/150-zstd-libarchive.patch | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index 07e2a43218..b7dadee733 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.24.2 +PKG_VERSION:=3.25.1 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=0d9020f06f3ddf17fb537dc228e1a56c927ee506b486f55fe2dc19f69bf0c8db +PKG_HASH:=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8 HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/cmake/patches/120-curl-fix-libressl-linking.patch b/tools/cmake/patches/120-curl-fix-libressl-linking.patch index 6ef37c22cb..1744fe5b04 100644 --- a/tools/cmake/patches/120-curl-fix-libressl-linking.patch +++ b/tools/cmake/patches/120-curl-fix-libressl-linking.patch @@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich --- --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt -@@ -594,6 +594,14 @@ if(CURL_USE_OPENSSL) +@@ -611,6 +611,14 @@ if(CURL_USE_OPENSSL) endif() set(SSL_ENABLED ON) set(USE_OPENSSL ON) diff --git a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch index 2b3ba361bd..70d122c9d9 100644 --- a/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch +++ b/tools/cmake/patches/130-bootstrap_parallel_make_flag.patch @@ -1,6 +1,6 @@ --- a/bootstrap +++ b/bootstrap -@@ -1441,7 +1441,10 @@ int main(){ printf("1%c", (char)0x0a); r +@@ -1449,7 +1449,10 @@ int main(){ printf("1%c", (char)0x0a); r ' > "test.c" cmake_original_make_flags="${cmake_make_flags}" if test "x${cmake_parallel_make}" != "x"; then diff --git a/tools/cmake/patches/150-zstd-libarchive.patch b/tools/cmake/patches/150-zstd-libarchive.patch index 603ac03775..34f7240fe4 100644 --- a/tools/cmake/patches/150-zstd-libarchive.patch +++ b/tools/cmake/patches/150-zstd-libarchive.patch @@ -1,6 +1,6 @@ --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt -@@ -630,8 +630,13 @@ IF(ENABLE_ZSTD) +@@ -632,8 +632,13 @@ IF(ENABLE_ZSTD) SET(ZSTD_FIND_QUIETLY TRUE) ENDIF (ZSTD_INCLUDE_DIR) From 58088ff457afff5fcfa4b32f00c44593f4b7b2c1 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 29 Nov 2022 18:13:19 +0800 Subject: [PATCH 13/28] ath79: convert Netgear R6100 radio calibration to nvmem-cells use nvmem-cells implementation to avoid copying art calibration data to rootfs. Tested on Netgear R6100 Signed-off-by: Shiji Yang --- target/linux/ath79/dts/ar9344_netgear_r6100.dts | 15 ++++++++++++--- .../etc/hotplug.d/firmware/11-ath10k-caldata | 3 --- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_netgear_r6100.dts b/target/linux/ath79/dts/ar9344_netgear_r6100.dts index a73ea52de9..76bd77d4c6 100644 --- a/target/linux/ath79/dts/ar9344_netgear_r6100.dts +++ b/target/linux/ath79/dts/ar9344_netgear_r6100.dts @@ -181,8 +181,8 @@ compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; - nvmem-cells = <&macaddr_caldata_c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&cal_ath10k>, <&macaddr_caldata_c>; + nvmem-cell-names = "calibration", "mac-address"; }; }; @@ -201,7 +201,8 @@ &wmac { status = "okay"; - mtd-cal-data = <&caldata 0x1000>; + nvmem-cells = <&cal_ath9k>; + nvmem-cell-names = "calibration"; }; &caldata { @@ -209,6 +210,14 @@ #address-cells = <1>; #size-cells = <1>; + cal_ath9k: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_ath10k: calibration@5000 { + reg = <0x5000 0x844>; + }; + macaddr_caldata_0: macaddr@0 { reg = <0x0 0x6>; }; diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index e5c26d6bb5..d26625981e 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -18,9 +18,6 @@ case "$FIRMWARE" in caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 1) ;; - netgear,r6100) - caldata_extract "caldata" 0x5000 0x844 - ;; zyxel,emg2926-q10a|\ zyxel,nbg6716) caldata_extract "art" 0x5000 0x844 From 3c1512a25d927dbddea96802f55980e6c963302e Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 29 Nov 2022 18:13:38 +0800 Subject: [PATCH 14/28] ath79: optimize the firmware recipe for Netgear NAND devices 1. Drop useless character '0xff' before fake filesystem header. 2. Reduce useless padding to shrink the size of the sysupgrade image. 3. Do not check the size of sysupgrade image. It does not make sense to check the size of a compressed package. 4. Do not take the size of netgear header into account because it will not be written to Flash. 5. Use the default lzma compression dictionary parameter '-d24' to get better performance. Tested on Netgear R6100 Signed-off-by: Shiji Yang --- target/linux/ath79/image/nand.mk | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 9da47ad38e..ee14c005cc 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -230,7 +230,7 @@ define Device/linksys_ea4500-v3 endef TARGET_DEVICES += linksys_ea4500-v3 -# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff) +# fake rootfs is mandatory, pad-offset 64 equals (1 * uimage_header) define Device/netgear_ath79_nand DEVICE_VENDOR := NETGEAR DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport @@ -238,15 +238,12 @@ define Device/netgear_ath79_nand BLOCKSIZE := 128k PAGESIZE := 2048 IMAGE_SIZE := 25600k - KERNEL := kernel-bin | append-dtb | lzma -d20 | \ - pad-offset $$(KERNEL_SIZE) 129 | uImage lzma | \ - append-string -e '\xff' | \ - append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC) - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | \ + pad-offset $$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC) IMAGES := sysupgrade.bin factory.img - IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \ - check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | check-size | netgear-dni + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata UBINIZE_OPTS := -E 5 endef @@ -262,8 +259,7 @@ define Device/netgear_pgzng1 IMAGE_SIZE := 83968k PAGESIZE := 2048 BLOCKSIZE := 128k - KERNEL := kernel-bin | append-dtb | lzma | uImage lzma - IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += netgear_pgzng1 From 6cee46def01a0d51d1fb003d92e0840f87aa8822 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Mon, 28 Nov 2022 04:00:02 -0800 Subject: [PATCH 15/28] build: images: squashfs: add help, fix description add help text for `TARGET_SQUASHFS_BLOCK_SIZE` to match the only valid settings accepted by `mksquashfs4` ("block size not power of two or not between 4096 and 1Mbyte") thus for this setting in "KB", the set: `4, 8, 16, 32, 64, 128, 256, 512, 1024` replace `squashfs-lzma` with `squashfs` in the description for `TARGET_ROOTFS_SQUASHFS` because it has various compressions, and not just lzma as it did in the past cosmetic change with no functional effect Signed-off-by: Tony Butler --- config/Config-images.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/Config-images.in b/config/Config-images.in index aa23876259..0252ef6425 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -150,7 +150,7 @@ menu "Target Images" bool "squashfs" default y if USES_SQUASHFS help - Build a squashfs-lzma root filesystem. + Build a squashfs root filesystem. config TARGET_SQUASHFS_BLOCK_SIZE int "Block size (in KiB)" @@ -158,6 +158,9 @@ menu "Target Images" default 64 if LOW_MEMORY_FOOTPRINT default 1024 if (SMALL_FLASH && !LOW_MEMORY_FOOTPRINT) default 256 + help + Select squashfs block size, must be one of: + 4, 8, 16, 32, 64, 128, 256, 512, 1024 menuconfig TARGET_ROOTFS_UBIFS bool "ubifs" From 42f0ab028e2eae0d4e7acf9db7fd68b256f23503 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 5 Dec 2022 23:23:04 +0100 Subject: [PATCH 16/28] CI: build: fix use of sdk as toolchain The toolchain included in a sdk have a different format than an external toolchain tar. Since sdk is a more integrated setup doesn't use and include wrapper bin that use the external toolchain config and use an alternative and more standard way to include all the toolchain headers. External toolchain use wrapper.sh to append the configured include header when each tool is called. Fix the sdk toolchain by reverting their own sdk wrapper scripts and to simulate an external toolchain build copying what is done in the toolchain target makefile. This handle compilation error and warning caused by not using fortify header on building packages. Fixes: 006e52545d14 ("CI: build: add support to fallback to sdk for external toolchain") Signed-off-by: Christian Marangi --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 115bf2c654..43f30617d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -266,6 +266,34 @@ jobs: --overwrite-config \ --config ${{ env.TARGET }}/${{ env.SUBTARGET }} + - name: Adapt external sdk to external toolchain format + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain) + TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin + OPENWRT_DIR=$(pwd) + + # Find target name from toolchain info.mk + GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/') + + cd $TOOLCHAIN_BIN + + # Revert sdk wrapper scripts applied to all the bins + for app in $(find . -name "*.bin"); do + TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/') + rm $TARGET_APP + mv .$TARGET_APP.bin $TARGET_APP + done + + # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build + cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh + for app in cc gcc g++ c++ cpp ld as ; do + [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin + ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app + done + - name: Configure external toolchain with sdk if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' shell: su buildbot -c "sh -e {0}" From f595bebc7fc67255dc05ec4c1b74b0349c1d2aa3 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Fri, 2 Dec 2022 12:05:08 -0800 Subject: [PATCH 17/28] build: add gzip to prereq-build.mk gzip has never been checked for, a system without it would be rare, fix it anyway Signed-off-by: Tony Butler --- include/prereq-build.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index c5c2f1c8bb..9c4ef547ad 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -149,6 +149,9 @@ $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ gstat -c%s $(TOPDIR)/Makefile, \ stat -c%s $(TOPDIR)/Makefile)) +$(eval $(call SetupHostCommand,gzip,Please install 'gzip', \ + gzip --version &1 | grep zipfile, \ unzip)) From 9d22ab703fbaf8691b5b27073b940b6f002cd0eb Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 7 Dec 2022 00:34:55 +0000 Subject: [PATCH 18/28] mediatek: remove redundant flash entry from dtsi Splitting-off the common parts of Ruijie RG-EW3200GX PRO and reyee AX3200-E5 went wrong because the flash descriptiom was kept also in the dtsi. Remove it there, as flash definition is added by both board dts files. Fixes: 7dbac3433f ("mediatek: add support for reyee AX3200-E5") Signed-off-by: Daniel Golle --- .../mediatek/dts/mt7622-reyee-ax3200-e5.dts | 8 ++ .../mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi | 74 ------------------- .../dts/mt7622-ruijie-rg-ew3200gx-pro.dts | 8 ++ 3 files changed, 16 insertions(+), 74 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts index c4ae63e800..3aa59b1c6d 100644 --- a/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts +++ b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts @@ -76,3 +76,11 @@ }; }; }; + +&wmac { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&epa_elna_pins>; + mediatek,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi index 86ef475733..9a04e79235 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi @@ -232,72 +232,6 @@ pinctrl-0 = <&pmic_bus_pins>; }; -&nor_flash { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&spi_nor_pins>; - - 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 = "Preloader"; - reg = <0x0 0x40000>; - read-only; - }; - - partition@40000 { - label = "ATF"; - reg = <0x40000 0x20000>; - read-only; - }; - - partition@60000 { - label = "u-boot"; - reg = <0x60000 0x50000>; - read-only; - }; - - partition@B0000 { - label = "u-boot-env"; - reg = <0xb0000 0x20000>; - }; - - factory: partition@D0000 { - label = "Factory"; - reg = <0xd0000 0x80000>; - read-only; - }; - - partition@150000 { - label = "product_info"; - reg = <0x150000 0x10000>; - read-only; - }; - - partition@160000 { - label = "kdump"; - reg = <0x160000 0x10000>; - read-only; - }; - - partition@170000 { - compatible = "denx,fit"; - label = "firmware"; - reg = <0x170000 0xe90000>; - }; - }; - }; -}; - &rtc { status = "disabled"; }; @@ -315,11 +249,3 @@ pinctrl-names = "default"; pinctrl-0 = <&watchdog_pins>; }; - -&wmac { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&epa_elna_pins>; - mediatek,mtd-eeprom = <&factory 0x0>; -}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts index dacd5bed5f..53abf300cd 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts @@ -73,3 +73,11 @@ }; }; }; + +&wmac { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&epa_elna_pins>; + mediatek,mtd-eeprom = <&factory 0x0>; +}; From 2307b049e4c2d4f9aad50342d4d5da4ca4ffdf8e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 7 Dec 2022 01:42:53 +0000 Subject: [PATCH 19/28] mediatek: also move &slot0 from dtsi down to board dts As the referenced MTD partition is only present in the dts, also move &slot0 down to the dts files. Fixes: 64e9b62829 ("mediatek: remove redundant flash entry from dtsi") Fixes: 7dbac3433f ("mediatek: add support for reyee AX3200-E5") Signed-off-by: Daniel Golle --- target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts | 10 ++++++++++ target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi | 10 ---------- .../mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts | 10 ++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts index 3aa59b1c6d..d86ea52fcf 100644 --- a/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts +++ b/target/linux/mediatek/dts/mt7622-reyee-ax3200-e5.dts @@ -84,3 +84,13 @@ pinctrl-0 = <&epa_elna_pins>; mediatek,mtd-eeprom = <&factory 0x0>; }; + +&slot0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,disable-radar-background; + }; +}; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi index 9a04e79235..5a1cd99f61 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi @@ -159,16 +159,6 @@ pinctrl-0 = <&pcie0_pins>; }; -&slot0 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x5000>; - ieee80211-freq-limit = <5000000 6000000>; - mediatek,disable-radar-background; - }; -}; - &pio { epa_elna_pins: epa-elna-pins { mux { diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts index 53abf300cd..857f94ae94 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200gx-pro.dts @@ -81,3 +81,13 @@ pinctrl-0 = <&epa_elna_pins>; mediatek,mtd-eeprom = <&factory 0x0>; }; + +&slot0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x5000>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,disable-radar-background; + }; +}; From f1f3d19387ffd8910669750ad2f61f6e0dd94fd4 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 7 Dec 2022 08:54:56 +0100 Subject: [PATCH 20/28] firewall4: add missing PKG_MIRROR_HASH Fixes: 84183f0d98 ("firewall4: update to latest Git HEAD") Signed-off-by: Jo-Philipp Wich --- package/network/config/firewall4/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/firewall4/Makefile b/package/network/config/firewall4/Makefile index 47b4e060c0..bec03b62d4 100644 --- a/package/network/config/firewall4/Makefile +++ b/package/network/config/firewall4/Makefile @@ -11,7 +11,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git PKG_SOURCE_DATE:=2022-11-29 PKG_SOURCE_VERSION:=700a925fd9c1f1ff404e6b125cd5347ad7c45668 -PKG_MIRROR_HASH:= +PKG_MIRROR_HASH:=18fb7a27399bf2e9e094a4cbacd4e859448c1c9194b6da4a78c9f37a642d1703 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From 4e2d5f4f9f136d52ba76185df897e14586a2af83 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Wed, 15 Dec 2021 11:38:20 +0100 Subject: [PATCH 21/28] fritz-tools: fritz_tffs_nand: exclude oob code when disabled Skip unnecessary stuff if checking the oob data is disabled. Signed-off-by: Andre Heider --- .../utils/fritz-tools/src/fritz_tffs_nand_read.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c index 22b27336f8..32f3cdf693 100644 --- a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c +++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c @@ -186,15 +186,18 @@ static int find_entry(uint32_t id, struct tffs_entry *entry) fprintf(stderr, "ERROR: sector isn't readable, but has been previously!\n"); exit(EXIT_FAILURE); } - uint32_t oob_id = read_uint32(oobbuf, 0x02); - uint32_t oob_len = read_uint32(oobbuf, 0x06); - uint32_t oob_rev = read_uint32(oobbuf, 0x0a); uint32_t read_id = read_uint32(readbuf, 0x00); uint32_t read_len = read_uint32(readbuf, 0x04); uint32_t read_rev = read_uint32(readbuf, 0x0c); - if (read_oob_sector_health && (oob_id != read_id || oob_len != read_len || oob_rev != read_rev)) { - fprintf(stderr, "Warning: sector has inconsistent metadata\n"); - continue; + if (read_oob_sector_health) { + uint32_t oob_id = read_uint32(oobbuf, 0x02); + uint32_t oob_len = read_uint32(oobbuf, 0x06); + uint32_t oob_rev = read_uint32(oobbuf, 0x0a); + + if (oob_id != read_id || oob_len != read_len || oob_rev != read_rev) { + fprintf(stderr, "Warning: sector has inconsistent metadata\n"); + continue; + } } if (read_id == TFFS_ID_END) { /* no more entries in this block */ From 902378dc87a88ad3242a8bc4812f8ee6dbf08a90 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Wed, 15 Dec 2021 12:21:48 +0100 Subject: [PATCH 22/28] fritz-tools: fritz_tffs_nand: get rid of struct tffs_sectors This doesn't help and "[0]" gets in the way of bounds checks. Signed-off-by: Andre Heider --- .../fritz-tools/src/fritz_tffs_nand_read.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c index 32f3cdf693..29b4a5d2e5 100644 --- a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c +++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c @@ -73,21 +73,17 @@ static uint8_t readbuf[TFFS_SECTOR_SIZE]; static uint8_t oobbuf[TFFS_SECTOR_OOB_SIZE]; static uint32_t blocksize; static int mtdfd; -struct tffs_sectors *sectors; - -struct tffs_sectors { - uint32_t num_sectors; - uint8_t sectors[0]; -}; +static uint32_t num_sectors; +static uint8_t *sectors; static inline void sector_mark_bad(int num) { - sectors->sectors[num / 8] &= ~(0x80 >> (num % 8)); + sectors[num / 8] &= ~(0x80 >> (num % 8)); }; static inline uint8_t sector_get_good(int num) { - return sectors->sectors[num / 8] & 0x80 >> (num % 8); + return sectors[num / 8] & 0x80 >> (num % 8); }; struct tffs_entry_segment { @@ -176,7 +172,7 @@ static int find_entry(uint32_t id, struct tffs_entry *entry) off_t pos = 0; uint8_t block_end = 0; - for (uint32_t sector = 0; sector < sectors->num_sectors; sector++, pos += TFFS_SECTOR_SIZE) { + for (uint32_t sector = 0; sector < num_sectors; sector++, pos += TFFS_SECTOR_SIZE) { if (block_end) { if (pos % blocksize == 0) { block_end = 0; @@ -417,13 +413,13 @@ static int scan_mtd(void) blocksize = info.erasesize; - sectors = malloc(sizeof(*sectors) + (info.size / TFFS_SECTOR_SIZE + 7) / 8); + num_sectors = info.size / TFFS_SECTOR_SIZE; + sectors = malloc((num_sectors + 7) / 8); if (sectors == NULL) { fprintf(stderr, "ERROR: memory allocation failed!\n"); exit(EXIT_FAILURE); } - sectors->num_sectors = info.size / TFFS_SECTOR_SIZE; - memset(sectors->sectors, 0xff, (info.size / TFFS_SECTOR_SIZE + 7) / 8); + memset(sectors, 0xff, (num_sectors + 7) / 8); uint32_t sector = 0, valid_blocks = 0; uint8_t block_ok = 0; From 8138d66fccd1131eb18f47ed1d16a24c7ce89b99 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Wed, 15 Dec 2021 12:48:26 +0100 Subject: [PATCH 23/28] fritz-tools: fritz_tffs_nand: cache already read sector ids This speeds up the tool significantly, especially when using the "-a" argument. Signed-off-by: Andre Heider --- .../fritz-tools/src/fritz_tffs_nand_read.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c index 29b4a5d2e5..05179bb423 100644 --- a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c +++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c @@ -75,6 +75,7 @@ static uint32_t blocksize; static int mtdfd; static uint32_t num_sectors; static uint8_t *sectors; +static uint32_t *sector_ids; static inline void sector_mark_bad(int num) { @@ -135,6 +136,8 @@ static int read_sector(off_t pos) return -1; } + sector_ids[pos / TFFS_SECTOR_SIZE] = read_uint32(readbuf, 0x00); + return 0; } @@ -178,6 +181,17 @@ static int find_entry(uint32_t id, struct tffs_entry *entry) block_end = 0; } } else if (sector_get_good(sector)) { + if (sector_ids[sector]) { + if (sector_ids[sector] == TFFS_ID_END) { + /* no more entries in this block */ + block_end = 1; + continue; + } + + if (sector_ids[sector] != id) + continue; + } + if (read_sectoroob(pos) || read_sector(pos)) { fprintf(stderr, "ERROR: sector isn't readable, but has been previously!\n"); exit(EXIT_FAILURE); @@ -415,7 +429,8 @@ static int scan_mtd(void) num_sectors = info.size / TFFS_SECTOR_SIZE; sectors = malloc((num_sectors + 7) / 8); - if (sectors == NULL) { + sector_ids = calloc(num_sectors, sizeof(uint32_t)); + if (!sectors || !sector_ids) { fprintf(stderr, "ERROR: memory allocation failed!\n"); exit(EXIT_FAILURE); } @@ -563,6 +578,7 @@ int main(int argc, char *argv[]) out_free_entry: free(name_table.val); out_free_sectors: + free(sector_ids); free(sectors); out_close: close(mtdfd); From bc14925f3de510937a5a73598fda481f5c00ee26 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 17 Nov 2022 22:48:10 +0100 Subject: [PATCH 24/28] ramips: define loadaddr for all UniFi devices Define the load-address for the DTB of all Ubiquiti UniFi devices using FIT images. From the GPL code we can assume these boards are affected by the same relocating issue with the vendor bootloader. Signed-off-by: David Bauer --- target/linux/ramips/image/mt7621.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 18ac8ac136..9d8641352a 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2064,6 +2064,7 @@ define Device/ubnt_unifi-flexhd DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi FlexHD DEVICE_DTS_CONFIG := config@2 + DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-leds-ubnt-ledbar IMAGE_SIZE := 15552k @@ -2084,6 +2085,7 @@ define Device/ubnt_usw-flex DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi Switch Flex DEVICE_DTS_CONFIG := config@1 + DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGE_SIZE := 7360k endef From 13f82ce264ed2d02c66cb2cae8f013c8f64a979f Mon Sep 17 00:00:00 2001 From: Jan-Niklas Burfeind Date: Wed, 30 Nov 2022 21:35:29 +0100 Subject: [PATCH 25/28] comgt-ncm: add support for quectel modem EC200T-EU context_type is an integer mapping of pdptype: 1: IPV4 2: IPV6 3: IPV4V6 Signed-off-by: Jan-Niklas Burfeind --- package/network/utils/comgt/files/ncm.json | 16 ++++++++++++++++ package/network/utils/comgt/files/ncm.sh | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/package/network/utils/comgt/files/ncm.json b/package/network/utils/comgt/files/ncm.json index b6ad717529..7d9a38fe36 100644 --- a/package/network/utils/comgt/files/ncm.json +++ b/package/network/utils/comgt/files/ncm.json @@ -75,6 +75,22 @@ "finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1", "disconnect": "AT+CGACT=0,${profile}" }, + "quectel": { + "initialize": [ + "AT+CFUN=1" + ], + "configure": [ + "at+qicsgp=${profile},${context_type},\\\"${apn}\\\",\\\"${username}\\\",\\\"${password}\\\",0" + ], + "modes": { + "lte": "AT+QCFG=\\\"nwscanmode\\\",3", + "umts": "AT+QCFG=\\\"nwscanmode\\\",2", + "gsm": "AT+QCFG=\\\"nwscanmode\\\",1", + "auto": "AT+QCFG=\\\"nwscanmode\\\",0" + }, + "connect": "AT+qnetdevctl=1,${profile},1", + "disconnect": "AT+qnetdevctl=0,${profile},0" + }, "\"zte": { "initialize": [ "AT+CFUN=1" diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index a2c913ea1d..2f36697487 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -31,6 +31,8 @@ proto_ncm_setup() { local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS json_get_vars device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS + local context_type + [ "$metric" = "" ] && metric="0" [ -n "$profile" ] || profile=1 @@ -38,6 +40,10 @@ proto_ncm_setup() { pdptype=$(echo "$pdptype" | awk '{print toupper($0)}') [ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP" + [ "$pdptype" = "IPV4V6" ] && context_type=3 + [ -z "$context_type" -a "$pdptype" = "IPV6" ] && context_type=2 + [ -n "$context_type" ] || context_type=1 + [ -n "$ctl_device" ] && device=$ctl_device [ -n "$device" ] || { From dce66899bf243d78689afcc693340b891bbf4c2d Mon Sep 17 00:00:00 2001 From: Jan-Niklas Burfeind Date: Wed, 30 Nov 2022 21:35:30 +0100 Subject: [PATCH 26/28] ramips: add support for Wavlink WS-WN572HP3 4G MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wavlink WS-WN572HP3 4G is an 802.11ac dual-band outdoor router with LTE support. Specifications; * Soc: MT7621DAT * RAM: 128MiB * Flash: NOR 16MiB GD-25Q128ESIG3 * Wi-Fi: * MT7613BEN: 5GHz * MT7603EN: 2.4GHz * Ethernet: 2x 1GbE * USB: None - only used internally * LTE Modem: Quectel EC200T-EU * UART: 115200 baud * LEDs: * 7 blue at the front * 1 Power * 2 LAN / WAN * 1 Status * 3 RSSI (annotated 4G) * 1 green at the bottom (4G LED) * Buttons: 1 reset button Installation: * press and hold the reset button while powering on the device * keep it pressed for ten seconds * connect to 192.168.10.1 via webbrowser (chromium/chrome works, at least Firefox 106.0.3 does not) * upload the sysupgrade image, confirm the checksum, wait 2 minutes until the device reboots Revert to stock firmware: * same as installation but use the recovery image for WL-WN572HP3 Signed-off-by: Jan-Niklas Burfeind Acked-by: Arınç ÜNAL --- .../dts/mt7621_wavlink_ws-wn572hp3-4g.dts | 184 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 17 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + 3 files changed, 202 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts diff --git a/target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts b/target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts new file mode 100644 index 0000000000..60d0708a80 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_wavlink_ws-wn572hp3-4g.dts @@ -0,0 +1,184 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "wavlink,ws-wn572hp3-4g", "mediatek,mt7621-soc"; + model = "Wavlink WS-WN572HP3 4G"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + label-mac-device = &wifi1; + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset Button"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + rssihigh { + label = "blue:rssihigh"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + rssimedium { + label = "blue:rssimedium"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + rssilow { + label = "blue:rssilow"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + // gpio 15 would be Quectels PWRKEY if used + }; +}; + +&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 = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x50000 0xf30000>; + }; + + partition@f00000 { + label = "vendor"; + reg = <0xf80000 0x80000>; + read-only; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi0: mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&pcie1 { + wifi1: mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "wdt"; + function = "gpio"; + }; +}; + +&factory { + 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>; + }; +}; + +&wifi0{ + ieee80211-freq-limit = <2400000 2500000>; +}; + +&wifi1{ + ieee80211-freq-limit = <5000000 6000000>; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9d8641352a..08aa592be8 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2145,6 +2145,23 @@ define Device/wavlink_wl-wn533a8 endef TARGET_DEVICES += wavlink_wl-wn533a8 +define Device/wavlink_ws-wn572hp3-4g + $(Device/dsa-migration) + BLOCKSIZE := 64k + DEVICE_VENDOR := Wavlink + DEVICE_MODEL := WS-WN572HP3 + DEVICE_VARIANT := 4G + IMAGE_SIZE := 15040k + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + kmod-usb3 kmod-usb-net-rndis comgt-ncm +endef +TARGET_DEVICES += wavlink_ws-wn572hp3-4g + define Device/wevo_11acnas $(Device/dsa-migration) $(Device/uimage-lzma-loader) 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 c4fe2153ac..b7121db64f 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 @@ -50,6 +50,7 @@ ramips_setup_interfaces() ;; asiarf,ap7621-001|\ humax,e10|\ + wavlink,ws-wn572hp3-4g|\ winstars,ws-wn583a6) ucidef_set_interfaces_lan_wan "lan" "wan" ;; From 99eaedfe3966b1ca812e8a962197cf91286247f7 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Dec 2022 18:09:18 +0100 Subject: [PATCH 27/28] CI: build: skip sdk adapt to external toolchain on cache hit On cache hit, skip sdk adapt to external toolchain. This is needed because we cache the already extracted sdk and that is already adapted to be used as external toolchain. Rerunning the adap step will result in the test to fail for missing file as the file are already got wrapped to the external toolchain format. Fixes: 42f0ab028e2e ("CI: build: fix use of sdk as toolchain") Signed-off-by: Christian Marangi --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43f30617d8..1c665cb869 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -267,7 +267,7 @@ jobs: --config ${{ env.TARGET }}/${{ env.SUBTARGET }} - name: Adapt external sdk to external toolchain format - if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' + if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk' && steps.cache-external-toolchain.outputs.cache-hit != 'true' shell: su buildbot -c "sh -e {0}" working-directory: openwrt run: | From 925e2a155ee4d4cc792fbf68aa9666e32a1f649b Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 7 Dec 2022 18:12:31 +0100 Subject: [PATCH 28/28] CI: kernel: don't checkout and install feeds We don't need to checkout feed and install feeds for kernel tests. This saves up to 2 minutes for each target kernel build test. Signed-off-by: Christian Marangi --- .github/workflows/kernel.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 5a8c1123af..0fd03749f3 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -68,7 +68,6 @@ jobs: with: target: ${{ matrix.target }} build_all_kmods: true - include_feeds: true check-kernel-patches: name: Check Kernel patches