From 340e3dc4537522f44f3b8247d90b132e8e293948 Mon Sep 17 00:00:00 2001 From: Cedric DOURLENT Date: Fri, 1 Mar 2024 16:42:34 +0100 Subject: [PATCH 01/14] build: fix kernel component in CycloneDX SBOM As stated in the cycloneDX documentation, the field "type" is mandatory for all components. More details here (https://cyclonedx.org/docs/1.5/json/#components_items_type) Signed-off-by: Cedric DOURLENT (cherry picked from commit 84331215e57090a9cdae4af75af2539c39cd7de7) --- scripts/package-metadata.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index bc61577d2211d9..b4855ce67ab5e9 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -675,6 +675,7 @@ () license => "GPL-2.0", cpe_id => "cpe:/o:linux:linux_kernel", name => "kernel", + category => "operating-system", }; my %abimap; @@ -703,6 +704,7 @@ () if ($pkg->{category}) { my $category = $pkg->{category}; my %cat_type = ( + "operating-system" => "operating-system", "Firmware" => "firmware", "Libraries" => "library" ); From f2366d75cf7b74239fc3f26f45d577ca4aa3a067 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 19 Jul 2023 11:54:25 +0200 Subject: [PATCH 02/14] .gitignore: ignore link if target is included from feed If an out of tree target is included via a feed, then there is a link with the name 'feed' in the target directory. Do not show this link in git. Signed-off-by: Florian Eckert (cherry picked from commit 13e7a2d19f4545170a8deaab03411bc37182f7c4) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a80cdbbea31029..84cfc997705f4b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ /feeds /feeds.conf /files +/target/linux/feeds /overlay /package/feeds /package/openwrt-packages From 726d4be297311f87a4d1947b3ae2c1bf6bed75ac Mon Sep 17 00:00:00 2001 From: CheWei Chien Date: Thu, 4 Jan 2024 13:28:40 +0800 Subject: [PATCH 03/14] kernel: add kmod-leds-lp5562 and kmod-leds-lp55xx-common Add kernel module for lp5562 LED driver. The kmod-leds-lp5562 depends on kmod-leds-lp55xx-common. Signed-off-by: CheWei Chien (cherry picked from commit b33fa6ac9065028046016ea631f6be0926d7abd0) --- package/kernel/linux/modules/leds.mk | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index fcf9c987e8ece4..55298fd00953f4 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -245,3 +245,37 @@ define KernelPackage/input-leds/description endef $(eval $(call KernelPackage,input-leds)) + + +define KernelPackage/leds-lp55xx-common + SUBMENU:=$(LEDS_MENU) + TITLE:=LED common driver for LP5521/LP5523/LP55231/LP5562 controllers + DEPENDS:=+kmod-i2c-core + KCONFIG:=CONFIG_LEDS_LP55XX_COMMON + FILES:=$(LINUX_DIR)/drivers/leds/leds-lp55xx-common.ko + AUTOLOAD:=$(call AutoLoad,60,leds-lp55xx-common,1) +endef + +define KernelPackage/leds-lp55xx-common/description + This option enables support for Texas Instruments + LP5521/LP5523/LP55231/LP5562 common driver. +endef + +$(eval $(call KernelPackage,leds-lp55xx-common)) + + +define KernelPackage/leds-lp5562 + SUBMENU:=$(LEDS_MENU) + TITLE:=LED driver for LP5562 controllers + DEPENDS:=+kmod-i2c-core +kmod-leds-lp55xx-common + KCONFIG:=CONFIG_LEDS_LP5562 + FILES:=$(LINUX_DIR)/drivers/leds/leds-lp5562.ko + AUTOLOAD:=$(call AutoLoad,60,leds-lp5562,1) +endef + +define KernelPackage/leds-lp5562/description + This option enables support for Texas Instruments LP5562 + LED controllers. +endef + +$(eval $(call KernelPackage,leds-lp5562)) \ No newline at end of file From 26e882f06f732784b2fbb224044ba7add93a34d8 Mon Sep 17 00:00:00 2001 From: CheWei Chien Date: Mon, 19 Feb 2024 09:21:53 +0800 Subject: [PATCH 04/14] ipq807x: prpl-haze: enable LED driver on device tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable LED driver LP5562 on HAZE device tree and include its kernel module package on default package for HAZE. Signed-off-by: CheWei Chien Signed-off-by: Petr Štetiar [commit facelift] (cherry picked from commit fb45194305e6bf9b58f610c1528769320879c749) --- .../arch/arm64/boot/dts/qcom/ipq8072-haze.dts | 49 +++++++++++++++++++ target/linux/ipq807x/image/generic.mk | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts index 8a5200b4ebf50e..60dc0ce28a24da 100644 --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts @@ -21,6 +21,10 @@ ethernet2 = &dp3; ethernet3 = &dp2; label-mac-device = &dp6_syn; + led-boot = &led_system_blue; + led-failsafe = &led_system_red; + led-running = &led_system_green; + led-upgrade = &led_system_blue; }; chosen { @@ -78,6 +82,13 @@ bias-pull-up; }; }; + + i2c_3_pins: i2c-3-state { + pins = "gpio46", "gpio47"; + function = "blsp2_i2c"; + drive-strength = <8>; + bias-disable; + }; }; &blsp1_uart5 { @@ -306,3 +317,41 @@ qcom,ath11k-calibration-variant = "prpl-Haze"; }; + +&blsp1_i2c3{ + pinctrl-0 = <&i2c_3_pins>; + pinctrl-names = "default"; + status = "okay"; + + led-controller@30 { + compatible = "ti,lp5562"; + reg = <0x30>; + clock-mode = /bits/ 8 <2>; + #address-cells = <1>; + #size-cells = <0>; + + led_system_red: chan@0 { + chan-name = "red"; + led-cur = /bits/ 8 <0x20>; + max-cur = /bits/ 8 <0x60>; + color = ; + reg = <0>; + }; + + led_system_green: chan@1 { + chan-name = "green"; + led-cur = /bits/ 8 <0x20>; + max-cur = /bits/ 8 <0x60>; + color = ; + reg = <1>; + }; + + led_system_blue: chan@2 { + chan-name = "blue"; + led-cur = /bits/ 8 <0x20>; + max-cur = /bits/ 8 <0x60>; + color = ; + reg = <2>; + }; + }; +}; diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk index 104a6678945f6a..d1ada0edfa3ae4 100644 --- a/target/linux/ipq807x/image/generic.mk +++ b/target/linux/ipq807x/image/generic.mk @@ -104,7 +104,7 @@ define Device/prpl_haze DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci \ - mkf2fs f2fsck kmod-fs-f2fs + mkf2fs f2fsck kmod-fs-f2fs kmod-leds-lp5562 endef TARGET_DEVICES += prpl_haze From 677ecd09d28ab8c34c3fc3cfcadea88dee94fdf5 Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Tue, 16 Apr 2024 17:47:20 -0300 Subject: [PATCH 05/14] ipq40xx: whw03v2: enable additional 5 GHz channels This device supports channel ranges 36-64 and 100-165, just like others based on the same reference design, but its current DTS is unnecessarily restricting these ranges to 36-48 and 149-165. Signed-off-by: Rodrigo Balerdi (cherry picked from commit 1c32cee348f54e9f64b5928ee1a1efe491eec137) --- .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-whw03v2.dts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-whw03v2.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-whw03v2.dts index 1f0572b8798f68..e01be0ae4bc946 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-whw03v2.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-whw03v2.dts @@ -488,7 +488,6 @@ qcom,coexist-support = <1>; qcom,coexist-gpio-pin = <0x34>; - ieee80211-freq-limit = <2401000 2473000>; qcom,ath10k-calibration-variant = "linksys-whw03v2"; nvmem-cell-names = "pre-calibration", "mac-address"; @@ -499,7 +498,7 @@ &wifi1 { status = "okay"; - ieee80211-freq-limit = <5170000 5250000>; + ieee80211-freq-limit = <5170000 5330000>; qcom,ath10k-calibration-variant = "linksys-whw03v2"; nvmem-cell-names = "pre-calibration", "mac-address"; @@ -510,7 +509,7 @@ &wifi2 { status = "okay"; - ieee80211-freq-limit = <5735000 5835000>; + ieee80211-freq-limit = <5490000 5835000>; qcom,ath10k-calibration-variant = "linksys-whw03v2"; nvmem-cell-names = "pre-calibration", "mac-address"; From 33612fdb924f8adab3523cf9388ed969f6f5f77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 24 May 2023 09:46:45 +0200 Subject: [PATCH 06/14] kernel: introduce KERNEL_WERROR config option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit b2d1eb717b65 ("generic: 5.15: enable Werror by default for kernel compile") CONFIG_WERROR=y was enabled and all warnings/errors reported with GCC 12 were fixed. Keeping this in sync with past/future GCC versions is going to be uphill battle, so lets introduce new KERNEL_WERROR config option, enable it by default only for tested/known working combinations and on buildbots. References: #12687 Signed-off-by: Petr Štetiar (cherry picked from commit ce8c639a6c539534be14a540e7c3e9933d3a34ef) --- config/Config-kernel.in | 16 ++++++++++++++++ target/linux/generic/config-5.15 | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index c1bc7984f76f48..bbda247cd76daa 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1340,3 +1340,19 @@ config KERNEL_UBIFS_FS_SECURITY config KERNEL_JFFS2_FS_SECURITY bool "JFFS2 Security Labels" + +config KERNEL_WERROR + bool "Compile the kernel with warnings as errors" + default BUILDBOT + default y if GCC_USE_VERSION_12 + help + A kernel build should not cause any compiler warnings, and this + enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags + to enforce that rule by default. Certain warnings from other tools + such as the linker may be upgraded to errors with this option as + well. + + However, if you have a new (or very old) compiler or linker with odd + and unusual warnings, or you have some architecture with problems, + you may need to disable this config option in order to + successfully build the kernel. diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index e9b8fc42cde92f..f527a6fb51d84f 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -7476,7 +7476,7 @@ CONFIG_WATCHDOG_OPEN_TIMEOUT=0 # CONFIG_WD80x3 is not set # CONFIG_WDAT_WDT is not set # CONFIG_WDTPCI is not set -CONFIG_WERROR=y +# CONFIG_WERROR is not set # CONFIG_WEXT_CORE is not set # CONFIG_WEXT_PRIV is not set # CONFIG_WEXT_PROC is not set From 915dfbdbb1ae16fb16bf07ed836d8979c30f1fbe Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 7 Apr 2024 19:50:04 +0100 Subject: [PATCH 07/14] config: select KERNEL_WERROR if building with default GCC version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ during cherry-pick GCC version was changed to default GCC 12 version ] At the moment we have to manually follow the default GCC version also in config/Config-kernel.in. This tends to be forgotten at GCC version bumps (just happened when switching from version 12 to 13). Instead, introduce a hidden Kconfig symbol which implies KERNEL_WERROR in toolchain/gcc/Config.in where it is visible for developers changing the default version. Also remove the explicit default on BUILDBOT to avoid a circular dependency and also because buildbots anyway implicitly always select the default GCC version. Reference: https://github.com/openwrt/openwrt/pull/15064 Signed-off-by: Daniel Golle Signed-off-by: Petr Štetiar [GCC 12 default] (cherry picked from commit 501ef81040baa2ee31de6dd9f75d619de0e4c9bc) --- config/Config-kernel.in | 2 -- toolchain/gcc/Config.in | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index bbda247cd76daa..42755a4d59f349 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1343,8 +1343,6 @@ config KERNEL_JFFS2_FS_SECURITY config KERNEL_WERROR bool "Compile the kernel with warnings as errors" - default BUILDBOT - default y if GCC_USE_VERSION_12 help A kernel build should not cause any compiler warnings, and this enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index 9156f9c2635684..be975e533469bd 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -16,6 +16,11 @@ choice bool "gcc 13.x" endchoice +config GCC_USE_DEFAULT_VERSION + bool + default y if !TOOLCHAINOPTS || GCC_USE_VERSION_12 + imply KERNEL_WERROR + config GCC_USE_GRAPHITE bool prompt "Compile in support for the new Graphite framework in GCC 4.4+" if TOOLCHAINOPTS From e8cc17e147c092d99430f6c707c2ca94dfad40ae Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 8 Apr 2024 22:05:19 +0200 Subject: [PATCH 08/14] config: fix CONFIG_GDB appearing in main menuconfig menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I noticed that CONFIG_GDB was suddenly appearing in the main menuconfig menu despite the fact that it should be visible only when TOOLCHAINOPTS is selected and under a dedicated menu. After some trial and error, it seems that this was caused by the recent addition of GCC_USE_DEFAULT_VERSION, and after even more trial and error it gets fixed as soon GCC_USE_DEFAULT_VERSION is placed after GCC_VERSION. So, lets simply put GCC_USE_DEFAULT_VERSION after GCC_VERSION. Fixes: 501ef81040ba ("config: select KERNEL_WERROR if building with default GCC version") Signed-off-by: Robert Marko Signed-off-by: Petr Štetiar [rebased] (cherry picked from commit 12b2cb2ec3f1366b65caa0dbbdd83846c1c88d4e) --- toolchain/gcc/Config.in | 5 ----- toolchain/gcc/Config.version | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index be975e533469bd..9156f9c2635684 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -16,11 +16,6 @@ choice bool "gcc 13.x" endchoice -config GCC_USE_DEFAULT_VERSION - bool - default y if !TOOLCHAINOPTS || GCC_USE_VERSION_12 - imply KERNEL_WERROR - config GCC_USE_GRAPHITE bool prompt "Compile in support for the new Graphite framework in GCC 4.4+" if TOOLCHAINOPTS diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index 7126a0c883fd63..e40d6b2df35fb5 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -11,3 +11,8 @@ config GCC_VERSION default "11.3.0" if GCC_VERSION_11 default "13.1.0" if GCC_VERSION_13 default "12.3.0" + +config GCC_USE_DEFAULT_VERSION + bool + default y if !TOOLCHAINOPTS || GCC_USE_VERSION_12 + imply KERNEL_WERROR From afb5fdd79a00a1737fb64d9e2420ffdeebff392f Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 18 Apr 2024 12:40:18 +0200 Subject: [PATCH 09/14] netifd: packet-steering: silence error on applying queue mask Some queues can't be tweaked and return -ENOENT if it's not multiqueue. Silence any error from echo to produce a more clean bootlog. Fixes: #12095 Suggested-by: Andris PE Signed-off-by: Christian Marangi --- package/network/config/netifd/Makefile | 2 +- .../config/netifd/files/usr/libexec/network/packet-steering.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index b9f0e692d5386f..acfabf05e0e5a3 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git diff --git a/package/network/config/netifd/files/usr/libexec/network/packet-steering.sh b/package/network/config/netifd/files/usr/libexec/network/packet-steering.sh index 799c0808053f8d..51b9284449764f 100755 --- a/package/network/config/netifd/files/usr/libexec/network/packet-steering.sh +++ b/package/network/config/netifd/files/usr/libexec/network/packet-steering.sh @@ -29,7 +29,7 @@ set_hex_val() { local val="$2" val="$(printf %x "$val")" [ -n "$DEBUG" ] && echo "$file = $val" - echo "$val" > "$file" + echo "$val" > "$file" 2>/dev/null } packet_steering="$(uci get "network.@globals[0].packet_steering")" From 9b33b74ef71225442361d5192d3a727be212c3cd Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 18 Apr 2024 14:14:42 +0200 Subject: [PATCH 10/14] bcm27xx: refresh kernel patches Refresh kernel patches with make target/linux/refresh. Signed-off-by: Christian Marangi --- ...2-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch b/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch index 46397c0ca82c9e..9addd5ec718def 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0312-phy-broadcom-split-out-the-BCM54213PE-from-the-BCM54.patch @@ -49,7 +49,7 @@ Signed-off-by: Jonathan Bell .phy_id = PHY_ID_BCM5461, .phy_id_mask = 0xfffffff0, .name = "Broadcom BCM5461", -@@ -975,7 +983,8 @@ module_phy_driver(broadcom_drivers); +@@ -977,7 +985,8 @@ module_phy_driver(broadcom_drivers); static struct mdio_device_id __maybe_unused broadcom_tbl[] = { { PHY_ID_BCM5411, 0xfffffff0 }, { PHY_ID_BCM5421, 0xfffffff0 }, From 2b6b6e2f3ce090b7ef5c4401c8366ac1ebc7f9b0 Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Fri, 19 Apr 2024 10:19:00 +0300 Subject: [PATCH 11/14] kernel: backport ipeth CDC NCM support Fixes no communication with tethered iOS devices in CDC NCM mode. Freshly booted iOS devices start in legacy mode, but are put into NCM mode by the official Apple driver. [1] https://github.com/torvalds/linux/commit/a2d274c62e44b1995c170595db3865c6fe701226 Fixes: #12566 Tested-by: Georgi Valkov Signed-off-by: Foster Snowhill Signed-off-by: Georgi Valkov [ better reference fixed issue ] Signed-off-by: Christian Marangi (cherry picked from commit 680f8738d02a1876ae4cd11aacf9cd56e520fadf) --- ...ix-risk-of-NULL-pointer-deallocation.patch | 30 ++ ...ansmit-URBs-without-trailing-padding.patch | 35 ++ ...03-usbnet-ipheth-add-CDC-NCM-support.patch | 326 ++++++++++++++++++ ...et-ipheth-update-Kconfig-description.patch | 36 ++ 4 files changed, 427 insertions(+) create mode 100644 target/linux/generic/backport-5.15/796-v6.5-01-usbnet-ipheth-fix-risk-of-NULL-pointer-deallocation.patch create mode 100644 target/linux/generic/backport-5.15/796-v6.5-02-usbnet-ipheth-transmit-URBs-without-trailing-padding.patch create mode 100644 target/linux/generic/backport-5.15/796-v6.5-03-usbnet-ipheth-add-CDC-NCM-support.patch create mode 100644 target/linux/generic/backport-5.15/796-v6.5-04-usbnet-ipheth-update-Kconfig-description.patch diff --git a/target/linux/generic/backport-5.15/796-v6.5-01-usbnet-ipheth-fix-risk-of-NULL-pointer-deallocation.patch b/target/linux/generic/backport-5.15/796-v6.5-01-usbnet-ipheth-fix-risk-of-NULL-pointer-deallocation.patch new file mode 100644 index 00000000000000..d9d6f36fcef385 --- /dev/null +++ b/target/linux/generic/backport-5.15/796-v6.5-01-usbnet-ipheth-fix-risk-of-NULL-pointer-deallocation.patch @@ -0,0 +1,30 @@ +From 2203718c2f59ffdd6c78d54e5add594aebb4461e Mon Sep 17 00:00:00 2001 +From: Georgi Valkov +Date: Wed, 7 Jun 2023 15:56:59 +0200 +Subject: [PATCH 1/4] usbnet: ipheth: fix risk of NULL pointer deallocation + +The cleanup precedure in ipheth_probe will attempt to free a +NULL pointer in dev->ctrl_buf if the memory allocation for +this buffer is not successful. While kfree ignores NULL pointers, +and the existing code is safe, it is a better design to rearrange +the goto labels and avoid this. + +Signed-off-by: Georgi Valkov +Signed-off-by: Foster Snowhill +Signed-off-by: David S. Miller +--- + drivers/net/usb/ipheth.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -510,8 +510,8 @@ err_register_netdev: + ipheth_free_urbs(dev); + err_alloc_urbs: + err_get_macaddr: +-err_alloc_ctrl_buf: + kfree(dev->ctrl_buf); ++err_alloc_ctrl_buf: + err_endpoints: + free_netdev(netdev); + return retval; diff --git a/target/linux/generic/backport-5.15/796-v6.5-02-usbnet-ipheth-transmit-URBs-without-trailing-padding.patch b/target/linux/generic/backport-5.15/796-v6.5-02-usbnet-ipheth-transmit-URBs-without-trailing-padding.patch new file mode 100644 index 00000000000000..adfec356d9faee --- /dev/null +++ b/target/linux/generic/backport-5.15/796-v6.5-02-usbnet-ipheth-transmit-URBs-without-trailing-padding.patch @@ -0,0 +1,35 @@ +From 3e65efcca87a9bb5f3b864e0a43d167bc0a8688c Mon Sep 17 00:00:00 2001 +From: Foster Snowhill +Date: Wed, 7 Jun 2023 15:57:00 +0200 +Subject: [PATCH 2/4] usbnet: ipheth: transmit URBs without trailing padding + +The behaviour of the official iOS tethering driver on macOS is to not +transmit any trailing padding at the end of URBs. This is applicable +to both NCM and legacy modes, including older devices. + +Adapt the driver to not include trailing padding in TX URBs, matching +the behaviour of the official macOS driver. + +Signed-off-by: Foster Snowhill +Tested-by: Georgi Valkov +Signed-off-by: David S. Miller +--- + drivers/net/usb/ipheth.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -373,12 +373,10 @@ static netdev_tx_t ipheth_tx(struct sk_b + } + + memcpy(dev->tx_buf, skb->data, skb->len); +- if (skb->len < IPHETH_BUF_SIZE) +- memset(dev->tx_buf + skb->len, 0, IPHETH_BUF_SIZE - skb->len); + + usb_fill_bulk_urb(dev->tx_urb, udev, + usb_sndbulkpipe(udev, dev->bulk_out), +- dev->tx_buf, IPHETH_BUF_SIZE, ++ dev->tx_buf, skb->len, + ipheth_sndbulk_callback, + dev); + dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; diff --git a/target/linux/generic/backport-5.15/796-v6.5-03-usbnet-ipheth-add-CDC-NCM-support.patch b/target/linux/generic/backport-5.15/796-v6.5-03-usbnet-ipheth-add-CDC-NCM-support.patch new file mode 100644 index 00000000000000..e3f2b9c3311e2f --- /dev/null +++ b/target/linux/generic/backport-5.15/796-v6.5-03-usbnet-ipheth-add-CDC-NCM-support.patch @@ -0,0 +1,326 @@ +From a2d274c62e44b1995c170595db3865c6fe701226 Mon Sep 17 00:00:00 2001 +From: Foster Snowhill +Date: Wed, 7 Jun 2023 15:57:01 +0200 +Subject: [PATCH 3/4] usbnet: ipheth: add CDC NCM support + +Recent iOS releases support CDC NCM encapsulation on RX. This mode is +the default on macOS and Windows. In this mode, an iOS device may include +one or more Ethernet frames inside a single URB. + +Freshly booted iOS devices start in legacy mode, but are put into +NCM mode by the official Apple driver. When reconnecting such a device +from a macOS/Windows machine to a Linux host, the device stays in +NCM mode, making it unusable with the legacy ipheth driver code. + +To correctly support such a device, the driver has to either support +the NCM mode too, or put the device back into legacy mode. + +To match the behaviour of the macOS/Windows driver, and since there +is no documented control command to revert to legacy mode, implement +NCM support. The device is attempted to be put into NCM mode by default, +and falls back to legacy mode if the attempt fails. + +Signed-off-by: Foster Snowhill +Tested-by: Georgi Valkov +Signed-off-by: David S. Miller +--- + drivers/net/usb/ipheth.c | 180 +++++++++++++++++++++++++++++++++------ + 1 file changed, 155 insertions(+), 25 deletions(-) + +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -52,6 +52,7 @@ + #include + #include + #include ++#include + + #define USB_VENDOR_APPLE 0x05ac + +@@ -59,8 +60,12 @@ + #define IPHETH_USBINTF_SUBCLASS 253 + #define IPHETH_USBINTF_PROTO 1 + +-#define IPHETH_BUF_SIZE 1514 + #define IPHETH_IP_ALIGN 2 /* padding at front of URB */ ++#define IPHETH_NCM_HEADER_SIZE (12 + 96) /* NCMH + NCM0 */ ++#define IPHETH_TX_BUF_SIZE ETH_FRAME_LEN ++#define IPHETH_RX_BUF_SIZE_LEGACY (IPHETH_IP_ALIGN + ETH_FRAME_LEN) ++#define IPHETH_RX_BUF_SIZE_NCM 65536 ++ + #define IPHETH_TX_TIMEOUT (5 * HZ) + + #define IPHETH_INTFNUM 2 +@@ -71,6 +76,7 @@ + #define IPHETH_CTRL_TIMEOUT (5 * HZ) + + #define IPHETH_CMD_GET_MACADDR 0x00 ++#define IPHETH_CMD_ENABLE_NCM 0x04 + #define IPHETH_CMD_CARRIER_CHECK 0x45 + + #define IPHETH_CARRIER_CHECK_TIMEOUT round_jiffies_relative(1 * HZ) +@@ -97,6 +103,8 @@ struct ipheth_device { + u8 bulk_out; + struct delayed_work carrier_work; + bool confirmed_pairing; ++ int (*rcvbulk_callback)(struct urb *urb); ++ size_t rx_buf_len; + }; + + static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags); +@@ -116,12 +124,12 @@ static int ipheth_alloc_urbs(struct iphe + if (rx_urb == NULL) + goto free_tx_urb; + +- tx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE, ++ tx_buf = usb_alloc_coherent(iphone->udev, IPHETH_TX_BUF_SIZE, + GFP_KERNEL, &tx_urb->transfer_dma); + if (tx_buf == NULL) + goto free_rx_urb; + +- rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, ++ rx_buf = usb_alloc_coherent(iphone->udev, iphone->rx_buf_len, + GFP_KERNEL, &rx_urb->transfer_dma); + if (rx_buf == NULL) + goto free_tx_buf; +@@ -134,7 +142,7 @@ static int ipheth_alloc_urbs(struct iphe + return 0; + + free_tx_buf: +- usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, tx_buf, ++ usb_free_coherent(iphone->udev, IPHETH_TX_BUF_SIZE, tx_buf, + tx_urb->transfer_dma); + free_rx_urb: + usb_free_urb(rx_urb); +@@ -146,9 +154,9 @@ error_nomem: + + static void ipheth_free_urbs(struct ipheth_device *iphone) + { +- usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf, ++ usb_free_coherent(iphone->udev, iphone->rx_buf_len, iphone->rx_buf, + iphone->rx_urb->transfer_dma); +- usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf, ++ usb_free_coherent(iphone->udev, IPHETH_TX_BUF_SIZE, iphone->tx_buf, + iphone->tx_urb->transfer_dma); + usb_free_urb(iphone->rx_urb); + usb_free_urb(iphone->tx_urb); +@@ -160,15 +168,106 @@ static void ipheth_kill_urbs(struct iphe + usb_kill_urb(dev->rx_urb); + } + +-static void ipheth_rcvbulk_callback(struct urb *urb) ++static int ipheth_consume_skb(char *buf, int len, struct ipheth_device *dev) + { +- struct ipheth_device *dev; + struct sk_buff *skb; +- int status; ++ ++ skb = dev_alloc_skb(len); ++ if (!skb) { ++ dev->net->stats.rx_dropped++; ++ return -ENOMEM; ++ } ++ ++ skb_put_data(skb, buf, len); ++ skb->dev = dev->net; ++ skb->protocol = eth_type_trans(skb, dev->net); ++ ++ dev->net->stats.rx_packets++; ++ dev->net->stats.rx_bytes += len; ++ netif_rx(skb); ++ ++ return 0; ++} ++ ++static int ipheth_rcvbulk_callback_legacy(struct urb *urb) ++{ ++ struct ipheth_device *dev; ++ char *buf; ++ int len; ++ ++ dev = urb->context; ++ ++ if (urb->actual_length <= IPHETH_IP_ALIGN) { ++ dev->net->stats.rx_length_errors++; ++ return -EINVAL; ++ } ++ len = urb->actual_length - IPHETH_IP_ALIGN; ++ buf = urb->transfer_buffer + IPHETH_IP_ALIGN; ++ ++ return ipheth_consume_skb(buf, len, dev); ++} ++ ++static int ipheth_rcvbulk_callback_ncm(struct urb *urb) ++{ ++ struct usb_cdc_ncm_nth16 *ncmh; ++ struct usb_cdc_ncm_ndp16 *ncm0; ++ struct usb_cdc_ncm_dpe16 *dpe; ++ struct ipheth_device *dev; ++ int retval = -EINVAL; + char *buf; + int len; + + dev = urb->context; ++ ++ if (urb->actual_length < IPHETH_NCM_HEADER_SIZE) { ++ dev->net->stats.rx_length_errors++; ++ return retval; ++ } ++ ++ ncmh = urb->transfer_buffer; ++ if (ncmh->dwSignature != cpu_to_le32(USB_CDC_NCM_NTH16_SIGN) || ++ le16_to_cpu(ncmh->wNdpIndex) >= urb->actual_length) { ++ dev->net->stats.rx_errors++; ++ return retval; ++ } ++ ++ ncm0 = urb->transfer_buffer + le16_to_cpu(ncmh->wNdpIndex); ++ if (ncm0->dwSignature != cpu_to_le32(USB_CDC_NCM_NDP16_NOCRC_SIGN) || ++ le16_to_cpu(ncmh->wHeaderLength) + le16_to_cpu(ncm0->wLength) >= ++ urb->actual_length) { ++ dev->net->stats.rx_errors++; ++ return retval; ++ } ++ ++ dpe = ncm0->dpe16; ++ while (le16_to_cpu(dpe->wDatagramIndex) != 0 && ++ le16_to_cpu(dpe->wDatagramLength) != 0) { ++ if (le16_to_cpu(dpe->wDatagramIndex) >= urb->actual_length || ++ le16_to_cpu(dpe->wDatagramIndex) + ++ le16_to_cpu(dpe->wDatagramLength) > urb->actual_length) { ++ dev->net->stats.rx_length_errors++; ++ return retval; ++ } ++ ++ buf = urb->transfer_buffer + le16_to_cpu(dpe->wDatagramIndex); ++ len = le16_to_cpu(dpe->wDatagramLength); ++ ++ retval = ipheth_consume_skb(buf, len, dev); ++ if (retval != 0) ++ return retval; ++ ++ dpe++; ++ } ++ ++ return 0; ++} ++ ++static void ipheth_rcvbulk_callback(struct urb *urb) ++{ ++ struct ipheth_device *dev; ++ int retval, status; ++ ++ dev = urb->context; + if (dev == NULL) + return; + +@@ -191,25 +290,27 @@ static void ipheth_rcvbulk_callback(stru + dev->net->stats.rx_length_errors++; + return; + } +- len = urb->actual_length - IPHETH_IP_ALIGN; +- buf = urb->transfer_buffer + IPHETH_IP_ALIGN; + +- skb = dev_alloc_skb(len); +- if (!skb) { +- dev_err(&dev->intf->dev, "%s: dev_alloc_skb: -ENOMEM\n", +- __func__); +- dev->net->stats.rx_dropped++; ++ /* RX URBs starting with 0x00 0x01 do not encapsulate Ethernet frames, ++ * but rather are control frames. Their purpose is not documented, and ++ * they don't affect driver functionality, okay to drop them. ++ * There is usually just one 4-byte control frame as the very first ++ * URB received from the bulk IN endpoint. ++ */ ++ if (unlikely ++ (((char *)urb->transfer_buffer)[0] == 0 && ++ ((char *)urb->transfer_buffer)[1] == 1)) ++ goto rx_submit; ++ ++ retval = dev->rcvbulk_callback(urb); ++ if (retval != 0) { ++ dev_err(&dev->intf->dev, "%s: callback retval: %d\n", ++ __func__, retval); + return; + } + +- skb_put_data(skb, buf, len); +- skb->dev = dev->net; +- skb->protocol = eth_type_trans(skb, dev->net); +- +- dev->net->stats.rx_packets++; +- dev->net->stats.rx_bytes += len; ++rx_submit: + dev->confirmed_pairing = true; +- netif_rx(skb); + ipheth_rx_submit(dev, GFP_ATOMIC); + } + +@@ -310,6 +411,27 @@ static int ipheth_get_macaddr(struct iph + return retval; + } + ++static int ipheth_enable_ncm(struct ipheth_device *dev) ++{ ++ struct usb_device *udev = dev->udev; ++ int retval; ++ ++ retval = usb_control_msg(udev, ++ usb_sndctrlpipe(udev, IPHETH_CTRL_ENDP), ++ IPHETH_CMD_ENABLE_NCM, /* request */ ++ 0x41, /* request type */ ++ 0x00, /* value */ ++ 0x02, /* index */ ++ NULL, ++ 0, ++ IPHETH_CTRL_TIMEOUT); ++ ++ dev_info(&dev->intf->dev, "%s: usb_control_msg: %d\n", ++ __func__, retval); ++ ++ return retval; ++} ++ + static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags) + { + struct usb_device *udev = dev->udev; +@@ -317,7 +439,7 @@ static int ipheth_rx_submit(struct iphet + + usb_fill_bulk_urb(dev->rx_urb, udev, + usb_rcvbulkpipe(udev, dev->bulk_in), +- dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, ++ dev->rx_buf, dev->rx_buf_len, + ipheth_rcvbulk_callback, + dev); + dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; +@@ -365,7 +487,7 @@ static netdev_tx_t ipheth_tx(struct sk_b + int retval; + + /* Paranoid */ +- if (skb->len > IPHETH_BUF_SIZE) { ++ if (skb->len > IPHETH_TX_BUF_SIZE) { + WARN(1, "%s: skb too large: %d bytes\n", __func__, skb->len); + dev->net->stats.tx_dropped++; + dev_kfree_skb_any(skb); +@@ -448,6 +570,8 @@ static int ipheth_probe(struct usb_inter + dev->net = netdev; + dev->intf = intf; + dev->confirmed_pairing = false; ++ dev->rx_buf_len = IPHETH_RX_BUF_SIZE_LEGACY; ++ dev->rcvbulk_callback = ipheth_rcvbulk_callback_legacy; + /* Set up endpoints */ + hintf = usb_altnum_to_altsetting(intf, IPHETH_ALT_INTFNUM); + if (hintf == NULL) { +@@ -479,6 +603,12 @@ static int ipheth_probe(struct usb_inter + if (retval) + goto err_get_macaddr; + ++ retval = ipheth_enable_ncm(dev); ++ if (!retval) { ++ dev->rx_buf_len = IPHETH_RX_BUF_SIZE_NCM; ++ dev->rcvbulk_callback = ipheth_rcvbulk_callback_ncm; ++ } ++ + INIT_DELAYED_WORK(&dev->carrier_work, ipheth_carrier_check_work); + + retval = ipheth_alloc_urbs(dev); diff --git a/target/linux/generic/backport-5.15/796-v6.5-04-usbnet-ipheth-update-Kconfig-description.patch b/target/linux/generic/backport-5.15/796-v6.5-04-usbnet-ipheth-update-Kconfig-description.patch new file mode 100644 index 00000000000000..2ab7e8feddc44c --- /dev/null +++ b/target/linux/generic/backport-5.15/796-v6.5-04-usbnet-ipheth-update-Kconfig-description.patch @@ -0,0 +1,36 @@ +From 0c6e9d32ef0ccfcf2d875cbcff23bf345a54d585 Mon Sep 17 00:00:00 2001 +From: Foster Snowhill +Date: Wed, 7 Jun 2023 15:57:02 +0200 +Subject: [PATCH 4/4] usbnet: ipheth: update Kconfig description + +This module has for a long time not been limited to iPhone <= 3GS. +Update description to match the actual state of the driver. + +Remove dead link from 2010, instead reference an existing userspace +iOS device pairing implementation as part of libimobiledevice. + +Signed-off-by: Foster Snowhill +Signed-off-by: David S. Miller +--- + drivers/net/usb/Kconfig | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +--- a/drivers/net/usb/Kconfig ++++ b/drivers/net/usb/Kconfig +@@ -582,12 +582,10 @@ config USB_IPHETH + default n + help + Module used to share Internet connection (tethering) from your +- iPhone (Original, 3G and 3GS) to your system. +- Note that you need userspace libraries and programs that are needed +- to pair your device with your system and that understand the iPhone +- protocol. +- +- For more information: http://giagio.com/wiki/moin.cgi/iPhoneEthernetDriver ++ iPhone to your system. ++ Note that you need a corresponding userspace library/program ++ to pair your device with your system, for example usbmuxd ++ . + + config USB_SIERRA_NET + tristate "USB-to-WWAN Driver for Sierra Wireless modems" From 675d9a2d4141a9251e6feb0dd948b7f6533553ae Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Wed, 17 Apr 2024 00:42:56 +0200 Subject: [PATCH 12/14] sunxi: fix network bringup on Olinuxino Micro boards It's the A13-based Olinuxino Micro which has only wireless interfaces. The A20-based board is a fully-fledged one which has an ethernet interface. Signed-off-by: Zoltan HERPAI --- target/linux/sunxi/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/sunxi/base-files/etc/board.d/02_network b/target/linux/sunxi/base-files/etc/board.d/02_network index b295dc7daa426c..073565d4eeff55 100644 --- a/target/linux/sunxi/base-files/etc/board.d/02_network +++ b/target/linux/sunxi/base-files/etc/board.d/02_network @@ -17,7 +17,7 @@ sunxi_setup_interfaces() lamobo,lamobo-r1) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; - olimex,a20-olinuxino-micro) + olimex,a13-olinuxino-micro) ucidef_set_interface_lan "wlan0" ;; xunlong,orangepi-r1) From 82ba1d26357fe005da6a71c10f75d83227af299c Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 24 Jan 2024 13:18:53 +0100 Subject: [PATCH 13/14] tools/cpio: update to 2.15 Release Notes: https://lists.gnu.org/archive/html/info-gnu/2024-01/msg00006.html Fixes: #15228 Signed-off-by: Nick Hainke Signed-off-by: Robert Marko --- tools/cpio/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cpio/Makefile b/tools/cpio/Makefile index 1550785ddc5d71..bd6e2589803f61 100644 --- a/tools/cpio/Makefile +++ b/tools/cpio/Makefile @@ -3,11 +3,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cpio PKG_CPE_ID:=cpe:/a:gnu:cpio -PKG_VERSION:=2.14 +PKG_VERSION:=2.15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@GNU/cpio -PKG_HASH:=fcdc15d60f7267a6fc7efcd6b9db7b6c8966c4f2fbbb964c24d41336fd3f2c12 +PKG_HASH:=937610b97c329a1ec9268553fb780037bcfff0dcffe9725ebc4fd9c1aa9075db include $(INCLUDE_DIR)/host-build.mk From a48786ef4034d9905357c44d09caba3303eb28d2 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 29 Mar 2024 18:57:03 +0100 Subject: [PATCH 14/14] tools: b43-tools: fix compilation with GCC14 GCC14 no longer treats integer types and pointer types as equivalent in assignments (including implied assignments of function arguments and return values), and instead fails the compilation with a type error. So, as a workaround lets disable the newly introduced error -Werror=int-conversion and just make it print a warning to enable compiling with GCC14 as Fedora 40 now defaults to it. Signed-off-by: Robert Marko --- tools/b43-tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/b43-tools/Makefile b/tools/b43-tools/Makefile index bae498c78fc4f7..19918efde4011a 100644 --- a/tools/b43-tools/Makefile +++ b/tools/b43-tools/Makefile @@ -23,7 +23,7 @@ define Host/Compile $(HOST_MAKE_FLAGS) \ $(1) QUIET_SPARSE=: +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/assembler \ - CFLAGS="$(HOST_CFLAGS) -include endian.h" \ + CFLAGS="$(HOST_CFLAGS) -include endian.h -Wno-error=int-conversion" \ $(HOST_MAKE_FLAGS) \ LDFLAGS= \ $(1) QUIET_SPARSE=: