From 918908fe7639fde76c486b9be559992873978656 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Fri, 9 Jul 2021 13:50:57 +0200 Subject: [PATCH 01/18] ath79: add missing MTD_NAND_RB91X symbol Looks like the symbol was forgotten for 5.4 Fixes: 820e660cd7 ("ath79: add NAND driver for MikroTik RB91xG series") Signed-off-by: Koen Vandeputte --- target/linux/ath79/config-5.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/config-5.4 b/target/linux/ath79/config-5.4 index 9c5520775d..e37b728554 100644 --- a/target/linux/ath79/config-5.4 +++ b/target/linux/ath79/config-5.4 @@ -173,6 +173,7 @@ CONFIG_MTD_CFI_GEOMETRY=y CONFIG_MTD_CMDLINE_PARTS=y # CONFIG_MTD_MAP_BANK_WIDTH_1 is not set # CONFIG_MTD_MAP_BANK_WIDTH_4 is not set +# CONFIG_MTD_NAND_RB91X is not set CONFIG_MTD_PARSER_CYBERTAN=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y From cce8d16bf18909e1634c0aeac05e40a7be96a519 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 20 Jun 2021 18:54:36 +0200 Subject: [PATCH 02/18] treewide: call check-size before append-metadata sysupgrade metadata is not flashed to the device, so check-size should be called _before_ adding metadata to the image. While at it, do some obvious wrapping improvements. Signed-off-by: Adrian Schmutzler Acked-by: Paul Spooren --- target/linux/ath79/image/Makefile | 2 +- target/linux/ath79/image/common-mikrotik.mk | 2 +- target/linux/ath79/image/common-netgear.mk | 10 +++--- target/linux/ath79/image/common-tp-link.mk | 5 ++- target/linux/ath79/image/generic-tp-link.mk | 2 +- target/linux/ath79/image/generic-ubnt.mk | 4 +-- target/linux/ath79/image/generic.mk | 36 +++++++++------------ target/linux/ath79/image/nand.mk | 3 +- target/linux/ath79/image/tiny.mk | 3 +- target/linux/ipq40xx/image/generic.mk | 8 ++--- target/linux/ipq40xx/image/mikrotik.mk | 2 +- target/linux/ipq806x/image/Makefile | 2 +- target/linux/lantiq/image/Makefile | 4 +-- target/linux/lantiq/image/ar9.mk | 6 ++-- target/linux/lantiq/image/tp-link.mk | 2 +- target/linux/lantiq/image/vr9.mk | 2 +- target/linux/ramips/image/Makefile | 6 ++-- target/linux/ramips/image/common-tp-link.mk | 10 +++--- target/linux/ramips/image/mt7620.mk | 10 +++--- target/linux/ramips/image/mt7621.mk | 10 +++--- target/linux/ramips/image/rt305x.mk | 6 ++-- target/linux/ramips/image/rt3883.mk | 2 +- target/linux/realtek/image/Makefile | 2 +- 23 files changed, 64 insertions(+), 75 deletions(-) diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index aa8665fbb2..aee4ddf963 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -81,7 +81,7 @@ define Device/Default COMPILE := IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin = append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | append-metadata | check-size + append-rootfs | pad-rootfs | check-size | append-metadata endef include $(SUBTARGET).mk diff --git a/target/linux/ath79/image/common-mikrotik.mk b/target/linux/ath79/image/common-mikrotik.mk index 6e739f2d85..5f5fa7899a 100644 --- a/target/linux/ath79/image/common-mikrotik.mk +++ b/target/linux/ath79/image/common-mikrotik.mk @@ -9,7 +9,7 @@ define Device/mikrotik_nor $(Device/mikrotik) IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | \ pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata endef define Device/mikrotik_nand diff --git a/target/linux/ath79/image/common-netgear.mk b/target/linux/ath79/image/common-netgear.mk index 8a74fdc0c9..5a61caf1f6 100644 --- a/target/linux/ath79/image/common-netgear.mk +++ b/target/linux/ath79/image/common-netgear.mk @@ -32,10 +32,8 @@ define Device/netgear_generic KERNEL := kernel-bin | append-dtb | lzma -d20 | uImage lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma IMAGES += factory.img - IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \ - append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \ - check-size + IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + netgear-squashfs | append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata + IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size endef diff --git a/target/linux/ath79/image/common-tp-link.mk b/target/linux/ath79/image/common-tp-link.mk index 0b7b0e1935..f1d5614aa7 100644 --- a/target/linux/ath79/image/common-tp-link.mk +++ b/target/linux/ath79/image/common-tp-link.mk @@ -22,8 +22,7 @@ define Device/tplink-v2 TPLINK_HVERSION := 3 KERNEL := kernel-bin | append-dtb | lzma KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v2-header - IMAGE/sysupgrade.bin := tplink-v2-image -s | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := tplink-v2-image -s | check-size | append-metadata endef define Device/tplink-nolzma @@ -74,7 +73,7 @@ define Device/tplink-safeloader KERNEL := kernel-bin | append-dtb | lzma | tplink-v1-header -O KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := append-rootfs | tplink-safeloader factory endef diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index daeac8341f..9c4920b4e6 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -692,7 +692,7 @@ define Device/tplink_tl-wr2543-v1 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport TPLINK_HWID := 0x25430001 IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -v 3.13.99 | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := tplink-v1-image factory -v 3.13.99 SUPPORTED_DEVICES += tl-wr2543n endef diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index e8ea06a07a..01e8533fd6 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -128,7 +128,7 @@ define Device/ubnt-unifi-jffs2 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma | jffs2 kernel0 IMAGES := sysupgrade.bin factory.bin IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs |\ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/sysupgrade.bin) | mkubntimage2 endef @@ -373,7 +373,7 @@ define Device/ubnt_routerstation_common IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \ check-size IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - append-metadata | check-size + check-size | append-metadata KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb endef diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 0db9987d70..fbcc9d186a 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -172,7 +172,7 @@ define Device/seama # - 36 bytes of META data (4-bytes aligned) IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \ seama-seal | check-size SEAMA_SIGNATURE := @@ -336,7 +336,7 @@ define Device/avm KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \ append-squashfs-fakeroot-be | pad-to 256 | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := fritz-tffs endef @@ -777,7 +777,7 @@ define Device/dlink_dap-2xxx IMAGE/factory.img := append-kernel | pad-offset 6144k 160 | \ append-rootfs | wrgg-pad-rootfs | mkwrggimg | check-size IMAGE/sysupgrade.bin := append-kernel | mkwrggimg | \ - pad-to $$$$(BLOCKSIZE) | append-rootfs | append-metadata | check-size + pad-to $$$$(BLOCKSIZE) | append-rootfs | check-size | append-metadata KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma KERNEL_INITRAMFS := $$(KERNEL) | mkwrggimg endef @@ -829,7 +829,7 @@ define Device/dlink_dap-2695-a1 IMAGE/factory.img := $$(IMAGE/default) | append-rootfs | wrgg-pad-rootfs | \ mkwrggimg | check-size IMAGE/sysupgrade.bin := $$(IMAGE/default) | mkwrggimg | append-rootfs | \ - wrgg-pad-rootfs | append-metadata | check-size + wrgg-pad-rootfs | check-size | append-metadata KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma KERNEL_INITRAMFS := $$(KERNEL) | mkwrggimg DAP_SIGNATURE := wapac02_dkbs_dap2695 @@ -891,7 +891,7 @@ define Device/dlink_dir-825-b1 DEVICE_VARIANT := B1 IMAGE_SIZE := 6208k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ kmod-leds-reset kmod-owl-loader SUPPORTED_DEVICES += dir-825-b1 @@ -912,8 +912,7 @@ define Device/dlink_dir-825-c1 pad-rootfs IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ append-string 00DB120AR9344-RT-101214-00 | check-size - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata endef TARGET_DEVICES += dlink_dir-825-c1 @@ -930,8 +929,7 @@ define Device/dlink_dir-835-a1 pad-rootfs IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ append-string 00DB120AR9344-RT-101214-00 | check-size - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata endef TARGET_DEVICES += dlink_dir-835-a1 @@ -950,7 +948,7 @@ define Device/dlink_dir-842-c IMAGE/default := append-kernel | uImage lzma | \ pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/default) | pad-rootfs -x 64 | seama | \ seama-seal | check-size IMAGE_SIZE := 15680k @@ -1363,7 +1361,7 @@ define Device/jjplus_ja76pf2 IMAGE/kernel.bin := append-kernel IMAGE/rootfs.bin := append-rootfs | pad-rootfs IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - append-metadata | check-size + check-size | append-metadata KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb IMAGE_SIZE := 16000k @@ -1430,7 +1428,7 @@ define Device/nec_wx1200cr DEVICE_VENDOR := NEC IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | seama | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct endef @@ -1482,10 +1480,8 @@ define Device/netgear_ex6400_ex7300 IMAGE_SIZE := 15552k IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ netgear-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size - IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata + IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca99x0-ct endef @@ -1868,7 +1864,7 @@ define Device/phicomm_k2t DEVICE_MODEL := K2T IMAGE_SIZE := 15744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-leds-reset kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9888-ct endef TARGET_DEVICES += phicomm_k2t @@ -2230,8 +2226,7 @@ define Device/teltonika_rut955 pad-rootfs | teltonika-fw-fake-checksum 20 | append-string master |\ append-md5sum-bin | check-size IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\ - append-rootfs | pad-rootfs | append-metadata |\ - check-size + append-rootfs | pad-rootfs | check-size | append-metadata endef TARGET_DEVICES += teltonika_rut955 @@ -2254,8 +2249,7 @@ define Device/trendnet_tew-823dru pad-rootfs IMAGE/factory.bin := $$(IMAGE/default) | pad-offset $$$$(IMAGE_SIZE) 26 | \ append-string 00AP135AR9558-RT-131129-00 | check-size - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata endef TARGET_DEVICES += trendnet_tew-823dru diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index caaa01c92d..20cb2f60fa 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -166,8 +166,7 @@ define Device/netgear_ath79_nand IMAGES := sysupgrade.bin factory.img IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \ check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata UBINIZE_OPTS := -E 5 endef diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 29e411c058..f4a03e2840 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -21,8 +21,7 @@ define Device/dlink_dir-615-e4 FACTORY_IMAGE_SIZE := 3456k IMAGES += factory.bin IMAGE/default := append-kernel | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata IMAGE/factory.bin := $$(IMAGE/default) | \ check-size $$$$(FACTORY_IMAGE_SIZE) | pad-to $$$$(FACTORY_IMAGE_SIZE) | \ append-string "AP99-AR7240-RT-091105-05" diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 68e565594d..9dee742eb4 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -35,7 +35,7 @@ define Device/DniImage IMAGES += factory.img IMAGE/factory.img := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | append-rootfs | pad-rootfs | netgear-dni IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ - append-rootfs | pad-rootfs | append-metadata | check-size + append-rootfs | pad-rootfs | check-size | append-metadata endef define Build/append-rootfshdr @@ -106,7 +106,7 @@ define Device/8dev_habanero-dvk IMAGE_SIZE := 30976k SOC := qcom-ipq4019 DEVICE_PACKAGES := ipq-wifi-8dev_habanero-dvk - IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | append-metadata | check-size + IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata endef TARGET_DEVICES += 8dev_habanero-dvk @@ -207,7 +207,7 @@ define Device/avm_fritzbox-4040 UBOOT_PARTITION_SIZE := 524288 IMAGES += eva.bin IMAGE/eva.bin := append-uboot | pad-to $$$$(UBOOT_PARTITION_SIZE) | append-kernel | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata DEVICE_PACKAGES := fritz-tffs fritz-caldata endef TARGET_DEVICES += avm_fritzbox-4040 @@ -822,7 +822,7 @@ define Device/zyxel_wre6606 DEVICE_DTS_CONFIG := config@4 SOC := qcom-ipq4018 IMAGE_SIZE := 13184k - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers endef TARGET_DEVICES += zyxel_wre6606 diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk index 7c2fa52738..31497608be 100644 --- a/target/linux/ipq40xx/image/mikrotik.mk +++ b/target/linux/ipq40xx/image/mikrotik.mk @@ -7,7 +7,7 @@ define Device/mikrotik_nor IMAGES = sysupgrade.bin IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 | \ pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata endef define Device/mikrotik_hap-ac2 diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index e53fba1e1d..93e7ba3151 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -401,7 +401,7 @@ define Device/ubnt_unifi-ac-hd BLOCKSIZE := 64k IMAGE_SIZE := 14784k DEVICE_PACKAGES := ath10k-firmware-qca9984-ct - IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata | check-size + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata endef TARGET_DEVICES += ubnt_unifi-ac-hd diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index c90975d098..ec10cd882a 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -63,7 +63,7 @@ define Device/Default SOC := $(DEFAULT_SOC) DEVICE_DTS = $$(SOC)_$(1) IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata endef define Device/NAND/xway @@ -102,7 +102,7 @@ define Device/AVM KERNEL := kernel-bin | append-dtb | lzma | eva-image KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-avm-fakeroot | \ - append-rootfs | pad-rootfs | append-metadata | check-size + append-rootfs | pad-rootfs | check-size | append-metadata endef ifeq ($(SUBTARGET),ase) diff --git a/target/linux/lantiq/image/ar9.mk b/target/linux/lantiq/image/ar9.mk index ea3836ea9d..a68868f0d9 100644 --- a/target/linux/lantiq/image/ar9.mk +++ b/target/linux/lantiq/image/ar9.mk @@ -90,10 +90,10 @@ define Device/netgear_dgn3500 factory-na.img factory.img IMAGE/sysupgrade-na.bin := \ append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "NA" | \ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata IMAGE/sysupgrade.bin := \ append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "WW" | \ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata IMAGE/factory-na.img := \ pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \ dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "NA" | pad-rootfs | \ @@ -119,7 +119,7 @@ define Device/netgear_dgn3500b IMAGES += factory.img IMAGE/sysupgrade.bin := \ append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "DE" | \ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata IMAGE/factory.img := \ pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \ dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "DE" | pad-rootfs | \ diff --git a/target/linux/lantiq/image/tp-link.mk b/target/linux/lantiq/image/tp-link.mk index e269aacd02..756105b94c 100644 --- a/target/linux/lantiq/image/tp-link.mk +++ b/target/linux/lantiq/image/tp-link.mk @@ -14,7 +14,7 @@ define Device/lantiqTpLink tplink-v2-header -s -V "ver. 1.0" IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin := tplink-v2-image -s -V "ver. 1.0" | \ - append-metadata | check-size + check-size | append-metadata endef define Device/tplink_tdw8970 diff --git a/target/linux/lantiq/image/vr9.mk b/target/linux/lantiq/image/vr9.mk index 5bc31314f8..d997866568 100644 --- a/target/linux/lantiq/image/vr9.mk +++ b/target/linux/lantiq/image/vr9.mk @@ -253,7 +253,7 @@ define Device/netgear_dm200 IMAGE/sysupgrade.bin := append-kernel | \ pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ - append-rootfs | pad-rootfs | append-metadata | check-size + append-rootfs | pad-rootfs | check-size | append-metadata IMAGE/factory.img := $$(IMAGE/sysupgrade.bin) | netgear-dni IMAGE_SIZE := 7872k NETGEAR_BOARD_ID := DM200 diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index fc5223f3a4..cd2c425cef 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -166,7 +166,7 @@ define Device/Default IMAGES := sysupgrade.bin COMPILE := sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata endef define Device/netgear_sercomm_nor @@ -175,7 +175,7 @@ define Device/netgear_sercomm_nor IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \ pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata IMAGE/factory.img := pad-extra $$$$(SERCOMM_PAD) | $$(IMAGE/default) | \ pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | \ zip $$$$(SERCOMM_HWNAME).bin | sercom-seal @@ -190,7 +190,7 @@ define Device/seama # - 36 bytes of META data (4-bytes aligned) IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs IMAGE/sysupgrade.bin := \ - $$(IMAGE/default) | seama | pad-rootfs | append-metadata | check-size + $$(IMAGE/default) | seama | pad-rootfs | check-size | append-metadata IMAGE/factory.bin := \ $$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size SEAMA_SIGNATURE := diff --git a/target/linux/ramips/image/common-tp-link.mk b/target/linux/ramips/image/common-tp-link.mk index 07ad1ea250..915a086f98 100644 --- a/target/linux/ramips/image/common-tp-link.mk +++ b/target/linux/ramips/image/common-tp-link.mk @@ -11,8 +11,8 @@ define Device/tplink-v1 KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v1-header -e -O IMAGES += factory.bin IMAGE/factory.bin := tplink-v1-image factory -e -O - IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -e -O | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -e -O | check-size | \ + append-metadata endef define Device/tplink-v2 @@ -26,8 +26,8 @@ define Device/tplink-v2 KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e IMAGES += factory.bin IMAGE/factory.bin := tplink-v2-image -e - IMAGE/sysupgrade.bin := tplink-v2-image -s -e | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := tplink-v2-image -s -e | check-size | \ + append-metadata endef define Device/tplink-safeloader @@ -39,6 +39,6 @@ define Device/tplink-safeloader KERNEL := $(KERNEL_DTB) | tplink-v1-header -e -O IMAGES += factory.bin IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \ - append-metadata | check-size + check-size | append-metadata IMAGE/factory.bin := append-rootfs | tplink-safeloader factory endef diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 849bd31ef8..c3b9bc9f6b 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -327,7 +327,7 @@ define Device/edimax_br-6478ac-v2 IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN68 -f 0x70000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci \ kmod-usb-ledtrig-usbport endef @@ -341,7 +341,7 @@ define Device/edimax_ew-7476rpc IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN79 -f 0x70000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-mt76x2 kmod-phy-realtek endef TARGET_DEVICES += edimax_ew-7476rpc @@ -354,7 +354,7 @@ define Device/edimax_ew-7478ac IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN70 -f 0x70000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-mt76x2 kmod-phy-realtek endef TARGET_DEVICES += edimax_ew-7478ac @@ -367,7 +367,7 @@ define Device/edimax_ew-7478apc IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN75 -f 0x70000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci \ kmod-usb-ledtrig-usbport endef @@ -407,7 +407,7 @@ define Device/fon_fon2601 DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci KERNEL_INITRAMFS := $$(KERNEL) | uimage-padhdr IMAGE/sysupgrade.bin := append-kernel | append-rootfs | uimage-padhdr | \ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata endef TARGET_DEVICES += fon_fon2601 diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index cf3225dc81..a11fa21fb4 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -289,7 +289,7 @@ define Device/dlink_dir-8xx-a1 KERNEL_INITRAMFS := $$(KERNEL) | uimage-padhdr 96 IMAGES += factory.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | uimage-padhdr 96 |\ - pad-rootfs | append-metadata | check-size + pad-rootfs | check-size | append-metadata IMAGE/factory.bin := append-kernel | append-rootfs | uimage-padhdr 96 |\ check-size endef @@ -440,7 +440,7 @@ define Device/edimax_re23s DEVICE_ALT0_MODEL := Gemini RE23S IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN76 -f 0x70000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata IMAGES += factory.bin IMAGE/factory.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN76 -f 0x70000 -S 0x01100000 | pad-rootfs | \ @@ -824,7 +824,7 @@ define Device/linksys_ea7xxx uboot-envtools UBINIZE_OPTS := -E 5 IMAGES := sysupgrade.bin factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size + IMAGE/sysupgrade.bin := sysupgrade-tar | check-size | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ append-ubi | check-size | linksys-image type=$$$$(LINKSYS_HWNAME) endef @@ -901,8 +901,8 @@ define Device/MikroTik KERNEL_NAME := vmlinuz KERNEL := kernel-bin | append-dtb-elf IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 | \ - pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata | \ - check-size + pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | \ + append-metadata endef define Device/mikrotik_routerboard-750gr3 diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index 4edc2eb3c4..6c339dcba1 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -500,7 +500,7 @@ define Device/edimax_3g-6200n IMAGE_SIZE := 3648k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m 3G62 -f 0x50000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_VENDOR := Edimax DEVICE_MODEL := 3g-6200n SUPPORTED_DEVICES += 3g-6200n @@ -513,7 +513,7 @@ define Device/edimax_3g-6200nl IMAGE_SIZE := 3648k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m 3G62 -f 0x50000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_VENDOR := Edimax DEVICE_MODEL := 3g-6200nl SUPPORTED_DEVICES += 3g-6200nl @@ -1047,7 +1047,7 @@ define Device/trendnet_tew-638apb-v2 BLOCKSIZE := 64k IMAGE_SIZE := 3776k IMAGE/sysupgrade.bin := $$(sysupgrade_bin) | umedia-header 0x026382 | \ - append-metadata | check-size + check-size | append-metadata DEVICE_VENDOR := TRENDnet DEVICE_MODEL := TEW-638APB DEVICE_VARIANT := v2 diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk index 1b46d570fd..148bfbbe44 100644 --- a/target/linux/ramips/image/rt3883.mk +++ b/target/linux/ramips/image/rt3883.mk @@ -52,7 +52,7 @@ define Device/edimax_br-6475nd IMAGE_SIZE := 7744k IMAGE/sysupgrade.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN54 -f 0x70000 -S 0x01100000 | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata DEVICE_VENDOR := Edimax DEVICE_MODEL := BR-6475nD SUPPORTED_DEVICES += br-6475nd diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index ebc0c0a784..cf0d588851 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -24,7 +24,7 @@ define Device/Default DEVICE_DTS = $$(SOC)_$(1) IMAGES := sysupgrade.bin IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | \ - append-metadata | check-size + check-size | append-metadata endef # "NGE" refers to the uImage magic From b8168f4716ad64863db8a6a2aba24bbff4664ffe Mon Sep 17 00:00:00 2001 From: Stas Fiduchi Date: Sat, 12 Jun 2021 11:35:27 +0300 Subject: [PATCH 03/18] ramips: add support for D-Link DIR-853-R1 This PR adds support for router D-Link DIR-853-R1 Specifications: SoC: MT7621AT RAM: 128MB Flash: 16MB SPI WiFi: MT7615DN (2.4GHz+5Ghz) with DBDC (This mode allows this single chip act as an 2x2 11n radio and an 2x2 11ac radio at the same time) LAN: 5x1000M LEDs Power Blue+Orange,Wan Blue+Orange,WPS Blue,"2.4G"Blue, "5G" Blue USB Blue Buttons Reset,WPS, Wifi MAC addresses: |Interface | MAC | Factory |Comment |------------|-----------------|-------------|---------------- |WAN sticker |C4:XX:XX:6E:XX:2A| |Sticker |LAN |C4:XX:XX:6E:XX:2B| | |Wifi (5g) |C4:XX:XX:6E:XX:2C|0x4 | |Wifi (2.4g) |C6:XX:XX:7E:XX:2C| | | | | | | |C4:XX:XX:6E:XX:2E|0x8004 0xe000| | |C4:XX:XX:6E:XX:2F|0xe006 | The increment of the 4th byte for the 2.4g address appears to vary. Reported cases: 5g 2.4g increment C4:XX:XX:6E:XX:2C C6:XX:XX:7E:XX:2C 0x10 f4:XX:XX:16:XX:32 f6:XX:XX:36:XX:32 0x20 F4:XX:XX:A6:XX:E3 F6:XX:XX:B6:XX:E3 0x10 Since increment is inconsistent and there is no obvious pattern in swapping bytes, and the 2.4g address has local bit set anyway, it seems safer to use the LAN address with flipped byte here in order to prevent collisions between OpenWrt devices and OEM devices for this interface. This way we at least use an address as base that is definitely owned by the device at hand. Flashing instruction: The Dlink "Emergency Room" Connect your client computer to LAN1 of the device Set your client IP address manually to 192.168.0.101 / 255.255.255.0. Then, power down the router, press and hold the reset button, then re-plug it. Keep the reset button pressed until the internet LED stops flashing Call the recovery page or tftp for the device at http://192.168.0.1 Use the provided emergency web GUI to upload and flash a new firmware to the device. Signed-off-by: Stas Fiduchi [commit title/message improvements, use correct label MAC address, calculate MAC addresses based on 0x4, minor DTS style fixes, add uart2 to state_default, remove factory image, add 2.4g MAC address, use partition DTSI, add macaddr comment in DTS] Signed-off-by: Adrian Schmutzler --- .../ramips/dts/mt7621_dlink_dir-853-r1.dts | 144 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 8 + .../mt7621/base-files/etc/board.d/01_leds | 3 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 + 4 files changed, 161 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts new file mode 100644 index 0000000000..09e46b011e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts @@ -0,0 +1,144 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include "mt7621_dlink_flash-16m-r1.dtsi" + +#include +#include + +/ { + compatible = "dlink,dir-853-r1", "mediatek,mt7621-soc"; + model = "D-Link DIR-853 R1"; + + aliases { + label-mac-device = &wan; + led-boot = &led_power_orange; + led-failsafe = &led_power_blue; + led-running = &led_power_blue; + led-upgrade = &led_net_orange; + }; + + leds { + compatible = "gpio-leds"; + + led_power_orange: power_orange { + label = "orange:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_power_blue: power_blue { + label = "blue:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_net_orange: net_orange { + label = "orange:net"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + net_blue { + label = "blue:net"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + usb_blue { + label = "blue:usb"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + trigger-sources = <&xhci_ehci_port1>; + linux,default-trigger = "usbport"; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0radio"; + }; + + wlan5g { + label = "blue:wlan5g"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1radio"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + /* 5 GHz (phy1) does not take the address from calibration data, + but setting it manually here works */ + mtd-mac-address = <&factory 0x4>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0x4>; + mtd-mac-address-increment = <(-1)>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan4"; + }; + + port@1 { + status = "okay"; + label = "lan3"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + + wan: port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0x4>; + mtd-mac-address-increment = <(-2)>; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uart3", "uart2", "jtag", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a11fa21fb4..63d28530b6 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -342,6 +342,14 @@ define Device/dlink_dir-2660-a1 endef TARGET_DEVICES += dlink_dir-2660-a1 +define Device/dlink_dir-853-r1 + $(Device/dlink_dir-8xx-r1) + DEVICE_MODEL := DIR-853 + DEVICE_VARIANT := R1 + DEVICE_PACKAGES += kmod-usb3 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += dlink_dir-853-r1 + define Device/dlink_dir-860l-b1 $(Device/dsa-migration) $(Device/seama) 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 c04dae4f0d..cb889de208 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 @@ -23,6 +23,9 @@ d-team,newifi-d2) ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "blue:wlan2g" "wlan0" ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "blue:wlan5g" "wlan1" ;; +dlink,dir-853-r1) + ucidef_set_led_netdev "internet" "internet" "blue:net" "wan" + ;; d-team,pbr-m1|\ gehua,ghl-r-001|\ jcg,y2|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index bd0f0254c6..24d73b039d 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -10,6 +10,12 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + dlink,dir-853-r1) + [ "$PHYNBR" = "0" ] && \ + base_mac=$(mtd_get_mac_binary factory 0x4) + base_mac=$(macaddr_add "$base_mac" -1) + macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress + ;; glinet,gl-mt1300) [ "$PHYNBR" = "1" ] && \ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress From 5e8eaac8c3984fa5860e3b5e97504be54c4fea22 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sat, 10 Jul 2021 20:33:26 +0200 Subject: [PATCH 04/18] ramips: mt7628an: remove redundant console setup for bootargs This is already set in mt7628an.dtsi Signed-off-by: Adrian Schmutzler --- target/linux/ramips/dts/mt7628an_minew_g1-c.dts | 4 ---- target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts | 4 ---- 2 files changed, 8 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_minew_g1-c.dts b/target/linux/ramips/dts/mt7628an_minew_g1-c.dts index 74ea47aee0..12cf47f5a7 100644 --- a/target/linux/ramips/dts/mt7628an_minew_g1-c.dts +++ b/target/linux/ramips/dts/mt7628an_minew_g1-c.dts @@ -16,10 +16,6 @@ led-upgrade = &led_system; }; - chosen { - bootargs = "console=ttyS0,57600"; - }; - memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; diff --git a/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts b/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts index 6962651e1b..859568b1c1 100644 --- a/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts +++ b/target/linux/ramips/dts/mt7628an_ravpower_rp-wd009.dts @@ -16,10 +16,6 @@ led-upgrade = &led_globe; }; - chosen { - bootargs = "console=ttyS0,57600"; - }; - leds { compatible = "gpio-leds"; From 315f52e0f3bfa3d65ad14ca21a696c6d31c4edcd Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 10 Jul 2021 20:21:26 +0100 Subject: [PATCH 05/18] lua: make it easier to detect host-built Lua Install pkg-config file also for host-build, clean up Lua symlinks. Signed-off-by: Daniel Golle --- package/utils/lua/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package/utils/lua/Makefile b/package/utils/lua/Makefile index d262d1e1fc..e15142d8d2 100644 --- a/package/utils/lua/Makefile +++ b/package/utils/lua/Makefile @@ -134,8 +134,12 @@ define Host/Install INSTALL_TOP="$(STAGING_DIR_HOSTPKG)" \ install - $(LN) $(STAGING_DIR_HOSTPKG)/bin/lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua - $(LN) $(STAGING_DIR_HOSTPKG)/bin/luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac + $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/pkgconfig + $(CP) $(HOST_BUILD_DIR)/etc/lua.pc $(STAGING_DIR_HOSTPKG)/lib/pkgconfig/lua5.1.pc + + $(LN) lua5.1 $(STAGING_DIR_HOSTPKG)/bin/lua + $(LN) luac5.1 $(STAGING_DIR_HOSTPKG)/bin/luac + $(LN) lua5.1.pc $(STAGING_DIR_HOSTPKG)/lib/pkgconfig/lua.pc endef define Build/InstallDev From f46a38a1ac83f8ce715e6fe03ec4192202527ca8 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 10 Jul 2021 22:43:47 +0100 Subject: [PATCH 06/18] procd: update to git HEAD 2dcefbd jail: add support for cgroup devices as in OCI run-time spec Signed-off-by: Daniel Golle --- package/system/procd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 2b0ea6d119..36e7f11c29 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_SOURCE_DATE:=2021-05-05 -PKG_SOURCE_VERSION:=021ece84de430fca988acd6934f6046ea59d8c37 -PKG_MIRROR_HASH:=edbe464cadbae000f4a48a6f1e6a0f5d27ae3ad521e308205252ad89639b6f9d +PKG_SOURCE_DATE:=2021-07-10 +PKG_SOURCE_VERSION:=2dcefbd6094681dcbd2d7ff608590e74425a9220 +PKG_MIRROR_HASH:=6f2615230a1db09740e8125517488a53b62baef0731b9adbd377765cad130289 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 88f39b72da6ceb5f2f87692369dc41e9c9cced12 Mon Sep 17 00:00:00 2001 From: Dmitry Tunin Date: Fri, 9 Jul 2021 13:33:15 +0300 Subject: [PATCH 07/18] ipq40xx: increase SPI frequency for Zyxel NBG6617 The mx25l25635f supports clock speed up to 50Mhz. Also remove obsolete "mx25l25635f" hack and rename the matching device-tree flash node. Signed-off-by: Dmitry Tunin [mention node rename as well. chip is very very likely always the "f" revision for all NBG6617] Signed-off-by: Christian Lamparter --- .../files/arch/arm/boot/dts/qcom-ipq4018-nbg6617.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-nbg6617.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-nbg6617.dts index 4d17325c8d..caafc1beb4 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-nbg6617.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-nbg6617.dts @@ -210,10 +210,10 @@ status = "okay"; cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>; - mx25l25635f@0 { - compatible = "mx25l25635f", "jedec,spi-nor"; + flash@0 { + compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <24000000>; + spi-max-frequency = <50000000>; status = "okay"; m25p,fast-read; From c13d7c82aa4cd2cbf1f61bad857cd01b795318e3 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 11 Jul 2021 15:59:48 +0200 Subject: [PATCH 08/18] iwinfo: update to latest Git HEAD and move device info into -data package a0a0e02 iwinfo: rename hardware.txt to devices.txt Also split common devices.txt (former hardware.txt) into a common libiwinfo-data package to allow different libiwinfo versions to coexist without file clashes. Signed-off-by: Jo-Philipp Wich --- package/network/utils/iwinfo/Makefile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 3802d8d614..9dbf91efe9 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -7,13 +7,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2021-06-28 -PKG_SOURCE_VERSION:=c9b1672f5a83c8dcb14fdbaee651f775a7defe52 -PKG_MIRROR_HASH:=f33779035153da6bd0b2f100f402f62f1554ab87ed6fbbd938d41df6b9947a1f +PKG_SOURCE_DATE:=2021-07-11 +PKG_SOURCE_VERSION:=a0a0e02dd91d14a50155390d5fd3b95d6ec87bf4 +PKG_MIRROR_HASH:=7b4f745c2cace836e57bd116399973d9ac32cee7f98d4628a17395caa3d0cebc PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 @@ -26,7 +26,7 @@ define Package/libiwinfo SECTION:=libs CATEGORY:=Libraries TITLE:=Generalized Wireless Information Library (iwinfo) - DEPENDS:=+libnl-tiny +libuci +libubus + DEPENDS:=+libnl-tiny +libuci +libubus +libiwinfo-data ABI_VERSION:=$(IWINFO_ABI_VERSION) endef @@ -50,6 +50,12 @@ define Package/libiwinfo-lua/description endef +define Package/libiwinfo-data + TITLE:=libiwinfo Lua binding + HIDDEN:=1 +endef + + define Package/iwinfo SECTION:=utils CATEGORY:=Utilities @@ -90,8 +96,6 @@ endef define Package/libiwinfo/install $(INSTALL_DIR) $(1)/usr/lib $(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so.$(IWINFO_ABI_VERSION) $(1)/usr/lib/libiwinfo.so.$(IWINFO_ABI_VERSION) - $(INSTALL_DIR) $(1)/usr/share/libiwinfo - $(INSTALL_DATA) $(PKG_BUILD_DIR)/hardware.txt $(1)/usr/share/libiwinfo/hardware.txt endef define Package/libiwinfo-lua/install @@ -99,6 +103,11 @@ define Package/libiwinfo-lua/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so endef +define Package/libiwinfo-data/install + $(INSTALL_DIR) $(1)/usr/share/libiwinfo + $(INSTALL_DATA) $(PKG_BUILD_DIR)/devices.txt $(1)/usr/share/libiwinfo/devices.txt +endef + define Package/iwinfo/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo $(1)/usr/bin/iwinfo @@ -106,4 +115,5 @@ endef $(eval $(call BuildPackage,libiwinfo)) $(eval $(call BuildPackage,libiwinfo-lua)) +$(eval $(call BuildPackage,libiwinfo-data)) $(eval $(call BuildPackage,iwinfo)) From 0c721434ea56044cdc1c13554c970b82471bc43e Mon Sep 17 00:00:00 2001 From: Tee Hao Wei Date: Tue, 6 Jul 2021 01:19:08 +0800 Subject: [PATCH 09/18] ramips: add support for Linksys EA8100 v2 Specifications: - SoC: MT7621AT - RAM: 256MB - Flash: 128MB NAND - Ethernet: 5 Gigabit ports - WiFi: 2.4G/5G MT7615N - USB: 1 USB 3.0, 1 USB 2.0 This device is very similar to the EA7300 v1/v2, EA7500 v2, and EA8100 v1. Installation: Upload the generated factory image through the factory web interface. (following part taken from EA7300 v2 commit message:) This might fail due to the A/B nature of this device. When flashing, OEM firmware writes over the non-booted partition. If booted from 'A', flashing over 'B' won't work. To get around this, you should flash the OEM image over itself. This will then boot the router from 'B' and allow you to flash OpenWRT without problems. Reverting to factory firmware: Hard-reset the router three times to force it to boot from 'B.' This is where the stock firmware resides. To remove any traces of OpenWRT from your router simply flash the OEM image at this point. With thanks to Tom Wizetek (@wizetek) for testing. Signed-off-by: Tee Hao Wei --- package/boot/uboot-envtools/files/ramips | 1 + target/linux/ramips/dts/mt7621_linksys_ea8100-v2.dts | 8 ++++++++ target/linux/ramips/image/mt7621.mk | 8 ++++++++ target/linux/ramips/mt7621/base-files/etc/board.d/01_leds | 3 ++- .../linux/ramips/mt7621/base-files/etc/board.d/02_network | 3 ++- .../base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | 3 ++- .../linux/ramips/mt7621/base-files/etc/init.d/bootcount | 3 ++- .../ramips/mt7621/base-files/lib/upgrade/platform.sh | 1 + 8 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_linksys_ea8100-v2.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 2bb04997f9..7941c106e4 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -54,6 +54,7 @@ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1|\ +linksys,ea8100-v2|\ xiaomi,mi-router-3g|\ xiaomi,mi-router-3-pro|\ xiaomi,mi-router-4|\ diff --git a/target/linux/ramips/dts/mt7621_linksys_ea8100-v2.dts b/target/linux/ramips/dts/mt7621_linksys_ea8100-v2.dts new file mode 100644 index 0000000000..db1429ea10 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_linksys_ea8100-v2.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_linksys_ea7xxx.dtsi" + +/ { + compatible = "linksys,ea8100-v2", "mediatek,mt7621-soc"; + model = "Linksys EA8100 v2"; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 63d28530b6..853741f9af 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -870,6 +870,14 @@ define Device/linksys_ea8100-v1 endef TARGET_DEVICES += linksys_ea8100-v1 +define Device/linksys_ea8100-v2 + $(Device/linksys_ea7xxx) + DEVICE_MODEL := EA8100 + DEVICE_VARIANT := v2 + LINKSYS_HWNAME := EA8100v2 +endef +TARGET_DEVICES += linksys_ea8100-v2 + define Device/linksys_re6500 $(Device/dsa-migration) IMAGE_SIZE := 7872k 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 cb889de208..9545d8d0c7 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 @@ -55,7 +55,8 @@ linksys,e5600) linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ -linksys,ea8100-v1) +linksys,ea8100-v1|\ +linksys,ea8100-v2) ucidef_set_led_netdev "lan1" "lan1 link" "green:lan1" "lan1" "link" ucidef_set_led_netdev "lan2" "lan2 link" "green:lan2" "lan2" "link" ucidef_set_led_netdev "lan3" "lan3 link" "green:lan3" "lan3" "link" 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 aa1d644938..16148547f7 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 @@ -143,7 +143,8 @@ ramips_setup_macs() linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ - linksys,ea8100-v1) + linksys,ea8100-v1|\ + linksys,ea8100-v2) lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) wan_mac=$lan_mac label_mac=$lan_mac diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 24d73b039d..ee847e947b 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -28,7 +28,8 @@ case "$board" in linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ - linksys,ea8100-v1) + linksys,ea8100-v1|\ + linksys,ea8100-v2) hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index d3525ea0c9..7b4a63d663 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -12,7 +12,8 @@ boot() { linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ - linksys,ea8100-v1) + linksys,ea8100-v1|\ + linksys,ea8100-v2) mtd resetbc s_env || true ;; samknows,whitebox-v8) diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index c2ad4d3ed6..18fea53aee 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -63,6 +63,7 @@ platform_do_upgrade() { linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1|\ + linksys,ea8100-v2|\ netgear,r6220|\ netgear,r6260|\ netgear,r6350|\ From af56075a8ff760832df27546325428f2497a0121 Mon Sep 17 00:00:00 2001 From: Roberto Valentini Date: Thu, 1 Jul 2021 11:56:30 +0200 Subject: [PATCH 10/18] ath79: add support for TP-Link RE455 v1 TP-Link RE455 v1 is a dual band router/range-extender based on Qualcomm/Atheros QCA9563 + QCA9880. This device is nearly identical to RE450 v3 Specification: - 775 MHz CPU - 64 MB of RAM (DDR2) - 8 MB of FLASH (SPI NOR) - 3T3R 2.4 GHz - 3T3R 5 GHz - 1x 10/100/1000 Mbps Ethernet (AR8033 PHY) - 7x LED, 4x button - UART header on PCB[1] Flash instruction: Apply factory image in OEM firmware web-gui. [1] Didn't work, probably need to short unpopulated resistor R64 and R69 as RE450v3 Signed-off-by: Roberto Valentini --- .../ath79/dts/qca9563_tplink_re455-v1.dts | 52 +++++++++++++++++++ .../generic/base-files/etc/board.d/01_leds | 3 +- .../generic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 3 +- target/linux/ath79/image/generic-tp-link.mk | 12 +++++ tools/firmware-utils/src/tplink-safeloader.c | 40 ++++++++++++++ 6 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 target/linux/ath79/dts/qca9563_tplink_re455-v1.dts diff --git a/target/linux/ath79/dts/qca9563_tplink_re455-v1.dts b/target/linux/ath79/dts/qca9563_tplink_re455-v1.dts new file mode 100644 index 0000000000..b6c1efb846 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_re455-v1.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_tplink_re450.dtsi" + +/ { + compatible = "tplink,re455-v1", "qca,qca9563"; + model = "TP-Link RE455 v1"; +}; + +&partitions { + partition@0 { + label = "u-boot"; + reg = <0x000000 0x020000>; + read-only; + }; + + info: partition@20000 { + label = "info"; + reg = <0x020000 0x002000>; + read-only; + }; + + partition@22000 { + label = "partition-table"; + reg = <0x022000 0x002000>; + read-only; + }; + + partition@24000 { + label = "info2"; + reg = <0x024000 0x00a000>; + read-only; + }; + + partition@2e000 { + label = "config"; + reg = <0x02e000 0x022000>; + read-only; + }; + + partition@50000 { + compatible = "tplink,firmware"; + label = "firmware"; + reg = <0x050000 0x7a0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x010000>; + read-only; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds index 890b38e58a..5e5ccca32f 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -352,7 +352,8 @@ tplink,tl-wr902ac-v1) tplink,re355-v1|\ tplink,re450-v1|\ tplink,re450-v2|\ -tplink,re450-v3) +tplink,re450-v3|\ +tplink,re455-v1) ucidef_set_led_netdev "lan_data" "LAN Data" "green:lan_data" "eth0" "tx rx" ucidef_set_led_netdev "lan_link" "LAN Link" "green:lan_link" "eth0" "link" ;; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 025d55fec0..1731f141af 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -70,6 +70,7 @@ ath79_setup_interfaces() tplink,re450-v1|\ tplink,re450-v2|\ tplink,re450-v3|\ + tplink,re455-v1|\ tplink,tl-wr902ac-v1|\ ubnt,bullet-ac|\ ubnt,bullet-m-ar7240|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 8d7407450d..59d692c3d0 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -141,7 +141,8 @@ case "$FIRMWARE" in ;; tplink,eap245-v1|\ tplink,re450-v2|\ - tplink,re450-v3) + tplink,re450-v3|\ + tplink,re455-v1) caldata_extract "art" 0x5000 0x844 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) 1) ;; diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index 9c4920b4e6..16494b111f 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -486,6 +486,18 @@ define Device/tplink_re450-v3 endef TARGET_DEVICES += tplink_re450-v3 +define Device/tplink_re455-v1 + $(Device/tplink-safeloader) + SOC := qca9563 + IMAGE_SIZE := 7808k + DEVICE_MODEL := RE455 + DEVICE_VARIANT := v1 + DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct + TPLINK_BOARD_ID := RE455-V1 + LOADER_TYPE := elf +endef +TARGET_DEVICES += tplink_re455-v1 + define Device/tplink_tl-mr6400-v1 $(Device/tplink-8mlzma) SOC := qca9531 diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index 432044882c..4e7549d5e6 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -2431,6 +2431,46 @@ static struct device_info boards[] = { .last_sysupgrade_partition = "file-system" }, + /** Firmware layout for the RE455 v1 */ + { + .id = "RE455-V1", + .vendor = "", + .support_list = + "SupportList:\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:00000000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:55530000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:45550000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:4A500000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:43410000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:41550000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:41530000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:4B520000}\r\n" + "{product_name:RE455,product_ver:1.0.0,special_id:42520000}\r\n", + .part_trail = 0x00, + .soft_ver = NULL, + + /* We're using a dynamic kernel/rootfs split here */ + .partitions = { + {"fs-uboot", 0x00000, 0x20000}, + {"default-mac", 0x20000, 0x00020}, + {"pin", 0x20020, 0x00020}, + {"product-info", 0x21000, 0x01000}, + {"partition-table", 0x22000, 0x02000}, + {"soft-version", 0x24000, 0x01000}, + {"support-list", 0x25000, 0x01000}, + {"profile", 0x26000, 0x08000}, + {"user-config", 0x2e000, 0x10000}, + {"default-config", 0x3e000, 0x10000}, + {"config-info", 0x4e000, 0x00400}, + {"firmware", 0x50000, 0x7a0000}, + {"radio", 0x7f0000, 0x10000}, + {NULL, 0, 0} + }, + + .first_sysupgrade_partition = "os-image", + .last_sysupgrade_partition = "file-system" + }, + /** Firmware layout for the RE500 */ { .id = "RE500-V1", From 6639623e75b84de5cf4a657be7a80383309e290d Mon Sep 17 00:00:00 2001 From: Karim Dehouche Date: Tue, 18 Aug 2020 11:19:16 +0400 Subject: [PATCH 11/18] ramips: add support for D-Link DIR-853 A3 Specifications: * SoC: MT7621AT * RAM: 256MB * Flash: 128MB NAND flash * WiFi: MT7615DN (2.4GHz+5Ghz) with DBDC * LAN: 5x1000M * Firmware layout is Uboot with extra 96 bytes in header * Base PCB is DIR-1360 REV1.0 * LEDs Power Blue+Orange,Wan Blue+Orange,WPS Blue,"2.4G"Blue, "5G" Blue, USB Blue * Buttons Reset,WPS, Wifi MAC addresses on OEM firmware: lan factory 0xe000 f4:*:*:a8:*:65 (label) wan factory 0xe006 f4:*:*:a8:*:68 2.4 GHz [not on flash] f6:*:*:c8:*:66 5.0 GHz factory 0x4 f4:*:*:a8:*:66 The increment of the 4th byte for the 2.4g address appears to vary. Reported cases: 5g 2.4g increment f4:XX:XX:a8:XX:66 f6:XX:XX:c8:XX:66 +0x20 x0:xx:xx:68:xx:xx x2:xx:xx:48:xx:xx -0x20 x4:xx:xx:6a:xx:xx x6:xx:xx:4a:xx:xx -0x20 Since increment is inconsistent and there is no obvious pattern in swapping bytes, and the 2.4g address has local bit set anyway, it seems safer to use the LAN address with flipped byte here in order to prevent collisions between OpenWrt devices and OEM devices for this interface. This way we at least use an address as base that is definitely owned by the device at hand. Flashing instruction: The Dlink "Emergency Room" cannot be accessed through the reset button on this device. You can either use console or use the encrypted factory image availble in the openwrt forum. Once the encrypted image is flashed throuh the stock Dlink web interface, the sysupgrade images can be used. Header pins needs to be soldered near the WPS and Wifi buttons. The layout for the pins is (VCC,RX,TX,GND). No need to connect the VCC. the settings are: Bps/Par/Bits : 57600 8N1 Hardware Flow Control : No Software Flow Control : No Connect your client computer to LAN1 of the device Set your client IP address manually to 192.168.0.101 / 255.255.255.0. Call the recovery page or tftp for the device at http://192.168.0.1 Use the provided emergency web GUI to upload and flash a new firmware to the device At the time of adding support the wireless config needs to be set up by editing the wireless config file: * Setting the country code is mandatory, otherwise the router loses connectivity at the next reboot. This is mandatory and can be done from luci. After setting the country code the router boots correctly. A reset with the reset button will fix the issue and the user has to reconfigure. * This is minor since the 5g interface does not come up online although it is not set as disabled. 2 options here: 1- Either run the "wifi" command. Can be added from LUCI in system - startup - local startup and just add wifi above "exit 0". 2- Or add the serialize option in the wireless config file as shown below. This one would work and bring both interfaces automatically at every boot: config wifi-device 'radio0' option serialize '1' config wifi-device 'radio1' option serialize '1' Signed-off-by: Karim Dehouche [rebase, improve MAC table, update wireless config comment, fix 2.4g macaddr setup] Signed-off-by: Adrian Schmutzler --- .../ramips/dts/mt7621_dlink_dir-853-a3.dts | 204 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 7 + .../mt7621/base-files/etc/board.d/01_leds | 9 +- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 5 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 5 files changed, 223 insertions(+), 3 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts b/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts new file mode 100644 index 0000000000..738bcdc7d6 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "dlink,dir-853-a3", "mediatek,mt7621-soc"; + model = "D-Link DIR-853 A3"; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power_orange; + led-failsafe = &led_power_blue; + led-running = &led_power_blue; + led-upgrade = &led_net_orange; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wifi { + label = "wifi"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_orange: power_orange { + label = "orange:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_power_blue: power_blue { + label = "blue:power"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + led_net_orange: net_orange { + label = "orange:net"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + net_blue { + label = "blue:net"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + usb_blue { + label = "blue:usb"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + trigger-sources = <&xhci_ehci_port1>; + linux,default-trigger = "usbport"; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0radio"; + }; + + wlan5g { + label = "blue:wlan5g"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1radio"; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "config2"; + reg = <0x140000 0x40000>; + read-only; + }; + + partition@180000 { + label = "firmware"; + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,padding = <96>; + reg = <0x180000 0x2800000>; + }; + + partition@2980000 { + label = "private"; + reg = <0x2980000 0x2000000>; + read-only; + }; + + partition@4980000 { + label = "firmware2"; + reg = <0x4980000 0x2800000>; + }; + + partition@7180000 { + label = "mydlink"; + reg = <0x7180000 0x600000>; + read-only; + }; + + partition@7780000 { + label = "reserved"; + reg = <0x7780000 0x880000>; + read-only; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + /* 5 GHz (phy1) does not take the address from calibration data, + but setting it manually here works */ + mtd-mac-address = <&factory 0x4>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe000>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan4"; + }; + + port@1 { + status = "okay"; + label = "lan3"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe006>; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uart2", "uart3", "jtag", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 853741f9af..ea0c3fc619 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -342,6 +342,13 @@ define Device/dlink_dir-2660-a1 endef TARGET_DEVICES += dlink_dir-2660-a1 +define Device/dlink_dir-853-a3 + $(Device/dlink_dir-xx60-a1) + DEVICE_MODEL := DIR-853 + DEVICE_VARIANT := A3 +endef +TARGET_DEVICES += dlink_dir-853-a3 + define Device/dlink_dir-853-r1 $(Device/dlink_dir-8xx-r1) DEVICE_MODEL := DIR-853 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 9545d8d0c7..d01ba53568 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 @@ -23,9 +23,6 @@ d-team,newifi-d2) ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "blue:wlan2g" "wlan0" ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "blue:wlan5g" "wlan1" ;; -dlink,dir-853-r1) - ucidef_set_led_netdev "internet" "internet" "blue:net" "wan" - ;; d-team,pbr-m1|\ gehua,ghl-r-001|\ jcg,y2|\ @@ -37,6 +34,12 @@ dlink,dir-2640-a1|\ dlink,dir-2660-a1) ucidef_set_led_netdev "wan" "wan" "white:net" "wan" ;; +dlink,dir-853-a3) + ucidef_set_led_netdev "wan" "wan" "blue:net" "wan" + ;; +dlink,dir-853-r1) + ucidef_set_led_netdev "internet" "internet" "blue:net" "wan" + ;; dlink,dir-860l-b1|\ dlink,dir-867-a1|\ dlink,dir-878-a1|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index ee847e947b..4349a3592d 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -10,6 +10,11 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + dlink,dir-853-a3) + [ "$PHYNBR" = "0" ] && \ + macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \ + > /sys${DEVPATH}/macaddress + ;; dlink,dir-853-r1) [ "$PHYNBR" = "0" ] && \ base_mac=$(mtd_get_mac_binary factory 0x4) diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 18fea53aee..ef9b680f32 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -56,6 +56,7 @@ platform_do_upgrade() { dlink,dir-1960-a1|\ dlink,dir-2640-a1|\ dlink,dir-2660-a1|\ + dlink,dir-853-a3|\ hiwifi,hc5962|\ jcg,q20|\ linksys,e5600|\ From 3ac13416ca67908a691d3ae3c9b08623a56e9c60 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Sun, 11 Jul 2021 15:19:47 +0200 Subject: [PATCH 12/18] ramips: fix Wifi MAC address setup for D-Link DIR-853 R1 Commands in 10_fix_wifi_mac were not properly concatenated, so this was also triggered for the second phy without giving a MAC address as argument. Signed-off-by: Adrian Schmutzler --- .../base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 4349a3592d..711af4e3af 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -16,10 +16,10 @@ case "$board" in > /sys${DEVPATH}/macaddress ;; dlink,dir-853-r1) - [ "$PHYNBR" = "0" ] && \ - base_mac=$(mtd_get_mac_binary factory 0x4) - base_mac=$(macaddr_add "$base_mac" -1) + if [ "$PHYNBR" = "0" ]; then + base_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" -1) macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress + fi ;; glinet,gl-mt1300) [ "$PHYNBR" = "1" ] && \ From 349e2b7e658290f967a4aab4fd9d754572f9b0b2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 11 Jul 2021 15:32:34 +0100 Subject: [PATCH 13/18] uboot-mediatek: several fixes for MT7622 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ! Behavior change ! Old behavior: If the Reset button is held down during power-on do factory reset and try booting recovery from TFTP forever. If valid recovery is received via TFTP, write it to flash and boot. New behavior: If the Reset button is held down during power-on do factory reset, then try TFTP *once*, then try booting on-flash recovery, then keep trying via TFTP forever until a valid image is received. Only if there is no bootable recovery stored on flash, store the downloaded recovery. Then boot it. * Set loadaddr to 0x48000000 in order to allow booting images larger than ~47MB (reported by Oskari Lemmelä). Setting loadaddr to 0x48000000 gives us 384MB on devices with 512MB RAM, which should be more than enough as a maximum size for uImage.FIT to be loaded. * Widely unify device-specific default environment in preparation to auto-generate it from parameters. * backport upstream commit fixing MBR/DOS partitioning Signed-off-by: Daniel Golle --- ...Fix-a-variable-typo-in-write_mbr_par.patch | 26 ++++ .../404-add-bananapi_bpi-r64_defconfigs.patch | 117 +++++++++--------- .../patches/410-add-linksys-e8450.patch | 51 ++++---- .../patches/412-add-ubnt-unifi-6-lr.patch | 23 ++-- 4 files changed, 123 insertions(+), 94 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/001-disk-part_dos.c-Fix-a-variable-typo-in-write_mbr_par.patch diff --git a/package/boot/uboot-mediatek/patches/001-disk-part_dos.c-Fix-a-variable-typo-in-write_mbr_par.patch b/package/boot/uboot-mediatek/patches/001-disk-part_dos.c-Fix-a-variable-typo-in-write_mbr_par.patch new file mode 100644 index 0000000000..8432053ea0 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/001-disk-part_dos.c-Fix-a-variable-typo-in-write_mbr_par.patch @@ -0,0 +1,26 @@ +From c7d1b1890880ee64786b92a1b95ba9ecb4694997 Mon Sep 17 00:00:00 2001 +From: Christian Melki +Date: Mon, 7 Jun 2021 11:21:15 +0200 +Subject: [PATCH] disk/part_dos.c: Fix a variable typo in + write_mbr_partitions() + +This function is passed *dev not *dev_desc, so pass the right name to +part_init(). + +Fixes: f14c5ee5ab8b ("disk: part_dos: update partition table entries after write") +Signed-off-by: Christian Melki +--- + disk/part_dos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/disk/part_dos.c ++++ b/disk/part_dos.c +@@ -424,7 +424,7 @@ int write_mbr_partitions(struct blk_desc + } + + /* Update the partition table entries*/ +- part_init(dev_desc); ++ part_init(dev); + + return 0; + } diff --git a/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch b/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch index 72913e4d2f..9e694c9c8b 100644 --- a/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch +++ b/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch @@ -161,10 +161,10 @@ +CONFIG_USB_STORAGE=y --- /dev/null +++ b/bananapi_bpi-r64-sdmmc_env -@@ -0,0 +1,81 @@ +@@ -0,0 +1,82 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 -+loadaddr=0x4007ff28 ++loadaddr=0x48000000 +bootargs=root=/dev/mmcblk1p65 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi +bootconf=config-mt7622-bananapi-bpi-r64-pcie1 @@ -172,9 +172,11 @@ +bootconf_sata=config-mt7622-bananapi-bpi-r64-sata +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb -+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb -+bootfile_emmcbl3=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-bl31-uboot.fip +bootfile_emmcbl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-preloader.bin ++bootfile_emmcbl3=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb ++bootled_pwr=bpi-r64:pio:green ++bootled_rec=bpi-r64:pio:blue +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 +bootmenu_default=0 +bootmenu_delay=0 @@ -184,34 +186,33 @@ +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return +bootmenu_2=Boot production system from SD card.=run boot_production ; run bootmenu_confirm_return +bootmenu_3=Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return -+bootmenu_4=Load production system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return -+bootmenu_5=Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return +bootmenu_6=Install bootloader, recovery and production to eMMC.=run emmc_init ; run bootmenu_confirm_return +bootmenu_7=Install bootloader, recovery and production to NAND.=run ubi_init ; run bootmenu_confirm_return +bootmenu_8=Reboot.=reset +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset -+boot_default=run bootcmd ; run boot_recovery ; run boot_tftp_forever -+boot_first=if button reset ; then run boot_tftp_forever ; fi ; bootmenu -+boot_production=led bpi-r64:pio:green on ; run sdmmc_read_production && bootm $loadaddr#$bootconf -+boot_recovery=led bpi-r64:pio:green off ; run sdmmc_read_recovery && bootm $loadaddr#$bootconf ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run sdmmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run sdmmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off +boot_sdmmc=run boot_production ; run boot_recovery -+boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done -+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && run sdmmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi -+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run sdmmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr -+boot_ubi=ubi part ubi && setenv bootargs && run boot_ubi_production ; run check_recovery -+boot_ubi_production=led bpi-r64:pio:green on ; run ubi_read_production && bootm $loadaddr -+boot_ubi_recovery=led bpi-r64:pio:green off ; run check_recovery -+check_recovery=run ubi_read_recovery ; if iminfo $loadaddr ; then bootm $loadaddr ; else ubi remove recovery ; fi ++boot_ubi=ubi part ubi && setenv bootargs && run boot_ubi_production ; run boot_ubi_recovery ++boot_ubi_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr ; led $bootled_pwr off ++boot_ubi_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off +check_ubi=ubi part ubi || run ubi_format +emmc_init=run emmc_init_bl && run emmc_init_openwrt ; env default bootcmd ; saveenv ; saveenv +emmc_init_bl=run sdmmc_read_emmc_bl2 && run emmc_write_bl2 && run sdmmc_read_emmc_hdr && run emmc_write_hdr && run sdmmc_read_emmc_fip && run emmc_write_fip -+emmc_init_openwrt=run sdmmc_read_recovery && run emmc_write_recovery ; run sdmmc_read_production && run emmc_write_production ++emmc_init_openwrt=run sdmmc_read_recovery && iminfo $loadaddr && run emmc_write_recovery ; run sdmmc_read_production && iminfo $loadaddr && run emmc_write_production +emmc_write_bl2=mmc dev 0 1 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $loadaddr 0x0 0x100 ; mmc partconf 0 1 1 0 +emmc_write_fip=mmc dev 0 0 && mmc erase 0x1000 0x1000 && mmc write $loadaddr 0x1000 0x1000 && mmc erase 0x2000 0x800 +emmc_write_hdr=mmc dev 0 0 && mmc erase 0x0 0x40 && mmc write $loadaddr 0x0 0x40 -+emmc_write_production=iminfo $loadaddr && mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol -+emmc_write_recovery=iminfo $loadaddr && mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol ++emmc_write_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol ++emmc_write_recovery=mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$part_size && mmc write $loadaddr 0x$part_addr 0x$image_size +mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200 +part_default=production @@ -224,8 +225,8 @@ +sdmmc_read_recovery=mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_read_vol +sdmmc_read_snand_bl2=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x2000 && mmc read $loadaddr $offset 0x400 +sdmmc_read_snand_fip=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x2400 && mmc read $loadaddr $offset 0x1000 -+sdmmc_write_production=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_write_vol -+sdmmc_write_recovery=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol ++sdmmc_write_production=mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_write_vol ++sdmmc_write_recovery=mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol +snand_write_fip=mtd erase fip && mtd write fip $loadaddr +snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr +ubi_create_env=ubi create ubootenv 0x100000 dynamic 0 ; ubi create ubootenv2 0x100000 dynamic 1 ; ubi create fit 0x100000 dynamic 2 ; ubi create recovery 0x100000 dynamic 3 @@ -240,7 +241,7 @@ +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv -+_firstboot=setenv _firstboot ; led bpi-r64:pio:blue on ; run _switch_to_menu ; run _init_env ; run boot_first ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first +_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null @@ -393,10 +394,10 @@ +CONFIG_USB_STORAGE=y --- /dev/null +++ b/bananapi_bpi-r64-emmc_env -@@ -0,0 +1,54 @@ +@@ -0,0 +1,56 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 -+loadaddr=0x4007ff28 ++loadaddr=0x48000000 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi +bootargs=root=/dev/mmcblk0p65 +bootconf=config-mt7622-bananapi-bpi-r64-pcie1 @@ -405,8 +406,10 @@ +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb +bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb -+bootfile_fip=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-bl31-uboot.fip +bootfile_bl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-preloader.bin ++bootfile_fip=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-bl31-uboot.fip ++bootled_pwr=bpi-r64:pio:green ++bootled_rec=bpi-r64:pio:blue +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 +bootmenu_default=0 +bootmenu_delay=0 @@ -416,25 +419,25 @@ +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return +bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return +bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return -+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return -+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return +bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run boot_tftp_write_fip ; run bootmenu_confirm_return +bootmenu_7=Load BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return +bootmenu_8=Reboot.=reset +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset -+boot_default=run bootcmd ; run boot_recovery ; run boot_tftp_forever -+boot_first=if button reset ; then run boot_tftp_forever ; fi ; bootmenu -+boot_production=led bpi-r64:pio:green on ; run emmc_read_production && bootm $loadaddr#$bootconf -+boot_recovery=led bpi-r64:pio:green off ; run emmc_read_recovery && bootm $loadaddr#$bootconf ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off +boot_emmc=run boot_production ; run boot_recovery -+boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done -+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi -+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr -+emmc_write_production=iminfo $fileaddr && mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol -+emmc_write_recovery=iminfo $fileaddr && mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol ++emmc_write_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol ++emmc_write_recovery=mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol +emmc_write_bl2=mmc dev 0 1 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $loadaddr 0x0 0x100 ; mmc partconf 0 1 1 0 +emmc_write_fip=mmc dev 0 0 && mmc erase 0x1000 0x1000 && mmc write $loadaddr 0x1000 0x1000 && mmc erase 0x2000 0x800 +emmc_read_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol @@ -445,7 +448,7 @@ +part_recovery=recovery +reset_factory=eraseenv && reset +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv -+_firstboot=setenv _firstboot ; led bpi-r64:pio:blue on ; run _switch_to_menu ; run _init_env ; run boot_first ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first +_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" --- /dev/null @@ -595,7 +598,7 @@ @@ -0,0 +1,57 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 -+loadaddr=0x4007ff28 ++loadaddr=0x48000000 +bootargs=root=/dev/ubiblock0_2p1 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi +bootconf=config-mt7622-bananapi-bpi-r64-pcie1 @@ -603,9 +606,11 @@ +bootconf_sata=config-mt7622-bananapi-bpi-r64-sata +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb -+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb +bootfile_fip=openwrt-mediatek-mt7622-bananapi_bpi-r64-snand-bl31-uboot.fip +bootfile_bl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-snand-preloader.bin ++bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb ++bootled_pwr=bpi-r64:pio:green ++bootled_rec=bpi-r64:pio:blue +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 +bootmenu_default=0 +bootmenu_delay=0 @@ -615,38 +620,36 @@ +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return +bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return +bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return -+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return -+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return +bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return +bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return +bootmenu_8=Reboot.=reset +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset -+boot_default=run bootcmd ; run boot_recovery ; run boot_tftp_forever -+boot_first=if button reset ; then run boot_tftp_forever ; fi ; bootmenu -+boot_production=led bpi-r64:pio:green on ; run ubi_read_production && bootm $loadaddr#$bootconf -+boot_recovery=led bpi-r64:pio:green off ; run check_recovery ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf -+boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done -+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi -+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && ubi part ubi && run ubi_write_production ubi_prepare_rootfs ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run boot_write_bl2 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip +boot_ubi=ubi part ubi && run boot_production ; run boot_recovery ++boot_write_bl2=mtd erase bl2 && mtd write spi-nand0 $loadaddr 0x0 0x20000 && mtd write spi-nand0 $loadaddr 0x20000 0x20000 && mtd write spi-nand0 $loadaddr 0x40000 0x20000 && mtd write spi-nand0 $loadaddr 0x60000 0x20000 +boot_write_fip=mtd erase fip && mtd write fip $loadaddr -+boot_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr -+check_recovery=run ubi_read_recovery ; if iminfo $loadaddr ; then bootm $loadaddr#$bootconf; else ubi remove recovery ; fi +check_ubi=ubi part ubi || run ubi_format -+part_default=production -+part_recovery=recovery +reset_factory=ubi part ubi ; ubi write 0x0 ubootenv 0x0 ; ubi write 0x0 ubootenv2 0x0 ; ubi remove rootfs_data +ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize -+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ; fi ++ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ; fi +_create_env=ubi create ubootenv 0x100000 dynamic 0 ; ubi create ubootenv2 0x100000 dynamic 1 ; ubi create fit 0x100000 dynamic 2 ; ubi create recovery 0x100000 dynamic 3 +_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; saveenv || run ubi_format ; saveenv || run ubi_format -+_firstboot=setenv _firstboot ; led bpi-r64:pio:blue on ; run _switch_to_menu ; run check_ubi ; run _init_env ; run boot_first -+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run check_ubi ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch index f09a7db137..5b52206e1c 100644 --- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch +++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/configs/mt7622_linksys_e8450_defconfig -@@ -0,0 +1,134 @@ +@@ -0,0 +1,135 @@ +CONFIG_ARM=y +CONFIG_POSITION_INDEPENDENT=y +CONFIG_ARCH_MEDIATEK=y @@ -16,6 +16,7 @@ +CONFIG_DEBUG_UART_CLOCK=25000000 +CONFIG_DEFAULT_DEVICE_TREE="mt7622-linksys-e8450-ubi" +CONFIG_DEBUG_UART=y ++CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:512k(bl2),1280k(fip),1024k(factory),256k(reserved),-(ubi)" +CONFIG_SMBIOS_PRODUCT_NAME="" +CONFIG_AUTOBOOT_KEYED=y +CONFIG_BOOTDELAY=30 @@ -346,17 +347,19 @@ --- /dev/null +++ b/linksys_e8450_env @@ -0,0 +1,57 @@ -+mtdparts=spi-nand0:512k(bl2),1280k(fip),1024k(factory),256k(reserved),-(ubi) +ethaddr_factory=mtd read spi-nand0 0x40080000 0x220000 0x20000 && env readmem -b ethaddr 0x4009fff4 0x6 ; setenv ethaddr_factory +ipaddr=192.168.1.1 +serverip=192.168.1.254 -+loadaddr=0x4007ff28 ++loadaddr=0x48000000 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery.itb +bootfile_bl2=openwrt-mediatek-mt7622-linksys_e8450-ubi-preloader.bin +bootfile_fip=openwrt-mediatek-mt7622-linksys_e8450-ubi-bl31-uboot.fip +bootfile_upg=openwrt-mediatek-mt7622-linksys_e8450-ubi-squashfs-sysupgrade.itb ++bootled_pwr=power:blue ++bootled_rec=inet:orange on +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 +bootmenu_default=0 +bootmenu_delay=0 @@ -366,40 +369,38 @@ +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return +bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return +bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return -+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return -+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return +bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to flash.=run boot_tftp_write_fip ; run bootmenu_confirm_return -+bootmenu_7=Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_preloader ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return +bootmenu_8=Reboot.=reset +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset -+boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu -+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; run boot_tftp_forever -+boot_production=led power:blue on ; run ubi_read_production && bootm $loadaddr -+boot_production_or_recovery=run boot_production ; run boot_recovery -+boot_recovery=led power:blue off ; led power:orange on ; run check_recovery ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off ++boot_serial_write_bl2=loadx $loadaddr 115200 && run boot_write_bl2 +boot_serial_write_fip=loadx $loadaddr 115200 && run boot_write_fip -+boot_serial_write_preloader=loadx $loadaddr 115200 && run boot_write_preloader -+boot_tftp_forever=led inet:blue on ; while true ; do run boot_tftp_recovery ; led inet:blue off ; led inet:orange on ; sleep 1 ; done -+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && ubi part ubi && run ubi_write_production ubi_prepare_rootfs ; if env exists noboot ; then else bootm $loadaddr ; fi -+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi -+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && ubi part ubi && run ubi_write_production ubi_prepare_rootfs ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run boot_write_bl2 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip -+boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader -+boot_ubi=ubi part ubi && run boot_production_or_recovery -+boot_write_fip=mtd erase spi-nand0 0x80000 0x140000 && mtd write spi-nand0 $loadaddr 0x80000 0x140000 -+boot_write_preloader=mtd erase spi-nand0 0x0 0x80000 && mtd write spi-nand0 $loadaddr 0x0 0x20000 && mtd write spi-nand0 $loadaddr 0x20000 0x20000 && mtd write spi-nand0 $loadaddr 0x40000 0x20000 && mtd write spi-nand0 $loadaddr 0x60000 0x20000 -+check_recovery=run ubi_read_recovery ; if iminfo $loadaddr ; then bootm $loadaddr ; else ubi remove recovery ; fi ++boot_ubi=ubi part ubi && run boot_production ; run boot_recovery ++boot_write_bl2=mtd erase bl2 && mtd write spi-nand0 $loadaddr 0x0 0x20000 && mtd write spi-nand0 $loadaddr 0x20000 0x20000 && mtd write spi-nand0 $loadaddr 0x40000 0x20000 && mtd write spi-nand0 $loadaddr 0x60000 0x20000 ++boot_write_fip=mtd erase fip && mtd write fip $loadaddr +check_ubi=ubi part ubi || run ubi_format +reset_factory=ubi part ubi ; ubi write 0x0 ubootenv 0x0 ; ubi write 0x0 ubootenv2 0x0 ; ubi remove rootfs_data -+ubi_format=ubi detach ; mtd erase spi-nand0 0x300000 0x7D00000 && ubi part ubi ; reset ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize -+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ; fi ++ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ; fi +_create_env=ubi create ubootenv 0x100000 dynamic ; ubi create ubootenv2 0x100000 dynamic +_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; saveenv || run ubi_format ; saveenv || run ubi_format -+_firstboot=setenv _firstboot ; led power:orange on ; run _switch_to_menu ; run ethaddr_factory ; run check_ubi ; run _init_env ; run boot_first ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; run check_ubi ; run _init_env ; run boot_first +_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch index d9b8a01f73..bac4a86d05 100644 --- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch +++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/configs/mt7622_ubnt_unifi-6-lr_defconfig -@@ -0,0 +1,139 @@ +@@ -0,0 +1,140 @@ +CONFIG_ARM=y +CONFIG_POSITION_INDEPENDENT=y +CONFIG_ARCH_MEDIATEK=y @@ -8,6 +8,7 @@ +CONFIG_SYS_TEXT_BASE=0x41e00000 +CONFIG_SYS_MALLOC_F_LEN=0x4000 +CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)" +CONFIG_ENV_IS_IN_MTD=y +CONFIG_ENV_MTD_NAME="nor0" +CONFIG_ENV_SIZE_REDUND=0x4000 @@ -357,12 +358,11 @@ mt8512-bm1-emmc.dtb \ --- /dev/null +++ b/ubnt_unifi-6-lr_env -@@ -0,0 +1,52 @@ -+mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware) +@@ -0,0 +1,50 @@ +ethaddr_factory=mtd read nor0 $loadaddr 0x110000 0x10000 && env readmem -b ethaddr $loadaddr 0x6 ; setenv ethaddr_factory +ipaddr=192.168.1.1 +serverip=192.168.1.254 -+loadaddr=0x40080000 ++loadaddr=0x48000000 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi +bootdelay=0 +bootfile=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-ubootmod-initramfs-recovery.itb @@ -378,26 +378,25 @@ +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return +bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return +bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return -+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return -+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return +bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to flash.=run boot_tftp_write_fip ; run bootmenu_confirm_return +bootmenu_7=Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_preloader ; run bootmenu_confirm_return +bootmenu_8=Reboot.=reset +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset -+boot_first=if button reset ; then run boot_tftp_forever ; fi ; bootmenu -+boot_default=run bootcmd ; run boot_recovery ; run boot_tftp_forever ++boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever +boot_production=run nor_read_production && bootm $loadaddr -+boot_production_or_recovery=run boot_production ; run boot_recovery +boot_recovery=run nor_read_recovery ; bootm $loadaddr +boot_serial_write_fip=loadx $loadaddr 115200 && run boot_write_fip +boot_serial_write_preloader=loadx $loadaddr 115200 && run boot_write_preloader +boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done -+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi -+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && run nor_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip +boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader -+boot_nor=run boot_production_or_recovery ++boot_nor=run boot_production ; run boot_recovery +boot_write_fip=mtd erase nor0 0x20000 0x80000 && mtd write nor0 $loadaddr 0x20000 0x80000 +boot_write_preloader=mtd erase nor0 0x0 0x20000 && mtd write nor0 $loadaddr 0x0 0x20000 +reset_factory=mtd erase nor0 0xc0000 0x10000 && reset From 9aa0561534e8ea210d5a57c40ae0fcad5cada212 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 6 Jul 2021 14:11:33 +0200 Subject: [PATCH 14/18] hostapd: make it possible to update station airtime weights via ubus This allows dynamic tuning based on other runtime information Signed-off-by: Felix Fietkau --- .../hostapd/patches/600-ubus_support.patch | 41 +++++++++++++ .../services/hostapd/src/src/ap/ubus.c | 58 +++++++++++++++++++ 2 files changed, 99 insertions(+) diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch index 71537c9ec6..005ed54e0c 100644 --- a/package/network/services/hostapd/patches/600-ubus_support.patch +++ b/package/network/services/hostapd/patches/600-ubus_support.patch @@ -473,3 +473,44 @@ /* Proceed only if DFS is not offloaded to the driver */ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) return 0; +--- a/src/ap/airtime_policy.c ++++ b/src/ap/airtime_policy.c +@@ -112,8 +112,14 @@ static void set_sta_weights(struct hosta + { + struct sta_info *sta; + +- for (sta = hapd->sta_list; sta; sta = sta->next) +- sta_set_airtime_weight(hapd, sta, weight); ++ for (sta = hapd->sta_list; sta; sta = sta->next) { ++ unsigned int sta_weight = weight; ++ ++ if (sta->dyn_airtime_weight) ++ sta_weight = (weight * sta->dyn_airtime_weight) / 256; ++ ++ sta_set_airtime_weight(hapd, sta, sta_weight); ++ } + } + + +@@ -244,7 +250,10 @@ int airtime_policy_new_sta(struct hostap + unsigned int weight; + + if (hapd->iconf->airtime_mode == AIRTIME_MODE_STATIC) { +- weight = get_weight_for_sta(hapd, sta->addr); ++ if (sta->dyn_airtime_weight) ++ weight = sta->dyn_airtime_weight; ++ else ++ weight = get_weight_for_sta(hapd, sta->addr); + if (weight) + return sta_set_airtime_weight(hapd, sta, weight); + } +--- a/src/ap/sta_info.h ++++ b/src/ap/sta_info.h +@@ -324,6 +324,7 @@ struct sta_info { + #endif /* CONFIG_TESTING_OPTIONS */ + #ifdef CONFIG_AIRTIME_POLICY + unsigned int airtime_weight; ++ unsigned int dyn_airtime_weight; + struct os_reltime backlogged_until; + #endif /* CONFIG_AIRTIME_POLICY */ + diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 6201dfd524..85fd6f1cc7 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -21,6 +21,7 @@ #include "rrm.h" #include "wnm_ap.h" #include "taxonomy.h" +#include "airtime_policy.h" static struct ubus_context *ctx; static struct blob_buf b; @@ -1326,11 +1327,68 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj, } #endif +#ifdef CONFIG_AIRTIME_POLICY +enum { + UPDATE_AIRTIME_STA, + UPDATE_AIRTIME_WEIGHT, + __UPDATE_AIRTIME_MAX, +}; + + +static const struct blobmsg_policy airtime_policy[__UPDATE_AIRTIME_MAX] = { + [UPDATE_AIRTIME_STA] = { "sta", BLOBMSG_TYPE_STRING }, + [UPDATE_AIRTIME_WEIGHT] = { "weight", BLOBMSG_TYPE_INT32 }, +}; + +static int +hostapd_bss_update_airtime(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *ureq, const char *method, + struct blob_attr *msg) +{ + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); + struct blob_attr *tb[__UPDATE_AIRTIME_MAX]; + struct sta_info *sta = NULL; + u8 addr[ETH_ALEN]; + int weight; + + blobmsg_parse(airtime_policy, __UPDATE_AIRTIME_MAX, tb, blob_data(msg), blob_len(msg)); + + if (!tb[UPDATE_AIRTIME_WEIGHT]) + return UBUS_STATUS_INVALID_ARGUMENT; + + weight = blobmsg_get_u32(tb[UPDATE_AIRTIME_WEIGHT]); + + if (!tb[UPDATE_AIRTIME_STA]) { + if (!weight) + return UBUS_STATUS_INVALID_ARGUMENT; + + hapd->conf->airtime_weight = weight; + return 0; + } + + if (hwaddr_aton(blobmsg_data(tb[UPDATE_AIRTIME_STA]), addr)) + return UBUS_STATUS_INVALID_ARGUMENT; + + sta = ap_get_sta(hapd, addr); + if (!sta) + return UBUS_STATUS_NOT_FOUND; + + sta->dyn_airtime_weight = weight; + airtime_policy_new_sta(hapd, sta); + + return 0; +} +#endif + + static const struct ubus_method bss_methods[] = { UBUS_METHOD_NOARG("reload", hostapd_bss_reload), UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients), UBUS_METHOD_NOARG("get_status", hostapd_bss_get_status), UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy), +#ifdef CONFIG_AIRTIME_POLICY + UBUS_METHOD("update_airtime", hostapd_bss_update_airtime, airtime_policy), +#endif UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans), #ifdef CONFIG_WPS UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start), From 1ec4af41511f6d95ff7a370898a0be3ee43c0f00 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 7 Jul 2021 17:37:08 +0200 Subject: [PATCH 15/18] hostapd: add support for enabling HE on channel switch Signed-off-by: Felix Fietkau --- package/network/services/hostapd/src/src/ap/ubus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 85fd6f1cc7..49901fc4c3 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -742,6 +742,7 @@ enum { CSA_SEC_CHANNEL_OFFSET, CSA_HT, CSA_VHT, + CSA_HE, CSA_BLOCK_TX, __CSA_MAX }; @@ -755,6 +756,7 @@ static const struct blobmsg_policy csa_policy[__CSA_MAX] = { [CSA_SEC_CHANNEL_OFFSET] = { "sec_channel_offset", BLOBMSG_TYPE_INT32 }, [CSA_HT] = { "ht", BLOBMSG_TYPE_BOOL }, [CSA_VHT] = { "vht", BLOBMSG_TYPE_BOOL }, + [CSA_HE] = { "he", BLOBMSG_TYPE_BOOL }, [CSA_BLOCK_TX] = { "block_tx", BLOBMSG_TYPE_BOOL }, }; @@ -791,6 +793,7 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, SET_CSA_SETTING(CSA_SEC_CHANNEL_OFFSET, freq_params.sec_channel_offset, u32); SET_CSA_SETTING(CSA_HT, freq_params.ht_enabled, bool); SET_CSA_SETTING(CSA_VHT, freq_params.vht_enabled, bool); + SET_CSA_SETTING(CSA_HE, freq_params.he_enabled, bool); SET_CSA_SETTING(CSA_BLOCK_TX, block_tx, bool); for (i = 0; i < hapd->iface->num_bss; i++) { From da2c244e8c9f30e4fc5bf77f0800d685e35d1888 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 7 Jul 2021 17:40:41 +0200 Subject: [PATCH 16/18] hostapd: initialize ht/vht/he mode on channel switch by default Use the current mode, but allow overwriting via ubus command parameters Signed-off-by: Felix Fietkau --- .../services/hostapd/src/src/ap/ubus.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 49901fc4c3..9918f17d67 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -768,7 +768,15 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, { struct blob_attr *tb[__CSA_MAX]; struct hostapd_data *hapd = get_hapd_from_object(obj); - struct csa_settings css; + struct hostapd_config *iconf = hapd->iface->conf; + struct csa_settings css = { + .freq_params = { + .ht_enabled = iconf->ieee80211n, + .vht_enabled = iconf->ieee80211ac, + .he_enabled = iconf->ieee80211ax, + .sec_channel_offset = iconf->secondary_channel, + } + }; int ret = UBUS_STATUS_OK; int i; @@ -777,7 +785,21 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj, if (!tb[CSA_FREQ]) return UBUS_STATUS_INVALID_ARGUMENT; - memset(&css, 0, sizeof(css)); + switch (iconf->vht_oper_chwidth) { + case CHANWIDTH_USE_HT: + if (iconf->secondary_channel) + css.freq_params.bandwidth = 40; + else + css.freq_params.bandwidth = 20; + break; + case CHANWIDTH_160MHZ: + css.freq_params.bandwidth = 160; + break; + default: + css.freq_params.bandwidth = 80; + break; + } + css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]); #define SET_CSA_SETTING(name, field, type) \ From 8f7e6db23045b9b4831d10c5bdf29d514a3753c9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 12 Jul 2021 13:31:04 +0200 Subject: [PATCH 17/18] hostapd: fix uninitialized stack variable on CSA Signed-off-by: Felix Fietkau --- ...use-of-uninitialized-stack-variables.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch diff --git a/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch new file mode 100644 index 0000000000..c7da33f029 --- /dev/null +++ b/package/network/services/hostapd/patches/022-hostapd-fix-use-of-uninitialized-stack-variables.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Thu, 8 Jul 2021 16:33:03 +0200 +Subject: [PATCH] hostapd: fix use of uninitialized stack variables + +When a CSA is performed on an 80 MHz channel, hostapd_change_config_freq +unconditionally calls hostapd_set_oper_centr_freq_seg0/1_idx with seg0/1 +filled by ieee80211_freq_to_chan. +However, if ieee80211_freq_to_chan fails (because the freq is 0 or invalid), +seg0/1 remains uninitialized and filled with stack garbage, causing errors +such as "hostapd: 80 MHz: center segment 1 configured" + +Signed-off-by: Felix Fietkau +--- + +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -3431,7 +3431,7 @@ static int hostapd_change_config_freq(st + struct hostapd_freq_params *old_params) + { + int channel; +- u8 seg0, seg1; ++ u8 seg0 = 0, seg1 = 0; + struct hostapd_hw_modes *mode; + + if (!params->channel) { From 1236cbe30cec8e3e8246237005140596f8611ce9 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 13 Jul 2021 07:57:26 +0200 Subject: [PATCH 18/18] netifd: update to the latest version f12b073c0cc3 wireless: add some comments to functions b0d090688302 bridge: fix setting pvid for updated vlans ff3764ce28e0 device: move hotplug handling logic from system-linux.c to device.c 16bff892f415 ubus: add a dummy mode ubus call to simulate hotplug events 7f30b02013f2 examples: make dummy wireless vif names shorter 013a1171e9b0 device: do not treat devices with non-digit characters after . as vlan devices f037b082923a wireless: handle WDS per-sta devices db0fa24e1c17 bridge: fix enabling hotplug-added VLANs on the bridge port 4e92ea74273f bridge: bring up pre-existing vlans on hotplug as well 1f283c654aeb bridge: fix hotplug vlan overwrite on big-endian systems Signed-off-by: Felix Fietkau --- package/network/config/netifd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index fb0e470995..ebc601fa4a 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2021-06-04 -PKG_SOURCE_VERSION:=50381d0a2998f6c0fc4823f0c2aa4206063d549e -PKG_MIRROR_HASH:=2718df3d3538c93ac77accf55716fb341741df3d231aac59e04dd1f80f558889 +PKG_SOURCE_DATE:=2021-07-13 +PKG_SOURCE_VERSION:=1f283c654aeb1f8983e0a81b7a81cc4784fffe3f +PKG_MIRROR_HASH:=a65bb00f376eec5006c6efa1bc3298687054c3936de9c61997496969c93f9ccc PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0