From 3f814ecd2408da6ac96f741d3d6331ce93b79734 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 23 Sep 2022 12:04:12 +0200 Subject: [PATCH 01/32] mac80211: mark lib80211 as hidden Prevents build errors by ensuring that it is only selected when a wext based driver that needs it is also selected Signed-off-by: Felix Fietkau --- package/kernel/mac80211/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index e8a7690bb3..44428ca89f 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -226,6 +226,7 @@ define KernelPackage/lib80211 $(call KernelPackage/mac80211/Default) TITLE:=802.11 Networking stack DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash +kmod-crypto-ccm + HIDDEN:=1 FILES:= \ $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \ $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \ From a6fd151308b1ad1878ba367549a9e9ef5c717653 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 23 Sep 2022 18:11:04 +0200 Subject: [PATCH 02/32] mac80211: remove broken CFG80211_WEXT select from the r8723bs driver Fixes a build error Signed-off-by: Felix Fietkau --- .../patches/build/070-remove-broken-wext-select.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch diff --git a/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch b/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch new file mode 100644 index 0000000000..77b6e1de1c --- /dev/null +++ b/package/kernel/mac80211/patches/build/070-remove-broken-wext-select.patch @@ -0,0 +1,10 @@ +--- a/drivers/staging/rtl8723bs/Kconfig ++++ b/drivers/staging/rtl8723bs/Kconfig +@@ -5,7 +5,6 @@ config RTL8723BS + depends on m + depends on WLAN && MMC && CFG80211 + depends on m +- select CFG80211_WEXT + select BPAUTO_CRYPTO_LIB_ARC4 + help + This option enables support for RTL8723BS SDIO drivers, such as From a24e07700d0f884ff82e565110adef4ad2155db4 Mon Sep 17 00:00:00 2001 From: Will Moss Date: Wed, 3 Aug 2022 13:56:28 +0000 Subject: [PATCH 03/32] kernel: fix mac-address-increment on driver probe defer Fixes situations where MAC address gets incremented multiple times if device initialization fails at first and then is deferred. Fixes: d284e6ef0f06 ("treewide: convert mtd-mac-address-increment* to generic implementation") Signed-off-by: Will Moss --- ...t-do-mac-address-increment-only-once.patch | 31 +++++++++++++++++++ ...t-do-mac-address-increment-only-once.patch | 31 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 target/linux/generic/pending-5.10/684-of_net-do-mac-address-increment-only-once.patch create mode 100644 target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch diff --git a/target/linux/generic/pending-5.10/684-of_net-do-mac-address-increment-only-once.patch b/target/linux/generic/pending-5.10/684-of_net-do-mac-address-increment-only-once.patch new file mode 100644 index 0000000000..b1c5d9112a --- /dev/null +++ b/target/linux/generic/pending-5.10/684-of_net-do-mac-address-increment-only-once.patch @@ -0,0 +1,31 @@ +From dd07dd394d8bfdb5d527fab18ca54f20815ec4e4 Mon Sep 17 00:00:00 2001 +From: Will Moss +Date: Wed, 3 Aug 2022 13:48:55 +0000 +Subject: [PATCH] of_net: do mac-address-increment only once + +Remove mac-address-increment and mac-address-increment-byte +DT property after incrementing process to make sure MAC address +would not get incremented more if this function is stared again. +It could happen if device initialization is deferred after +unsuccessful attempt. + +Signed-off-by: Will Moss +--- + drivers/of/of_net.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/of/of_net.c ++++ b/drivers/of/of_net.c +@@ -190,6 +190,12 @@ found: + addr[3] = (mac_val >> 16) & 0xff; + addr[4] = (mac_val >> 8) & 0xff; + addr[5] = (mac_val >> 0) & 0xff; ++ ++ /* Remove mac-address-increment and mac-address-increment-byte ++ * DT property to make sure MAC address would not get incremented ++ * more if this function is stared again. */ ++ of_remove_property(np, of_find_property(np, "mac-address-increment", NULL)); ++ of_remove_property(np, of_find_property(np, "mac-address-increment-byte", NULL)); + } + + of_add_mac_address(np, addr); diff --git a/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch b/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch new file mode 100644 index 0000000000..44d88e31a2 --- /dev/null +++ b/target/linux/generic/pending-5.15/684-of_net-do-mac-address-increment-only-once.patch @@ -0,0 +1,31 @@ +From dd07dd394d8bfdb5d527fab18ca54f20815ec4e4 Mon Sep 17 00:00:00 2001 +From: Will Moss +Date: Wed, 3 Aug 2022 13:48:55 +0000 +Subject: [PATCH] of_net: do mac-address-increment only once + +Remove mac-address-increment and mac-address-increment-byte +DT property after incrementing process to make sure MAC address +would not get incremented more if this function is stared again. +It could happen if device initialization is deferred after +unsuccessful attempt. + +Signed-off-by: Will Moss +--- + drivers/of/of_net.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/net/core/of_net.c ++++ b/net/core/of_net.c +@@ -194,6 +194,12 @@ found: + addr[3] = (mac_val >> 16) & 0xff; + addr[4] = (mac_val >> 8) & 0xff; + addr[5] = (mac_val >> 0) & 0xff; ++ ++ /* Remove mac-address-increment and mac-address-increment-byte ++ * DT property to make sure MAC address would not get incremented ++ * more if this function is stared again. */ ++ of_remove_property(np, of_find_property(np, "mac-address-increment", NULL)); ++ of_remove_property(np, of_find_property(np, "mac-address-increment-byte", NULL)); + } + + of_add_mac_address(np, addr); From 579703f38c14b9441e2a28529c9883b311410f3e Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Fri, 16 Sep 2022 12:03:19 +0200 Subject: [PATCH 04/32] ath79: switch to 5.15 as default kernel The 5.15 kernel has new interesting features like MGLRU. Most of the targets already have added support for testing kernel 5.15 since April 2022. Set 5.15 as default for all subtargets. Testing support was added here: - ae6bfb7d67c1 ("ath79: tiny: add 5.15 support for tiny subtarget") - 9a0155bc4fa3 ("ath79: add 5.15 support for generic subtarget") - 5af9aafabbc0 ("ath79: mikrotik: add 5.15 support for mikrotik subtarget") - f3fa68e5153b ("ath79: nand: add 5.15 support for nand subtarget") Tested on: - Nanostation M5 XM (tiny) - TP-Link EAP-225 Outdoor (generic) - TP-Link CPE210 (generic) Signed-off-by: Nick Hainke --- target/linux/ath79/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index 20dae789af..d6ba3b0ead 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -8,8 +8,7 @@ SUBTARGETS:=generic mikrotik nand tiny FEATURES:=ramdisk squashfs usbgadget -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk From f08f7e88c99e8f17781945ddfbb0859f64c3a414 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 24 Sep 2022 13:33:37 +0200 Subject: [PATCH 05/32] kernel: Move some IOMMU options to generic This adds some missing IOMMU related options for x86/64 and moves some of them to generic for all targets. On x86 IOMMU_DEFAULT_DMA_LAZY is used by default, on all other platforms IOMMU_DEFAULT_DMA_STRICT is the default. we just follow the default kernel configuration here. Fixes: 8fea4a102ccd ("x86/64: enable IOMMU support") Signed-off-by: Hauke Mehrtens --- target/linux/generic/config-5.10 | 3 +++ target/linux/generic/config-5.15 | 6 ++++++ target/linux/layerscape/armv8_64b/config-5.10 | 1 - target/linux/mediatek/mt7623/config-5.15 | 2 -- target/linux/qoriq/config-5.10 | 1 - target/linux/qoriq/config-5.15 | 2 -- target/linux/rockchip/armv8/config-5.10 | 1 - target/linux/rockchip/armv8/config-5.15 | 2 -- target/linux/tegra/config-5.10 | 1 - target/linux/tegra/config-5.15 | 2 -- target/linux/x86/64/config-5.10 | 2 -- target/linux/x86/64/config-5.15 | 3 +-- 12 files changed, 10 insertions(+), 16 deletions(-) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 07edd53ff9..498cdff581 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -2651,6 +2651,7 @@ CONFIG_INPUT_MISC=y # CONFIG_INTEL_HID_EVENT is not set # CONFIG_INTEL_IDLE is not set # CONFIG_INTEL_IDMA64 is not set +# CONFIG_INTEL_IDXD is not set # CONFIG_INTEL_INT0002_VGPIO is not set # CONFIG_INTEL_IOATDMA is not set # CONFIG_INTEL_ISH_HID is not set @@ -2678,6 +2679,7 @@ CONFIG_INPUT_MISC=y # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_IIO is not set # CONFIG_INV_MPU6050_SPI is not set +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set # CONFIG_IOMMU_SUPPORT is not set # CONFIG_IONIC is not set # CONFIG_IOSCHED_BFQ is not set @@ -7009,6 +7011,7 @@ CONFIG_VHOST_MENU=y # CONFIG_VIRTIO_CONSOLE is not set # CONFIG_VIRTIO_FS is not set # CONFIG_VIRTIO_INPUT is not set +# CONFIG_VIRTIO_IOMMU is not set CONFIG_VIRTIO_MENU=y # CONFIG_VIRTIO_MMIO is not set # CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 1375ae6257..2da2d2393c 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -2745,6 +2745,8 @@ CONFIG_INPUT_MISC=y # CONFIG_INTEL_HID_EVENT is not set # CONFIG_INTEL_IDLE is not set # CONFIG_INTEL_IDMA64 is not set +# CONFIG_INTEL_IDXD is not set +# CONFIG_INTEL_IDXD_COMPAT is not set # CONFIG_INTEL_INT0002_VGPIO is not set # CONFIG_INTEL_IOATDMA is not set # CONFIG_INTEL_ISH_HID is not set @@ -2772,6 +2774,9 @@ CONFIG_INPUT_MISC=y # CONFIG_INV_MPU6050_I2C is not set # CONFIG_INV_MPU6050_IIO is not set # CONFIG_INV_MPU6050_SPI is not set +# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set +# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set # CONFIG_IOMMU_SUPPORT is not set # CONFIG_IONIC is not set # CONFIG_IOSCHED_BFQ is not set @@ -7341,6 +7346,7 @@ CONFIG_VHOST_MENU=y # CONFIG_VIRTIO_CONSOLE is not set # CONFIG_VIRTIO_FS is not set # CONFIG_VIRTIO_INPUT is not set +# CONFIG_VIRTIO_IOMMU is not set CONFIG_VIRTIO_MENU=y # CONFIG_VIRTIO_MMIO is not set # CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set diff --git a/target/linux/layerscape/armv8_64b/config-5.10 b/target/linux/layerscape/armv8_64b/config-5.10 index 6fc49fa79e..c480b71006 100644 --- a/target/linux/layerscape/armv8_64b/config-5.10 +++ b/target/linux/layerscape/armv8_64b/config-5.10 @@ -798,7 +798,6 @@ CONFIG_VIRTIO=y CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_BLK=y CONFIG_VIRTIO_CONSOLE=y -# CONFIG_VIRTIO_IOMMU is not set CONFIG_VIRTIO_MMIO=y CONFIG_VIRTIO_NET=y CONFIG_VIRTIO_PCI=y diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index aa4c4cbad1..5b0e11c676 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -275,9 +275,7 @@ CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set CONFIG_IOMMU_DEFAULT_DMA_STRICT=y -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_IO_PGTABLE=y CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y # CONFIG_IOMMU_IO_PGTABLE_ARMV7S_SELFTEST is not set diff --git a/target/linux/qoriq/config-5.10 b/target/linux/qoriq/config-5.10 index 2d49eeb9a1..5bf31de3ea 100644 --- a/target/linux/qoriq/config-5.10 +++ b/target/linux/qoriq/config-5.10 @@ -177,7 +177,6 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_HELPER=y CONFIG_IOMMU_SUPPORT=y CONFIG_IRQCHIP=y diff --git a/target/linux/qoriq/config-5.15 b/target/linux/qoriq/config-5.15 index e607501dbc..ef6442a1b1 100644 --- a/target/linux/qoriq/config-5.15 +++ b/target/linux/qoriq/config-5.15 @@ -183,9 +183,7 @@ CONFIG_INITRAMFS_SOURCE="" CONFIG_INPUT=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set CONFIG_IOMMU_DEFAULT_DMA_STRICT=y -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_HELPER=y CONFIG_IOMMU_SUPPORT=y CONFIG_IRQCHIP=y diff --git a/target/linux/rockchip/armv8/config-5.10 b/target/linux/rockchip/armv8/config-5.10 index 79dedb2041..75a61b8b16 100644 --- a/target/linux/rockchip/armv8/config-5.10 +++ b/target/linux/rockchip/armv8/config-5.10 @@ -284,7 +284,6 @@ CONFIG_INPUT_MATRIXKMAP=y # CONFIG_INPUT_RK805_PWRKEY is not set CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_DMA=y CONFIG_IOMMU_IOVA=y CONFIG_IOMMU_IO_PGTABLE=y diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index fa005294bc..95ee62b5e9 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -278,8 +278,6 @@ CONFIG_INPUT_LEDS=y CONFIG_INPUT_MATRIXKMAP=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set -# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y CONFIG_IOMMU_DMA=y CONFIG_IOMMU_IOVA=y diff --git a/target/linux/tegra/config-5.10 b/target/linux/tegra/config-5.10 index 8d808595d9..9c80b5595b 100644 --- a/target/linux/tegra/config-5.10 +++ b/target/linux/tegra/config-5.10 @@ -242,7 +242,6 @@ CONFIG_INPUT=y CONFIG_INPUT_KEYBOARD=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_IOVA=y # CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set # CONFIG_IOMMU_IO_PGTABLE_LPAE is not set diff --git a/target/linux/tegra/config-5.15 b/target/linux/tegra/config-5.15 index 794fa8b714..257ffda252 100644 --- a/target/linux/tegra/config-5.15 +++ b/target/linux/tegra/config-5.15 @@ -248,9 +248,7 @@ CONFIG_INPUT_KEYBOARD=y CONFIG_INTERCONNECT=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set CONFIG_IOMMU_DEFAULT_DMA_STRICT=y -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_IOVA=y # CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set # CONFIG_IOMMU_IO_PGTABLE_LPAE is not set diff --git a/target/linux/x86/64/config-5.10 b/target/linux/x86/64/config-5.10 index f91b3fe76f..3f84b00c0f 100644 --- a/target/linux/x86/64/config-5.10 +++ b/target/linux/x86/64/config-5.10 @@ -242,7 +242,6 @@ CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y CONFIG_INTEL_GTT=y CONFIG_INTEL_IDLE=y -# CONFIG_INTEL_IDXD is not set CONFIG_INTEL_IOMMU=y # CONFIG_INTEL_IOMMU_DEFAULT_ON is not set CONFIG_INTEL_IOMMU_FLOPPY_WA=y @@ -264,7 +263,6 @@ CONFIG_IOASID=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUG is not set # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set CONFIG_IOMMU_DMA=y CONFIG_IOMMU_HELPER=y CONFIG_IOMMU_IOVA=y diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index 7068b3b66c..040dceb961 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -257,7 +257,6 @@ CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y CONFIG_INTEL_GTT=y CONFIG_INTEL_IDLE=y -# CONFIG_INTEL_IDXD_COMPAT is not set CONFIG_INTEL_IOMMU=y # CONFIG_INTEL_IOMMU_DEFAULT_ON is not set CONFIG_INTEL_IOMMU_FLOPPY_WA=y @@ -280,7 +279,7 @@ CONFIG_IOASID=y CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUG is not set # CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set +CONFIG_IOMMU_DEFAULT_DMA_LAZY=y CONFIG_IOMMU_DMA=y CONFIG_IOMMU_HELPER=y CONFIG_IOMMU_IOVA=y From b02b95d1b0816274e5cf221071e0f52482c7537a Mon Sep 17 00:00:00 2001 From: Alberto Martinez-Alvarez Date: Sat, 6 Aug 2022 07:10:54 +1000 Subject: [PATCH 06/32] mac80211: fix parameter reading for AC_BE tx bursting The "tx_burst" option which should control the value was expecting more of a list and hence tx_queue_data2_burst value wasn't updated. Yes, it would make sense to have a list for this, the existing code only updates tx_queue_data2_burst and not the other tx_queue_data[0134]_burst values. Signed-off-by: Alberto Martinez-Alvarez (formatted commit message, wrote extra information into commit, moved tx_burst to existing json_get_vars) Signed-off-by: Christian Lamparter --- package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index f524940854..f462fc8ad9 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -138,8 +138,8 @@ mac80211_hostapd_setup_base() { [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=1" "$N" - json_get_vars noscan ht_coex min_tx_power:0 - json_get_values ht_capab_list ht_capab tx_burst + json_get_vars noscan ht_coex min_tx_power:0 tx_burst + json_get_values ht_capab_list ht_capab json_get_values channel_list channels [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ From 1ce2691bf3dacca41559a20e7f1a55587469dfae Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 24 Sep 2022 19:57:26 +0200 Subject: [PATCH 07/32] uml: headers are not exportable When building UML this showed up as of late (2022-09-01): | Makefile:1335: *** Headers not exportable for UML. Stop. This message popped up because of an upstream patch that fixed this error not showing up sooner. For more information see: Now, I don't think we can just skip the kernel headers. Some userspace applications are going to need these. So, The next best alternative I can think of, is to go with the headers by the host arch the UML is compiled for. (Technically, ARCH= should be safe for all other targets as well... But let's not poke a hornet's nest) Signed-off-by: Christian Lamparter --- include/kernel-defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index 2e21392016..dcba319a0f 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -117,7 +117,7 @@ define Kernel/Configure/Default cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \ cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ } - $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install + $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) $(if $(findstring uml,$(BOARD)),ARCH=$(ARCH)) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic endef From 8bea5edf89e57c32b98620540a457441f5f8ddeb Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 24 Sep 2022 23:42:42 +0200 Subject: [PATCH 08/32] uml: fix 5.10 build the 5.10 uml build currently breaks with: /usr/bin/ld: arch/um/os-Linux/signal.o: in function `sigusr1_handler': arch/um/os-Linux/signal.c:141: undefined reference to `uml_pm_wake' But there's an upstream fix for this. Backport the fix for now but also let upstream know so it finds its way through the -stable releases. Signed-off-by: Christian Lamparter --- ...001-um-Fix-build-w-o-CONFIG_PM_SLEEP.patch | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 target/linux/uml/patches-5.10/001-um-Fix-build-w-o-CONFIG_PM_SLEEP.patch diff --git a/target/linux/uml/patches-5.10/001-um-Fix-build-w-o-CONFIG_PM_SLEEP.patch b/target/linux/uml/patches-5.10/001-um-Fix-build-w-o-CONFIG_PM_SLEEP.patch new file mode 100644 index 0000000000..1f7db9ecf4 --- /dev/null +++ b/target/linux/uml/patches-5.10/001-um-Fix-build-w-o-CONFIG_PM_SLEEP.patch @@ -0,0 +1,32 @@ +From 1fb1abc83636f5329c26cd29f0f19f3faeb697a5 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Mon, 14 Dec 2020 20:51:02 +0100 +Subject: [PATCH] um: Fix build w/o CONFIG_PM_SLEEP + +uml_pm_wake() is unconditionally called from the SIGUSR1 wakeup +handler since that's in the userspace portion of UML, and thus +a bit tricky to ifdef out. Since pm_system_wakeup() can always +be called (but may be an empty inline), also simply always have +uml_pm_wake() to fix the build. + +Reported-by: Randy Dunlap +Acked-by: Randy Dunlap # build-tested +Signed-off-by: Johannes Berg +Signed-off-by: Richard Weinberger +--- +--- a/arch/um/kernel/um_arch.c ++++ b/arch/um/kernel/um_arch.c +@@ -387,12 +387,12 @@ + { + } + +-#ifdef CONFIG_PM_SLEEP + void uml_pm_wake(void) + { + pm_system_wakeup(); + } + ++#ifdef CONFIG_PM_SLEEP + static int init_pm_wake_signal(void) + { + /* From e2f0821b5a26bd7ee9d9db93358fa515eca98d1b Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 6 Aug 2022 19:44:02 +0200 Subject: [PATCH 09/32] uml: add Kernel 5.15 support via testing Add the latest default Kernel for testing. Signed-off-by: Christian Lamparter --- target/linux/uml/Makefile | 1 + target/linux/uml/README.md | 2 +- target/linux/uml/config-5.15 | 141 ++++++++++++ ...fix-default-console-kernel-parameter.patch | 54 +++++ .../uml/patches-5.15/101-mconsole-exec.patch | 213 ++++++++++++++++++ .../patches-5.15/102-pseudo-random-mac.patch | 147 ++++++++++++ ...efault-virtual-physical-memory-to-64.patch | 40 ++++ 7 files changed, 597 insertions(+), 1 deletion(-) create mode 100644 target/linux/uml/config-5.15 create mode 100644 target/linux/uml/patches-5.15/001-um-fix-default-console-kernel-parameter.patch create mode 100644 target/linux/uml/patches-5.15/101-mconsole-exec.patch create mode 100644 target/linux/uml/patches-5.15/102-pseudo-random-mac.patch create mode 100644 target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch diff --git a/target/linux/uml/Makefile b/target/linux/uml/Makefile index 5c884fb9a0..90770cc0e4 100644 --- a/target/linux/uml/Makefile +++ b/target/linux/uml/Makefile @@ -14,6 +14,7 @@ BOARDNAME:=User Mode Linux FEATURES:=audio ext4 rootfs-part squashfs KERNEL_PATCHVER:=5.10 +KERNEL_TESTING_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/uml/README.md b/target/linux/uml/README.md index 63c68db57f..9275f9891b 100644 --- a/target/linux/uml/README.md +++ b/target/linux/uml/README.md @@ -28,7 +28,7 @@ console prompt. If you would like it in xterms, substitute `con=xterm` and `con0=xterm`. **No networking is configured** but it's a starting point. The resulting file system has just enough free space to start kicking the tires and playing in the world of 'embedded routers' along with all the resource -restrictions that come with that world. +restrictions that come with that world. To configure networking and more refer to the *user mode linux* documentation online. A quick start goes along this line. Install the `uml-utilities` diff --git a/target/linux/uml/config-5.15 b/target/linux/uml/config-5.15 new file mode 100644 index 0000000000..549a31e1c6 --- /dev/null +++ b/target/linux/uml/config-5.15 @@ -0,0 +1,141 @@ +CONFIG_3_LEVEL_PGTABLES=y +CONFIG_64BIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_EPHEMERAL_INODES=y +CONFIG_ARCH_NO_PREEMPT=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_BLK_DEV_COW_COMMON=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_UBD=y +CONFIG_BLK_DEV_UBD_SYNC=y +CONFIG_BLK_MQ_VIRTIO=y +CONFIG_CDROM=y +# CONFIG_COMMON_CLK is not set +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CON_CHAN="xterm" +CONFIG_CON_ZERO_CHAN="fd:0,fd:1" +CONFIG_CPU_SUP_AMD=y +CONFIG_CPU_SUP_CENTAUR=y +CONFIG_CPU_SUP_HYGON=y +CONFIG_CPU_SUP_INTEL=y +CONFIG_CPU_SUP_ZHAOXIN=y +CONFIG_CRC16=y +CONFIG_CRYPTO_BLAKE2S=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=11 +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_SHA1=y +# CONFIG_CRYPTO_TWOFISH_X86_64 is not set +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DNOTIFY=y +# CONFIG_EARLY_PRINTK is not set +CONFIG_EXT4_FS=y +CONFIG_F2FS_FS=y +CONFIG_FAILOVER=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_CLOCKEVENTS=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_CPU_DEVICES=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_HOSTFS=y +CONFIG_HVC_DRIVER=y +CONFIG_HW_RANDOM=y +CONFIG_HZ_PERIODIC=y +CONFIG_IA32_FEAT_CTL=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INIT_ENV_ARG_LIMIT=128 +CONFIG_IRQ_WORK=y +CONFIG_ISO9660_FS=y +CONFIG_JBD2=y +# CONFIG_JFFS2_FS is not set +CONFIG_KALLSYMS=y +CONFIG_KERNEL_STACK_ORDER=2 +CONFIG_LOCK_DEBUGGING_SUPPORT=y +# CONFIG_MATOM is not set +CONFIG_MAY_HAVE_RUNTIME_DEPS=y +CONFIG_MCONSOLE=y +# CONFIG_MCORE2 is not set +CONFIG_MEMFD_CREATE=y +CONFIG_MIGRATION=y +CONFIG_MK8=y +# CONFIG_MMAPPER is not set +CONFIG_MODULES_USE_ELF_RELA=y +# CONFIG_MPSC is not set +CONFIG_NAMESPACES=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NET_FAILOVER=y +# CONFIG_NET_NS is not set +CONFIG_NLS=y +CONFIG_NO_DMA=y +CONFIG_NO_IOMEM=y +CONFIG_NO_IOPORT_MAP=y +CONFIG_NR_CPUS=1 +CONFIG_NULL_CHAN=y +# CONFIG_OF is not set +CONFIG_PGTABLE_LEVELS=3 +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PORT_CHAN=y +CONFIG_POSIX_MQUEUE=y +CONFIG_POSIX_MQUEUE_SYSCTL=y +# CONFIG_PROCESSOR_SELECT is not set +CONFIG_PROC_PAGE_MONITOR=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_PTY_CHAN=y +CONFIG_RD_BZIP2=y +CONFIG_RD_GZIP=y +CONFIG_RELAY=y +CONFIG_SG_POOL=y +CONFIG_SOFT_WATCHDOG=m +CONFIG_SRCU=y +CONFIG_SSL=y +CONFIG_SSL_CHAN="pty" +CONFIG_STACKTRACE=y +CONFIG_STDERR_CONSOLE=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TINY_SRCU=y +CONFIG_TTY_CHAN=y +CONFIG_UML=y +CONFIG_UML_NET=y +CONFIG_UML_NET_DAEMON=y +CONFIG_UML_NET_DETERMINISTIC_MAC=y +CONFIG_UML_NET_ETHERTAP=y +CONFIG_UML_NET_MCAST=y +# CONFIG_UML_NET_PCAP is not set +CONFIG_UML_NET_SLIP=y +CONFIG_UML_NET_SLIRP=y +CONFIG_UML_NET_TUNTAP=y +# CONFIG_UML_NET_VDE is not set +CONFIG_UML_NET_VECTOR=y +# CONFIG_UML_PCI_OVER_VIRTIO is not set +CONFIG_UML_RANDOM=y +# CONFIG_UML_SOUND is not set +CONFIG_UML_TIME_TRAVEL_SUPPORT=y +CONFIG_UML_WATCHDOG=y +CONFIG_UML_X86=y +# CONFIG_USER_NS is not set +CONFIG_VIRTIO=y +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTIO_CONSOLE=y +CONFIG_VIRTIO_NET=y +CONFIG_VIRTIO_UML=y +CONFIG_VMAP_STACK=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_WATCHDOG_CORE=y +CONFIG_X86_64=y +CONFIG_X86_CMOV=y +CONFIG_X86_CMPXCHG64=y +CONFIG_X86_INTEL_USERCOPY=y +CONFIG_X86_INTERNODE_CACHE_SHIFT=6 +CONFIG_X86_L1_CACHE_SHIFT=6 +CONFIG_X86_MINIMUM_CPU_FAMILY=64 +CONFIG_X86_TSC=y +CONFIG_X86_USE_PPRO_CHECKSUM=y +CONFIG_XTERM_CHAN=y +CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/uml/patches-5.15/001-um-fix-default-console-kernel-parameter.patch b/target/linux/uml/patches-5.15/001-um-fix-default-console-kernel-parameter.patch new file mode 100644 index 0000000000..dd7fe57d5f --- /dev/null +++ b/target/linux/uml/patches-5.15/001-um-fix-default-console-kernel-parameter.patch @@ -0,0 +1,54 @@ +From 53b5c5f559cc95fc676cb4cc9e5a8d9f0cb8f58c Mon Sep 17 00:00:00 2001 +Message-Id: <53b5c5f559cc95fc676cb4cc9e5a8d9f0cb8f58c.1659815468.git.chunkeey@gmail.com> +From: Christian Lamparter +Date: Sat, 6 Aug 2022 21:22:01 +0200 +Subject: [PATCH v1 1/2] um: fix default console kernel parameter +To: linux-um@lists.infradead.org +Cc: Richard Weinberger , + Anton Ivanov , + Johannes Berg + +OpenWrt's UML with 5.15 was producing odd errors/warnings during preinit +part of the early userspace portion: + +|[ 0.000000] Kernel command line: ubd0=root.img root=98:0 console=tty +|[...] +|[ 0.440000] random: jshn: uninitialized urandom read (4 bytes read) +|[ 0.460000] random: jshn: uninitialized urandom read (4 bytes read) +|/etc/preinit: line 47: can't create /dev/tty: No such device or address +|/etc/preinit: line 48: can't create /dev/tty: No such device or address +|/etc/preinit: line 58: can't open /dev/tty: No such device or address +|[...] repeated many times + +That "/dev/tty" came from the command line (which is automatically +added if no console= parameter was specified for the uml binary). + +The TLDP project tells the following about the /dev/tty: + +| /dev/tty stands for the controlling terminal (if any) for the current +| process.[...] +| /dev/tty is something like a link to the actually terminal device[..] + +The "(if any)" is important here, since it's possible for processes to +not have a controlling terminal. + +I think this was a simple typo and the author wanted tty0 there. + +CC: Thomas Meyer +Fixes: d7ffac33631b ("um: stdio_console: Make preferred console") +Signed-off-by: Christian Lamparter +--- + arch/um/kernel/um_arch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/um/kernel/um_arch.c ++++ b/arch/um/kernel/um_arch.c +@@ -31,7 +31,7 @@ + #include + + #define DEFAULT_COMMAND_LINE_ROOT "root=98:0" +-#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty" ++#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty0" + + /* Changed in add_arg and setup_arch, which run before SMP is started */ + static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 }; diff --git a/target/linux/uml/patches-5.15/101-mconsole-exec.patch b/target/linux/uml/patches-5.15/101-mconsole-exec.patch new file mode 100644 index 0000000000..ceea41e013 --- /dev/null +++ b/target/linux/uml/patches-5.15/101-mconsole-exec.patch @@ -0,0 +1,213 @@ +# +# Minimalist mconsole exec patch +# +# 3.10 version (with bit more synchronous behavior) by fingon at iki dot fi +# Adaptation to kernel 3.3.8 made by David Fernández (david at dit.upm.es) for +# Starting point: mconsole-exec-2.6.30.patch for kernel 2.6.30 +# Author of original patch: Paolo Giarrusso, aka Blaisorblade +# (http://www.user-mode-linux.org/~blaisorblade) +# +# Known misfeatures: +# +# - If output is too long, blocks (and breaks horribly) +# (this misfeature from 3.10 patches, when minimalizing the patch; +# workaround: redirect to a shared filesystem if long output is expected) +# +# - Nothing useful is done with stdin +# +--- a/arch/um/drivers/mconsole.h ++++ b/arch/um/drivers/mconsole.h +@@ -85,6 +85,7 @@ extern void mconsole_cad(struct mc_reque + extern void mconsole_stop(struct mc_request *req); + extern void mconsole_go(struct mc_request *req); + extern void mconsole_log(struct mc_request *req); ++extern void mconsole_exec(struct mc_request *req); + extern void mconsole_proc(struct mc_request *req); + extern void mconsole_stack(struct mc_request *req); + +--- a/arch/um/drivers/mconsole_kern.c ++++ b/arch/um/drivers/mconsole_kern.c +@@ -4,6 +4,7 @@ + * Copyright (C) 2001 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com) + */ + ++#include + #include + #include + #include +@@ -27,6 +28,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -124,6 +126,59 @@ void mconsole_log(struct mc_request *req + mconsole_reply(req, "", 0, 0); + } + ++void mconsole_exec(struct mc_request *req) ++{ ++ struct subprocess_info *sub_info; ++ int res, len; ++ struct file *out; ++ char buf[MCONSOLE_MAX_DATA]; ++ ++ char *envp[] = { ++ "HOME=/", "TERM=linux", ++ "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin", ++ NULL ++ }; ++ char *argv[] = { ++ "/bin/sh", "-c", ++ req->request.data + strlen("exec "), ++ NULL ++ }; ++ ++ sub_info = call_usermodehelper_setup("/bin/sh", argv, envp, GFP_ATOMIC, NULL, NULL, NULL); ++ if (sub_info == NULL) { ++ mconsole_reply(req, "call_usermodehelper_setup failed", 1, 0); ++ return; ++ } ++ res = call_usermodehelper_stdoutpipe(sub_info, &out); ++ if (res < 0) { ++ kfree(sub_info); ++ mconsole_reply(req, "call_usermodehelper_stdoutpipe failed", 1, 0); ++ return; ++ } ++ ++ res = call_usermodehelper_exec(sub_info, UMH_WAIT_PROC); ++ if (res < 0) { ++ kfree(sub_info); ++ mconsole_reply(req, "call_usermodehelper_exec failed", 1, 0); ++ return; ++ } ++ ++ for (;;) { ++ len = out->f_op->read(out, buf, sizeof(buf), &out->f_pos); ++ if (len < 0) { ++ mconsole_reply(req, "reading output failed", 1, 0); ++ break; ++ } ++ if (len == 0) ++ break; ++ mconsole_reply_len(req, buf, len, 0, 1); ++ } ++ fput(out); ++ ++ mconsole_reply_len(req, NULL, 0, 0, 0); ++} ++ ++ + void mconsole_proc(struct mc_request *req) + { + struct vfsmount *mnt = proc_mnt; +@@ -190,6 +245,7 @@ void mconsole_proc(struct mc_request *re + stop - pause the UML; it will do nothing until it receives a 'go' \n\ + go - continue the UML after a 'stop' \n\ + log - make UML enter into the kernel log\n\ ++ exec - pass to /bin/sh -c synchronously\n\ + proc - returns the contents of the UML's /proc/\n\ + stack - returns the stack of the specified pid\n\ + " +--- a/arch/um/drivers/mconsole_user.c ++++ b/arch/um/drivers/mconsole_user.c +@@ -30,6 +30,7 @@ static struct mconsole_command commands[ + { "stop", mconsole_stop, MCONSOLE_PROC }, + { "go", mconsole_go, MCONSOLE_INTR }, + { "log", mconsole_log, MCONSOLE_INTR }, ++ { "exec", mconsole_exec, MCONSOLE_PROC }, + { "proc", mconsole_proc, MCONSOLE_PROC }, + { "stack", mconsole_stack, MCONSOLE_INTR }, + }; +--- a/arch/um/os-Linux/file.c ++++ b/arch/um/os-Linux/file.c +@@ -560,6 +560,8 @@ int os_create_unix_socket(const char *fi + + addr.sun_family = AF_UNIX; + ++ if (len > sizeof(addr.sun_path)) ++ len = sizeof(addr.sun_path); + snprintf(addr.sun_path, len, "%s", file); + + err = bind(sock, (struct sockaddr *) &addr, sizeof(addr)); +--- a/include/linux/kmod.h ++++ b/include/linux/kmod.h +@@ -32,4 +32,6 @@ static inline int request_module_nowait( + #define try_then_request_module(x, mod...) (x) + #endif + ++int call_usermodehelper_stdoutpipe(struct subprocess_info *sub_info, struct file **filp); ++ + #endif /* __LINUX_KMOD_H__ */ +--- a/include/linux/umh.h ++++ b/include/linux/umh.h +@@ -22,6 +22,7 @@ struct subprocess_info { + const char *path; + char **argv; + char **envp; ++ struct file *stdout; + int wait; + int retval; + int (*init)(struct subprocess_info *info, struct cred *new); +--- a/kernel/umh.c ++++ b/kernel/umh.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #include + +@@ -73,6 +74,28 @@ static int call_usermodehelper_exec_asyn + flush_signal_handlers(current, 1); + spin_unlock_irq(¤t->sighand->siglock); + ++ /* Install output when needed */ ++ if (sub_info->stdout) { ++ struct files_struct *f = current->files; ++ struct fdtable *fdt; ++ ++ sys_close(1); ++ sys_close(2); ++ get_file(sub_info->stdout); ++ fd_install(1, sub_info->stdout); ++ fd_install(2, sub_info->stdout); ++ spin_lock(&f->file_lock); ++ fdt = files_fdtable(f); ++ __set_bit(1, fdt->open_fds); ++ __clear_bit(1, fdt->close_on_exec); ++ __set_bit(2, fdt->open_fds); ++ __clear_bit(2, fdt->close_on_exec); ++ spin_unlock(&f->file_lock); ++ ++ /* disallow core files */ ++ current->signal->rlim[RLIMIT_CORE] = (struct rlimit){0, 0}; ++ } ++ + /* + * Initial kernel threads share ther FS with init, in order to + * get the init root directory. But we've now created a new +@@ -332,6 +355,20 @@ static void helper_unlock(void) + wake_up(&running_helpers_waitq); + } + ++int call_usermodehelper_stdoutpipe(struct subprocess_info *sub_info, ++ struct file **filp) ++{ ++ struct file *f[2]; ++ ++ if (create_pipe_files(f, 0) < 0) ++ return PTR_ERR(f); ++ ++ sub_info->stdout = f[1]; ++ *filp = f[0]; ++ return 0; ++} ++EXPORT_SYMBOL(call_usermodehelper_stdoutpipe); ++ + /** + * call_usermodehelper_setup - prepare to call a usermode helper + * @path: path to usermode executable diff --git a/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch b/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch new file mode 100644 index 0000000000..925b9d7710 --- /dev/null +++ b/target/linux/uml/patches-5.15/102-pseudo-random-mac.patch @@ -0,0 +1,147 @@ +=============================================================================== + +This patch makes MAC addresses of network interfaces predictable. In +particular, it adds a small routine that computes MAC addresses of based on +a SHA1 hash of the virtual machine name and interface ID. + +TECHNICAL INFORMATION: + +Applies to vanilla kernel 3.9.4. + +=============================================================================== +--- a/arch/um/drivers/Kconfig ++++ b/arch/um/drivers/Kconfig +@@ -146,6 +146,20 @@ config UML_NET + enable at least one of the following transport options to actually + make use of UML networking. + ++config UML_NET_DETERMINISTIC_MAC ++ bool "Use deterministic MAC addresses for network interfaces" ++ default y ++ depends on UML_NET ++ select CRYPTO_SHA1 ++ help ++ Virtual network devices inside a User-Mode Linux instance must be ++ assigned a MAC (Ethernet) address. If none is specified on the UML ++ command line, one must be automatically computed. If this option is ++ enabled, a randomly generated address is used. Otherwise, if this ++ option is disabled, the address is generated from a SHA1 hash of ++ the umid of the UML instance and the interface name. The latter choice ++ is useful to make MAC addresses predictable. ++ + config UML_NET_ETHERTAP + bool "Ethertap transport (obsolete)" + depends on UML_NET +--- a/arch/um/drivers/net_kern.c ++++ b/arch/um/drivers/net_kern.c +@@ -25,6 +25,14 @@ + #include + #include + ++#include ++#include ++#include ++#include ++#include ++#include ++#include "os.h" ++ + #define DRIVER_NAME "uml-netdev" + + static DEFINE_SPINLOCK(opened_lock); +@@ -274,9 +282,51 @@ static const struct ethtool_ops uml_net_ + .get_ts_info = ethtool_op_get_ts_info, + }; + ++#ifdef CONFIG_UML_NET_DETERMINISTIC_MAC ++ ++/* Compute a SHA1 hash of the UML instance's id and ++ * * an interface name. */ ++static int compute_hash(const char *umid, const char *ifname, char *hash) ++{ ++ struct ahash_request *desc; ++ struct crypto_ahash *tfm; ++ struct scatterlist sg; ++ char vmif[1024]; ++ int ret; ++ ++ strcpy (vmif, umid); ++ strcat (vmif, ifname); ++ ++ tfm = crypto_alloc_ahash("sha1", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tfm)) ++ return -ENOMEM; ++ ++ desc = ahash_request_alloc(tfm, GFP_KERNEL); ++ if (!desc) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ crypto_ahash_clear_flags(tfm, ~0); ++ ++ sg_init_table(&sg, 1); ++ sg_set_buf(&sg, vmif, strlen(vmif)); ++ ++ ahash_request_set_crypt(desc, &sg, hash, strlen(vmif)); ++ ++ ret = crypto_ahash_digest(desc); ++out: ++ crypto_free_ahash(tfm); ++ ++ return ret; ++} ++ ++#endif ++ + void uml_net_setup_etheraddr(struct net_device *dev, char *str) + { + unsigned char *addr = dev->dev_addr; ++ u8 hash[SHA1_DIGEST_SIZE]; + char *end; + int i; + +@@ -319,9 +369,26 @@ void uml_net_setup_etheraddr(struct net_ + return; + + random: ++#ifndef CONFIG_UML_NET_DETERMINISTIC_MAC + printk(KERN_INFO + "Choosing a random ethernet address for device %s\n", dev->name); + eth_hw_addr_random(dev); ++#else ++ printk(KERN_INFO ++ "Computing a digest to use as ethernet address for device %s\n", dev->name); ++ if (compute_hash(get_umid(), dev->name, hash) < 0) { ++ printk(KERN_WARNING ++ "Could not compute digest to use as ethernet address for device %s. " ++ "Using random address instead.\n", dev->name); ++ random_ether_addr(addr); ++ } ++ else { ++ for (i=0; i < 6; i++) ++ addr[i] = (hash[i] + hash[i+6]) % 0x100; ++ } ++ addr [0] &= 0xfe; /* clear multicast bit */ ++ addr [0] |= 0x02; /* set local assignment bit (IEEE802) */ ++#endif + } + + static DEFINE_SPINLOCK(devices_lock); +--- a/kernel/umh.c ++++ b/kernel/umh.c +@@ -356,12 +356,12 @@ static void helper_unlock(void) + } + + int call_usermodehelper_stdoutpipe(struct subprocess_info *sub_info, +- struct file **filp) ++ struct file **filp) + { + struct file *f[2]; + + if (create_pipe_files(f, 0) < 0) +- return PTR_ERR(f); ++ return PTR_ERR(f); + + sub_info->stdout = f[1]; + *filp = f[0]; diff --git a/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch b/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch new file mode 100644 index 0000000000..3a67a7dbd0 --- /dev/null +++ b/target/linux/uml/patches-5.15/104-um-increase-default-virtual-physical-memory-to-64.patch @@ -0,0 +1,40 @@ +From d7936f11aded13f03871c0d6502d611d6a1e2dc5 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <53b5c5f559cc95fc676cb4cc9e5a8d9f0cb8f58c.1659815468.git.chunkeey@gmail.com> +References: <53b5c5f559cc95fc676cb4cc9e5a8d9f0cb8f58c.1659815468.git.chunkeey@gmail.com> +From: Christian Lamparter +Date: Sat, 6 Aug 2022 19:27:20 +0200 +Subject: [PATCH v1 2/2] um: increase default virtual physical memory to 64 MiB +To: linux-um@lists.infradead.org +Cc: Richard Weinberger , + Anton Ivanov , + Johannes Berg + +The current 32 MiB of RAM causes OOMs to appear shortly after +booting in a minimal OpenWrt 22.03 configuration with a +5.10.134 kernel. + +Of course, passing a "mem=64M" (from the --help text) parameter +works too, but it produces the following (info) message: + +| [ 0.000000] Unknown kernel command line parameters "mem=64M", will be passed to user space. + +That's why, I think it would be nicer, if this is working out +of the box again :). + +Signed-off-by: Christian Lamparter +--- + arch/um/kernel/um_arch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/um/kernel/um_arch.c ++++ b/arch/um/kernel/um_arch.c +@@ -130,7 +130,7 @@ static int have_root __initdata; + static int have_console __initdata; + + /* Set in uml_mem_setup and modified in linux_main */ +-long long physmem_size = 32 * 1024 * 1024; ++long long physmem_size = 64 * 1024 * 1024; + EXPORT_SYMBOL(physmem_size); + + static const char *usage_string = From bb73828b89def128f26ae1cdff0d08569d261f1b Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Mon, 22 Aug 2022 10:35:28 +0200 Subject: [PATCH 10/32] firmware: intel-microcode: update to 20220809 Debian's changelog by Henrique de Moraes Holschuh : * New upstream microcode datafile 20220809 * Fixes INTEL-SA-00657, CVE-2022-21233 Stale data from APIC leaks SGX memory (AEPIC leak) * Fixes unspecified errata (functional issues) on Xeon Scalable * Updated Microcodes: sig 0x00050653, pf_mask 0x97, 2022-03-14, rev 0x100015e, size 34816 sig 0x00050654, pf_mask 0xb7, 2022-03-08, rev 0x2006e05, size 44032 sig 0x000606a6, pf_mask 0x87, 2022-04-07, rev 0xd000375, size 293888 sig 0x000706a1, pf_mask 0x01, 2022-03-23, rev 0x003c, size 75776 sig 0x000706a8, pf_mask 0x01, 2022-03-23, rev 0x0020, size 75776 sig 0x000706e5, pf_mask 0x80, 2022-03-17, rev 0x00b2, size 112640 sig 0x000806c2, pf_mask 0xc2, 2022-03-19, rev 0x0028, size 97280 sig 0x000806d1, pf_mask 0xc2, 2022-03-28, rev 0x0040, size 102400 sig 0x00090672, pf_mask 0x03, 2022-06-07, rev 0x0022, size 216064 sig 0x00090675, pf_mask 0x03, 2022-06-07, rev 0x0022, size 216064 sig 0x000906a3, pf_mask 0x80, 2022-06-15, rev 0x0421, size 216064 sig 0x000906a4, pf_mask 0x80, 2022-06-15, rev 0x0421, size 216064 sig 0x000a0671, pf_mask 0x02, 2022-03-17, rev 0x0054, size 103424 sig 0x000b06f2, pf_mask 0x03, 2022-06-07, rev 0x0022, size 216064 sig 0x000b06f5, pf_mask 0x03, 2022-06-07, rev 0x0022, size 216064 Signed-off-by: Christian Lamparter --- package/firmware/intel-microcode/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 0d51730173..b0379f363d 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20220510 +PKG_VERSION:=20220809 PKG_RELEASE:=1 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/non-free/i/intel-microcode/ -PKG_HASH:=49752447c1b905dd130699cdef09fb2bba47b6f413d27787c98a5569273e283e +PKG_HASH:=4cf6c3638bb52d9d45c1916af866fd0929628a6f459daac3edfd369149e9c665 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_BUILD_DEPENDS:=iucode-tool/host From e562746263b37ae7943c3700998f2be30b815a2e Mon Sep 17 00:00:00 2001 From: Kasparas Elzbutas Date: Mon, 18 Jul 2022 10:05:33 +0300 Subject: [PATCH 11/32] ipq40xx: fix RUTX10 Wi-Fi woes This partially reverts: commit cfc13c44595d ("ipq40xx: utilize nvmem-cells for macs & (pre-)calibration data") U-Boot on these devices mangles the device tree, so nvmem-cell type calibration doesn't work. Fixes: cfc13c44595d ("ipq40xx: utilize nvmem-cells for macs & (pre-)calibration data") Signed-off-by: Kasparas Elzbutas (added reference to commit, rewrote commit message) Signed-off-by: Christian Lamparter --- .../etc/hotplug.d/firmware/11-ath10k-caldata | 8 +++++ .../arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi | 30 ------------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index a0280b7f22..6adf6f23f1 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -138,6 +138,10 @@ case "$FIRMWARE" in caldata_extract "0:ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_label) 2) ;; + teltonika,rutx10) + caldata_extract "0:ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 2) + ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x1000 0x2f20 @@ -229,6 +233,10 @@ case "$FIRMWARE" in caldata_extract "0:ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_label) 4) ;; + teltonika,rutx10) + caldata_extract "0:ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 3) + ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x5000 0x2f20 diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi index ebb2d08e73..3673a13430 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rutx.dtsi @@ -188,30 +188,12 @@ label = "0:ART"; reg = <0x2e0000 0x10000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - precal_art_1000: precal@1000 { - reg = <0x1000 0x2f20>; - }; - - precal_art_5000: precal@5000 { - reg = <0x5000 0x2f20>; - }; }; config: partition@2f0000 { label = "0:CONFIG"; reg = <0x2f0000 0x10000>; read-only; - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_config_0: macaddr@0 { - reg = <0x0 0x6>; - }; }; partition@300000 { @@ -267,15 +249,3 @@ pinctrl-names = "default"; phy-reset-gpio = <&tlmm 62 0>; }; - -&wifi0 { - nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_1000>, <&macaddr_config_0>; - mac-address-increment = <2>; -}; - -&wifi1 { - nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_5000>, <&macaddr_config_0>; - mac-address-increment = <3>; -}; From 48ef6697596abda22d3a6bc964c4e1efa3fc2c52 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 17 Sep 2022 00:09:27 +0200 Subject: [PATCH 12/32] apm821xx: refresh 5.15 config use the toolchain's default CPU (464fp) as the CPU option. This fixes a CPU selection prompt which shows up now. CPU selection > 1. Generic 32 bits powerpc (POWERPC_CPU) (NEW) 2. Rely on the toolchain's implicit default CPU (TOOLCHAIN_DEFAULT_CPU) (NEW) Signed-off-by: Christian Lamparter --- target/linux/apm821xx/config-5.15 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/config-5.15 b/target/linux/apm821xx/config-5.15 index 7cb81d7fdd..2af8110553 100644 --- a/target/linux/apm821xx/config-5.15 +++ b/target/linux/apm821xx/config-5.15 @@ -38,7 +38,6 @@ CONFIG_CPU_BIG_ENDIAN=y CONFIG_CRC16=y # CONFIG_CRC32_SARWATE is not set CONFIG_CRC32_SLICEBY8=y -CONFIG_CRYPTO_BLAKE2S=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DEV_PPC4XX=y CONFIG_CRYPTO_HW=y @@ -76,7 +75,6 @@ CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_CPU=y CONFIG_GENERIC_CPU_AUTOPROBE=y CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_GENERIC_GETTIMEOFDAY=y @@ -180,6 +178,7 @@ CONFIG_PHYSICAL_START=0x00000000 CONFIG_PHYS_64BIT=y CONFIG_PHYS_ADDR_T_64BIT=y # CONFIG_PMU_SYSFS is not set +# CONFIG_POWERPC_CPU is not set CONFIG_PPC=y CONFIG_PPC32=y CONFIG_PPC44x_SIMPLE=y @@ -233,6 +232,7 @@ CONFIG_THREAD_INFO_IN_TASK=y CONFIG_THREAD_SHIFT=13 CONFIG_TICK_CPU_ACCOUNTING=y CONFIG_TINY_SRCU=y +CONFIG_TOOLCHAIN_DEFAULT_CPU=y CONFIG_USB_SUPPORT=y CONFIG_VDSO32=y # CONFIG_VIRTIO_MENU is not set From 3aec35ab96b721ea1ee5a606169aef621807c861 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 16 Sep 2022 22:32:58 +0200 Subject: [PATCH 13/32] apm821xx: make 5.15 kernel default 5.15 has been available for some time for testing. Signed-off-by: Christian Lamparter --- target/linux/apm821xx/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/apm821xx/Makefile b/target/linux/apm821xx/Makefile index 875ff225a9..bb0ee9b5b1 100644 --- a/target/linux/apm821xx/Makefile +++ b/target/linux/apm821xx/Makefile @@ -9,8 +9,7 @@ CPU_TYPE:=464fp FEATURES:=fpu dt gpio ramdisk squashfs usb SUBTARGETS:=nand sata -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 define Target/Description Build images for AppliedMicro APM821xx based boards. From 04eb08029010e78b193c98115b0fed761bd9fe46 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Fri, 23 Sep 2022 14:47:39 +0200 Subject: [PATCH 14/32] ipq40xx: luma_wrtq-329acn: differentiate ethernet mac addresses On OEM firmware both addresses for In and Out ports are different. Set them as such also in OpenWrt. Fixes: e24635710c7e (" ipq40xx: add support for Luma Home WRTQ-329ACN") Signed-off-by: Tomasz Maciej Nowak --- .../arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts index 5b0c8cf106..2af4296342 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wrtq-329acn.dts @@ -182,6 +182,14 @@ #address-cells = <1>; #size-cells = <1>; + macaddr_art_0: macaddr@0{ + reg = <0x0000 0x0006>; + }; + + macaddr_art_6: macaddr@6{ + reg = <0x0006 0x0006>; + }; + precal_art_1000: precal@1000 { reg = <0x1000 0x2f20>; }; @@ -227,11 +235,15 @@ &gmac0 { qcom,phy_mdio_addr = <2>; qcom,poll_required = <1>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_6>; }; &gmac1 { qcom,phy_mdio_addr = <4>; qcom,poll_required = <1>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_0>; }; &tlmm { From 0410c95f0bb191663989dfda08e3e80a1827baee Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Fri, 23 Sep 2022 14:48:12 +0200 Subject: [PATCH 15/32] ipq40xx: base-files: properly close case Fix this occurrence during boot: /bin/board_detect: line 10: Unsupported: not found Fixes: 80baffd2aa91 (" ipq40xx: add support for Pakedge WR-1") Signed-off-by: Tomasz Maciej Nowak --- target/linux/ipq40xx/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index db58eb9363..040f3ee619 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -228,6 +228,7 @@ ipq40xx_setup_macs() ;; pakedge,wr-1) wan_mac=$(macaddr_add $(get_mac_label) 1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac From c34f071972474fbe5fcfca6fbb397a355216c221 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sun, 4 Sep 2022 21:27:11 +0900 Subject: [PATCH 16/32] ipq40xx: add support for Sony NCP-HG100/Cellular Sony NCP-HG100/Cellular is a IoT Gateway with 2.4/5 GHz band 11ac (WiFi-5) wireless function, based on IPQ4019. Specification: - SoC : Qualcomm IPQ4019 - RAM : DDR3 512 MiB (H5TC4G63EFR) - Flash : eMMC 4 GiB (THGBMNG5D1LBAIT) - WLAN : 2.4/5 GHz 2T2R (IPQ4019) - Ethernet : 10/100/1000 Mbps x2 - Transceiver : Qualcomm QCA8072 - WWAN : Telit LN940A9 - Z-Wave : Silicon Labs ZM5101 - Bluetooth : Qualcomm CSR8811 - Audio DAC : Realtek ALC5629 - Audio Amp. : Realtek ALC1304 - Voice Input Processor : Conexant CX20924 - Micro Controller Unit : Nuvoton MINI54FDE - RGB LED, Fan, Temp. sensors - Touch Sensor : Cypress CY8C4014LQI - RGB LED driver : TI LP55231 (2x) - LEDs/Keys : 11x, 6x - UART : through-hole on PCB - J1: 3.3V, TX, RX, GND from tri-angle marking - 115200n8 - Power : 12 VDC, 2.5 A Flash instruction using initramfs image: 1. Prepare TFTP server with the IP address 192.168.132.100 and place the initramfs image to TFTP directory with the name "C0A88401.img" 2. Boot NCP-HG100/Cellular and interrupt after the message "Hit any key to stop autoboot: 2" 3. Perform the following commands and set bootcmd to allow booting from eMMC setenv bootcmd "mmc read 0x84000000 0x2e22 0x4000 && bootm 0x84000000" saveenv 4. Perform the following command to load/boot the OpenWrt initramfs image tftpboot && bootm 5. On the initramfs image, perform sysupgrade with the sysupgrade image (if needed, backup eMMC partitions by dd command and download to other place before performing sysupgrade) 6. Wait for ~120 seconds to complete flashing Known issues: - There are no drivers for audio-related chips/functions in Linux Kernel and OpenWrt, they cannot be used. - There is no driver for MINI54FDE Micro-Controller Unit, customized for this device by the firmware in the MCU. This chip controls the following functions, but they cannot be controlled in OpenWrt. - RGB LED - Fan this fan is controlled automatically by MCU by default, without driver - Thermal Sensors (2x) - Currently, there is no driver or tool for CY8C4014LQI and cannot be controlled. It cannot be exited from "booting mode" and moved to "normal op mode" after booting. And also, the 4x buttons (mic mute, vol down, vol up, alexa trigger) connected to the IC cannot be controlled. - it can be exited from "booting mode" by installing and executing i2cset command: opkg update opkg install i2c-tools i2cset -y 1 0x14 0xf 1 - There is a connection issue on the control by uqmi for the WWAN module. But modemmanager can be used without any issues and the use of it is recommended. - With the F2FS format, too many errors are reported on erasing eMMC partition "rootfs_data" while booting: [ 1.360270] sdhci: Secure Digital Host Controller Interface driver [ 1.363636] sdhci: Copyright(c) Pierre Ossman [ 1.369730] sdhci-pltfm: SDHCI platform and OF driver helper [ 1.374729] sdhci_msm 7824900.sdhci: Got CD GPIO ... [ 1.413552] mmc0: SDHCI controller on 7824900.sdhci [7824900.sdhci] using ADMA 64-bit [ 1.528325] mmc0: new HS200 MMC card at address 0001 [ 1.530627] mmcblk0: mmc0:0001 004GA0 3.69 GiB [ 1.533530] mmcblk0boot0: mmc0:0001 004GA0 partition 1 2.00 MiB [ 1.537831] mmcblk0boot1: mmc0:0001 004GA0 partition 2 2.00 MiB [ 1.542918] mmcblk0rpmb: mmc0:0001 004GA0 partition 3 512 KiB, chardev (247:0) [ 1.550323] Alternate GPT is invalid, using primary GPT. [ 1.561669] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 ... [ 8.841400] mount_root: loading kmods from internal overlay [ 8.860241] kmodloader: loading kernel modules from //etc/modules-boot.d/* [ 8.863746] kmodloader: done loading kernel modules from //etc/modules-boot.d/* [ 9.240465] block: attempting to load /etc/config/fstab [ 9.246722] block: unable to load configuration (fstab: Entry not found) [ 9.246863] block: no usable configuration [ 9.254883] mount_root: overlay filesystem in /dev/mmcblk0p17 has not been formatted yet [ 9.438915] urandom_read: 5 callbacks suppressed [ 9.438924] random: mkfs.f2fs: uninitialized urandom read (16 bytes read) [ 12.243332] mmc_erase: erase error -110, status 0x800 [ 12.246638] mmc0: cache flush error -110 [ 15.134585] mmc_erase: erase error -110, status 0x800 [ 15.135891] mmc_erase: group start error -110, status 0x0 [ 15.139850] mmc_erase: group start error -110, status 0x0 ...(too many the same errors)... [ 17.350811] mmc_erase: group start error -110, status 0x0 [ 17.356197] mmc_erase: group start error -110, status 0x0 [ 17.439498] sdhci_msm 7824900.sdhci: Card stuck in wrong state! card_busy_detect status: 0xe00 [ 17.446910] mmc0: tuning execution failed: -5 [ 17.447111] mmc0: cache flush error -110 [ 18.012440] F2FS-fs (mmcblk0p17): Found nat_bits in checkpoint [ 18.062652] F2FS-fs (mmcblk0p17): Mounted with checkpoint version = 428fa16b [ 18.198691] block: attempting to load /etc/config/fstab [ 18.198972] block: unable to load configuration (fstab: Entry not found) [ 18.203029] block: no usable configuration [ 18.211371] mount_root: overlay filesystem has not been fully initialized yet [ 18.214487] mount_root: switching to f2fs overlay So, this support uses ext4 format instead which has no errors. Note: - The primary uart is shared for debug console and Z-Wave chip. The function is switched by GPIO15 (Linux: 427). value: 1: debug console 0: Z-Wave - NCP-HG100/Cellular has 2x os-image pairs in eMMC. - 0:HLOS, rootfs - 0:HLOS_1, rootfs_1 In OpenWrt, the first image pair is used. - "bootipq" command in U-Boot requires authentication with signed-image by default. To boot unsigned image of OpenWrt, use "mmc read" and "bootm" command instead. - This support is for "Cellular" variant of NCP-HG100 and not tested on "WLAN" (non-cellular) variant. - The board files of ipq-wifi may also be used in "WLAN" variant of NCP-HG100, but unconfirmed and add files as for "Cellular" variant. - "NET" LED is used to indicate WWAN status in stock firmware. - There is no MAC address information in the label on the case, use the address included in UUID in the label as "label-MAC" instead. - The "CLOUD" LEDs are partially used for indication of system status in stock firmware, use they as status LEDs in OpenWrt instead of RGB LED connected to the MCU. MAC addresses: LAN : 5C:FF:35:**:**:ED (ART, 0x6 (hex)) WAN : 5C:FF:35:**:**:EF (ART, 0x0 (hex)) 2.4 GHz: 5C:FF:35:**:**:ED (ART, 0x1006 (hex)) 5 GHz : 5C:FF:35:**:**:EE (ART, 0x5006 (hex)) partition layout in eMMC (by fdisk, GPT): Disk /dev/mmcblk0: 7733248 sectors, 3776M Logical sector size: 512 Disk identifier (GUID): **** Partition table holds up to 20 entries First usable sector is 34, last usable sector is 7634910 Number Start (sector) End (sector) Size Name 1 34 1057 512K 0:SBL1 2 1058 2081 512K 0:BOOTCONFIG 3 2082 3105 512K 0:QSEE 4 3106 4129 512K 0:QSEE_1 5 4130 4641 256K 0:CDT 6 4642 5153 256K 0:CDT_1 7 5154 6177 512K 0:BOOTCONFIG1 8 6178 6689 256K 0:APPSBLENV 9 6690 8737 1024K 0:APPSBL 10 8738 10785 1024K 0:APPSBL_1 11 10786 11297 256K 0:ART 12 11298 11809 256K 0:HSEE 13 11810 28193 8192K 0:HLOS 14 28194 44577 8192K 0:HLOS_1 15 44578 306721 128M rootfs 16 306722 568865 128M rootfs_1 17 568866 3958065 1654M rootfs_data [initial work] Signed-off-by: Iwao Yuki Co-developed-by: Iwao Yuki [adjustments, cleanups, commit message, sending patch] Signed-off-by: INAGAKI Hiroshi (dropped clk_unused_ignore, dropped 901-* patches, renamed key nodes, changed LEDs chan/labels to match func-en, made :net -> (w)wan leds) Signed-off-by: Christian Lamparter --- package/firmware/ipq-wifi/Makefile | 2 + .../board-sony_ncp-hg100-cellular.qca4019 | Bin 0 -> 24340 bytes .../ipq40xx/base-files/etc/board.d/01_leds | 5 + .../ipq40xx/base-files/etc/board.d/02_network | 3 +- .../base-files/etc/board.d/03_gpio_switches | 3 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 6 + .../base-files/lib/upgrade/platform.sh | 3 + .../ipq40xx/base-files/lib/upgrade/sony.sh | 91 +++ .../dts/qcom-ipq4019-ncp-hg100-cellular.dts | 631 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 13 + 10 files changed, 756 insertions(+), 1 deletion(-) create mode 100644 package/firmware/ipq-wifi/board-sony_ncp-hg100-cellular.qca4019 create mode 100644 target/linux/ipq40xx/base-files/lib/upgrade/sony.sh create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-ncp-hg100-cellular.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 7b683ef0a2..e76aa9235e 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -37,6 +37,7 @@ ALLWIFIBOARDS:= \ pakedge_wr-1 \ qxwlan_e2600ac-c1 \ qxwlan_e2600ac-c2 \ + sony_ncp-hg100-cellular \ teltonika_rutx ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -110,6 +111,7 @@ $(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC)) $(eval $(call generate-ipq-wifi-package,pakedge_wr-1,Pakedge WR-1)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c1,Qxwlan E2600AC C1)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c2,Qxwlan E2600AC C2)) +$(eval $(call generate-ipq-wifi-package,sony_ncp-hg100-cellular,Sony NCP-HG100/Cellular)) $(eval $(call generate-ipq-wifi-package,teltonika_rutx,Teltonika RUTX)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-sony_ncp-hg100-cellular.qca4019 b/package/firmware/ipq-wifi/board-sony_ncp-hg100-cellular.qca4019 new file mode 100644 index 0000000000000000000000000000000000000000..6776864de7aa0b6d7da4dfbbeafdd20532974f84 GIT binary patch literal 24340 zcmeHPdr(tX8b1l)p-UHT2#A1}5I~590D)?d@J0-f0-_=T7J&+qNO&3^hA!CgK_MUl zwP1*#Wl$bX5gCgQz+!Ffj57Pj{;{)vw4K@A{;}@Rt~%4s?5^&)2{#FWXoAoNxL-K; zeCOQnJLfyUdr9ui_siWE8|@!`fEN^)_ES&yb57n$?@?0r6slg$+4;ayuCqzf&Q@t#l@21 zyb3rj364dFN&p}>9ft@)~7-x_b*fs^!T5FJMW_VX`% z4;CY?YwO76N30zLYMV9l(t-K~JL$S6G^%bZl4fmfZE0y~p(6lHVk3470Ar6jPwz_V^-|%&6 z>^=5X0>^qkuWrj6~R$F< zB!#+*y$gw?+Ta4x^4qVB-PhgXxBjNpi|5#c%Zkmhfe#_EbQ2MHwn$7IV71KW=?bqM z-dMZW4rE>i{Olsx_+tQIT_fuof2?1d=Xc&~Fe)ca%x0yT*V(u@nkaw(haZ>?00e>U zkO|}tix;FqF<`;!Hfj*e)VR56k~Q;6C+uI`%V1=8cmXbl1fG`y&}og3qCx=hwLt(E za4ES~2p~I>H)q4z-d>e-TpSS5vu+T0IciHIlaIg*1k5gzDK;NNxeNtg-~^O6>Ema> zH`l)LZw%Ew+r7Ph%c9QQsdIJe>>NM!Kt^`%ks?`JXID>O|Fx0P@rlVV9(?oI^c^~R zJkzdR*Nin#Mm!U$%7OA@8u2WsD*wr6H{uyk(?K-ovHsCrGpE7&3e=dKadLW2 zVe5rU1InAzUmMcb7b@D-&|c6GH`I;g#;1X}7jXz5<+J$wI1ut81mU7w7MCBgV)xhD zSxwQL*iHyajc3Or$<&?fok#>V^CI?IJO=(bhu3T67ROZneUM4~duj`b1j+X`Z7Mdn zV;``<`1g+14Jw!*o5@bazlUTr95>yXDOffB{SDoDF#VPMdwpX~+YT=1KDhtL)*$~L zMKs1xQS;!ftt>1l8YVmd<1dY)<&SIl@=NmXbtl4p+n^&W!274sXaFm?I5{~1tl(l| z`zvC%burlBpMeC#eiFVJC?v(1(;54d@(ty2w_rKKgrGEdyc2CdjY)_x9?LunI zLK{hj1M4&2lR%9Z84Qh(!SGLH z@OZ)k%yB8eZju5b!z}^gXklr+G9eJ75C{+mY&Zn8{Q0H$_y76l-@pIvyT3qG!oxy$ z!7oc8|K7%mLVoh(AFxlKe?Rv`&A(4Skd~_E?>~R~)7;8)@(KR^{N34I{4VWP3c9Rw6kX=MT33auUf`;4u{TFu?meczA^qN)pMibpJ^6Uy9fr1r&G{<% zc5J#+Q6)_m1blmITCS**<_I{`Hx(D8<$`#Q_w<;uUnUg^IBwW)#_rzp@dePKLm`nK z6tHGTmFH!pqBH?VIj-mvi3G_Uzv<5v?NYHIhC|03CTDznfXYlHO_!$6-d6U=B%=L- zUCP_C3!(~M9ES}ZI;6$8!_#UmL zm?%pf()0`rY4(;Be-oqEeP4jhmf-J1eExqC^iI9vrfCNeeN(K;E52uEKr4ij57J;s@lBRY#^NG4A{9dz9B&|77(V)YiymL*eUJdXNk>zwOb4A4-JkU?Tc^sIzcP!8Y;OI*|fcemUp#V*cc(% zanvDc;9BX$uv4BDw495BdEL>?9+lLb&H>>??itTYhwPTtL+^)(7+KV)v7ySI3V85`o<>-L-XDwiJ}!M|VWPf63p`#+Fw2#f## literal 0 HcmV?d00001 diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds index 0e473534f5..4b9522af92 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds +++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -94,6 +94,11 @@ qxwlan,e2600ac-c2) ucidef_set_led_wlan "wlan2g" "WLAN0" "green:wlan0" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN1" "green:wlan1" "phy1tpt" ;; +sony,ncp-hg100-cellular) + ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" + ucidef_set_led_netdev "wwan" "WWAN" "green:wan-4" "wwan0" + ;; zyxel,nbg6617 |\ zyxel,wre6606) ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy0tpt" diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 040f3ee619..74a1d61d06 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -19,7 +19,8 @@ ipq40xx_setup_interfaces() luma,wrtq-329acn|\ netgear,wac510|\ plasmacloud,pa1200|\ - plasmacloud,pa2200) + plasmacloud,pa2200|\ + sony,ncp-hg100-cellular) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; aruba,ap-303|\ diff --git a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches index a52a33d2f4..2ead17b152 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches @@ -24,6 +24,9 @@ mikrotik,cap-ac) mikrotik,hap-ac3) ucidef_add_gpio_switch "poe_passtrough" "PoE Passthrough" "452" "0" ;; +sony,ncp-hg100-cellular) + ucidef_add_gpio_switch "uart_dbgcon_en" "debug console enable" "427" "1" + ;; zte,mf286d) ucidef_add_gpio_switch "power_btn_block" "Power button blocker" "421" "0" ;; diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 6adf6f23f1..f8d270a659 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -142,6 +142,9 @@ case "$FIRMWARE" in caldata_extract "0:ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 2) ;; + sony,ncp-hg100-cellular) + caldata_extract_mmc "0:ART" 0x1000 0x2f20 + ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x1000 0x2f20 @@ -237,6 +240,9 @@ case "$FIRMWARE" in caldata_extract "0:ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:CONFIG" 0x0) 3) ;; + sony,ncp-hg100-cellular) + caldata_extract_mmc "0:ART" 0x5000 0x2f20 + ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x5000 0x2f20 diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 0fa30db7cf..8a45bb213c 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -194,6 +194,9 @@ platform_do_upgrade() { PART_NAME="inactive" platform_do_upgrade_dualboot_datachk "$1" ;; + sony,ncp-hg100-cellular) + sony_emmc_do_upgrade "$1" + ;; teltonika,rutx10 |\ zte,mf286d) CI_UBIPART="rootfs" diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/sony.sh b/target/linux/ipq40xx/base-files/lib/upgrade/sony.sh new file mode 100644 index 0000000000..8ff9df0fac --- /dev/null +++ b/target/linux/ipq40xx/base-files/lib/upgrade/sony.sh @@ -0,0 +1,91 @@ +. /lib/functions.sh + +update_bootconfig() { + local offset=$1 + local index="$2" + local cfgpart=$(find_mmc_part "0:BOOTCONFIG") + local cur_index + + if [ -z "$cfgpart" ]; then + echo "failed to get the partition: \"0:BOOTCONFIG\"" + return 1 + fi + + cur_index=$(dd if=${cfgpart} bs=1 count=1 skip=$offset 2> /dev/null | hexdump -e '"%d"') + if [ ${index} != ${cur_index} ]; then + echo "updating \"0:BOOTCONFIG\"" + echo -en "\x0${index}" | \ + dd of=${cfgpart} bs=1 count=1 seek=$offset conv=notrunc 2>/dev/null + fi + + # also update 0:BOOTCONFIG1 if exists + cfgpart=$(find_mmc_part "0:BOOTCONFIG1") + [ -z "$cfgpart" ] && return + + cur_index=$(dd if=${cfgpart} bs=1 count=1 skip=$offset 2> /dev/null | hexdump -e '"%d"') + if [ ${index} != ${cur_index} ]; then + echo "updating \"0:BOOTCONFIG1\"" + echo -en "\x0${index}" | \ + dd of=${cfgpart} bs=1 count=1 seek=$offset conv=notrunc 2>/dev/null + fi +} + +### Note ### +# After the commit bad1835f27ec31dbc30060b03cc714212275168a in fstools, +# p17 (label: "rootfs_data") is mounted as a rootfs_data on boot instead +# of the loop device labeled as "rootfs_data" in p15 (label: "rootfs"). +# +# cmdline flag is added to avoid mount "rootfs_data" partition by the +# commit 964d1e3af0e111bad6d393f8a3be702e334c2398 in fstools, but +# NCP-HG100 doesn't use it because it has a large (abount 1.6GB) +# "rootfs_data" partition and the advantage is larger than the +# disadvantages, such as overwriting the stock data in "rootfs_data" +# partition. +sony_emmc_do_upgrade() { + local tar_file=$1 + local kernel_dev + local rootfs_dev + local board_dir + + kernel_dev=$(find_mmc_part "0:HLOS") + rootfs_dev=$(find_mmc_part "rootfs") + rootfs_data_dev=$(find_mmc_part "rootfs_data") + + if [ -z "$kernel_dev" ] || [ -z "$rootfs_dev" ] || [ -z "$rootfs_data_dev" ]; then + echo "The partition name for kernel or rootfs or rootfs_data is not specified or failed to get the mmc device." + exit 1 + fi + + # use first partitions of kernel/rootfs for NCP-HG100 + # - offset 88 (0x58): 0:HLOS (kernel) + # - offset 108 (0x6c): rootfs + update_bootconfig 88 0 || exit 1 + update_bootconfig 108 0 || exit 1 + + board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') + board_dir=${board_dir%/} + + echo "Flashing kernel to ${kernel_dev}" + tar xf $tar_file ${board_dir}/kernel -O > $kernel_dev + + echo "Flashing rootfs to ${rootfs_dev}" + tar xf $tar_file ${board_dir}/root -O > $rootfs_dev + + echo "Format new rootfs_data" + mkfs.ext4 -F -L rootfs_data $rootfs_data_dev + + if [ -e "$UPGRADE_BACKUP" ]; then + mkdir /tmp/new_root + mount -t ext4 $rootfs_data_dev /tmp/new_root && { + echo "Saving configurations to rootfs_data" + cp "$UPGRADE_BACKUP" "/tmp/new_root/$BACKUP_FILE" + umount /tmp/new_root + } + fi + + echo "sysupgrade successful" + + sync + umount -a + reboot -f +} diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-ncp-hg100-cellular.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-ncp-hg100-cellular.dts new file mode 100644 index 0000000000..f1ac5fd52f --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-ncp-hg100-cellular.dts @@ -0,0 +1,631 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +#include "qcom-ipq4019.dtsi" + +#include +#include +#include +#include + +/ { + model = "Sony NCP-HG100/Cellular"; + compatible = "sony,ncp-hg100-cellular"; + + aliases { + led-boot = &led_cloud_green; + led-failsafe = &led_cloud_red; + led-running = &led_cloud_green; + led-upgrade = &led_cloud_green; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyMSM0,115200n8 root=/dev/mmcblk0p15 rootfstype=squashfs,ext4"; + }; + + memory { + device_type = "memory"; + reg = <0x80000000 0x20000000>; + }; + + soc { + tcsr@1949000 { + status = "okay"; + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + status = "okay"; + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + status = "okay"; + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + status = "okay"; + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + dma@7984000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + switch_mac_mode = <0x0>; /* mac mode for RGMII RMII */ + switch_initvlas = <0x0007c 0x54>; /* PORT0_STATUS */ + }; + + edma@c080000 { + status = "okay"; + }; + }; + + keys-repeat { + compatible = "gpio-keys"; + pinctrl-0 = <&keys_pins>; + pinctrl-names = "default"; + autorepeat; + + key-volup { + label = "volume up"; + linux,code = ; + gpios = <&tlmm 39 GPIO_ACTIVE_HIGH>; + linux,input-type = ; + }; + + key-voldown { + label = "volume down"; + linux,code = ; + gpios = <&tlmm 40 GPIO_ACTIVE_HIGH>; + linux,input-type = ; + }; + + key-alexatrigger { + label = "alexa trigger"; + linux,code = ; + gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; + linux,input-type = ; + }; + + key-mute { + label = "mic mute"; + linux,code = ; + gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; + linux,input-type = ; + }; + }; + + keys { + compatible = "gpio-keys"; + + key-reset { + label = "reset"; + gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + key-wps { + label = "setup"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&tlmm { + pinctrl-0 = <&bt_pins>, <&aud_pins>, <&mcu_pins>; + pinctrl-names = "default"; + + /* + * uart0 is shared for debug console and Z-Wave, + * use only for debug console in OpenWrt. + * + * 1: debug console + * 0: Z-Wave + */ + uart0_ctrl_pins: uart0_ctrl_pinmux { + mux { + pins = "gpio15"; + function = "gpio"; + output-high; + }; + }; + + serial_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + /* + * reset pin for Z-Wave + * active-low, >= 20ns + */ + zwave_pins: zwave_pinmux { + mux { + pins = "gpio59"; + function = "gpio"; + output-high; + }; + }; + + serial_1_pins: serial1_pinmux { + mux { + pins = "gpio8", "gpio9", + "gpio10", "gpio11"; + function = "blsp_uart1"; + bias-disable; + }; + }; + + bt_pins: bt_pinmux { + mux_reset { + pins = "gpio66"; + function = "gpio"; + output-high; + }; + + mux_pwr { + pins = "gpio68"; + function = "gpio"; + output-high; + }; + }; + + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + i2c_1_pins: i2c_1_pinmux { + mux { + pins = "gpio12", "gpio13"; + function = "blsp_i2c1"; + bias-disable; + }; + }; + + keys_pins: keys_pinmux { + mux_1 { + pins = "gpio39", "gpio40", "gpio42", "gpio47"; + function = "gpio"; + bias-disable; + }; + + mux_2 { + pins = "gpio2"; + function = "gpio"; + input; + }; + }; + + sd_pins: sd_pins { + mux { + function = "sdio"; + pins = "gpio23", "gpio24", "gpio25", "gpio26", + "gpio28", "gpio29", "gpio30", "gpio31"; + drive-strength = <4>; + }; + + mux_sd_clk { + function = "sdio"; + pins = "gpio27"; + drive-strength = <16>; + }; + + mux_sd7 { + function = "sdio"; + pins = "gpio32"; + drive-strength = <4>; + bias-disable; + }; + }; + + aud_pins: aud_pinmux { + mux { + pins = "gpio48", "gpio49", "gpio50", "gpio51"; + function = "aud_pin"; + }; + }; + + alc1304_pins: alc1304_pinmux { + mux_1 { + pins = "gpio44"; + function = "gpio"; + bias-disable; + }; + + mux_2 { + pins = "gpio45"; + function = "gpio"; + bias-disable; + }; + }; + + cx2902x_reset: cx2902x_pinmux { + mux_1 { + pins = "gpio64"; + function = "gpio"; + bias-disable; + }; + + mux_2 { + pins = "gpio65"; + function = "gpio"; + bias-disable; + }; + }; + + lte_pins: lte_pinmux { + mux_en { + pins = "gpio20"; + function = "gpio"; + output-high; + }; + + mux_reset { + pins = "gpio35"; + function = "gpio"; + input; + }; + }; + + usb3_pins: usb3_pinmux { + mux_en { + pins = "gpio36"; + function = "gpio"; + output-high; + }; + + mux_flt { + pins = "gpio4"; + function = "gpio"; + input; + }; + }; + + mcu_pins: mcu_pinmux { + mux_boot { + pins = "gpio38"; + function = "gpio"; + output-low; + }; + + mux_reset { + pins = "gpio5"; + function = "gpio"; + output-high; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_i2c4 { + /* + * There is no driver for the following devices: + * - CY8C4014LQI@14 : Touch-Sensor for buttons on top + * - MINI54FDE@15 : MCU for Fan/RGB LED/Thermal control + * - ALC5629@18 : I2S/PCM Audio DAC + * - CX20924@41 : Voice Input Processor + */ + pinctrl-0 = <&i2c_1_pins>; + pinctrl-names = "default"; + status = "okay"; + + led-controller@32 { + compatible = "ti,lp55231"; + reg = <0x32>; + clock-mode = /bits/ 8 <0>; + enable-gpio = <&tlmm 1 GPIO_ACTIVE_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + chan-name = "green:wan"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x0>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led@1 { + chan-name = "blue:wan"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x1>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led@2 { + chan-name = "green:lan"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x2>; + color = ; + function = LED_FUNCTION_LAN; + }; + + led@3 { + chan-name = "blue:lan"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x3>; + color = ; + function = LED_FUNCTION_LAN; + }; + + led@4 { + chan-name = "green:wlan-2"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x4>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; + linux,default-trigger = "phy0tpt"; + }; + + led@5 { + chan-name = "blue:wlan-2"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x5>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; + }; + + led@6 { + chan-name = "red:wan"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x6>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led@7 { + chan-name = "red:lan"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x7>; + color = ; + function = LED_FUNCTION_LAN; + }; + + led@8 { + chan-name = "red:wlan-2"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x8>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <2>; + }; + }; + + led-controller@33 { + compatible = "ti,lp55231"; + reg = <0x33>; + clock-mode = /bits/ 8 <0>; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + chan-name = "green:wlan-5"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x0>; + color = ; + function = LED_FUNCTION_WLAN; + linux,default-trigger = "phy1tpt"; + function-enumerator = <5>; + }; + + led@1 { + chan-name = "blue:wlan-5"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x1>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <5>; + }; + + led@2 { + chan-name = "green:wan-4"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x2>; + color = ; + function = LED_FUNCTION_WAN; /* WWAN/LTE/4G */ + function-enumerator = <4>; /* WWAN/LTE/4G */ + }; + + led@3 { + chan-name = "blue:wan-4"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x3>; + color = ; + function = LED_FUNCTION_WAN; /* WWAN/LTE/4G */ + function-enumerator = <4>; /* WWAN/LTE/4G */ + }; + + led_cloud_green: led@4 { + chan-name = "green:power"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x4>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led@5 { + chan-name = "blue:power"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x5>; + color = ; + function = LED_FUNCTION_POWER; + }; + + led@6 { + chan-name = "red:wlan-5"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x6>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <5>; + }; + + led@7 { + chan-name = "red:wan-4"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x7>; + color = ; + function = LED_FUNCTION_WAN; /* WWAN/LTE/4G */ + function-enumerator = <4>; /* WWAN/LTE/4G */ + }; + + led_cloud_red: led@8 { + chan-name = "red:power"; + led-cur = /bits/ 8 <50>; + max-cur = /bits/ 8 <100>; + reg = <0x8>; + color = ; + function = LED_FUNCTION_POWER; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>, <&uart0_ctrl_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_uart2 { + pinctrl-0 = <&serial_1_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 41 GPIO_ACTIVE_LOW>; +}; + +&prng { + status = "okay"; +}; + +&vqmmc { + status = "okay"; +}; + +&sdhci { + status = "okay"; + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + vqmmc-supply = <&vqmmc>; + non-removable; + #address-cells = <1>; + #size-cells = <0>; + + emmc@0 { + compatible = "mmc-card"; + reg = <0>; + }; +}; + +&usb2 { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3 { + status = "okay"; + + pinctrl-0 = <&usb3_pins>, <<e_pins>; + pinctrl-names = "default"; + + dwc3@8a00000 { + #address-cells = <1>; + #size-cells = <0>; + + device@1 { + compatible = "usb1bc7,1900"; + reg = <1>; + }; + }; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "Sony-NCP-HG100-Cellular"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "Sony-NCP-HG100-Cellular"; +}; + +&watchdog { + status = "okay"; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index dfb235c8d5..43244a914c 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1004,6 +1004,19 @@ define Device/qxwlan_e2600ac-c2 endef TARGET_DEVICES += qxwlan_e2600ac-c2 +define Device/sony_ncp-hg100-cellular + $(call Device/FitImage) + DEVICE_VENDOR := Sony + DEVICE_MODEL := NCP-HG100/Cellular + DEVICE_DTS_CONFIG := config@ap.dk04.1-c4 + SOC := qcom-ipq4019 + KERNEL_SIZE := 8192k + IMAGE_SIZE := 128m + DEVICE_PACKAGES := e2fsprogs ipq-wifi-sony_ncp-hg100-cellular \ + kmod-fs-ext4 uqmi +endef +TARGET_DEVICES += sony_ncp-hg100-cellular + define Device/teltonika_rutx10 $(call Device/FitImage) $(call Device/UbiFit) From 0de6a3339f1aadc1de2c9371435e3de239a00645 Mon Sep 17 00:00:00 2001 From: Giammarco Marzano Date: Wed, 14 Sep 2022 14:20:43 +0200 Subject: [PATCH 17/32] ipq40xx: Add ZTE MF289F It's a 4G Cat.20 router used by Vodafone Italy (called Vodafone FWA) and Vodafone DE\T-Mobile PL (called GigaCube). Modem is a MiniPCIe-to-USB based on Snapdragon X24, it supports 4CA aggregation. There are currently two hardware revisions, which differ on the 5Ghz radio: AT1 = QCA9984 5Ghz Radio on PCI-E bus AT2 = IPQ4019 5Ghz Radio inside IPQ4019 like 2.4Ghz Device specification -------------------- SoC Type: Qualcomm IPQ4019 RAM: 256 MiB Flash: 128 MiB SPI NAND (Winbond W25N01GV) ROM: 2MiB SPI Flash (GD25Q16) Wireless 2.4 GHz (IP4019): b/g/n, 2x2 Wireless 5 GHz: (QCA9984): a/n/ac, 4x4 HW REV AT1 (IPA4019): a/n/ac, 2x2 HW REV AT2 Ethernet: 2xGbE (WAN/LAN1, LAN2) USB ports: No Button: 2 (Reset/WPS) LEDs: 3 external leds: Network (white or red), Wifi, Power and 1 internal (blue) Power: 12 VDC, 1 A Connector type: Barrel Bootloader: U-Boot Installation ------------ 1. Place OpenWrt initramfs image for the device on a TFTP in the server's root. This example uses Server IP: 192.168.0.2 2. Connect serial console (115200,8n1) to serial connector GND (which is right next to the thing with MF289F MIMO-V1.0), RX, TX (refer to this image: https://ibb.co/31Gngpr). 3. Connect TFTP server to RJ-45 port (WAN/LAN1). 4. Stop in u-Boot (using ESC button) and run u-Boot commands: setenv serverip 192.168.0.2 setenv ipaddr 192.168.0.1 set fdt_high 0x85000000 tftp openwrt-ipq40xx-generic-zte_mf289f-initramfs-fit-zImage.itb bootm $loadaddr 5. Please make backup of original partitions, if you think about revert to stock, specially mtd16 (Web UI) and mtd17 (rootFS). Use /tmp as temporary storage and do: WEB PARITION -------------------------------------- cat /dev/mtd16 > /tmp/mtd16.bin scp /tmp/mtd16.bin root@YOURSERVERIP:/ rm /tmp/mtd16.bin ROOT PARITION -------------------------------------- cat /dev/mtd17 > /tmp/mtd17.bin scp /tmp/mtd17.bin root@YOURSERVERIP:/ rm /tmp/mtd17.bin 6. Login via ssh or serial and remove stock partitions (default IP 192.168.0.1): # this can return an error, if ubi was attached before # or rootfs part was erased before. ubiattach -m 17 # it could return error if rootfs part was erased before ubirmvol /dev/ubi0 -N ubi_rootfs # some devices doesn't have it ubirmvol /dev/ubi0 -N ubi_rootfs_data 7. download and install image via sysupgrade -n (either use wget/scp to copy the mf289f's squashfs-sysupgrade.bin to the device's /tmp directory) sysupgrade -n /tmp/openwrt-...-zte_mf289f-squashfs-sysupgrade.bin Sometimes it could print ubi attach error, but please ignore it if process goes forward. Flash Layout NAND: mtd8: 000a0000 00020000 "fota-flag" mtd9: 00080000 00020000 "0:ART" mtd10: 00080000 00020000 "mac" mtd11: 000c0000 00020000 "reserved2" mtd12: 00400000 00020000 "cfg-param" mtd13: 00400000 00020000 "log" mtd14: 000a0000 00020000 "oops" mtd15: 00500000 00020000 "reserved3" mtd16: 00800000 00020000 "web" mtd17: 01d00000 00020000 "rootfs" mtd18: 01900000 00020000 "data" mtd19: 03200000 00020000 "fota" mtd20: 0041e000 0001f000 "kernel" mtd21: 0101b000 0001f000 "ubi_rootfs" SPI: mtd0: 00040000 00010000 "0:SBL1" mtd1: 00020000 00010000 "0:MIBIB" mtd2: 00060000 00010000 "0:QSEE" mtd3: 00010000 00010000 "0:CDT" mtd4: 00010000 00010000 "0:DDRPARAMS" mtd5: 00010000 00010000 "0:APPSBLENV" mtd6: 000c0000 00010000 "0:APPSBL" mtd7: 00050000 00010000 "0:reserved1" Back to Stock (!!! need original dump taken from initramfs !!!) ------------- 1. Place mtd16.bin and mtd17.bin initramfs image for the device on a TFTP in the server's root. This example uses Server IP: 192.168.0.2 2. Connect serial console (115200,8n1) to serial console connector (refer to the pin-out from above). 3. Connect TFTP server to RJ-45 port (WAN/LAN1). 4. rename mtd16.bin to web.img and mtd17.bin to root_uImage_s 5. Stop in u-Boot (using ESC button) and run u-Boot commands: This will erase RootFS+Web: nand erase 0x1000000 0x800000 nand erase 0x1800000 0x1D00000 This will restore RootFS: tftpboot 0x84000000 ${dir}root_uImage_s nand erase 0x1800000 0x1D00000 nand write $fileaddr 0x1800000 $filesize This will restore Web Interface: tftpboot 0x84000000 ${dir}web.img nand erase 0x1000000 0x800000 nand write $fileaddr 0x1000000 $filesize After first boot on stock firwmare, do a factory reset. Push reset button for 5 seconds so all parameters will be reverted to the one printed on label on bottom of the router Signed-off-by: Giammarco Marzano Reviewed-by: Lech Perczak (Warning: commit message did not conform to UTF-8 - hopefully fixed?, added description of the pin-out if image goes down, reformatted commit message to be hopefully somewhat readable on git-web, redid some of the gpio-buttons & leds DT nodes, etc.) Signed-off-by: Christian Lamparter --- package/firmware/ipq-wifi/Makefile | 4 +- .../ipq-wifi/board-zte_mf289f.qca4019 | Bin 0 -> 24308 bytes .../ipq-wifi/board-zte_mf289f.qca9984 | Bin 0 -> 12204 bytes .../ipq40xx/base-files/etc/board.d/02_network | 5 + .../base-files/etc/board.d/03_gpio_switches | 3 +- .../base-files/lib/upgrade/platform.sh | 6 +- .../arch/arm/boot/dts/qcom-ipq4019-mf289f.dts | 438 ++++++++++++++++++ target/linux/ipq40xx/image/generic.mk | 15 +- 8 files changed, 465 insertions(+), 6 deletions(-) create mode 100644 package/firmware/ipq-wifi/board-zte_mf289f.qca4019 create mode 100644 package/firmware/ipq-wifi/board-zte_mf289f.qca9984 create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-mf289f.dts diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index e76aa9235e..da82e16dde 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -38,7 +38,8 @@ ALLWIFIBOARDS:= \ qxwlan_e2600ac-c1 \ qxwlan_e2600ac-c2 \ sony_ncp-hg100-cellular \ - teltonika_rutx + teltonika_rutx \ + zte_mf289f ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -113,5 +114,6 @@ $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c1,Qxwlan E2600AC C1)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac-c2,Qxwlan E2600AC C2)) $(eval $(call generate-ipq-wifi-package,sony_ncp-hg100-cellular,Sony NCP-HG100/Cellular)) $(eval $(call generate-ipq-wifi-package,teltonika_rutx,Teltonika RUTX)) +$(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-zte_mf289f.qca4019 b/package/firmware/ipq-wifi/board-zte_mf289f.qca4019 new file mode 100644 index 0000000000000000000000000000000000000000..3a4cb8b888cc7e7282b064fce2c0d6e48f562702 GIT binary patch literal 24308 zcmeHPdr(tX8b1j^)WyOLAtK->oQjvu$S|-I;aQcC|b0%8Jt@ka^; z*woR(GO#iIdjJLG0kF{yYXQIjz%dlB(ePY9<8s;9PymF6hJOG2IYr1=2Y&qXxhNvp zzyTI1_x0^sv@?O1P~fqd)=bf>-K!c{nsw`1b1a9!i*B?yW=sXK&cs(h6 z;v;Av#SQx4AjMfJ0zWuhYfVX3x*&MQz<0iXKhvs#@-toLA0`dv<6*e98c;I4vX!On zZOX3-FZ9iDPnm2ht4oma4m!t<50rK!obfAj$?F)*?g&4_DtF57Ys{C27x?Vmnsl$_ zXzgxEK(=$_XZxxs46{SY9_HcGv4OgIylIy@!u-I9~A2o9*f8#r9;gGid9HYZAg2vRr-yGBeXt z*=!Fu(GNd7|8{yBy8;q$y}h)$|9<<2Z*+B7$F25uR2uDnu%81wVRQB`UOfMow(oL# zT`~l(N8ltSb-G6X9ybvMUWUY1_?n! zkP`Xvx|8oVx3w><0O5?>Gpj;J={)*lI^v4D@?1rZs3YQn#-g#j*vGL*GMdaw7Dc1c zNFvHd`8@t(KC%ZjMi-g?`y{Z10x5s~XZx-b)mnj~0VfL;o*} z)vbnWQgRKZoP81{5+x%DkXyqDF!R)F5~X(UtU|Fr~8GWK(@&W?_0{s0rEYvz{&^dp9KOg9ymDZqpGyYj+ z&5E|7L06&y0-V0#)&md%d>|9Z1163mjLyJ>l`ZrT7^!i0C!#e(c>(GdYT4|ZHVzO9 zDB$~J0OYMh0M(hgF$b28j(CvKpbw;Sbt3R`*q%Y99)b}F7+t2)*1r$s3KU|sV^Ef& z6J^3T*PhWYjFrAV-ke`DX(M;qSe-UHC)%?wGbis*v9jetdsk2I^`YU>vGGqHe(}Wo z13Ga$^R8T1OmBe4K}GZiA`*(nKt-_)L=+T{e~S1GLvVC<6 z&i;1pfoSAG-nLymtl<3ZSG0V4ytyFbikFRVe^Y-lJ-)sEVIyrVWgO$Z8{^xfh_0!Y z_ine&#+EkAd5T=VQ z*4P)?uou2T%U!78+V3cMIt|OyUsFIehYALUs9^9rDtIzx1D*+K zz+s#QqITH=#M#Dn=BHhjafBR&M1VwK4Iwbcmp8<>|Igq5^7U6={T||><=|s{`lysha})hcqu0?jSeMMbGNLExs=ll2kX9xp`nhSw zRPW&~d0;Nxf8fUjaH-wub1Jzq54xmMol=%6#OfQWZmBFWMi4Z0SAA7kBRwE+)f#Yp zur;)*jw_24sqo-sWwmsVI0!n@p^%GH1l*}x>PyNpX<8x&Gx%hZ3sJhM=}?s`a~1JZ zWAI?PB1f7G-Mj*^j258qXqT!=8ke{QH+TrwV2)Vfr9SDBDJPIbiA2c=0;^$b7+D&r zUb6_aj~u-gbs@09t@4Wc*PZd_d~3HHt+<$Ql3VIpV4rZmxA5#Ph1cQD;wvK+*J9g( z8rW4ExF3!{oR7|9<_97Lw{};|1>J6 z7mQsmy%_xtw~W63!GNSKs^05}OK$Dp{>y<4u9dIk4-8j*5Z&xoySZ4|nR+Uu!ui0a z-M9M-T6fm5-g3_V^tNIkt<(1eQ>MNlzZ%iVuB0Dq>_|HuR_P+PPrNyJ@IAph9x~_L zKDDGf{v1n={7%@uQEpNrT+Ymm?qD1dhUfj$tB@wuX3lHv&{$I z4wJI8>CqztLHVu;#=79>WcJ0!RGm8{Xa=_y?c7 z!SeF-WP4@+t9kmyLM}W(w_k6uSpC8|2)g|Si_KvGeo{puU=V=?bo&>2-ApBWSh}B{ z8*8okb9{S__E9kI?yeY<89sK#)zyX6tsV@lf4@VXJ!C>*T>D-~9pc!-1X(cAkbl3i zms^jek0wa4Zr`Sy6MYq1&0w_hxBq@C3wU`ou`7{^{$Z?y|tqGKfA-qN3v=8gA%FoqY> literal 0 HcmV?d00001 diff --git a/package/firmware/ipq-wifi/board-zte_mf289f.qca9984 b/package/firmware/ipq-wifi/board-zte_mf289f.qca9984 new file mode 100644 index 0000000000000000000000000000000000000000..0422bc852feebf5bd70cbe74e8c6ade6a0515be2 GIT binary patch literal 12204 zcmeHMdr(u^89%v63<^qah$zTj-ac527+63JAV|@XyBaNn#v&44Vl+y_V^MH%2^7{1 zY>EaS+aMLfMi)}BxM3GH5kX`|nf}okce<_9cBX%>Gu?J}ZO7*JoSWPb1GwO7i%z~T z=bYd9&i6R?yBF>~=j_^&x;8ay+xnQywP`z3cc%lTQVAew*P$AKTv+le%92V84nAR-&k zdLTA7_MhK=%aRBe0E(hgn8Fs$VEDu0uiaI&_DIM-<%kLZ%OP}EcJ_T~l$s6z-@#D8 zM?y45)Dk$V8A=gyxm-4z&0?`&Z6^Q*C^Rl)bGQqhR~&jscM)q1wh&ynun2C|v9iqN;VgTA*FaV5x0afUf_fQrm2H=DX2H>Z3FNEs1 zU9){-ql1Bs)JE#jf9x25SgMWIIZpk-_O&hBVVz6mQb!#60HjhRE$327o6=TG<8$bl-az2XZ=ag3_MSmLAwEt!?Q+1r0>IP*l|Fl>~tV^A9;M!Uf<2j;9i- z_v$2DGTxog?2oW;I>Ws1^Cr0u5Px{WoVRM)6ebqi$ z!V^duo%Un!&}zP{t5#*p#AA0%y_yC^0W`Q{>eAFGWYRcjV1NcPS-jI=V$@{NsZ}|$ zc*|YGXBv&-pfnYk>NKh%S<1wi$*B8<>VRwmGWZBZFc0gy)D4Qm(sc7}gyj3TC7DL_ zz10o!;%ynGJGxF)jVwEHJsqL#m(aip{hn47N+o8izC(Qqq9pUE-k@$oPE1z4QQf3a zN;8}W7OUa1rdF{>y3Rai=-0HUl(L_|$r&|`iUZOF%dnvfCL%`~=P=NMv0>9yU0rpa zJjHw$8Z@g8%Xe8u3af? zU6{;ntuosP^IPxqNWq|_d(Aoj59-Z7yAperP~)Y8!=?T2c1AU?s5agx`E09xRpass z)7_Ip?_Le6$5ov}M|&mbA{zXEe(Ktuu9%jf8h**p&5E9#?Qb^*R<@1iUQadzYXm25 z-%Y!;O5^{Y??L^IlHPb-h#FUZGI-D!rwy**A8a323?+1hXz}X1_qKLLX_r^?kC;aG z_a*nggqR8p3s~{i zvkNo2ht>FU-(DJOkC7f z1!(zN{)5Gs7v|;a->xt84T9_{e+s^X3_#SsD2ge^*cgSu{YBLGvDwQ_xPAFOd@_&> zU8C+PMIo6HUNR#?@_*Be(4@~pY!1b7^XJQj`=@UHSS%Yr8=uTPP+P#BoF6lnB-VCT zlOrypJA`#WJ_afv1JH~87UD+GfTjV4u{u~ErLmF5@56a_LB0&SA;S}RYyfKoZIBW5 zVMwL{TI@XJB`h2=08LmE7Qn(F|6>Z#W|I}vo)x`py;%i)c}iM3=XET^FVE|Xdm?j6 zGy@L+fNd4rHhbXShCvD;h@imb9`xcl2nu9u=Nl3sie3$G?)*eA{$zVBU-t}9eLg}C zrx5HtZyZJEn&%+>8WM9|gOGlVjPdiTT5>P^=h`taK2y7DWn{$vv)E7W>}PfM(>YR_ zwKpfPutcLhd;V7)UB;fifx(-%N5>z`eZb`$Z*E_%uZ=dK&p}B+6LS(upMjETP0T4M zef~*`o0t>OxhHW(i#I>JugzodW=(W9XU03SbBkNr+Ph7kTgGO>Z&p?&uSRGS;z2}^ zD2Nn-bXz)35~PSE(?Ogq4wn!Tk%WwUY3u9BsB=O7Vt. +// Copyright (c) 2022, Giammarco Marzano . + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + model = "ZTE MF289F"; + compatible = "zte,mf289f"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + chosen { + /* + * bootargs forced by u-boot bootipq command: + * 'ubi.mtd=rootfs root=mtd:ubi_rootfs rootfstype=squashfs rootwait' + */ + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + /* + * This node is used to restart modem module to avoid anomalous + * behaviours on initial communication. + */ + gpio-restart { + compatible = "gpio-restart"; + gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led-0 { + label = "blue:power"; + function = LED_FUNCTION_POWER; + color = ; + gpios = <&tlmm 10 GPIO_ACTIVE_LOW>; + }; + + led-1 { + function = LED_FUNCTION_WLAN; + color = ; + gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + key-reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + }; + + key-wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 68 GPIO_ACTIVE_LOW>; + }; + }; + + soc { + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; +}; + +&prng { + status = "okay"; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; + reset-delay-us = <2000>; +}; + +&watchdog { + status = "okay"; +}; + +&blsp_dma { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>, + <&tlmm 54 GPIO_ACTIVE_HIGH>; + + flash@0 { + compatible = "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "0:APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0xf0000 0xc0000>; + read-only; + }; + + partition@1b0000 { + label = "0:reserved1"; + reg = <0x1b0000 0x50000>; + read-only; + }; + }; + }; + + spi-nand@1 { /* flash@1 ? */ + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "fota-flag"; + reg = <0x0 0xa0000>; + read-only; + }; + + partition@a0000 { + label = "ART"; + reg = <0xa0000 0x80000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + + partition@120000 { + label = "mac"; + reg = <0x120000 0x80000>; + read-only; + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mac_0: macaddr@0 { + reg = <0x0 0x6>; + }; + }; + + partition@1a0000 { + label = "reserved2"; + reg = <0x1a0000 0xc0000>; + read-only; + }; + + partition@260000 { + label = "cfg-param"; + reg = <0x260000 0x400000>; + read-only; + }; + + partition@660000 { + label = "log"; + reg = <0x660000 0x400000>; + }; + + partition@a60000 { + label = "oops"; + reg = <0xa60000 0xa0000>; + }; + + partition@b00000 { + label = "reserved3"; + reg = <0xb00000 0x500000>; + read-only; + }; + + partition@1000000 { + label = "web"; + reg = <0x1000000 0x800000>; + }; + + partition@1800000 { + label = "rootfs"; + reg = <0x1800000 0x1d00000>; + }; + + partition@3500000 { + label = "data"; + reg = <0x3500000 0x1900000>; + }; + + partition@4e00000 { + label = "fota"; + reg = <0x4e00000 0x3200000>; + }; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&gmac0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_mac_0>; +}; + +&gmac1 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_mac_0>; + mac-address-increment = <1>; +}; + + +&qpic_bam { + status = "okay"; +}; + +&tlmm { + i2c_0_pins: i2c_0_pinmux { + mux { + pins = "gpio20", "gpio21"; + function = "blsp_i2c0"; + bias-disable; + }; + }; + + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + serial_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio12", "gpio54"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_1000>, <&macaddr_mac_0>; + mac-address-increment = <2>; + qcom,ath10k-calibration-variant = "zte,mf289f"; +}; + +/* This node is used only on AT2 version for 5Ghz on IPQ4019 with board-id=21 */ +&wifi1 { + status = "okay"; + nvmem-cell-names = "pre-calibration", "mac-address"; + nvmem-cells = <&precal_art_5000>, <&macaddr_mac_0>; + mac-address-increment = <3>; + qcom,ath10k-calibration-variant = "zte,mf289f"; +}; + +/* This node is used only on AT1 version for 5Ghz on QCA9984 */ +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 40 GPIO_ACTIVE_LOW>; + clkreq-gpio = <&tlmm 39 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi2: wifi@1,0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_mac_0>; + mac-address-increment = <4>; + compatible = "qcom,ath10k"; + reg = <0x00010000 0 0 0 0>; + qcom,ath10k-calibration-variant = "zte,mf289f"; + }; + }; +}; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 43244a914c..81cc83e28f 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1060,10 +1060,9 @@ define Device/unielec_u4019-32m endef TARGET_DEVICES += unielec_u4019-32m -define Device/zte_mf286d +define Device/zte_mf28x_common $(call Device/FitzImage) DEVICE_VENDOR := ZTE - DEVICE_MODEL := MF286D SOC := qcom-ipq4019 DEVICE_DTS_CONFIG := config@ap.dk04.1-c1 BLOCKSIZE := 128k @@ -1071,8 +1070,20 @@ define Device/zte_mf286d KERNEL_IN_UBI := 1 DEVICE_PACKAGES := kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi endef + +define Device/zte_mf286d + $(call Device/zte_mf28x_common) + DEVICE_MODEL := MF286D +endef TARGET_DEVICES += zte_mf286d +define Device/zte_mf289f + $(call Device/zte_mf28x_common) + DEVICE_MODEL := MF289F + DEVICE_PACKAGES += ipq-wifi-zte_mf289f ath10k-firmware-qca9984-ct +endef +TARGET_DEVICES += zte_mf289f + define Device/zyxel_nbg6617 $(call Device/FitImageLzma) DEVICE_VENDOR := ZyXEL From 355c02d963c20d5f32d5759a1cffa149d1a36162 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 3 Aug 2022 16:22:12 +0200 Subject: [PATCH 18/32] linux/x86: add missing CONFIG_WATCHDOG_CORE to *-wdt The packages also need a dependency to watchdog core. This commit adds the needed WATCHDOG_CORE dependency. https://github.com/torvalds/linux/blob/master/drivers/watchdog/Kconfig Signed-off-by: Florian Eckert --- target/linux/x86/modules.mk | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/target/linux/x86/modules.mk b/target/linux/x86/modules.mk index 28cb276f7e..3173cf9e84 100644 --- a/target/linux/x86/modules.mk +++ b/target/linux/x86/modules.mk @@ -39,7 +39,9 @@ define KernelPackage/f71808e-wdt SUBMENU:=$(OTHER_MENU) TITLE:=Fintek F718xx/F818xx Watchdog Timer DEPENDS:=@TARGET_x86 - KCONFIG:=CONFIG_F71808E_WDT + KCONFIG:=\ + CONFIG_F71808E_WDT \ + CONFIG_WATCHDOG_CORE=y FILES:=$(LINUX_DIR)/drivers/watchdog/f71808e_wdt.ko AUTOLOAD:=$(call AutoProbe,f71808e-wdt,1) endef @@ -123,8 +125,10 @@ define KernelPackage/itco-wdt SUBMENU:=$(OTHER_MENU) TITLE:=Intel iTCO Watchdog Timer DEPENDS:=@TARGET_x86 - KCONFIG:=CONFIG_ITCO_WDT \ - CONFIG_ITCO_VENDOR_SUPPORT=y + KCONFIG:=\ + CONFIG_ITCO_WDT \ + CONFIG_ITCO_VENDOR_SUPPORT=y \ + CONFIG_WATCHDOG_CORE=y FILES:=$(LINUX_DIR)/drivers/watchdog/iTCO_wdt.ko \ $(LINUX_DIR)/drivers/watchdog/iTCO_vendor_support.ko AUTOLOAD:=$(call AutoLoad,50,iTCO_vendor_support iTCO_wdt,1) @@ -178,7 +182,9 @@ define KernelPackage/w83627hf-wdt SUBMENU:=$(OTHER_MENU) TITLE:=Winbond 83627HF Watchdog Timer DEPENDS:=@TARGET_x86 - KCONFIG:=CONFIG_W83627HF_WDT + KCONFIG:=\ + CONFIG_W83627HF_WDT \ + ONFIG_WATCHDOG_CORE=y FILES:=$(LINUX_DIR)/drivers/watchdog/w83627hf_wdt.ko AUTOLOAD:=$(call AutoLoad,50,w83627hf-wdt,1) endef From fea1705819a9cfae484e9244abf55361361a0075 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 5 Aug 2022 11:58:26 +0200 Subject: [PATCH 19/32] x86/config-5.15: geode: add missing CONFIG_WATCHDOG_CORE option If this module is not set to y, then I get the following compilation error during geode build. Package kmod-w83627hf-wdt is missing dependencies for the following libraries: watchdog.ko Setting the linux CONFIG_WATCHDOG_CORE to y as in all other targets fixes this issue. Signed-off-by: Florian Eckert --- target/linux/x86/geode/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/x86/geode/config-5.15 b/target/linux/x86/geode/config-5.15 index 8b5bf266d7..2ede23ea5e 100644 --- a/target/linux/x86/geode/config-5.15 +++ b/target/linux/x86/geode/config-5.15 @@ -131,6 +131,7 @@ CONFIG_SERIAL_MCTRL_GPIO=y # CONFIG_USB_UHCI_HCD is not set CONFIG_VIA_RHINE=y CONFIG_VIA_RHINE_MMIO=y +CONFIG_WATCHDOG_CORE=y # CONFIG_WDT is not set # CONFIG_WIRELESS_HOTKEY is not set # CONFIG_X86_ACPI_CPUFREQ is not set From 99b6e3cb41826cb920ddf06ee4ad447d71effc12 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Tue, 19 Oct 2021 16:15:08 +0200 Subject: [PATCH 20/32] x86/config-5.10: geode: add missing CONFIG_WATCHDOG_CORE option If this module is not set to y, then I get the following compilation error during geode build. Package kmod-w83627hf-wdt is missing dependencies for the following libraries: watchdog.ko Setting the linux CONFIG_WATCHDOG_CORE to y as in all other targets fixes this issue. Signed-off-by: Florian Eckert --- target/linux/x86/geode/config-5.10 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/x86/geode/config-5.10 b/target/linux/x86/geode/config-5.10 index 07c9b050d3..579f316914 100644 --- a/target/linux/x86/geode/config-5.10 +++ b/target/linux/x86/geode/config-5.10 @@ -123,6 +123,7 @@ CONFIG_SERIAL_MCTRL_GPIO=y # CONFIG_USB_UHCI_HCD is not set CONFIG_VIA_RHINE=y CONFIG_VIA_RHINE_MMIO=y +CONFIG_WATCHDOG_CORE=y # CONFIG_WDT is not set # CONFIG_X86_ACPI_CPUFREQ is not set CONFIG_X86_ALIGNMENT_16=y From a67f484e67b1d0930cb4b10b9e3787ecf7e71579 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 11 Sep 2022 13:52:31 +0200 Subject: [PATCH 21/32] octeon: fix imagebuilder generation by introducing generic target The generic imagebuilder does not have a generic in the name, although this is the default naming scheme. Use bcm53xx as template for this fix. Before the fix: openwrt-imagebuilder-octeon.Linux-x86_64.tar.xz After: openwrt-imagebuilder-octeon-generic.Linux-x86_64.tar.xz Signed-off-by: Nick Hainke --- target/linux/octeon/generic/target.mk | 1 + target/linux/octeon/profiles/000-Generic.mk | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 target/linux/octeon/generic/target.mk diff --git a/target/linux/octeon/generic/target.mk b/target/linux/octeon/generic/target.mk new file mode 100644 index 0000000000..f5cb1fb19b --- /dev/null +++ b/target/linux/octeon/generic/target.mk @@ -0,0 +1 @@ +BOARDNAME:=Generic diff --git a/target/linux/octeon/profiles/000-Generic.mk b/target/linux/octeon/profiles/000-Generic.mk index 6d5aa4e2bd..b7261cd355 100644 --- a/target/linux/octeon/profiles/000-Generic.mk +++ b/target/linux/octeon/profiles/000-Generic.mk @@ -2,13 +2,12 @@ # # Copyright (C) 2013 OpenWrt.org -define Profile/Default - NAME:=Default Profile - PRIORITY:=1 +define Profile/Generic + NAME:=Octeon SoC endef -define Profile/Default/Description +define Profile/Generic/Description Base packages for Octeon boards. endef -$(eval $(call Profile,Default)) +$(eval $(call Profile,Generic)) From d391236269314a759acb7dfb7ec01ccaa0e0b32c Mon Sep 17 00:00:00 2001 From: Bradford Zhang Date: Wed, 14 Sep 2022 07:54:04 +0800 Subject: [PATCH 22/32] download.pl: add aria2c support Use aria2c download tool by default on package download if available in the system. aria2c permits to use multiple mirrors and may improve download speed on special context where servers are hard to reach. Co-authored-by: Christian Marangi Signed-off-by: Bradford Zhang [ fix wrong var in the script and improve commit description ] Signed-off-by: Christian Marangi --- scripts/download.pl | 51 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/scripts/download.pl b/scripts/download.pl index 33e1e12c1e..4dec985fd1 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -70,27 +70,52 @@ sub hash_cmd() { return undef; } -sub download_cmd($) { +sub download_cmd { my $url = shift; my $have_curl = 0; + my $have_aria2c = 0; + my $filename = shift; + my @additional_mirrors = @_; + my $mirrors_url = "'$url'"; - if (open CURL, "curl --version 2>/dev/null |") { + my @chArray = ('a'..'z', 'A'..'Z', 0..9); + my $rfn = join '', map{ $chArray[int rand @chArray] } 0..9; + if (open CURL, '-|', 'curl', '--version') { if (defined(my $line = readline CURL)) { $have_curl = 1 if $line =~ /^curl /; } close CURL; } + if (open ARIA2C, '-|', 'aria2c', '--version') { + if (defined(my $line = readline ARIA2C)) { + $have_aria2c = 1 if $line =~ /^aria2 /; + } + close ARIA2C; + } - return $have_curl - ? (qw(curl -f --connect-timeout 20 --retry 5 --location), + for my $mirror (@additional_mirrors ) { + $mirrors_url = $mirrors_url ." '$mirror /$filename'"; + } + + if ($have_aria2c) { + return join(" ", "touch /dev/shm/${rfn}_spp;", + qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $mirrors_url , + $check_certificate ? () : '--check-certificate=false', + "--server-stat-of=/dev/shm/${rfn}_spp", + "--server-stat-if=/dev/shm/${rfn}_spp", + "-d /dev/shm -o $rfn;", + "cat /dev/shm/$rfn;", "rm /dev/shm/$rfn /dev/shm/${rfn}_spp"); + } elsif ($have_curl) { + return (qw(curl -f --connect-timeout 20 --retry 5 --location), $check_certificate ? () : '--insecure', shellwords($ENV{CURL_OPTIONS} || ''), - $url) - : (qw(wget --tries=5 --timeout=20 --output-document=-), + $url); + } else { + return (qw(wget --tries=5 --timeout=20 --output-document=-), $check_certificate ? () : '--no-check-certificate', shellwords($ENV{WGET_OPTIONS} || ''), - $url) - ; + $url); + } } my $hash_cmd = hash_cmd(); @@ -100,6 +125,7 @@ sub download { my $mirror = shift; my $download_filename = shift; + my @additional_mirrors = @_; $mirror =~ s!/$!!; @@ -146,9 +172,9 @@ sub download } }; } else { - my @cmd = download_cmd("$mirror/$download_filename"); + my @cmd = download_cmd("$mirror/$download_filename", $download_filename, @additional_mirrors); print STDERR "+ ".join(" ",@cmd)."\n"; - open(FETCH_FD, '-|', @cmd) or die "Cannot launch curl or wget.\n"; + open(FETCH_FD, '-|', @cmd) or die "Cannot launch aria2c, curl or wget.\n"; $hash_cmd and do { open MD5SUM, "| $hash_cmd > '$target/$filename.hash'" or die "Cannot launch $hash_cmd.\n"; }; @@ -296,10 +322,11 @@ while (!-f "$target/$filename") { my $mirror = shift @mirrors; $mirror or die "No more mirrors to try - giving up.\n"; - download($mirror, $url_filename); + download($mirror, $url_filename, @mirrors); if (!-f "$target/$filename" && $url_filename ne $filename) { - download($mirror, $filename); + download($mirror, $filename, @mirrors); } + @mirrors=(); } $SIG{INT} = \&cleanup; From 50d0b41b38440fa5c6b87bebc229296667851b26 Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Fri, 23 Sep 2022 08:26:51 -0300 Subject: [PATCH 23/32] wolfssl: ABI version shouldn't depend on benchmark Move CONFIG_PACKAGE_libwolfssl-benchmark from the top of PKG_CONFIG_DEPENDS to after PKG_ABI_VERSION is set. This avoids changing the ABI version hash whether the bnechmark package package is selected or not. Fixes: 05df135cac (wolfssl: Rebuild when libwolfssl-benchmark gets changes) Signed-off-by: Eneas U de Queiroz --- package/libs/wolfssl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index def3f657c1..71379736f0 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -25,7 +25,6 @@ PKG_MAINTAINER:=Eneas U de Queiroz PKG_CPE_ID:=cpe:/a:wolfssl:wolfssl PKG_CONFIG_DEPENDS:=\ - CONFIG_PACKAGE_libwolfssl-benchmark \ CONFIG_WOLFSSL_HAS_AES_CCM \ CONFIG_WOLFSSL_HAS_ARC4 \ CONFIG_WOLFSSL_HAS_CERTGEN \ @@ -44,6 +43,7 @@ PKG_CONFIG_DEPENDS:=\ PKG_ABI_VERSION:=$(patsubst %-stable,%,$(PKG_VERSION)).$(call version_abbrev,$(call confvar,$(PKG_CONFIG_DEPENDS))) PKG_CONFIG_DEPENDS+=\ + CONFIG_PACKAGE_libwolfssl-benchmark \ CONFIG_WOLFSSL_HAS_AFALG \ CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES \ CONFIG_WOLFSSL_HAS_DEVCRYPTO_CBC \ From d08c9da43cf364712e947d5faa3ab84d995dd0ec Mon Sep 17 00:00:00 2001 From: Eneas U de Queiroz Date: Fri, 23 Sep 2022 08:43:59 -0300 Subject: [PATCH 24/32] wolfssl: prefer regular libwolfssl over cpu-crypto Rename libwolfssl-cpu-crypto to libwolfsslcpu-crypto so that the regular libwolfssl version comes first when running: opkg install libwolfssl Normally, if the package name matches the opkg parameter, that package is preferred. However, for libraries, the ABI version string is appended to the package official name, and the short name won't match. Failing a name match, the candidate packages are sorted in alphabetical order, and a dash will come before any number. So in order to prefer the original library, the dash should be removed from the alternative library. Fixes: c3e7d86d2b (wolfssl: add libwolfssl-cpu-crypto package) Signed-off-by: Eneas U de Queiroz --- package/libs/wolfssl/Config.in | 4 ++-- package/libs/wolfssl/Makefile | 22 +++++++++++----------- package/libs/wolfssl/preinst.arm-ce | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package/libs/wolfssl/Config.in b/package/libs/wolfssl/Config.in index af9ba923fe..a212d1fb8a 100644 --- a/package/libs/wolfssl/Config.in +++ b/package/libs/wolfssl/Config.in @@ -67,8 +67,8 @@ config WOLFSSL_HAS_DEVCRYPTO bool if PACKAGE_libwolfssl - if PACKAGE_libwolfssl-cpu-crypto - comment "Hardware Acceleration does not apply to libwolfssl-cpu-crypto" + if PACKAGE_libwolfsslcpu-crypto + comment "Hardware Acceleration does not apply to libwolfsslcpu-crypto" endif choice prompt "Hardware Acceleration" diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile index 71379736f0..d090dd5780 100644 --- a/package/libs/wolfssl/Makefile +++ b/package/libs/wolfssl/Makefile @@ -67,7 +67,7 @@ $(call Package/libwolfssl/Default) ABI_VERSION:=$(PKG_ABI_VERSION) VARIANT:=regular DEFAULT_VARIANT:=1 - CONFLICTS:=libwolfssl-cpu-crypto + CONFLICTS:=libwolfsslcpu-crypto endef define Package/libwolfssl/description @@ -79,7 +79,7 @@ define Package/libwolfssl/config source "$(SOURCE)/Config.in" endef -define Package/libwolfssl-cpu-crypto +define Package/libwolfsslcpu-crypto $(call Package/libwolfssl/Default) TITLE:=wolfSSL library with AES CPU instructions PROVIDES:=libwolfssl libcyassl @@ -94,20 +94,20 @@ $(call Package/libwolfssl/Default) DEPENDS:=libwolfssl endef -define Package/libwolfssl-cpu-crypto/description +define Package/libwolfsslcpu-crypto/description $(call Package/libwolfssl/description) This variant uses AES CPU instructions (Intel AESNI or ARMv8 Crypto Extension) endef -define Package/libwolfssl-cpu-crypto/config - if TARGET_armvirt && PACKAGE_libwolfssl-cpu-crypto = y - comment "You are about to build libwolfssl-cpu-crypto into an armvirt_64 image." +define Package/libwolfsslcpu-crypto/config + if TARGET_armvirt && PACKAGE_libwolfsslcpu-crypto = y + comment "You are about to build libwolfsslcpu-crypto into an armvirt_64 image." comment "Ensure all of your installation targets support the Crypto Extension. " comment "Look for the 'aes' feature in /proc/cpuinfo. This library does not do " comment "run-time detection and will crash if the CPU does not support it. " endif - if TARGET_bcm27xx && PACKAGE_libwolfssl-cpu-crypto - comment "Beware that libwolfssl-cpu-crypto will not run in a bcm27xx target. " + if TARGET_bcm27xx && PACKAGE_libwolfsslcpu-crypto + comment "Beware that libwolfsslcpu-crypto will not run in a bcm27xx target. " endif endef @@ -161,7 +161,7 @@ else ifdef CONFIG_aarch64 CONFIGURE_ARGS += --enable-armasm TARGET_CFLAGS:=$(TARGET_CFLAGS:-mcpu%=-mcpu%+crypto) WOLFSSL_NOASM_REGEX:=^bcm27xx/.* - Package/libwolfssl-cpu-crypto/preinst=\ + Package/libwolfsslcpu-crypto/preinst=\ $(subst @@WOLFSSL_NOASM_REGEX@@,$(WOLFSSL_NOASM_REGEX),$(file &2 -printf "[libwolfssl-cpu-crypto] Checking for Arm v8-A Cryptographic Extension support: " +printf "[libwolfsslcpu-crypto] Checking for Arm v8-A Cryptographic Extension support: " if [ -n "${IPKG_INSTROOT}" ]; then printf "...[offline]... " eval "$(grep '^DISTRIB_TARGET=' "${IPKG_INSTROOT}/etc/openwrt_release")" @@ -8,14 +8,14 @@ if [ -n "${IPKG_INSTROOT}" ]; then echo "${DISTRIB_TARGET}" | grep '@@WOLFSSL_NOASM_REGEX@@' > /dev/null && { echo "not supported" echo "Error: Target ${DISTRIB_TARGET} does not support Arm Cryptographic Extension." - echo "Install the regular libwolfssl package instead of libwolfssl-cpu-crypto." + echo "Install the regular libwolfssl package instead of libwolfsslcpu-crypto." exit 1 } else grep -q '^Features.*\baes\b' /proc/cpuinfo || { echo "not supported" echo "Error: Arm v8-A Cryptographic Extension not supported." - echo "Install the regular libwolfssl package instead of libwolfssl-cpu-crypto." + echo "Install the regular libwolfssl package instead of libwolfsslcpu-crypto." echo "Contents of /proc/cpuinfo:" cat /proc/cpuinfo exit 1 From 295e0ed7a9fee59c1bb6dd80179109c634578425 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 25 Sep 2022 15:54:12 +0200 Subject: [PATCH 25/32] scripts/download.pl: fix whitespace in mirror urls and drop for Fix whitespace in mirror urls and replace for loop with join+map logic. Fixes: d39123626931 ("download.pl: add aria2c support") Signed-off-by: Christian Marangi --- scripts/download.pl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/download.pl b/scripts/download.pl index 4dec985fd1..50dca2335e 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -75,8 +75,7 @@ sub download_cmd { my $have_curl = 0; my $have_aria2c = 0; my $filename = shift; - my @additional_mirrors = @_; - my $mirrors_url = "'$url'"; + my $additional_mirrors = join(" ", map "$_/$filename", @_); my @chArray = ('a'..'z', 'A'..'Z', 0..9); my $rfn = join '', map{ $chArray[int rand @chArray] } 0..9; @@ -93,13 +92,9 @@ sub download_cmd { close ARIA2C; } - for my $mirror (@additional_mirrors ) { - $mirrors_url = $mirrors_url ." '$mirror /$filename'"; - } - if ($have_aria2c) { return join(" ", "touch /dev/shm/${rfn}_spp;", - qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $mirrors_url , + qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $url, $additional_mirrors, $check_certificate ? () : '--check-certificate=false', "--server-stat-of=/dev/shm/${rfn}_spp", "--server-stat-if=/dev/shm/${rfn}_spp", From 6e9613844ca1ddea7e36abc44a513c89ef0598ff Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 25 Sep 2022 16:04:58 +0200 Subject: [PATCH 26/32] mt76: fix compilation error with mt7915 and kernel >= 5.15.61 With kernel 5.15.61 the define IEEE80211_MAX_AMPDU_BUF got changed to IEEE80211_MAX_AMPDU_BUF_HE. Add patch to fix compilation error on next 5.15 kernel versions. Signed-off-by: Christian Marangi --- ...changed-IEEE80211_MAX_AMPDU_BUF-defi.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch diff --git a/package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch b/package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch new file mode 100644 index 0000000000..885c0aee04 --- /dev/null +++ b/package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch @@ -0,0 +1,38 @@ +From 2994307fe092a9627e12ad7cd9f32f4d36c201d8 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Sun, 25 Sep 2022 15:58:37 +0200 +Subject: [PATCH] mt76: mt7915: fix changed IEEE80211_MAX_AMPDU_BUF define in + new kernel + +New kernel use IEEE80211_MAX_AMPDU_BUF_HE instead of +IEEE80211_MAX_AMPDU_BUF. +This got backported to stable kernel 5.15.61 and cause compilation +error. +Add required ifdef to handle this changed define. + +Signed-off-by: Christian Marangi +--- + mt7915/init.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/mt7915/init.c b/mt7915/init.c +index 489f6e77..1813370a 100644 +--- a/mt7915/init.c ++++ b/mt7915/init.c +@@ -327,8 +327,13 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) + struct mt7915_dev *dev = phy->dev; + + hw->queues = 4; ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 61)) + hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; + hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; ++#else ++ hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; ++ hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; ++#endif + hw->netdev_features = NETIF_F_RXCSUM; + + hw->radiotap_timestamp.units_pos = +-- +2.37.2 + From d924a75be360dfddc69cd8dedd2fc88aa19598a1 Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Sun, 25 Sep 2022 14:32:31 +0200 Subject: [PATCH 27/32] realtek: fix RTL839x egress tag for ports >= 32 Don't overwrite AS_DPM and L2LEARNING flags when dest_port is >= 32. Fixes: 1773264a0c6d ("realtek: correct egress frame port verification") Signed-off-by: Jan Hoffmann --- .../linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c index e96c5a7216..d497b4cc8c 100644 --- a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c @@ -116,7 +116,7 @@ static void rtl839x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in // h->cpu_tag[1] |= BIT(1) | BIT(0); // Bypass filter 1/2 if (dest_port >= 32) { dest_port -= 32; - h->cpu_tag[2] = BIT(dest_port) >> 16; + h->cpu_tag[2] |= (BIT(dest_port) >> 16) & 0xf; h->cpu_tag[3] = BIT(dest_port) & 0xffff; } else { h->cpu_tag[4] = BIT(dest_port) >> 16; From 4ed90e84f87e8284cb98d0ed99de041a8a4cde35 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 25 Sep 2022 20:34:46 +0200 Subject: [PATCH 28/32] Revert "mt76: fix compilation error with mt7915 and kernel >= 5.15.61" This reverts commit 6e9613844ca1ddea7e36abc44a513c89ef0598ff. The patch was wrong in the first place as we base everything on backports package and the compilation error was caused by an ath11k present downstream. (will be needed later when backports package will be updated but not now) Signed-off-by: Christian Marangi --- ...changed-IEEE80211_MAX_AMPDU_BUF-defi.patch | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch diff --git a/package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch b/package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch deleted file mode 100644 index 885c0aee04..0000000000 --- a/package/kernel/mt76/patches/0001-mt76-mt7915-fix-changed-IEEE80211_MAX_AMPDU_BUF-defi.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2994307fe092a9627e12ad7cd9f32f4d36c201d8 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Sun, 25 Sep 2022 15:58:37 +0200 -Subject: [PATCH] mt76: mt7915: fix changed IEEE80211_MAX_AMPDU_BUF define in - new kernel - -New kernel use IEEE80211_MAX_AMPDU_BUF_HE instead of -IEEE80211_MAX_AMPDU_BUF. -This got backported to stable kernel 5.15.61 and cause compilation -error. -Add required ifdef to handle this changed define. - -Signed-off-by: Christian Marangi ---- - mt7915/init.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/mt7915/init.c b/mt7915/init.c -index 489f6e77..1813370a 100644 ---- a/mt7915/init.c -+++ b/mt7915/init.c -@@ -327,8 +327,13 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) - struct mt7915_dev *dev = phy->dev; - - hw->queues = 4; -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 61)) - hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; - hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; -+#else -+ hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; -+ hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; -+#endif - hw->netdev_features = NETIF_F_RXCSUM; - - hw->radiotap_timestamp.units_pos = --- -2.37.2 - From dafa6630125ce92967792d177b02c38b8e64e293 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Mon, 26 Sep 2022 09:57:43 +0100 Subject: [PATCH 29/32] sysfsutils: Define START early in file The luci ucode rewrite exposed the definition of START as being over 1K from start of file. Initial versions limited the search for START & STOP to within the 1st 1K of a file. Whilst the search has been expanded, it doesn't do any harm to define START early in the file like all other init scripts seen so far. Signed-off-by: Kevin Darbyshire-Bryant --- package/libs/sysfsutils/Makefile | 2 +- package/libs/sysfsutils/files/sysfsutils | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package/libs/sysfsutils/Makefile b/package/libs/sysfsutils/Makefile index 8ce9a40f91..ff676308da 100644 --- a/package/libs/sysfsutils/Makefile +++ b/package/libs/sysfsutils/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sysfsutils PKG_VERSION:=2.1.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/linux-diag diff --git a/package/libs/sysfsutils/files/sysfsutils b/package/libs/sysfsutils/files/sysfsutils index 0305ca82a9..3c5b35e78d 100644 --- a/package/libs/sysfsutils/files/sysfsutils +++ b/package/libs/sysfsutils/files/sysfsutils @@ -4,6 +4,8 @@ # Based on Debian's script /etc/init.d/sysfsutils by # Martin Pitt +START=11 + load_conffile() { FILE="$1" sed 's/#.*$//; /^[[:space:]]*$/d; @@ -39,7 +41,6 @@ load_conffile() { } } -START=11 start() { for file in /etc/sysfs.conf /etc/sysfs.d/*.conf; do [ -r "$file" ] || continue From 582c098c0936b7f2083541017ef88921bf6d281b Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Tue, 20 Sep 2022 15:16:37 +0100 Subject: [PATCH 30/32] nftables: backport fix to interval based rules 'rule inet dscpclassify dscp_match meta l4proto { udp } th dport { 3478 } th sport { 3478-3497, 16384-16387 } goto ct_set_ef' works with 'nft add', but not 'nft insert', the latter yields: "BUG: unhandled op 4". Signed-off-by: Kevin Darbyshire-Bryant --- package/network/utils/nftables/Makefile | 2 +- .../utils/nftables/patches/0001-fix-nft.patch | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 package/network/utils/nftables/patches/0001-fix-nft.patch diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index fd53e3faa1..9691151c7b 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables PKG_VERSION:=1.0.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files diff --git a/package/network/utils/nftables/patches/0001-fix-nft.patch b/package/network/utils/nftables/patches/0001-fix-nft.patch new file mode 100644 index 0000000000..2138e254e8 --- /dev/null +++ b/package/network/utils/nftables/patches/0001-fix-nft.patch @@ -0,0 +1,23 @@ +'rule inet dscpclassify dscp_match meta l4proto { udp } th dport { 3478 } th sport { 3478-3497, 16384-16387 } goto ct_set_ef' +works with 'nft add', but not 'nft insert', the latter yields: "BUG: unhandled op 4". + +Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge") +Signed-off-by: Florian Westphal +--- + src/evaluate.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/evaluate.c b/src/evaluate.c +index d9c9ca28a53a..edebd7bcd8ab 100644 +--- a/src/evaluate.c ++++ b/src/evaluate.c +@@ -1520,6 +1520,7 @@ static int interval_set_eval(struct eval_ctx *ctx, struct set *set, + switch (ctx->cmd->op) { + case CMD_CREATE: + case CMD_ADD: ++ case CMD_INSERT: + if (set->automerge) { + ret = set_automerge(ctx->msgs, ctx->cmd, set, init, + ctx->nft->debug_mask); +-- +2.35.1 From 5df60f5c24e40fc373178427a6b654826edbe885 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 25 Sep 2022 21:43:43 +0200 Subject: [PATCH 31/32] scripts/download.pl: fix mirrors regression for curl and wget With the introduction of aria2c support, curl and wget no longer try to download the file from mirrors. Fix this regression by emptying the remaining mirrors list only when aria2c is used. Fixes: d39123626931 ("download.pl: add aria2c support") Signed-off-by: Christian Marangi --- scripts/download.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download.pl b/scripts/download.pl index 50dca2335e..51a816cff4 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -93,6 +93,7 @@ sub download_cmd { } if ($have_aria2c) { + @mirrors=(); return join(" ", "touch /dev/shm/${rfn}_spp;", qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $url, $additional_mirrors, $check_certificate ? () : '--check-certificate=false', @@ -321,7 +322,6 @@ while (!-f "$target/$filename") { if (!-f "$target/$filename" && $url_filename ne $filename) { download($mirror, $filename, @mirrors); } - @mirrors=(); } $SIG{INT} = \&cleanup; From f1b3958d02ba8b8a8bf2182599653ddd553906a8 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 26 Sep 2022 20:48:25 +0200 Subject: [PATCH 32/32] scripts/download.pl: fix support for aria2c download tool on macos Currently we use /dev/shm to place aria2c tmp file. This is not present on macos. Use the openwrt tmp directory instead of the linux-only /dev/shm to save compatibility with more os. Fixes: d39123626931 ("download.pl: add aria2c support") Signed-off-by: Christian Marangi --- scripts/download.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/download.pl b/scripts/download.pl index 51a816cff4..ad4fde7333 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -78,7 +78,7 @@ sub download_cmd { my $additional_mirrors = join(" ", map "$_/$filename", @_); my @chArray = ('a'..'z', 'A'..'Z', 0..9); - my $rfn = join '', map{ $chArray[int rand @chArray] } 0..9; + my $rfn = join '', "${filename}_", map{ $chArray[int rand @chArray] } 0..9; if (open CURL, '-|', 'curl', '--version') { if (defined(my $line = readline CURL)) { $have_curl = 1 if $line =~ /^curl /; @@ -94,13 +94,15 @@ sub download_cmd { if ($have_aria2c) { @mirrors=(); - return join(" ", "touch /dev/shm/${rfn}_spp;", + return join(" ", "[ -d $ENV{'TMPDIR'}/aria2c ] || mkdir $ENV{'TMPDIR'}/aria2c;", + "touch $ENV{'TMPDIR'}/aria2c/${rfn}_spp;", qw(aria2c --stderr -c -x2 -s10 -j10 -k1M), $url, $additional_mirrors, $check_certificate ? () : '--check-certificate=false', - "--server-stat-of=/dev/shm/${rfn}_spp", - "--server-stat-if=/dev/shm/${rfn}_spp", - "-d /dev/shm -o $rfn;", - "cat /dev/shm/$rfn;", "rm /dev/shm/$rfn /dev/shm/${rfn}_spp"); + "--server-stat-of=$ENV{'TMPDIR'}/aria2c/${rfn}_spp", + "--server-stat-if=$ENV{'TMPDIR'}/aria2c/${rfn}_spp", + "-d $ENV{'TMPDIR'}/aria2c -o $rfn;", + "cat $ENV{'TMPDIR'}/aria2c/$rfn;", + "rm $ENV{'TMPDIR'}/aria2c/$rfn $ENV{'TMPDIR'}/aria2c/${rfn}_spp"); } elsif ($have_curl) { return (qw(curl -f --connect-timeout 20 --retry 5 --location), $check_certificate ? () : '--insecure',