From 4c65359af49b6ccecd98987f842db5eba985f64b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 13 Nov 2024 07:04:31 +0100 Subject: [PATCH 01/35] build: fix including busybox, procd and apk/opkg in imagebuilder Since the image builder pulls package lists from metadata directly, add procd and busybox as depdendencies to base-files. As for the package manager itself, since it can be disabled it needs to be added directly in the image builder makefile Fixes: 44598c233dd9 ("build: remove broken dependency of metadata on toplevel .config variables") Signed-off-by: Felix Fietkau --- package/base-files/Makefile | 6 +++++- package/system/procd/Makefile | 3 --- package/utils/busybox/Makefile | 2 -- target/imagebuilder/files/Makefile | 5 +++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 4bcb4882d733c4..7ac4ea557f9f10 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -39,7 +39,11 @@ endif define Package/base-files SECTION:=base CATEGORY:=Base system - DEPENDS:=+netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool + DEPENDS:= \ + +netifd +libc +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:openwrt-keyring \ + +NAND_SUPPORT:ubi-utils +fstools +fwtool \ + +SELINUX:procd-selinux +!SELINUX:procd +SECCOMP:procd-seccomp \ + +SELINUX:busybox-selinux +!SELINUX:busybox TITLE:=Base filesystem for OpenWrt URL:=http://openwrt.org/ VERSION:=$(PKG_RELEASE)~$(lastword $(subst -, ,$(REVISION))) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 9ff6fb80f7c949..86de4babfdfaff 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -50,7 +50,6 @@ define Package/procd $(call Package/procd/Default) VARIANT:=default CONFLICTS:=procd-selinux - DEFAULT:=y if !SELINUX endef define Package/procd-selinux @@ -59,7 +58,6 @@ define Package/procd-selinux TITLE += with SELinux support PROVIDES:=procd VARIANT:=selinux - DEFAULT:=y if SELINUX endef define Package/procd-ujail @@ -75,7 +73,6 @@ define Package/procd-seccomp CATEGORY:=Base system DEPENDS:=@SECCOMP +libubox +libblobmsg-json TITLE:=OpenWrt process seccomp helper + utrace - DEFAULT:=y if SECCOMP endef define Package/uxc diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 7b591db71679c7..4ef470df755890 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -56,7 +56,6 @@ define Package/busybox $(call Package/busybox/Default) CONFLICTS:=busybox-selinux VARIANT:=default - DEFAULT:=y if !SELINUX endef define Package/busybox-selinux @@ -65,7 +64,6 @@ define Package/busybox-selinux DEPENDS += +libselinux VARIANT:=selinux PROVIDES:=busybox - DEFAULT:=y if SELINUX endef define Package/busybox/description diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 72b36b0862389d..c92ab7430663b7 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -138,6 +138,11 @@ _call_info: FORCE echo 'Available Profiles:' echo; $(PROFILE_LIST) +ifneq ($(CONFIG_USE_APK),) + DEFAULT_PACKAGES += apk-mbedtls +else + DEFAULT_PACKAGES += opkg +endif BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) # "-pkgname" in the package list means remove "pkgname" from the package list BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) From b902284290b846423ca30d8f4f69eda6bb2c9ee2 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 12 Nov 2024 07:49:22 +0100 Subject: [PATCH 02/35] base-files: improve default root-passwd script The script was not exiting cleanly causing it to not be removed from the uci-defaults folder. Signed-off-by: John Crispin --- .../files/etc/uci-defaults/50-root-passwd | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/package/base-files/files/etc/uci-defaults/50-root-passwd b/package/base-files/files/etc/uci-defaults/50-root-passwd index 9eddf1559baf33..f0bb519aece4f4 100644 --- a/package/base-files/files/etc/uci-defaults/50-root-passwd +++ b/package/base-files/files/etc/uci-defaults/50-root-passwd @@ -3,10 +3,16 @@ json_init json_load "$(cat /etc/board.json)" -json_select credentials - json_get_vars root_password_hash root_password_hash - [ -z "$root_password_hash" ] || sed -i "s|^root:[^:]*|root:$root_password_hash|g" /etc/shadow +if json_is_a credentials object; then + json_select credentials + json_get_vars root_password_hash root_password_hash + if [ -n "$root_password_hash" ]; then + sed -i "s|^root:[^:]*|root:$root_password_hash|g" /etc/shadow + fi - json_get_vars root_password_plain root_password_plain - [ -z "$root_password_plain" ] || { (echo "$root_password_plain"; sleep 1; echo "$root_password_plain") | passwd root } -json_select .. + json_get_vars root_password_plain root_password_plain + if [ -n "$root_password_plain" ]; then + (echo "$root_password_plain"; sleep 1; echo "$root_password_plain") | passwd root + fi + json_select .. +fi From 93d005e6bc571e062b3dd263c06b2d9957552e9c Mon Sep 17 00:00:00 2001 From: Kuan-Yi Li Date: Thu, 14 Nov 2024 00:29:21 +0800 Subject: [PATCH 03/35] imagebuilder: fix APK keys dir creation Make keys directory for APK instead of OPKG while adding local key. Signed-off-by: Kuan-Yi Li Link: https://github.com/openwrt/openwrt/pull/16942 Signed-off-by: Christian Marangi --- target/imagebuilder/files/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index c92ab7430663b7..56f761e966acb1 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -249,7 +249,7 @@ ifeq ($(CONFIG_USE_APK),) else $(if $(CONFIG_SIGNATURE_CHECK), \ $(if $(ADD_LOCAL_KEY), \ - mkdir -p $(TARGET_DIR)/etc/opkg/keys/; \ + mkdir -p $(TARGET_DIR)/etc/apk/keys/; \ cp $(BUILD_KEY_APK_PUB) $(TARGET_DIR)/etc/apk/keys/; \ ) \ ) From c6a3a11c07fdd85baf9ae43d718eb7a317995ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 13 Nov 2024 08:11:38 +0000 Subject: [PATCH 04/35] apk: update to Git 417a93ceae540444fdbd3f76d1dadf0e15621fdc (2024-11-13) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit c1a3e69f24e2 db: validate package arch against compatible arches 2a3dbfc9db58 db: add and use apk_db_parse_file helper to parse files line by line b231eacd8121 db: simplify add_repos_from_file 98d7196a48d4 db: fix permissions of arch file d2aaf13ee488 commit: sort matched dependencies on error analysis c259642c006d tests: rework solver tests to not require apk-test binary 08b4d21f922e tests: move solver test data to separate directory 563d36481166 tests: minor updates to root tests a236fdd39040 pkg: use memfd_create only if target root has dev/fd working a5aeb3db113f test: unify makefile and meson tests d86afdef88b0 db: print message when a file is written to .apk-new 5dd91e3c387d db: consider --force-no-chroot when determining /dev/fd availability 5add6fce22d4 apk-tools-3.0.0_pre4 8a13ed96d1d5 test: fix solver.sh for parallel use fcd4defc18e6 test: move vertest to cmocka based unit testing infrastructure e38d5b5a9d04 test: add missing alpine tests makefile 19b1df79ebca blob: refactor apk_blob_for_each_segment into apk_blob_foreach_word 76970a938dd7 package: move the location of executable package scripts 1e0411568dad package: respect libexecdir instead of hard-coding /usr/libexec a4837ae8ffe2 package: don't call make_device_tree when APK_NO_CHROOT is set ade0be3449e4 db, extract: handle file/directory extraction errors more consistently 4050f9e69d2e db: fix hardlink handling: root directory and v3 checksums 89e4bf1db040 db, fs: do not extract devices in --usermode 64ff8c72d9fb db: allow files starting with a dot in the root directory of apk3 packages d26b65d30f55 db, audit: remove support for files without embedded checksum 417a93ceae54 pkg: truncate apkv3 description to 256 bytes Fixes: #16929 Signed-off-by: Petr Štetiar --- package/system/apk/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 2d637fa180987d..e911f4ae4b72b6 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-11-08 -PKG_SOURCE_VERSION:=d9c24813d983df9524fa7a2b78fc3132c159a20f -PKG_MIRROR_HASH:=3d1a79c08ef8c8b9404f9287d9acda6468b8b1c2a99dd384287f522ed3b1a047 +PKG_SOURCE_DATE:=2024-11-13 +PKG_SOURCE_VERSION:=417a93ceae540444fdbd3f76d1dadf0e15621fdc +PKG_MIRROR_HASH:=3888aa506f0ce808cbe0287b98abfb7ba92e68b1eb17516fef4b58068bc72131 PKG_VERSION=3.0.0_pre$(subst -,,$(PKG_SOURCE_DATE)) From 4c9031fda271ed7d4503642f63ff824faa6cc3a0 Mon Sep 17 00:00:00 2001 From: "David S. H. Rosenthal" Date: Wed, 6 Nov 2024 10:19:17 +0000 Subject: [PATCH 05/35] scripts: add download-check-artifact.sh script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While checking wiki documentation about GPG signatures checking I found this nice script and I've thought, that it would be nice to provide it officially instead of some random internet site. Usage example: $ ./scripts/download-check-artifact.sh https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb 1) Downloading image file ========================= ########################################### 100.0% 2) Downloading checksum file ============================ ########################################### 100.0% 3) Downloading the GPG signature ================================ ########################################### 100.0% 4) Verifying GPG signature ========================== gpg: Signature made Tue 05 Nov 2024 05:21:50 PM UTC gpg: using EDDSA key 92C561DE55AE6552F3C736B82B0151090606D1D9 gpg: Good signature from "OpenWrt Build System (Nitrokey3) " [ultimate] Primary key fingerprint: 8A8B C12F 46B8 36C0 F9CD B36F 1D53 D187 7742 E911 Subkey fingerprint: 92C5 61DE 55AE 6552 F3C7 36B8 2B01 5109 0606 D1D9 5) Verifying SHA256 checksum ============================ openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb: OK Verification done! ================== Downloaded artifact placed in '/var/home/ynezz/dev/openwrt/openwrt.git/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb' Cleaning up. Adding file in a state as downloaded from https://www.abitare.org/bin/download.sh References: https://openwrt.org/docs/guide-quick-start/verify_firmware_checksum?s[]=gpg#linux Signed-off-by: David S. H. Rosenthal Link: https://github.com/openwrt/openwrt/pull/16871 Signed-off-by: Petr Štetiar --- scripts/download-check-artifact.sh | 154 +++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100755 scripts/download-check-artifact.sh diff --git a/scripts/download-check-artifact.sh b/scripts/download-check-artifact.sh new file mode 100755 index 00000000000000..31868da5cd408e --- /dev/null +++ b/scripts/download-check-artifact.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# Script to perform verified file downloads. +# Exit codes: +# 0 - File downloaded successfully and verified +# 1 - Failed to download requested file +# 2 - Failed to download sha256sums file +# 3 - Failed to download sha256sums.gpg file +# 4 - GnuPG is available but fails to verify the signature (missing pubkey, file integrity error, ...) +# 5 - The checksums do not match +# 6 - Unable to copy the requested file to its final destination +# 254 - The script got interrupted by a signal +# 255 - A suitable download or checksum utility is missing + +[ -n "$1" ] || { + echo "Usage: $0 " >&2 + exit 1 +} + +finish() { + [ -e "/tmp/verify.$$" ] && { + echo "Cleaning up." + rm -r "/tmp/verify.$$" + } + exit $1 +} + +trap "finish 254" INT TERM + +destdir="$(pwd)" +image_url="$1" +image_file="${image_url##*/}" +sha256_url="${image_url%/*}/sha256sums" +gpgsig_url="${image_url%/*}/sha256sums.asc" +keyserver_url="hkp://keyserver.ubuntu.com" + +# Find a suitable download utility +if which curl >/dev/null; then + download() { curl --progress-bar -o "$1" "$2"; } +elif which wget >/dev/null; then + download() { wget -O "$1" "$2"; } +elif which fetch >/dev/null; then + download() { fetch -o "$1" "$2"; } +else + echo "No suitable download utility found, cannot download files!" >&2 + finish 255 +fi + +# Find a suitable checksum utility +if which sha256sum >/dev/null; then + checksum() { sha256sum -c --ignore-missing "sha256sums"; } +elif which shasum >/dev/null; then + checksum() { + local sum="$(shasum -a 256 "$image_file")"; + grep -xF "${sum%% *} *$image_file" "sha256sums"; + } +else + echo "No SHA256 checksum executable installed, cannot verify checksums!" >&2 + finish 255 +fi + +# Check for gpg availability +if which gpg >/dev/null; then + runpgp() { gpg "$@"; } +else + runpgp() { + echo "WARNING: No GnuPG installed, cannot verify digital signature!" >&2 + return 0 + } +fi + +mkdir -p "/tmp/verify.$$" +cd "/tmp/verify.$$" + +echo "" +echo "1) Downloading image file" +echo "=========================" +download "$image_file" "$image_url" || { + echo "Failed to download image file!" >&2 + finish 1 +} + +echo "" +echo "2) Downloading checksum file" +echo "============================" +download "sha256sums" "$sha256_url" || { + echo "Failed to download checksum file!" >&2 + finish 2 +} + +echo "" +echo "3) Downloading the GPG signature" +echo "================================" +download "sha256sums.gpg" "$gpgsig_url" || { + echo "Failed to download GPG signature!" >&2 + finish 3 +} + +echo "" +echo "4) Verifying GPG signature" +echo "==========================" +missing_key=$(runpgp --status-fd 1 --with-fingerprint --verify \ + "sha256sums.gpg" "sha256sums" 2>/dev/null | sed -ne 's!^.* NO_PUBKEY !!p') + +if [ -n "$missing_key" ]; then + echo "The signature was signed by a public key with the id $missing_key" >&2 + echo "which is not present on this system." >&2 + echo "" >&2 + + echo "Provide a public keyserver url below or press enter to accept the" >&2 + echo "default suggestion. Hit Ctrl-C to abort the operation." >&2 + echo "" >&2 + + while true; do + printf "Keyserver to use? [$keyserver_url] > " + read url; case "${url:-$keyserver_url}" in + hkp://*) + gpg --keyserver "${url:-$keyserver_url}" --recv-keys "$missing_key" || { + echo "Failed to download public key." >&2 + finish 7 + } + break + ;; + *) + echo "Expecting a key server url in the form 'hkp://hostname'." >&2 + ;; + esac + done +fi + +runpgp --with-fingerprint --verify "sha256sums.gpg" "sha256sums" || { + echo "Failed to verify checksum file with GPG signature!" >&2 + finish 4 +} + +echo "" +echo "5) Verifying SHA256 checksum" +echo "============================" +checksum || { + echo "Checksums do not match!" >&2 + finish 5 +} + +cp "$image_file" "$destdir/$image_file" || { + echo "Failed to write '$destdir/$image_file'" >&2 + finish 6 +} + +echo "" +echo "Verification done!" +echo "==================" +echo "Firmware image placed in '$destdir/$image_file'." +echo "" + +finish 0 From 27c2c140b16cb490f20c1c2259b3decf50ae5762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 6 Nov 2024 10:40:37 +0000 Subject: [PATCH 06/35] scripts: download-check-artifact.sh: fix shellcheck and improve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes following shellcheck's recommendations: In scripts/download-check-artifact.sh line 24: exit $1 ^-- SC2086 (info): Double quote to prevent globbing and word splitting. In scripts/download-check-artifact.sh line 53: local sum="$(shasum -a 256 "$image_file")"; ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. In scripts/download-check-artifact.sh line 72: cd "/tmp/verify.$$" ^-----------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails. In scripts/download-check-artifact.sh line 114: printf "Keyserver to use? [$keyserver_url] > " ^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo". In scripts/download-check-artifact.sh line 115: read url; case "${url:-$keyserver_url}" in ^--^ SC2162 (info): read without -r will mangle backslashes. While at it make it clear, that it is possible to download/check any build artifacts like even SDK or ImageBuilder. Link: https://github.com/openwrt/openwrt/pull/16871 Signed-off-by: Petr Štetiar --- scripts/download-check-artifact.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/download-check-artifact.sh b/scripts/download-check-artifact.sh index 31868da5cd408e..bc0918b2146388 100755 --- a/scripts/download-check-artifact.sh +++ b/scripts/download-check-artifact.sh @@ -12,6 +12,7 @@ # 255 - A suitable download or checksum utility is missing [ -n "$1" ] || { + echo "$0 - Download and verify build artifacts" echo "Usage: $0 " >&2 exit 1 } @@ -21,7 +22,7 @@ finish() { echo "Cleaning up." rm -r "/tmp/verify.$$" } - exit $1 + exit "$1" } trap "finish 254" INT TERM @@ -50,7 +51,8 @@ if which sha256sum >/dev/null; then checksum() { sha256sum -c --ignore-missing "sha256sums"; } elif which shasum >/dev/null; then checksum() { - local sum="$(shasum -a 256 "$image_file")"; + local sum + sum="$(shasum -a 256 "$image_file")"; grep -xF "${sum%% *} *$image_file" "sha256sums"; } else @@ -68,11 +70,14 @@ else } fi -mkdir -p "/tmp/verify.$$" -cd "/tmp/verify.$$" +tmpdir="$(mktemp -d)" +cd "$tmpdir" || { + echo "Failed to create temporary directory!" >&2 + finish 255 +} echo "" -echo "1) Downloading image file" +echo "1) Downloading artifact file" echo "=========================" download "$image_file" "$image_url" || { echo "Failed to download image file!" >&2 @@ -111,8 +116,8 @@ if [ -n "$missing_key" ]; then echo "" >&2 while true; do - printf "Keyserver to use? [$keyserver_url] > " - read url; case "${url:-$keyserver_url}" in + printf 'Keyserver to use? [%s] > ' "$keyserver_url" + read -r url; case "${url:-$keyserver_url}" in hkp://*) gpg --keyserver "${url:-$keyserver_url}" --recv-keys "$missing_key" || { echo "Failed to download public key." >&2 @@ -148,7 +153,7 @@ cp "$image_file" "$destdir/$image_file" || { echo "" echo "Verification done!" echo "==================" -echo "Firmware image placed in '$destdir/$image_file'." +echo "Downloaded artifact placed in '$destdir/$image_file'." echo "" finish 0 From 7f2c7b3238ee26180d44528ae98fd2f54e874511 Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sat, 9 Nov 2024 22:14:31 +0100 Subject: [PATCH 07/35] uboot-mediatek: add support for GatoNetworks GDSP The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial router from Yinghua Technologies. Advantages over stock bootloader: 1. supports serving the external GPIO WDT, allowing for easier work in U-Boot shell 2. supports cool features like netconsole, easy recovery, scripting and so on 3. allows using FIT image and image integrity validation and ultimately gives you much more flexibility to implement your tweaks. Known issues ------------ To make it easier to operate the device, console I/O multiplexing support has been enabled in U-Boot configuration. Setting I/O related U-Boot environment variables to something like "serial,nc" will have the desired effect. Still, setting these variables to such a value in the persistent environment will lead to a crash and make it impossible to boot the system or recover it. I decided to leave it on anyway since I think it can be very practical in development. Signed-off-by: Enrico Mioso --- package/boot/uboot-mediatek/Makefile | 14 + ...ialized-the-watchdog-subsystem-later.patch | 54 +++ .../patches/458-add-GatoNetworks-GDSP.patch | 406 ++++++++++++++++++ 3 files changed, 474 insertions(+) create mode 100644 package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch create mode 100644 package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 34857653688117..d2a03277d4057d 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -364,6 +364,19 @@ define U-Boot/mt7981_rfb-emmc DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr3 endef +define U-Boot/mt7981_gatonetworks_gdsp + NAME:=GatoNetworks GDSP + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=gatonetworks_gdsp + UBOOT_CONFIG:=mt7981_gatonetworks_gdsp + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=nor + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3 + FIP_COMPRESS:=1 +endef + define U-Boot/mt7981_rfb-nor NAME:=MT7981 Reference Board BUILD_SUBTARGET:=filogic @@ -797,6 +810,7 @@ UBOOT_TARGETS := \ mt7981_abt_asr3000 \ mt7981_cmcc_rax3000m-emmc \ mt7981_cmcc_rax3000m-nand \ + mt7981_gatonetworks_gdsp \ mt7981_glinet_gl-x3000 \ mt7981_glinet_gl-xe3000 \ mt7981_h3c_magic-nx30-pro \ diff --git a/package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch b/package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch new file mode 100644 index 00000000000000..7919b365601a7a --- /dev/null +++ b/package/boot/uboot-mediatek/patches/457-initialized-the-watchdog-subsystem-later.patch @@ -0,0 +1,54 @@ +From 9c1ad8a18ac1a20aee7a617964bcae3e90dac700 Mon Sep 17 00:00:00 2001 +From: Enrico Mioso +Date: Wed, 23 Oct 2024 17:46:35 +0200 +Subject: [PATCH] uboot-mediatek: initialized the watchdog subsystem later + +Initialize the watchdog subsystem later during initialization, to allow for +the gpio-wdt driver to work. + +Signed-off-by: Enrico Mioso +--- + common/board_r.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +--- a/common/board_r.c ++++ b/common/board_r.c +@@ -663,19 +663,13 @@ static init_fnc_t init_sequence_r[] = { + serial_initialize, + initr_announce, + dm_announce, +-#if CONFIG_IS_ENABLED(WDT) +- initr_watchdog, +-#endif +- INIT_FUNC_WATCHDOG_RESET + arch_initr_trap, + #if defined(CONFIG_BOARD_EARLY_INIT_R) + board_early_init_r, + #endif +- INIT_FUNC_WATCHDOG_RESET + #ifdef CONFIG_POST + post_output_backlog, + #endif +- INIT_FUNC_WATCHDOG_RESET + #if defined(CONFIG_PCI_INIT_R) && defined(CONFIG_SYS_EARLY_PCI_INIT) + /* + * Do early PCI configuration _before_ the flash gets initialised, +@@ -690,7 +684,6 @@ static init_fnc_t init_sequence_r[] = { + #ifdef CONFIG_MTD_NOR_FLASH + initr_flash, + #endif +- INIT_FUNC_WATCHDOG_RESET + #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) + /* initialize higher level parts of CPU like time base and timers */ + cpu_init_r, +@@ -719,6 +712,10 @@ static init_fnc_t init_sequence_r[] = { + #ifdef CONFIG_PVBLOCK + initr_pvblock, + #endif ++#if CONFIG_IS_ENABLED(WDT) ++ initr_watchdog, ++#endif ++ INIT_FUNC_WATCHDOG_RESET + initr_env, + #ifdef CONFIG_SYS_MALLOC_BOOTPARAMS + initr_malloc_bootparams, diff --git a/package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch b/package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch new file mode 100644 index 00000000000000..28bdd95e15355d --- /dev/null +++ b/package/boot/uboot-mediatek/patches/458-add-GatoNetworks-GDSP.patch @@ -0,0 +1,406 @@ +From 57d0f608d925cb688b5c9b71512fca7d228f07f6 Mon Sep 17 00:00:00 2001 +From: Enrico Mioso +Date: Wed, 23 Oct 2024 20:39:28 +0200 +Subject: [PATCH] add GatoNetworks GDSP + +Signed-off-by: Enrico Mioso +--- + arch/arm/dts/mt7981-gatonetworks_gdsp.dts | 200 +++++++++++++++++++++ + configs/mt7981_gatonetworks_gdsp_defconfig | 144 +++++++++++++++ + gatonetworks_gdsp_env | 38 ++++ + 3 files changed, 382 insertions(+) + create mode 100644 arch/arm/dts/mt7981-gatonetworks_gdsp.dts + create mode 100644 configs/mt7981_gatonetworks_gdsp_defconfig + create mode 100644 gatonetworks_gdsp_env + +--- /dev/null ++++ b/arch/arm/dts/mt7981-gatonetworks_gdsp.dts +@@ -0,0 +1,200 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "GatoNetworks GDSP"; ++ compatible = "gatonetworks,gdsp", "mediatek,mt7981"; ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ sim1 { ++ label = "sim1"; ++ gpios = <&gpio 13 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sim2 { ++ label = "sim2"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg1 { ++ label = "sg1"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg2 { ++ label = "sg2"; ++ gpios = <&gpio 11 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg3 { ++ label = "sg3"; ++ gpios = <&gpio 12 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg4 { ++ label = "sg4"; ++ gpios = <&gpio 7 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg5 { ++ label = "sg5"; ++ gpios = <&gpio 8 GPIO_ACTIVE_LOW>; ++ }; ++ ++ sg6 { ++ label = "sg6"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ gpio-watchdog { ++ compatible = "linux,wdt-gpio"; ++ gpios = <&gpio 6 GPIO_ACTIVE_LOW>; ++ hw_algo = "toggle"; ++ hw_margin_ms = <25000>; ++ always-running; ++ u-boot,autostart; ++ }; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "2500base-x"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <2500>; ++ full-duplex; ++ }; ++}; ++ ++&spi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ flash@0 { ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@00000 { ++ label = "BL2"; ++ reg = <0x00000 0x0040000>; ++ read-only; ++ }; ++ ++ partition@40000 { ++ label = "u-boot-env"; ++ reg = <0x40000 0x0010000>; ++ }; ++ ++ partition@50000 { ++ label = "Factory"; ++ reg = <0x50000 0x00B0000>; ++ read-only; ++ }; ++ ++ partition@100000 { ++ label = "FIP"; ++ reg = <0x100000 0x0080000>; ++ }; ++ ++ partition@180000 { ++ label = "firmware"; ++ reg = <0x180000 0x1E80000>; ++ }; ++ }; ++ }; ++}; ++ ++&pinctrl { ++ uart1_pins: uart1-pins { ++ mux { ++ function = "uart"; ++ groups = "uart1_0"; ++ }; ++ }; ++ ++ uart2_pins: uart2-pins { ++ mux { ++ function = "uart"; ++ groups = "uart2_0_tx_rx"; ++ }; ++ }; ++ ++ spi2_flash_pins: spi2-pins { ++ mux { ++ function = "spi"; ++ groups = "spi2", "spi2_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart2_pins>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/configs/mt7981_gatonetworks_gdsp_defconfig +@@ -0,0 +1,144 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_SIZE=0x10000 ++CONFIG_ENV_OFFSET=0x0 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-gatonetworks_gdsp" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_WATCHDOG_TIMEOUT_MSECS=25000 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_SPI_BOOT=y ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_USE_PREBOOT=y ++CONFIG_DEFAULT_FDT_FILE="mt7981-gatonetworks_gdsp" ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++CONFIG_LOGLEVEL=7 ++CONFIG_CONSOLE_MUX=y ++CONFIG_LOG=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="GDSP> " ++CONFIG_SYS_MAXARGS=16 ++CONFIG_CMD_BDINFO_EXTRA=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_HISTORY=y ++CONFIG_CMD_LICENSE=y ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++# CONFIG_CMD_BOOTEFI_BOOTMGR is not set ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_CALLBACK=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CRC32_VERIFY=y ++CONFIG_LOOPW=y ++CONFIG_CMD_MEMINFO=y ++CONFIG_CMD_MEMTEST=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_UNLZ4 is not set ++# CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPIO_READ=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_MTD=y ++# CONFIG_CMD_NAND_EXT is not set ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_CAT=y ++CONFIG_CMD_SETEXPR_FMT=y ++CONFIG_CMD_XXD=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_TFTPPUT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_CACHE=y ++# CONFIG_CMD_EFICONFIG is not set ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MTD=y ++CONFIG_ENV_MTD_NAME="u-boot-env" ++CONFIG_ENV_SIZE_REDUND=0x0 ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="gatonetworks_gdsp_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPI_FLASH_EON=y ++CONFIG_SPI_FLASH_GIGADEVICE=y ++CONFIG_SPI_FLASH_ISSI=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_SPANSION=y ++CONFIG_SPI_FLASH_STMICRO=y ++CONFIG_SPI_FLASH_WINBOND=y ++CONFIG_SPI_FLASH_XMC=y ++CONFIG_SPI_FLASH_XTX=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_UBI_SILENCE_MSG=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PHY=y ++CONFIG_PHY_MTK_TPHY=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_PWM=y ++CONFIG_PWM_MTK=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPIM=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_WDT=y ++CONFIG_WDT_GPIO=y ++CONFIG_UBIFS_SILENCE_MSG=y ++CONFIG_HEXDUMP=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/gatonetworks_gdsp_env +@@ -0,0 +1,38 @@ ++load_factory_data=if env exists factory_data_present ; then else mtd read Factory $loadaddr 0x0 0x1000 ; setenv factory_data_present 1 ; fi ++lan_mac_factory=run load_factory_data ; setexpr macoffs $loadaddr + 0x2a ; env readmem -b lan_mac $macoffs 0x6 ; setenv lan_mac_factory ; setenv macoffs ++wan_mac_factory=run load_factory_data ; setexpr macoffs $loadaddr + 0x24 ; env readmem -b wan_mac $macoffs 0x6 ; setenv wan_mac_factory ; setenv macoffs ++label_mac_factory=run load_factory_data ; setexpr macoffs $loadaddr + 0x4 ; env readmem -b label_mac $macoffs 0x6 ; setenv label_mac_factory ; setenv macoffs ++ethaddr_factory=setenv ethaddr $lan_mac ; setenv ethaddr_factory ++wifi_mac_factory=setenv wifi_mac $label_mac ; setenv wifi_mac_factory ++env_cleanup=setenv load_factory_data ; setenv factory_data_present ; setenv env_cleanup ++ipaddr=192.168.1.1 ++serverip=192.168.1.10 ++loadaddr=0x46000000 ++bootcmd=run boot_nor ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-gatonetworks_gdsp-initramfs-kernel.bin ++bootfile_upg=openwrt-mediatek-filogic-gatonetworks_gdsp-squashfs-sysupgrade.bin ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot system from flash.=run boot_nor ; run bootmenu_confirm_return ++bootmenu_3=Load system via TFTP then write to flash.=run boot_tftp_sysupgrade ; run bootmenu_confirm_return ++bootmenu_4=Reset all settings to factory defaults.=run reset_factory ; reset ++bootmenu_5=Reboot.=reset ++boot_first=if button reset ; then run boot_tftp ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_tftp_forever ++boot_nor=mtd read firmware ${loadaddr} ; bootm $loadaddr ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++boot_tftp_forever=while true ; do run boot_tftp ; sleep 1 ; done ++boot_tftp_sysupgrade=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && run nor_write_production ++reset_factory=env default -a && saveenv && reset ++nor_pad_size=setexpr image_eb $filesize / 0x1000 ; setexpr tmp1 image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb $image_eb + 1 ; setexpr image_eb $image_eb * 0x1000 ++nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x1e80000 && mtd erase firmware 0x0 0x$image_eb && mtd write firmware $loadaddr 0x0 $filesize ++_init_env=setenv _init_env ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run lan_mac_factory ; run wan_mac_factory ; run label_mac_factory ; run env_cleanup ; run ethaddr_factory ; run wifi_mac_factory ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" From 785ebf2baff4adadf818d71a99fdb2d2300590ba Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sat, 9 Nov 2024 22:14:32 +0100 Subject: [PATCH 08/35] uboot-envtools: add support for GatoNetworks GDSP This configuration should work with both stock and OpenWrt-based U-Boot. Signed-off-by: Enrico Mioso --- package/boot/uboot-envtools/files/mediatek_filogic | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index a38024de65976b..9de1a4d75ddc96 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -86,6 +86,9 @@ zbtlink,zbt-z8103ax) dlink,aquila-pro-ai-m30-a1) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x40000" ;; +gatonetworks,gdsp) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" + ;; glinet,gl-x3000|\ glinet,gl-xe3000|\ glinet,gl-mt2500|\ From b43194e041b17fbb574fb3721dafedcc30a20ab5 Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sat, 9 Nov 2024 22:14:33 +0100 Subject: [PATCH 09/35] mediatek: filogic: add support for GatoNetworks GDSP The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial router from Yinghua Technologies. The re-branded device comes with OpenWrt preinstalled, and an OpenWrt-based U-Boot bootloader version. While the flash layout has been kept compatible with the OpenWrt version found on the stock device (see [5]), the image format changed, making a bootloader upgrade necessary. Specifications: SoC: Mediatek MT7981BA RAM: 256MB Flash: SPI-NOR 32 MiB (Winbond W25Q256) WLAN: MT7976CN DBDC AX Wi-Fi Switch: MT7531AE (4x LAN Gigabit ports, 1x WAN Gigabit port) 5G: Quectel RM520N modem Watchdog: an external WDT connected to GPIO 6 is present and always running; the built-in Mediatek watchdog is also present and effective, but not used at the moment. This porting has been tested only with 1x 5G modems installed (the device supports up to two). Installation: Installation is possible via sysupgrade both in the stock device and re-branded version. However, in the former case, updating the bootloader is required. OpenWrt-based U-Boot Bootloader installation -------------------------------------------- The firmware flashed in the re-branded device at manifacturing time will flash an OpenWrt-based U-Boot bootloader with some extra recovery features (see [1]) at first boot. To update the bootloader, you need to install the mtd-rw module and insmod it: insmod mtd-rw i_want_a_brick=1 Then update relevant flash partitions: mtd erase u-boot-env mtd erase BL2 mtd erase FIP mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-preloader.bin BL2 mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-bl31-uboot.fip FIP And reboot, making sure all previous commands ran succesfully. If something goes wrong, you can recover your device via the mtk_uartboot tool. In my testing, it was possible to start the process even without (un)-plugging the device, may be handy for remote recovery. Installation from stock device and firmware ------------------------------------------- To install vanilla OpenWrt in the stock device (R5000 5G Industrial router from Yinghua Technologies) running the stock vendor firmware, you will need to update your bootloader as described in previous section. Remember to use -F (force upgrade) and -n (not keeping settings). U-Boot Recovery --------------- This procedure has been tested only with the OpenWrt-based U-boot bootloader. Assign your system static IP address 192.168.1.1 and start a TFTP server. The device will look for an initramfs image named openwrt-mediatek-filogic-gatonetworks_gdsp-initramfs-kernel.bin (so you may use openwrt/bin/targets/mediatek/filogic as root dir for your TFTP server). Power on the device while keeping the reset button pressed, until you see a TFTP request from 192.168.1.10. Your environment will be restored to it's default state. MAC addresses assignment ------------------------ MAC addresses are assigned slightly differently than in stock firmware. In particular, the 5 GHz Wi-Fi uses 2.4 GHZ MAC + 1, rather than reusing it with LA bit set as done in stock firmware. This MAC address is allocated to the device, so it can be used. The 2.4 GHz Wi-Fi MAC address is the label MAC. LAN MAC is used to set the special U-Boot environment ethaddr variable. device MAC address U-Boot env variable factory partition offset 2.4 GHz Wi-Fi :84 wifi_mac 0x4 5.8 GHz Wi-Fi :85 not present not present WAN :86 wan_mac 0x24 LAN :87 lan_mac 0x2A Notes ----- [1]: the OpenWrt-based U-Boot bootloader you will find installed in the re-branded device is configured to request for the initramfs image via TFTP for $gdsp_tftp_tries times before trying normal boot from NOR flash. Setting this U-Boot environment variable to 0x0 will disable the feature, which is not implemented in this patch. [2]: the exposed UART port is connected to ttyS1; the ttyS0 console port is not exposed. [3]: the provided bootloader environment has no provision for operating on BL2 and the FIP partitions. This is an intentional choice to make it (slightly) more difficult to brick the device. [4]: it seems GPIO 6 is used both for the "SYS" LED and external WDT. [5] BL2 expects to find FIP payload at a fixed offset, so some constraints apply. Signed-off-by: Enrico Mioso --- .../dts/mt7981b-gatonetworks-gdsp.dts | 389 ++++++++++++++++++ .../base-files/lib/upgrade/platform.sh | 1 + target/linux/mediatek/image/filogic.mk | 20 + 3 files changed, 410 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts diff --git a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts new file mode 100644 index 00000000000000..fd9fdca12404d5 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts @@ -0,0 +1,389 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981.dtsi" + +/ { + model = "GatoNetworks GDSP"; + compatible = "gatonetworks,gdsp", "mediatek,mt7981"; + + aliases { + serial0 = &uart0; + label-mac-device = &wifi_band_0; + led-boot = &sg1; + led-failsafe = &sg1; + led-running = &sg1; + led-upgrade = &sg1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "console=ttyS0,115200n1 earlycon=uart8250,mmio32,0x11002000"; + rootdisk = <&firmware>; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + modem1 { + gpio-export,name = "modem1"; + gpio-export,output = <0>; + gpios = <&pio 2 GPIO_ACTIVE_LOW>; + }; + + modem2 { + gpio-export,name = "modem2"; + gpio-export,output = <0>; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + sim1 { + label = "green:sim1"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + sim2 { + label = "green:sim2"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + sg1: sg1 { + label = "green:sg1"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + sg2 { + label = "green:sg2"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + sg3 { + label = "green:sg3"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + sg4 { + label = "green:sg4"; + gpios = <&pio 7 GPIO_ACTIVE_LOW>; + }; + + sg5 { + label = "green:sg5"; + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + }; + + sg6 { + label = "green:sg6"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <25000>; + always-running; + }; +}; + +&watchdog { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cells = <&macaddr_lan>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 0>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + swphy0: phy@0 { + reg = <0>; + }; + + swphy1: phy@1 { + reg = <1>; + }; + + swphy2: phy@2 { + reg = <2>; + }; + + swphy3: phy@3 { + reg = <3>; + }; + + swphy4: phy@4 { + reg = <4>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + phy-handle = <&swphy0>; + }; + + port@1 { + reg = <1>; + label = "lan2"; + phy-handle = <&swphy1>; + }; + + port@2 { + reg = <2>; + label = "lan3"; + phy-handle = <&swphy2>; + }; + + port@3 { + reg = <3>; + label = "lan4"; + phy-handle = <&swphy3>; + }; + + port@4 { + reg = <4>; + label = "wan"; + nvmem-cells = <&macaddr_wan>; + nvmem-cell-names = "mac-address"; + phy-handle = <&swphy4>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +&wifi { + mediatek,mtd-eeprom = <&factory 0x0>; + status = "okay"; + + wifi_band_0: band@0 { + reg = <0>; + nvmem-cells = <&macaddr_wifi 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_wifi 1>; + nvmem-cell-names = "mac-address"; + }; +}; + +&spi2 { + pinctrl-names = "default"; + pinctrl-0 = <&spi2_flash_pins>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <52000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@00000 { + label = "BL2"; + reg = <0x00000 0x0040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x0010000>; + }; + + factory: partition@50000 { + label = "Factory"; + reg = <0x50000 0x00B0000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_wifi: macaddr@4 { + reg = <0x4 0x6>; + compatible = "mac-base"; + #nvmem-cell-cells = <1>; + }; + + macaddr_wan: macaddr@24 { + reg = <0x24 0x6>; + }; + + macaddr_lan: macaddr@2a { + reg = <0x2a 0x6>; + }; + }; + }; + + partition@100000 { + label = "FIP"; + reg = <0x100000 0x0080000>; + read-only; + }; + + firmware: partition@180000 { + label = "firmware"; + reg = <0x180000 0x1E80000>; + }; + }; + }; +}; + +&pio { + uart1_pins: uart1-pins { + mux { + function = "uart"; + groups = "uart1_0"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart"; + groups = "uart2_0_tx_rx"; + }; + }; + + spi2_flash_pins: spi2-pins { + mux { + function = "spi"; + groups = "spi2", "spi2_wp_hold"; + }; + + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + mediatek,u3p-dis-msk = <0x0>; + phys = <&u2port0 PHY_TYPE_USB2>, + <&u3port0 PHY_TYPE_USB3>; + status = "okay"; + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; +}; diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 7fe2d29d31d207..cfd77b62d7affb 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -70,6 +70,7 @@ platform_do_upgrade() { bananapi,bpi-r4|\ bananapi,bpi-r4-poe|\ cmcc,rax3000m|\ + gatonetworks,gdsp|\ h3c,magic-nx30-pro|\ jcg,q30-pro|\ jdcloud,re-cp-03|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 5dfde755a0125b..739fd543085c60 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -670,6 +670,26 @@ define Device/edgecore_eap111 endef TARGET_DEVICES += edgecore_eap111 +define Device/gatonetworks_gdsp + DEVICE_VENDOR := GatoNetworks + DEVICE_MODEL := gdsp + DEVICE_DTS := mt7981b-gatonetworks-gdsp + DEVICE_DTS_DIR := ../dts + IMAGES := sysupgrade.itb + IMAGE_SIZE := 32768k + DEVICE_PACKAGES := fitblk kmod-mt7915e kmod-mt7981-firmware \ + kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 \ + mt7981-wo-firmware -kmod-phy-aquantia + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 nor-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot gatonetworks_gdsp + KERNEL := kernel-bin | gzip + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata +endef +TARGET_DEVICES += gatonetworks_gdsp + define Device/glinet_gl-mt2500 DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-MT2500 From 0e59eaa7962fc21635af5c9d2f6552a4accdc7ea Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Wed, 13 Nov 2024 17:23:52 -0300 Subject: [PATCH 10/35] ipq806x: tr4400v2: revert nesting of MTD partitions that bricks device This reverts commit e1043a746a1030062e73ea027d9a35c58bce6c6a, that attempts to nest partitions that overlap but are not nested. This causes the 'ubi' partition to be truncated, making rootfs inaccessible and bricking the device. Also, had this commit worked, it would have renumbered MTD partitions in a way that would have broken documented scripts for installation and update of main and recovery OSes, making backups, return to stock, etc, and broken user configurations that put the 'extra' partition to use. Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/16944 Signed-off-by: Robert Marko --- .../boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts | 80 ++++++++----------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts index 8818e95e8d1b3b..8410721b72c0e8 100644 --- a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts +++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8065-tr4400-v2.dts @@ -207,15 +207,6 @@ stock_partition@1340000 { label = "stock_rootfs"; reg = <0x1340000 0x4000000>; - - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "extra"; - reg = <0x0 0x4000000>; - }; }; partition@5340000 { label = "0:BOOTCONFIG"; @@ -265,42 +256,6 @@ stock_partition@6400000 { label = "stock_rootfs_1"; reg = <0x6400000 0x4000000>; - - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "fw_env"; - reg = <0x0 0x100000>; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_fw_env_0: macaddr@0 { - reg = <0x00 0x6>; - }; - macaddr_fw_env_6: macaddr@6 { - reg = <0x06 0x6>; - }; - macaddr_fw_env_c: macaddr@c { - reg = <0x0c 0x6>; - }; - macaddr_fw_env_12: macaddr@12 { - reg = <0x12 0x6>; - }; - macaddr_fw_env_18: macaddr@18 { - reg = <0x18 0x6>; - }; - }; - }; - - partition@100000 { - label = "ubi"; - reg = <0x100000 0x9b00000>; - }; }; stock_partition@a400000 { label = "stock_fw_env"; @@ -318,6 +273,41 @@ label = "stock_scfgmgr"; reg = <0xaf00000 0x0100000>; }; + + partition@6400000 { + label = "fw_env"; + reg = <0x6400000 0x0100000>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_fw_env_0: macaddr@0 { + reg = <0x00 0x6>; + }; + macaddr_fw_env_6: macaddr@6 { + reg = <0x06 0x6>; + }; + macaddr_fw_env_c: macaddr@c { + reg = <0x0c 0x6>; + }; + macaddr_fw_env_12: macaddr@12 { + reg = <0x12 0x6>; + }; + macaddr_fw_env_18: macaddr@18 { + reg = <0x18 0x6>; + }; + }; + }; + partition@6500000 { + label = "ubi"; + reg = <0x6500000 0x9b00000>; + }; + partition@1340000 { + label = "extra"; + reg = <0x1340000 0x4000000>; + }; }; }; }; From dab5ca818ef46b32a9c120b5136fd5a1a34a88a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 14 Nov 2024 09:02:13 +0000 Subject: [PATCH 11/35] Revert "apk: update to Git 417a93ceae540444fdbd3f76d1dadf0e15621fdc (2024-11-13)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c6a3a11c07fdd85baf9ae43d718eb7a317995ed8 as it was reported, that it causes issues: ERROR: failed to read repositories: /dev/zero: No buffer space available ERROR: unable to select packages: ca-bundle-20240203-r1: error: uninstallable arch: all satisfies: world[ca-bundle] Reported-by: xiao bo References: https://github.com/openwrt/openwrt/commit/c6a3a11c07fdd85baf9ae43d718eb7a317995ed8#commitcomment-149072959 Signed-off-by: Petr Štetiar --- package/system/apk/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index e911f4ae4b72b6..2d637fa180987d 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-11-13 -PKG_SOURCE_VERSION:=417a93ceae540444fdbd3f76d1dadf0e15621fdc -PKG_MIRROR_HASH:=3888aa506f0ce808cbe0287b98abfb7ba92e68b1eb17516fef4b58068bc72131 +PKG_SOURCE_DATE:=2024-11-08 +PKG_SOURCE_VERSION:=d9c24813d983df9524fa7a2b78fc3132c159a20f +PKG_MIRROR_HASH:=3d1a79c08ef8c8b9404f9287d9acda6468b8b1c2a99dd384287f522ed3b1a047 PKG_VERSION=3.0.0_pre$(subst -,,$(PKG_SOURCE_DATE)) From deeb29e6feccf1359d15f708a91bb53bc957bbe0 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Thu, 14 Nov 2024 11:21:41 +0100 Subject: [PATCH 12/35] apk: host: set lua version to 5.1 to fix help Commit b2a84c86e3 ("apk: host: make the help available") enabled the host build for lua (5.1) as a dependency, but apk defaults to lua 5.3. This caused it to ignore our lua, and only build the help if the host system had lua 5.3 installed. Fix this by explicitly setting the lua version to ours. Fixes: b2a84c86e3 ("apk: host: make the help available") Signed-off-by: Jonas Gorski --- package/system/apk/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 2d637fa180987d..fec6d5325c7e58 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -53,6 +53,7 @@ MESON_HOST_VARS+=VERSION=$(PKG_VERSION) MESON_VARS+=VERSION=$(PKG_VERSION) MESON_HOST_ARGS += \ + -Dlua_version=5.1 \ -Dcompressed-help=false \ -Ddocs=disabled \ -Durl_backend=wget \ From 954d2ad81b86762a7310a550158f0b35a0f81090 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Thu, 14 Nov 2024 12:01:40 +0100 Subject: [PATCH 13/35] apk: move common meson args to its own variable Most apk meson args are shared between host and target builds, so lets have a common variable for them. Signed-off-by: Jonas Gorski --- package/system/apk/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index fec6d5325c7e58..4ce8f21a48ce08 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -52,21 +52,20 @@ endef MESON_HOST_VARS+=VERSION=$(PKG_VERSION) MESON_VARS+=VERSION=$(PKG_VERSION) -MESON_HOST_ARGS += \ - -Dlua_version=5.1 \ +MESON_COMMON_ARGS = \ -Dcompressed-help=false \ -Ddocs=disabled \ + -Dlua_version=5.1 \ -Durl_backend=wget \ - -Dcrypto_backend=openssl \ -Dzstd=false +MESON_HOST_ARGS += \ + $(MESON_COMMON_ARGS) \ + -Dcrypto_backend=openssl + MESON_ARGS += \ - -Dlua_version=5.1 \ - -Dcompressed-help=false \ - -Ddocs=disabled \ - -Durl_backend=wget \ - -Dcrypto_backend=$(BUILD_VARIANT) \ - -Dzstd=false + $(MESON_COMMON_ARGS) \ + -Dcrypto_backend=$(BUILD_VARIANT) HOST_LDFLAGS += \ -Wl,-rpath $(STAGING_DIR_HOST)/lib From b67db1b0fc9528f7bf7b5dc47b276e4ad146ae00 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Thu, 14 Nov 2024 12:03:44 +0100 Subject: [PATCH 14/35] apk: explicitly enable help Explicitly enable help so that the build will fail when an appropriate lua binary isn't found instead of silently disabling the feature. Signed-off-by: Jonas Gorski --- package/system/apk/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 4ce8f21a48ce08..1ddc9635adffc1 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -55,6 +55,7 @@ MESON_VARS+=VERSION=$(PKG_VERSION) MESON_COMMON_ARGS = \ -Dcompressed-help=false \ -Ddocs=disabled \ + -Dhelp=enabled \ -Dlua_version=5.1 \ -Durl_backend=wget \ -Dzstd=false From 6720c4ccba256186bf2f1b1edadb851c447e62a5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 14 Nov 2024 13:03:23 +0100 Subject: [PATCH 15/35] mt76: update to Git HEAD (2024-10-28) 8dfead68c202 wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state d508a6eb935d wifi: mt76: mt7996: use mac80211 .sta_state op 57019e663f57 wifi: mt76: add code for emulating hardware scanning dc4c2bdf7c56 wifi: mt76: add support for allocating a phy without hw 8cd0263f92e1 wifi: mt76: rename struct mt76_vif to mt76_vif_link 99df84d62883 wifi: mt76: add vif link specific data structure dcc6f158d759 wifi: mt76: mt7996: split link specific data from struct mt7996_vif d388deab9e73 wifi: mt76: initialize more wcid fields mt76_wcid_init d026be405c54 wifi: mt76: add chanctx functions for multi-channel phy support 0b05795ca81c wifi: mt76: remove dev->wcid_phy_mask 0b526090de95 wifi: mt76: add multi-radio support to a few core hw ops aeedee5c0a2c wifi: mt76: add multi-radio support to tx scheduling fc0ff17b53ff wifi: mt76: add multi-radio support to scanning code f19cbcf83400 wifi: mt76: add multi-radio remain_on_channel functions 42429ae0eaf6 wifi: mt76: mt7996: use emulated hardware scan support f9d593d4a6b4 wifi: mt76: mt7996: pass wcid to mt7996_mcu_sta_hdr_trans_tlv 807090b28661 wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support 252baa7bf477 wifi: mt76: mt7996: prepare mt7996_mcu_add_beacon for MLO support 9ee990050305 wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support bf12cc404334 wifi: mt76: mt7996: prepare mt7996_mcu_set_timing for MLO support 60bf2bef95dc wifi: mt76: connac: prepare mt76_connac_mcu_sta_basic_tlv for MLO support 1289737e12a8 wifi: mt76: mt7996: prepare mt7996_mcu_update_bss_color for MLO support 7c00df0e7e57 wifi: mt76: connac: rework connac helpers 484e3f289a40 wifi: mt76: mt7996: move all debugfs files to the primary phy d258f4e3e1ca wifi: mt76: mt7996: switch to single multi-radio wiphy c246fa545119 wifi: mt76: mt7996: fix monitor mode Signed-off-by: Felix Fietkau --- package/kernel/mt76/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 73f34d8edadf18..b5cdc765729975 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-10-11.1 -PKG_SOURCE_VERSION:=ecca0e77b4bce629ec1f79d83bbd14a68f919188 -PKG_MIRROR_HASH:=770823f282c76532567a651bb020208c3ddd5a728c656fcde43129fc95edf538 +PKG_SOURCE_DATE:=2024-10-28 +PKG_SOURCE_VERSION:=c246fa545119abe5097682316700f13c91399042 +PKG_MIRROR_HASH:=ff59d9588e6b114be8fe08013b55da975bc6bb4219b97b6fedb72246e9337c18 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 From 1e8505ac4e88212106fe78486cfcbe9cae7660f9 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 13 Nov 2024 21:58:38 +0000 Subject: [PATCH 16/35] procd: update to git HEAD 7330fa5 initd: mount /sys and /proc with MS_RELATIME Fixes mounting /proc in unpriviledged user namespace. Signed-off-by: Daniel Golle --- package/system/procd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 86de4babfdfaff..81e133f55bc482 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_MIRROR_HASH:=0f494faf2811af6cd7332acda8049ad9713dcabc4b2885dc14acbd9f61920be1 -PKG_SOURCE_DATE:=2024-11-06 -PKG_SOURCE_VERSION:=109fa41b2321506280397e03757976c468832668 +PKG_MIRROR_HASH:=56c5f71da3f68036c63ae59d01992785e74027726da5973297895985cd27c215 +PKG_SOURCE_DATE:=2024-11-13 +PKG_SOURCE_VERSION:=7330fa55c5211eb7b3c675d1c7b8281b69b53553 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From a6c248e8ad75971ccfedebf2a172ef3e2696fa18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 14 Nov 2024 09:07:20 +0000 Subject: [PATCH 17/35] apk: fix long package description handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently its not possible to generate apk package.adb package index if the package has longer description field, which leads to following failure: (2352/2353) Installing zoneinfo-all (2024b-r1) (2353/2353) Installing zstd (1.5.6-r1) ERROR: System state may be inconsistent: failed to write database: No buffer space available 1 error; 2704 MiB in 2353 packages The code to read/write installeddb does not really handle long description well. Until the database is converted to apkv3 format, truncate the apkv3 descriptions to allow existing code to work. APKv3 index and packages still contain the original long description unmodified, so no package rebuild will be needed. Fixing the issue by backporting the single upstream fix as its not possible to to upstep apk to the latest Git HEAD due to some regressions, see commit 692052cdc0e7 ("Revert "apk: update to Git 417a93ceae540444fdbd3f76d1dadf0e15621fdc (2024-11-13)"") for more details. Fixes: #16929 References: https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/11038 Upstream-Status: Backport [https://gitlab.alpinelinux.org/alpine/apk-tools/-/commit/417a93ceae540444fdbd3f76d1dadf0e15621fdc] Link: https://github.com/openwrt/openwrt/pull/16951 Signed-off-by: Petr Štetiar --- package/system/apk/Makefile | 2 +- ...ncate-apkv3-description-to-256-bytes.patch | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 package/system/apk/patches/0020-pkg-truncate-apkv3-description-to-256-bytes.patch diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 1ddc9635adffc1..f760ce1ec4af65 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=apk -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL=https://gitlab.alpinelinux.org/alpine/apk-tools.git PKG_SOURCE_PROTO:=git diff --git a/package/system/apk/patches/0020-pkg-truncate-apkv3-description-to-256-bytes.patch b/package/system/apk/patches/0020-pkg-truncate-apkv3-description-to-256-bytes.patch new file mode 100644 index 00000000000000..62cdd9d0c9dae0 --- /dev/null +++ b/package/system/apk/patches/0020-pkg-truncate-apkv3-description-to-256-bytes.patch @@ -0,0 +1,45 @@ +From 417a93ceae540444fdbd3f76d1dadf0e15621fdc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Wed, 13 Nov 2024 09:40:21 +0200 +Subject: [PATCH] pkg: truncate apkv3 description to 256 bytes + +The code to read/write installeddb does not really handle long +description well. Until the database is converted to apkv3 format, +truncate the apkv3 descriptions to allow existing code to work. + +APKv3 index and packages still contain the original long description +unmodified, so no package rebuild will be needed. + +fixes #11038 + +Upstream-Status: Backport [https://gitlab.alpinelinux.org/alpine/apk-tools/-/commit/417a93ceae540444fdbd3f76d1dadf0e15621fdc] +--- + src/apk_blob.h | 5 +++++ + src/package.c | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/src/apk_blob.h ++++ b/src/apk_blob.h +@@ -48,6 +48,11 @@ static inline apk_blob_t apk_blob_trim(a + return b; + } + ++static inline apk_blob_t apk_blob_truncate(apk_blob_t blob, int maxlen) ++{ ++ return APK_BLOB_PTR_LEN(blob.ptr, min(blob.len, maxlen)); ++} ++ + char *apk_blob_cstr(apk_blob_t str); + apk_blob_t apk_blob_dup(apk_blob_t blob); + int apk_blob_split(apk_blob_t blob, apk_blob_t split, apk_blob_t *l, apk_blob_t *r); +--- a/src/package.c ++++ b/src/package.c +@@ -577,7 +577,7 @@ void apk_pkgtmpl_from_adb(struct apk_dat + + pkg->name = apk_db_get_name(db, adb_ro_blob(pkginfo, ADBI_PI_NAME)); + pkg->version = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_VERSION)); +- pkg->description = apk_atomize_dup0(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_DESCRIPTION)); ++ pkg->description = apk_atomize_dup0(&db->atoms, apk_blob_truncate(adb_ro_blob(pkginfo, ADBI_PI_DESCRIPTION), 512)); + pkg->url = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_URL)); + pkg->license = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_LICENSE)); + pkg->arch = apk_atomize_dup(&db->atoms, adb_ro_blob(pkginfo, ADBI_PI_ARCH)); From 8c018dcb5601150f26a01babd297e6b416895eba Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 15 Nov 2024 12:27:44 +0100 Subject: [PATCH 18/35] package: use /dev/null for apk --repositories-file In preparation for APK version bump, use /dev/null instead of /dev/zero for --repositories-file to mute an error in recent APK files. New APK version use modern istream logic that are more sensible to the kind of file passed and /dev/null is required to correctly handle an empty repository file. Signed-off-by: Christian Marangi --- include/image.mk | 4 ++-- package/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/image.mk b/include/image.mk index 9a4dff2167a14f..881d420ae1c36f 100644 --- a/include/image.mk +++ b/include/image.mk @@ -310,7 +310,7 @@ endef define Image/Manifest $(if $(CONFIG_USE_APK), \ $(call apk,$(TARGET_DIR_ORIG)) list --quiet --manifest --no-network \ - --repositories-file /dev/zero | sort | sed 's/ / - /' > \ + --repositories-file /dev/null | sort | sed 's/ / - /' > \ $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest, \ $(call opkg,$(TARGET_DIR_ORIG)) list-installed > \ $(BIN_DIR)/$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest \ @@ -365,7 +365,7 @@ opkg_target = \ apk_target = \ $(call apk,$(mkfs_cur_target_dir)) --no-scripts \ - --repositories-file /dev/zero --repository file://$(PACKAGE_DIR_ALL)/packages.adb + --repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb target-dir-%: FORCE diff --git a/package/Makefile b/package/Makefile index 88d312d4edc56d..2c7cd588793b62 100644 --- a/package/Makefile +++ b/package/Makefile @@ -99,7 +99,7 @@ ifneq ($(CONFIG_USE_APK),) $(file >$(TMP_DIR)/apk_install_list,\ $(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))) $(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \ - --repositories-file /dev/zero --repository file://$(PACKAGE_DIR_ALL)/packages.adb \ + --repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb \ $$(cat $(TMP_DIR)/apk_install_list) else $(file >$(TMP_DIR)/opkg_install_list,\ From 749a43325b98afe4430fa7e2f23ac3ee44791ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Fri, 15 Nov 2024 10:01:35 +0100 Subject: [PATCH 19/35] utils: Add the omnia-eeprom utility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new utility, `omnia-eeprom`, which can be used to print / set EEPROM fields on Turris Omnia. One example when this utility might be useful is if the board experiences random crashes due to newer versions of the DDR training algorithm in newer U-Boot. The user can change the DDR speed from 1600K to 1333H to solve these issues, with ``` omnia-eeprom set ddr_speed 1333H ``` Signed-off-by: Marek Behún Link: https://github.com/openwrt/openwrt/pull/16264 Signed-off-by: Robert Marko --- package/utils/omnia-eeprom/Makefile | 56 ++++++++++++++++++++++++++++ target/linux/mvebu/image/cortexa9.mk | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 package/utils/omnia-eeprom/Makefile diff --git a/package/utils/omnia-eeprom/Makefile b/package/utils/omnia-eeprom/Makefile new file mode 100644 index 00000000000000..03eb13bbc1d23e --- /dev/null +++ b/package/utils/omnia-eeprom/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2024 Marek Behún +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=omnia-eeprom +PKG_VERSION:=0.1 +PKG_RELEASE:=1 + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-v$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://gitlab.nic.cz/turris/omnia-eeprom/-/archive/v$(PKG_VERSION)/ +PKG_HASH:=6f949d0b8080adca8bae088774ce615b563ba6ec2807cce97ee6769b4eee7bbf + +PKG_MAINTAINER:=Marek Behun +PKG_LICENSE:=GPL-2.0-or-later + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +include $(INCLUDE_DIR)/package.mk + +define Package/omnia-eeprom + SECTION:=utils + CATEGORY:=Utilities + URL:=https://gitlab.nic.cz/turris/omnia-eeprom + TITLE:=CZ.NIC Turris Omnia EEPROM accessing utility + DEPENDS:=@TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia +kmod-eeprom-at24 +endef + +define Package/omnia-eeprom/description +This package contains the omnia-eeprom utility, which allows you to display +and update EEPROM fields on the Turris Omnia router. +The EEPROM is normally not meant to be updated by users, but there are some +exceptions where it might be useful. +One such example is to change the DDR3 speed from the default 1600K mode to +1333H mode, in order to solve random crashes that occur on some boards with +newer versions of the U-Boot bootloader (because of bugs in newer versions of +the DDR training algorithm). +endef + +MAKE_VARS += OMNIA_EEPROM_VERSION="v$(PKG_VERSION)" + +TARGET_CFLAGS += -Wall + +Build/Compile = $(Build/Compile/Default) + +define Package/omnia-eeprom/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/omnia-eeprom $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,omnia-eeprom)) diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 6e49045f68432e..4a41f2c1029c33 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -107,7 +107,8 @@ define Device/cznic_turris-omnia mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \ wpad-basic-mbedtls kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \ kmod-mt7915-firmware partx-utils kmod-i2c-mux-pca954x kmod-leds-turris-omnia \ - kmod-turris-omnia-mcu kmod-gpio-button-hotplug omnia-mcu-firmware omnia-mcutool + kmod-turris-omnia-mcu kmod-gpio-button-hotplug omnia-eeprom omnia-mcu-firmware \ + omnia-mcutool IMAGES := sysupgrade.img.gz IMAGE/sysupgrade.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata SUPPORTED_DEVICES += armada-385-turris-omnia From ca00bafd7e05b3f77e38acac6add223ce46df585 Mon Sep 17 00:00:00 2001 From: Joe Zheng Date: Fri, 20 Sep 2024 05:57:34 +0000 Subject: [PATCH 20/35] linux-firmware: rename packages for i915 firmware Change the package name from intel-igpu-firmware-* to i915-firmware-*, the prefix "intel-igpu" is misleading, i915 firmware is not only for iGPU but also for dGPU now. Remove the redundant "intel" as i915 is already well known. More accurate file classification to handle following files correctly: adlp_dmc.bin mtl_huc.bin mtl_huc_gsc.bin mtl_gsc_1.bin The pattern in regex is "([[:alnum:]]+)_([[:alnum:]]+)(_[\w-.]+)?\.bin", where $1 is the platform, $2 is the firmware type (dmc, guc, huc, etc.), and the optional $3 which is revision or other suffix. Glob first to narrow down the target file set, and then split with "_" to extract the firmware type (remove the ".bin" in case there is no $3) Add package "i915-firmware" as a meta package to install all the i915 firmwares, it is a balance between simplicity and optimization. * Installing all the available firmwares as a whole, can support all the platforms, not only the current one but also the future ones. The price to pay is the increased size. * If we want to minimize the storage, we can customize to install the necessary ones only, even for the target platform only (e.g. ADL) and skip the others. The price to pay is the time to tune. What I am going to do is: * Let drm-i915 driver depend on i915-firmware-dmc, which is small and can cover most of the old platforms * Let the user select i915-firmware to install all the i915 firmwares as a whole to cover the latest or future platforms Signed-off-by: Joe Zheng Link: https://github.com/openwrt/openwrt/pull/16276 Signed-off-by: Robert Marko --- package/firmware/linux-firmware/intel.mk | 56 ++++++++++++++++-------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 225b2aa86295e3..4c9e04cd3d344c 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -216,29 +216,49 @@ define Package/e100-firmware/install endef $(eval $(call BuildPackage,e100-firmware)) -Package/intel-igpu-firmware-dmc = $(call Package/firmware-default,Intel iGPU DMC Display MC firmware) -define Package/intel-igpu-firmware-dmc/install +i915_deps:=+i915-firmware-dmc +i915-firmware-guc +i915-firmware-huc +i915-firmware-gsc +Package/i915-firmware = $(call Package/firmware-default,Intel I915 firmware \(meta package\),$(i915_deps),LICENSE.i915) +define Package/i915-firmware/install + true +endef +$(eval $(call BuildPackage,i915-firmware)) + +Package/i915-firmware-dmc = $(call Package/firmware-default,Intel I915 DMC firmware,,LICENSE.i915) +define Package/i915-firmware-dmc/install $(INSTALL_DIR) $(1)/lib/firmware/i915 - $(CP) \ - $(PKG_BUILD_DIR)/i915/*_dmc_*.bin* \ - $(1)/lib/firmware/i915/ + for f in $(PKG_BUILD_DIR)/i915/*_dmc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = dmc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done endef -$(eval $(call BuildPackage,intel-igpu-firmware-dmc)) +$(eval $(call BuildPackage,i915-firmware-dmc)) -Package/intel-igpu-firmware-guc = $(call Package/firmware-default,Intel iGPU GUC Graphics MC firmware) -define Package/intel-igpu-firmware-guc/install +Package/i915-firmware-guc = $(call Package/firmware-default,Intel I915 GUC firmware,,LICENSE.i915) +define Package/i915-firmware-guc/install $(INSTALL_DIR) $(1)/lib/firmware/i915 - $(CP) \ - $(PKG_BUILD_DIR)/i915/*_guc_*.bin* \ - $(1)/lib/firmware/i915/ + for f in $(PKG_BUILD_DIR)/i915/*_guc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = guc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done endef -$(eval $(call BuildPackage,intel-igpu-firmware-guc)) +$(eval $(call BuildPackage,i915-firmware-guc)) -Package/intel-igpu-firmware-huc = $(call Package/firmware-default,Intel iGPU HUC H.265 MC firmware) -define Package/intel-igpu-firmware-huc/install +Package/i915-firmware-huc = $(call Package/firmware-default,Intel I915 HUC firmware,,LICENSE.i915) +define Package/i915-firmware-huc/install $(INSTALL_DIR) $(1)/lib/firmware/i915 - $(CP) \ - $(PKG_BUILD_DIR)/i915/*_huc_*.bin* \ - $(1)/lib/firmware/i915/ + for f in $(PKG_BUILD_DIR)/i915/*_huc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = huc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done +endef +$(eval $(call BuildPackage,i915-firmware-huc)) + +Package/i915-firmware-gsc = $(call Package/firmware-default,Intel I915 GSC firmware,,LICENSE.i915) +define Package/i915-firmware-gsc/install + $(INSTALL_DIR) $(1)/lib/firmware/i915 + for f in $(PKG_BUILD_DIR)/i915/*_gsc*.bin; do \ + t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \ + if [ "$$$$t" = gsc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \ + done endef -$(eval $(call BuildPackage,intel-igpu-firmware-huc)) +$(eval $(call BuildPackage,i915-firmware-gsc)) From 77cfe8fd15d3d0f77ee16660d06a174f41b53444 Mon Sep 17 00:00:00 2001 From: Joe Zheng Date: Sun, 25 Aug 2024 00:53:01 +0000 Subject: [PATCH 21/35] x86: make i915 as a kmod with required firmware i915 driver requires to load correct firmware to work on latest x86 GPU, it is more reasonable to make it as a kernel module, so that initramfs is not required, and it can also save some space from the kernel image comparing being a built-in driver Signed-off-by: Joe Zheng Link: https://github.com/openwrt/openwrt/pull/16276 Signed-off-by: Robert Marko --- package/kernel/linux/modules/video.mk | 42 +++++++++++++++++++++++++++ target/linux/x86/64/config-6.6 | 24 --------------- target/linux/x86/generic/config-6.6 | 24 --------------- target/linux/x86/legacy/config-6.6 | 24 --------------- 4 files changed, 42 insertions(+), 72 deletions(-) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 8b4585a624e604..fc0f038863ceaf 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -438,6 +438,48 @@ endef $(eval $(call KernelPackage,drm-amdgpu)) +define KernelPackage/drm-i915 + SUBMENU:=$(VIDEO_MENU) + TITLE:=Intel i915 DRM support + DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ + +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +i915-firmware-dmc \ + +kmod-drm-display-helper +kmod-drm-buddy +kmod-acpi-video \ + +kmod-drm-exec +kmod-drm-suballoc-helper + KCONFIG:=CONFIG_DRM_I915 \ + CONFIG_DRM_I915_CAPTURE_ERROR=y \ + CONFIG_DRM_I915_COMPRESS_ERROR=y \ + CONFIG_DRM_I915_DEBUG=n \ + CONFIG_DRM_I915_DEBUG_GUC=n \ + CONFIG_DRM_I915_DEBUG_MMIO=n \ + CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n \ + CONFIG_DRM_I915_DEBUG_VBLANK_EVADE=n \ + CONFIG_DRM_I915_FENCE_TIMEOUT=10000 \ + CONFIG_DRM_I915_FORCE_PROBE="" \ + CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 \ + CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=n \ + CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 \ + CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 \ + CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 \ + CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 \ + CONFIG_DRM_I915_SELFTEST=n \ + CONFIG_DRM_I915_STOP_TIMEOUT=100 \ + CONFIG_DRM_I915_SW_FENCE_CHECK_DAG=n \ + CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS=n \ + CONFIG_DRM_I915_TIMESLICE_DURATION=1 \ + CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 \ + CONFIG_DRM_I915_USERPTR=y \ + CONFIG_DRM_I915_WERROR=n \ + CONFIG_FB_INTEL=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/i915/i915.ko + AUTOLOAD:=$(call AutoProbe,i915) +endef + +define KernelPackage/drm-i915/description + Direct Rendering Manager (DRM) support for Intel GPU +endef + +$(eval $(call KernelPackage,drm-i915)) + define KernelPackage/drm-imx SUBMENU:=$(VIDEO_MENU) diff --git a/target/linux/x86/64/config-6.6 b/target/linux/x86/64/config-6.6 index def4527f77180b..3475e65287288b 100644 --- a/target/linux/x86/64/config-6.6 +++ b/target/linux/x86/64/config-6.6 @@ -151,30 +151,6 @@ CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 CONFIG_DRM_GEM_SHMEM_HELPER=y # CONFIG_DRM_HYPERV is not set -CONFIG_DRM_I915=y -CONFIG_DRM_I915_CAPTURE_ERROR=y -CONFIG_DRM_I915_COMPRESS_ERROR=y -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_I915_DEBUG_GUC is not set -# CONFIG_DRM_I915_DEBUG_MMIO is not set -# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set -# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set -CONFIG_DRM_I915_FENCE_TIMEOUT=10000 -CONFIG_DRM_I915_FORCE_PROBE="" -CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set -CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 -CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -# CONFIG_DRM_I915_SELFTEST is not set -CONFIG_DRM_I915_STOP_TIMEOUT=100 -# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set -# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set -CONFIG_DRM_I915_TIMESLICE_DURATION=1 -CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_WERROR is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y diff --git a/target/linux/x86/generic/config-6.6 b/target/linux/x86/generic/config-6.6 index 091584e0774aa8..ecbd0aa93ee29a 100644 --- a/target/linux/x86/generic/config-6.6 +++ b/target/linux/x86/generic/config-6.6 @@ -86,30 +86,6 @@ CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 CONFIG_DRM_GEM_SHMEM_HELPER=y # CONFIG_DRM_HYPERV is not set -CONFIG_DRM_I915=y -CONFIG_DRM_I915_CAPTURE_ERROR=y -CONFIG_DRM_I915_COMPRESS_ERROR=y -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_I915_DEBUG_GUC is not set -# CONFIG_DRM_I915_DEBUG_MMIO is not set -# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set -# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set -CONFIG_DRM_I915_FENCE_TIMEOUT=10000 -CONFIG_DRM_I915_FORCE_PROBE="" -CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set -CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 -CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -# CONFIG_DRM_I915_SELFTEST is not set -CONFIG_DRM_I915_STOP_TIMEOUT=100 -# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set -# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set -CONFIG_DRM_I915_TIMESLICE_DURATION=1 -CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_WERROR is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y diff --git a/target/linux/x86/legacy/config-6.6 b/target/linux/x86/legacy/config-6.6 index 8ce9237a21dfe5..10511ff08b384d 100644 --- a/target/linux/x86/legacy/config-6.6 +++ b/target/linux/x86/legacy/config-6.6 @@ -67,30 +67,6 @@ CONFIG_DRM_DISPLAY_HELPER=y CONFIG_DRM_EXEC=y CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 -CONFIG_DRM_I915=y -CONFIG_DRM_I915_CAPTURE_ERROR=y -CONFIG_DRM_I915_COMPRESS_ERROR=y -# CONFIG_DRM_I915_DEBUG is not set -# CONFIG_DRM_I915_DEBUG_GUC is not set -# CONFIG_DRM_I915_DEBUG_MMIO is not set -# CONFIG_DRM_I915_DEBUG_RUNTIME_PM is not set -# CONFIG_DRM_I915_DEBUG_VBLANK_EVADE is not set -CONFIG_DRM_I915_FENCE_TIMEOUT=10000 -CONFIG_DRM_I915_FORCE_PROBE="" -CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -# CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS is not set -CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 -CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -# CONFIG_DRM_I915_SELFTEST is not set -CONFIG_DRM_I915_STOP_TIMEOUT=100 -# CONFIG_DRM_I915_SW_FENCE_CHECK_DAG is not set -# CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS is not set -CONFIG_DRM_I915_TIMESLICE_DURATION=1 -CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -CONFIG_DRM_I915_USERPTR=y -# CONFIG_DRM_I915_WERROR is not set CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_MIPI_DSI=y CONFIG_DRM_PANEL=y From 487ca61f917f9308222faf481ad8be4e2cef0c90 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 14 Nov 2024 15:16:32 -0500 Subject: [PATCH 22/35] kernel: bump 6.6 to 6.6.61 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.61 Manually rebased: bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch All other patches automatically rebased. Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16959 Signed-off-by: Hauke Mehrtens --- include/kernel-6.6 | 4 ++-- ...devm_thermal_of_zone_register_with_pa.patch | 18 +++++++++--------- ...-all-the-downstream-rpi-sound-card-dr.patch | 2 +- ...nware-Add-SMBUS-quick-command-support.patch | 2 +- ...nware-Support-non-standard-bus-speeds.patch | 2 +- ...are-Add-support-for-bus-clear-feature.patch | 13 +++++++------ ...ac-move-TX-timer-arm-after-DMA-enable.patch | 12 ++++++------ .../780-usb-net-MeigLink_modem_support.patch | 4 ++-- ...bles-ignore-EOPNOTSUPP-on-flowtable-d.patch | 2 +- .../901-arm-add-cmdline-override.patch | 2 +- ...-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch | 2 +- ...m64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch | 2 +- ...-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch | 2 +- ...s-rockchip-Add-support-for-NanoPi-R6S.patch | 2 +- ...s-rockchip-Add-support-for-NanoPi-R6C.patch | 2 +- ...4-dts-rockchip-Add-ArmSom-Sige7-board.patch | 2 +- ...64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch | 2 +- .../1009-net-stmmac-use-GFP_DMA32.patch | 2 +- ...smccc-Export-revision-soc_id-function.patch | 2 +- 19 files changed, 40 insertions(+), 39 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index 261a77428cd3be..d870747f8362d5 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .60 -LINUX_KERNEL_HASH-6.6.60 = 52f9e32d5082ab94253447fd66670d0c3bb765cfcb99b0bf61d1b8eae25952ef +LINUX_VERSION-6.6 = .61 +LINUX_KERNEL_HASH-6.6.61 = 418fc24df9190f1c3ed9906dc3b7651c2a2eae5c1cb9ab4a6348e20faf047c0b diff --git a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch index 889ec1123ef314..7836aef7dd1704 100644 --- a/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch +++ b/target/linux/airoha/patches-6.6/101-01-thermal-of-Add-devm_thermal_of_zone_register_with_pa.patch @@ -40,7 +40,7 @@ Signed-off-by: Christian Marangi --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c -@@ -249,7 +249,7 @@ static void thermal_of_parameters_init(s +@@ -245,7 +245,7 @@ static void thermal_of_parameters_init(s { int coef[2]; int ncoef = ARRAY_SIZE(coef); @@ -49,7 +49,7 @@ Signed-off-by: Christian Marangi tzp->no_hwmon = true; -@@ -261,14 +261,11 @@ static void thermal_of_parameters_init(s +@@ -257,14 +257,11 @@ static void thermal_of_parameters_init(s * thermal zone. Thus, we are considering only the first two * values as slope and offset. */ @@ -67,7 +67,7 @@ Signed-off-by: Christian Marangi } static struct device_node *thermal_of_zone_get_by_name(struct thermal_zone_device *tz) -@@ -462,10 +459,15 @@ static void thermal_of_zone_unregister(s +@@ -458,10 +455,15 @@ static void thermal_of_zone_unregister(s * zone properties and registers new thermal zone with those * properties. * @@ -83,7 +83,7 @@ Signed-off-by: Christian Marangi * * Return: a valid thermal zone structure pointer on success. * - EINVAL: if the device tree thermal description is malformed -@@ -473,11 +475,11 @@ static void thermal_of_zone_unregister(s +@@ -469,11 +471,11 @@ static void thermal_of_zone_unregister(s * - Other negative errors are returned by the underlying called functions */ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *sensor, int id, void *data, @@ -97,7 +97,7 @@ Signed-off-by: Christian Marangi struct thermal_zone_device_ops *of_ops; struct device_node *np; int delay, pdelay; -@@ -509,7 +511,7 @@ static struct thermal_zone_device *therm +@@ -508,7 +510,7 @@ static struct thermal_zone_device *therm goto out_kfree_trips; } @@ -106,7 +106,7 @@ Signed-off-by: Christian Marangi of_ops->bind = thermal_of_bind; of_ops->unbind = thermal_of_unbind; -@@ -517,7 +519,7 @@ static struct thermal_zone_device *therm +@@ -516,7 +518,7 @@ static struct thermal_zone_device *therm mask = GENMASK_ULL((ntrips) - 1, 0); tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, @@ -115,7 +115,7 @@ Signed-off-by: Christian Marangi pdelay, delay); if (IS_ERR(tz)) { ret = PTR_ERR(tz); -@@ -572,6 +574,7 @@ static int devm_thermal_of_zone_match(st +@@ -571,6 +573,7 @@ static int devm_thermal_of_zone_match(st struct thermal_zone_device *devm_thermal_of_zone_register(struct device *dev, int sensor_id, void *data, const struct thermal_zone_device_ops *ops) { @@ -123,7 +123,7 @@ Signed-off-by: Christian Marangi struct thermal_zone_device **ptr, *tzd; ptr = devres_alloc(devm_thermal_of_zone_release, sizeof(*ptr), -@@ -579,7 +582,7 @@ struct thermal_zone_device *devm_thermal +@@ -578,7 +581,7 @@ struct thermal_zone_device *devm_thermal if (!ptr) return ERR_PTR(-ENOMEM); @@ -132,7 +132,7 @@ Signed-off-by: Christian Marangi if (IS_ERR(tzd)) { devres_free(ptr); return tzd; -@@ -593,6 +596,46 @@ struct thermal_zone_device *devm_thermal +@@ -592,6 +595,46 @@ struct thermal_zone_device *devm_thermal EXPORT_SYMBOL_GPL(devm_thermal_of_zone_register); /** diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index 8685508ddf6af7..395ec0797c15ca 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2195,6 +2195,8 @@ static const struct usb_audio_quirk_flag +@@ -2197,6 +2197,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch index ed57365598ae6a..e588003e6e56e0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -123,7 +123,9 @@ +@@ -124,7 +124,9 @@ #define DW_IC_ERR_TX_ABRT 0x1 diff --git a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch index 0e1cd5bf2a164d..90a64e8f2bbfb4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -292,6 +292,7 @@ struct dw_i2c_dev { +@@ -293,6 +293,7 @@ struct dw_i2c_dev { u16 fp_lcnt; u16 hs_hcnt; u16 hs_lcnt; diff --git a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch b/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch index 5eb4bcc5d2a9de..691484d46e02c8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch @@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell }; static int dw_reg_read(void *context, unsigned int reg, unsigned int *val) -@@ -607,8 +609,16 @@ int i2c_dw_wait_bus_not_busy(struct dw_i +@@ -609,8 +611,16 @@ int i2c_dw_wait_bus_not_busy(struct dw_i int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev) { unsigned long abort_source = dev->abort_source; @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell if (abort_source & DW_IC_TX_ABRT_NOACK) { for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources)) dev_dbg(dev->dev, -@@ -623,6 +633,8 @@ int i2c_dw_handle_tx_abort(struct dw_i2c +@@ -625,6 +635,8 @@ int i2c_dw_handle_tx_abort(struct dw_i2c return -EAGAIN; else if (abort_source & DW_IC_TX_ABRT_GCALL_READ) return -EINVAL; /* wrong msgs[] data */ @@ -74,7 +74,7 @@ Signed-off-by: Phil Elwell #define DW_IC_COMP_TYPE 0xfc #define DW_IC_COMP_TYPE_VALUE 0x44570140 /* "DW" + 0x0140 */ -@@ -111,12 +114,14 @@ +@@ -111,6 +114,7 @@ #define DW_IC_ENABLE_ENABLE BIT(0) #define DW_IC_ENABLE_ABORT BIT(1) @@ -82,14 +82,15 @@ Signed-off-by: Phil Elwell #define DW_IC_STATUS_ACTIVITY BIT(0) #define DW_IC_STATUS_TFE BIT(2) - #define DW_IC_STATUS_RFNE BIT(3) +@@ -118,6 +122,7 @@ #define DW_IC_STATUS_MASTER_ACTIVITY BIT(5) #define DW_IC_STATUS_SLAVE_ACTIVITY BIT(6) + #define DW_IC_STATUS_MASTER_HOLD_TX_FIFO_EMPTY BIT(7) +#define DW_IC_STATUS_SDA_STUCK_NOT_RECOVERED BIT(11) #define DW_IC_SDA_HOLD_RX_SHIFT 16 #define DW_IC_SDA_HOLD_RX_MASK GENMASK(23, 16) -@@ -164,6 +169,7 @@ +@@ -165,6 +170,7 @@ #define ABRT_SLAVE_FLUSH_TXFIFO 13 #define ABRT_SLAVE_ARBLOST 14 #define ABRT_SLAVE_RD_INTX 15 @@ -97,7 +98,7 @@ Signed-off-by: Phil Elwell #define DW_IC_TX_ABRT_7B_ADDR_NOACK BIT(ABRT_7B_ADDR_NOACK) #define DW_IC_TX_ABRT_10ADDR1_NOACK BIT(ABRT_10ADDR1_NOACK) -@@ -179,6 +185,7 @@ +@@ -180,6 +186,7 @@ #define DW_IC_RX_ABRT_SLAVE_RD_INTX BIT(ABRT_SLAVE_RD_INTX) #define DW_IC_RX_ABRT_SLAVE_ARBLOST BIT(ABRT_SLAVE_ARBLOST) #define DW_IC_RX_ABRT_SLAVE_FLUSH_TXFIFO BIT(ABRT_SLAVE_FLUSH_TXFIFO) diff --git a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch index 66a9251438a265..bd61343e0eed3a 100644 --- a/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch +++ b/target/linux/generic/backport-6.6/771-v6.7-02-net-stmmac-move-TX-timer-arm-after-DMA-enable.patch @@ -42,7 +42,7 @@ Signed-off-by: Paolo Abeni u64_stats_update_begin(&txq_stats->napi_syncp); u64_stats_add(&txq_stats->napi.tx_packets, tx_packets); -@@ -5602,6 +5606,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5603,6 +5607,7 @@ static int stmmac_napi_poll_tx(struct na container_of(napi, struct stmmac_channel, tx_napi); struct stmmac_priv *priv = ch->priv_data; struct stmmac_txq_stats *txq_stats; @@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni u32 chan = ch->index; int work_done; -@@ -5610,7 +5615,7 @@ static int stmmac_napi_poll_tx(struct na +@@ -5611,7 +5616,7 @@ static int stmmac_napi_poll_tx(struct na u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { -@@ -5621,6 +5626,10 @@ static int stmmac_napi_poll_tx(struct na +@@ -5622,6 +5627,10 @@ static int stmmac_napi_poll_tx(struct na spin_unlock_irqrestore(&ch->lock, flags); } @@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni return work_done; } -@@ -5629,6 +5638,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5630,6 +5639,7 @@ static int stmmac_napi_poll_rxtx(struct struct stmmac_channel *ch = container_of(napi, struct stmmac_channel, rxtx_napi); struct stmmac_priv *priv = ch->priv_data; @@ -78,7 +78,7 @@ Signed-off-by: Paolo Abeni int rx_done, tx_done, rxtx_done; struct stmmac_rxq_stats *rxq_stats; struct stmmac_txq_stats *txq_stats; -@@ -5644,7 +5654,7 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5645,7 +5655,7 @@ static int stmmac_napi_poll_rxtx(struct u64_stats_inc(&txq_stats->napi.poll); u64_stats_update_end(&txq_stats->napi_syncp); @@ -87,7 +87,7 @@ Signed-off-by: Paolo Abeni tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); -@@ -5669,6 +5679,10 @@ static int stmmac_napi_poll_rxtx(struct +@@ -5670,6 +5680,10 @@ static int stmmac_napi_poll_rxtx(struct spin_unlock_irqrestore(&ch->lock, flags); } diff --git a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch index e80dfbeb0f3926..66c58dba64e42a 100644 --- a/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch @@ -43,7 +43,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1159,6 +1164,11 @@ static const struct usb_device_id option +@@ -1160,6 +1165,11 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) }, @@ -55,7 +55,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support /* Quectel products using Qualcomm vendor ID */ { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), -@@ -1200,6 +1210,11 @@ static const struct usb_device_id option +@@ -1201,6 +1211,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index f27581d3e922b3..cfa3975c386bff 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -8376,7 +8376,7 @@ static int nft_register_flowtable_net_ho +@@ -8377,7 +8377,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); diff --git a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch index 034826253df2a6..4f4fb9f23e42b6 100644 --- a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * CONFIG_CMDLINE is meant to be a default in case nothing else --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -2308,6 +2308,14 @@ config CMDLINE_FORCE +@@ -2309,6 +2309,14 @@ config CMDLINE_FORCE endchoice diff --git a/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch b/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch index 9901d9fff04d6b..164b65bdf5d876 100644 --- a/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch +++ b/target/linux/rockchip/patches-6.6/009-v6.10-arm64-dts-rockchip-Add-Radxa-ROCK-3C.patch @@ -30,7 +30,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -81,6 +81,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-qu +@@ -82,6 +82,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-qu dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-radxa-cm3-io.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-roc-pc.dtb diff --git a/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch b/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch index 746078cf9e226f..19e6377ad1dab3 100644 --- a/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch +++ b/target/linux/rockchip/patches-6.6/011-v6.11-arm64-dts-rockchip-Add-Radxa-ZERO-3W-3E.patch @@ -32,7 +32,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -80,6 +80,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pi +@@ -81,6 +81,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-pi dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-a.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-quartz64-b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-radxa-cm3-io.dtb diff --git a/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch b/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch index e93a055c3ef0f0..4b2897f5249802 100644 --- a/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch +++ b/target/linux/rockchip/patches-6.6/014-v6.11-arm64-dts-rockchip-Add-Radxa-ROCK-3B.patch @@ -21,7 +21,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -100,6 +100,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-od +@@ -101,6 +101,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-od dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-radxa-e25.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-roc-pc.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3a.dtb diff --git a/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch b/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch index d0243023fc3089..f31f38ac9d9ce3 100644 --- a/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch +++ b/target/linux/rockchip/patches-6.6/053-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6S.patch @@ -17,7 +17,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -108,4 +108,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-na +@@ -109,4 +109,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-na dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-rock-5b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb diff --git a/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch b/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch index 7e2b083cf8d076..b63c01338fcc89 100644 --- a/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch +++ b/target/linux/rockchip/patches-6.6/054-v6.9-arm64-dts-rockchip-Add-support-for-NanoPi-R6C.patch @@ -17,7 +17,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -109,4 +109,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-ro +@@ -110,4 +110,5 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-ro dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-nanopi-r6s.dtb diff --git a/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch b/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch index bc1845b0d3c344..c60b9791094205 100644 --- a/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch +++ b/target/linux/rockchip/patches-6.6/056-01-v6.10-arm64-dts-rockchip-Add-ArmSom-Sige7-board.patch @@ -44,7 +44,7 @@ Signed-off-by: Heiko Stuebner --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -101,6 +101,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-ra +@@ -102,6 +102,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-ra dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-roc-pc.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3a.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-rock-3b.dtb diff --git a/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch b/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch index ff2ad5bb9a8995..899c85e0d2bdce 100644 --- a/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch +++ b/target/linux/rockchip/patches-6.6/127-arm64-dts-rockchip-rk3566-Add-Nanopi-R3S.patch @@ -557,7 +557,7 @@ +}; --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile -@@ -75,6 +75,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-an +@@ -76,6 +76,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-an dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353v.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg353vs.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-anbernic-rg503.dtb diff --git a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch index 25849e7c26d984..3191b1d9e328d9 100644 --- a/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch +++ b/target/linux/starfive/patches-6.6/1009-net-stmmac-use-GFP_DMA32.patch @@ -19,7 +19,7 @@ Signed-off-by: Matteo Croce if (priv->dma_cap.host_dma_width <= 32) gfp |= GFP_DMA32; -@@ -4685,7 +4685,7 @@ static inline void stmmac_rx_refill(stru +@@ -4686,7 +4686,7 @@ static inline void stmmac_rx_refill(stru struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue]; int dirty = stmmac_rx_dirty(priv, queue); unsigned int entry = rx_q->dirty_rx; diff --git a/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch b/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch index 538484dd82b6e4..aacd0ba9067316 100644 --- a/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch +++ b/target/linux/sunxi/patches-6.6/017-v6.10-firmware-smccc-Export-revision-soc_id-function.patch @@ -22,7 +22,7 @@ Signed-off-by: Viresh Kumar --- a/drivers/firmware/smccc/smccc.c +++ b/drivers/firmware/smccc/smccc.c -@@ -69,6 +69,7 @@ s32 arm_smccc_get_soc_id_revision(void) +@@ -65,6 +65,7 @@ s32 arm_smccc_get_soc_id_revision(void) { return smccc_soc_id_revision; } From 71c14cbee5aa5f1924191252c07a69b7e6aabd29 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 14 Nov 2024 22:57:02 +0100 Subject: [PATCH 23/35] build: apk: Remove /run/apk/db.lock Do not add the file /run/apk/db.lock to the root file system. The /run folder should be on a tmpfs. At runtime we should make /run point to a tmpfs. At build time we should just remove the folder. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/16961 Signed-off-by: Christian Marangi --- package/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/Makefile b/package/Makefile index 2c7cd588793b62..3c6621b81c3c13 100644 --- a/package/Makefile +++ b/package/Makefile @@ -101,6 +101,7 @@ ifneq ($(CONFIG_USE_APK),) $(call apk,$(TARGET_DIR)) add --no-cache --initdb --no-scripts --arch $(ARCH_PACKAGES) \ --repositories-file /dev/null --repository file://$(PACKAGE_DIR_ALL)/packages.adb \ $$(cat $(TMP_DIR)/apk_install_list) + rm -rf $(TARGET_DIR)/run else $(file >$(TMP_DIR)/opkg_install_list,\ $(call opkg_package_files,\ From 3b710375dd97af1e0416904c4174d11c51e3f09c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 14 Nov 2024 21:47:47 +0100 Subject: [PATCH 24/35] base-files: Create /run and /run/lock folder Create the folder /run and /run/lock using symlinks. Other Linux distributions also have these folders and some applications might already depend on them. Just create symlinks pointing to the older folder. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/16961 Signed-off-by: Christian Marangi --- package/base-files/files/etc/init.d/boot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index c7d1d4af3ad375..332a5c96f35c95 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -24,6 +24,8 @@ boot() { chmod 1777 /var/lock mkdir -p /var/log mkdir -p /var/run + ln -s /var/run /run + ln -s /var/lock /run/lock mkdir -p /var/state mkdir -p /var/tmp mkdir -p /tmp/.uci From b88d51898d126d2f918cb476d4158e9fcd62492c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 14 Nov 2024 21:46:36 +0100 Subject: [PATCH 25/35] base-files: Mount debugfs and pstore with nosuid,nodev,noexec These permissions are not needed. Systemd also mounts these file systems without these permissions on other Linux distributions. Dropping these permissions should make the system more secure. Signed-off-by: Hauke Mehrtens Link: https://github.com/openwrt/openwrt/pull/16960 Signed-off-by: Christian Marangi --- package/base-files/files/etc/init.d/boot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 332a5c96f35c95..a26d4886b2873b 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -35,9 +35,9 @@ boot() { mkdir -p /tmp/resolv.conf.d touch /tmp/resolv.conf.d/resolv.conf.auto ln -sf /tmp/resolv.conf.d/resolv.conf.auto /tmp/resolv.conf - grep -q debugfs /proc/filesystems && /bin/mount -o noatime -t debugfs debugfs /sys/kernel/debug + grep -q debugfs /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t debugfs debugfs /sys/kernel/debug grep -q bpf /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime,mode=0700 -t bpf bpffs /sys/fs/bpf - grep -q pstore /proc/filesystems && /bin/mount -o noatime -t pstore pstore /sys/fs/pstore + grep -q pstore /proc/filesystems && /bin/mount -o nosuid,nodev,noexec,noatime -t pstore pstore /sys/fs/pstore [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe touch /tmp/.config_pending From 3dbe730080e70e96990a5e89cbe2035adcca8d4b Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sun, 13 Oct 2024 21:15:59 +0800 Subject: [PATCH 26/35] ppp: remove more unnecessary kernel checks The ppp package can support all features since Linux 4.7.0 kernel. Therefore, most kernel version checks can pass unconditionally on OpenWrt v18.06 and later version. This patch can reduce the size of ppp package by approximately 2.5 KB. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16695 Signed-off-by: Christian Marangi --- .../patches/400-simplify_kernel_checks.patch | 100 ++++++++++-------- 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 137937c2448de0..311bb8752f9d44 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,14 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -231,7 +231,7 @@ static int driver_is_old = 0; +@@ -224,14 +224,10 @@ static fd_set in_fds; /* set of fds tha + static int max_in_fd; /* highest fd set in in_fds */ + + static int has_proxy_arp = 0; +-static int driver_version = 0; +-static int driver_modification = 0; +-static int driver_patch = 0; +-static int driver_is_old = 0; static int restore_term = 0; /* 1 => we've munged the terminal */ static struct termios inittermios; /* Initial TTY termios */ @@ -19,17 +26,18 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -250,8 +250,8 @@ static int looped; /* 1 if using loop +@@ -249,9 +245,8 @@ static int dynaddr_set; /* 1 if ip_dyna + static int looped; /* 1 if using loop */ static int link_mtu; /* mtu for the link (not bundle) */ - static struct utsname utsname; /* for the kernel version */ +-static struct utsname utsname; /* for the kernel version */ -static int kernel_version; #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p)) -+static const int kernel_version = KVERSION(2,6,37); ++static const int kernel_version = KVERSION(4,9,0); #define MAX_IFS 100 -@@ -1970,11 +1970,12 @@ int ccp_fatal_error (int unit) +@@ -1970,11 +1965,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -44,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1996,6 +1997,7 @@ static char *path_to_procfs(const char * +@@ -1996,6 +1992,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -52,35 +60,24 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2895,15 +2897,19 @@ int ppp_check_kernel_support(void) - int my_version, my_modification, my_patch; - int osmaj, osmin, ospatch; +@@ -2889,6 +2886,8 @@ ppp_registered(void) + int ppp_check_kernel_support(void) + { ++ return 1; /* OpenWrt support ppp device "/dev/ppp" by default */ +#if 0 - /* get the kernel version now, since we are called before sys_init */ - uname(&utsname); - osmaj = osmin = ospatch = 0; - sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch); - kernel_version = KVERSION(osmaj, osmin, ospatch); -+#endif - - fd = open("/dev/ppp", O_RDWR); - if (fd >= 0) { -+#if 0 - new_style_driver = 1; + int s, ok, fd; + struct ifreq ifr; + int size; +@@ -3016,6 +3015,7 @@ int ppp_check_kernel_support(void) + } + close(s); + return ok; +#endif + } - /* XXX should get from driver */ - driver_version = 2; -@@ -2963,6 +2969,7 @@ int ppp_check_kernel_support(void) - - if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) - ok = 0; -+ return ok; - - /* - * This is the PPP device. Validate the version of the driver at this -@@ -3577,6 +3584,7 @@ get_pty(int *master_fdp, int *slave_fdp, + #ifndef HAVE_LOGWTMP +@@ -3577,6 +3577,7 @@ get_pty(int *master_fdp, int *slave_fdp, } #endif /* TIOCGPTN */ @@ -88,7 +85,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -3601,6 +3609,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3601,6 +3602,7 @@ get_pty(int *master_fdp, int *slave_fdp, } } } @@ -96,23 +93,35 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) return 0; +@@ -3716,6 +3718,7 @@ get_host_seed(void) + int + sys_check_options(void) + { ++#if 0 + if (demand && driver_is_old) { + ppp_option_error("demand dialling is not supported by kernel driver " + "version %d.%d.%d", driver_version, driver_modification, +@@ -3726,6 +3729,7 @@ sys_check_options(void) + warn("Warning: multilink is not supported by the kernel driver"); + multilink = 0; + } ++#endif + return 1; + } + --- a/pppd/plugins/pppoatm/pppoatm.c +++ b/pppd/plugins/pppoatm/pppoatm.c -@@ -179,14 +179,6 @@ static void disconnect_pppoatm(void) - +@@ -180,10 +180,6 @@ static void disconnect_pppoatm(void) void plugin_init(void) { --#ifdef linux + #ifdef linux - extern int new_style_driver; /* From sys-linux.c */ - if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoATM"); --#else -- fatal("No PPPoATM support on this OS"); --#endif - ppp_add_options(pppoa_options); - } - + #else + fatal("No PPPoATM support on this OS"); + #endif --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c @@ -57,9 +57,6 @@ static char const RCSID[] = @@ -138,17 +147,14 @@ Signed-off-by: Jo-Philipp Wich info("PPPoE plugin from pppd %s", PPPD_VERSION); --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -500,12 +500,7 @@ static void pppol2tp_cleanup(void) - +@@ -501,10 +501,6 @@ static void pppol2tp_cleanup(void) void plugin_init(void) { --#if defined(__linux__) + #if defined(__linux__) - extern int new_style_driver; /* From sys-linux.c */ - if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoL2TP"); --#else -+#if !defined(__linux__) + #else fatal("No PPPoL2TP support on this OS"); #endif - ppp_add_options(pppol2tp_options); From 31111680f6fc5f17201b02b8ce656b955be56d7a Mon Sep 17 00:00:00 2001 From: John Audia Date: Mon, 2 Sep 2024 19:53:47 -0400 Subject: [PATCH 27/35] x86: switch config to a tickless kernel This commit fixes and closes #16313. Switch the x86 kernel's timer to tickless operation which is more power efficient since it is not woken up by periodic timer interrupts when idle. Also add several other options for CPU idle governors particularly the upstream default for tickless kernels, CONFIG_CPU_IDLE_GOV_MENU. Without this commit, my AMD Ryzen 7 5800U can only achieve a minimum core frequency of 1,384 MHz which is over 3x higher than the processor's minimum frequency of 400 MHz which is accessible with this modification. In addition to the lower clock rate, I have seen a concomitant reduction in both idle temps and at-the-wall power consumption. Summary: * Idle CPU freqs dropped from 1,384 MHz to 400 Mhz. * Idle power consumption dropped from 7 W avg to 5 W. * Idle temps have dropped from 50C on avg to 43C. There are other well known reasons to switch to a tickless timer including: reduced interrupt overhead, better use of CPU resources, and reduced latency to name a few. Build system: x86/64 Build-tested: x86/64/AMD Cezanne Run-tested: x86/64/AMD Cezanne Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/16317 Signed-off-by: Christian Marangi --- target/linux/x86/config-6.6 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/linux/x86/config-6.6 b/target/linux/x86/config-6.6 index b8d38e60fa372c..3d1c00513852d4 100644 --- a/target/linux/x86/config-6.6 +++ b/target/linux/x86/config-6.6 @@ -48,6 +48,7 @@ CONFIG_COMPAT_32=y CONFIG_COMPAT_32BIT_TIME=y # CONFIG_COMPAT_VDSO is not set CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CONTEXT_TRACKING_USER_FORCE=y # CONFIG_CPU5_WDT is not set CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y @@ -61,7 +62,10 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_USERSPACE is not set CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_HALTPOLL=y CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE_GOV_TEO=y CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_SUP_AMD=y CONFIG_CPU_SUP_CENTAUR=y @@ -180,7 +184,6 @@ CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_GEODE=y CONFIG_HW_RANDOM_VIA=y # CONFIG_HYPERVISOR_GUEST is not set -CONFIG_HZ_PERIODIC=y CONFIG_I8253_LOCK=y CONFIG_IA32_FEAT_CTL=y # CONFIG_IB700_WDT is not set @@ -275,6 +278,9 @@ CONFIG_NET_XGRESS=y CONFIG_NLS=y # CONFIG_NMI_CHECK_CPU is not set # CONFIG_NOHIGHMEM is not set +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_FULL=y CONFIG_NR_CPUS=1 CONFIG_NR_CPUS_DEFAULT=1 CONFIG_NR_CPUS_RANGE_BEGIN=1 @@ -330,6 +336,8 @@ CONFIG_PTP_1588_CLOCK_OPTIONAL=y # CONFIG_PUNIT_ATOM_DEBUG is not set CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y +CONFIG_RCU_LAZY=y +CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y CONFIG_RD_BZIP2=y CONFIG_RD_GZIP=y CONFIG_RETHUNK=y From 0000ba6ab8062f965d8fed240b76d36f9a493b55 Mon Sep 17 00:00:00 2001 From: Jeronimo Pellegrini Date: Sat, 21 Sep 2024 15:46:36 -0300 Subject: [PATCH 28/35] libreadlne: create symlinks for .so Currently, libreadline only installs ``` /usr/lib/libhistory.so.8 -> libhistory.so.8.2 /usr/lib/libhistory.so.8.2 /usr/lib/libreadline.so.8 -> libreadline.so.8.2 /usr/lib/libreadline.so.8.2 ``` But there is no `libreadline.so` or `libhistory.so` available. So this happens: ``` root@OpenWRT:~# cat a.c int main() { } root@OpenWRT:~# gcc a.c -lreadline /usr/bin/ld: cannot find -lreadline: No such file or directory collect2: error: ld returned 1 exit status ``` Unless, of course, one uses `-l:libreadline.so.8`... But that doesn't help with binaries that try to dynamically open `libreadline.so`. I have one of those here (the STklos Scheme compiler -- I didn't make a PR for it because it's far from being ready, but one issue is that it does use dlopen to use readline...) With the symlink, it works: ``` root@OpenWRT:~# ln -s /usr/lib/libreadline.so.8 /usr/lib/libreadline.so root@OpenWRT:~# root@OpenWRT:~# gcc a.c -lreadline root@OpenWRT:~# ``` Another example: when trying to package rlwrap, the build failed complaining it could not find readline (using `-lreadline`). It would then be necessary to change rlwrap's `configure.ac` (and also in all packages that use readline), but it seems simpler to add the symlinks... This PR changes the Makefile so it will include the links. Signed-off-by: Jeronimo Pellegrini Link: https://github.com/openwrt/openwrt/pull/16445 Signed-off-by: Christian Marangi --- package/libs/readline/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/libs/readline/Makefile b/package/libs/readline/Makefile index 11b9e0172f844a..03e56f36ed4d15 100644 --- a/package/libs/readline/Makefile +++ b/package/libs/readline/Makefile @@ -69,7 +69,7 @@ endef define Package/libreadline/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{history,readline}.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{history,readline}.so* $(1)/usr/lib/ endef $(eval $(call HostBuild)) From 8f6972df36a520738083dc48eac69b778fbc814e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 13 Nov 2024 12:33:12 -0800 Subject: [PATCH 29/35] apk: remove HOST_LDFLAGS hack No longer needed as upstream respects -Ddefault_library now. Refreshed patches. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16945 Signed-off-by: Christian Marangi --- package/system/apk/Makefile | 3 --- .../patches/0001-openwrt-move-layer-db-to-temp-folder.patch | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index f760ce1ec4af65..4dbd0f854f37b4 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -68,9 +68,6 @@ MESON_ARGS += \ $(MESON_COMMON_ARGS) \ -Dcrypto_backend=$(BUILD_VARIANT) -HOST_LDFLAGS += \ - -Wl,-rpath $(STAGING_DIR_HOST)/lib - define Package/apk/default/install $(INSTALL_DIR) $(1)/lib/apk/db diff --git a/package/system/apk/patches/0001-openwrt-move-layer-db-to-temp-folder.patch b/package/system/apk/patches/0001-openwrt-move-layer-db-to-temp-folder.patch index 850051221221e7..2b54f47ab77b22 100644 --- a/package/system/apk/patches/0001-openwrt-move-layer-db-to-temp-folder.patch +++ b/package/system/apk/patches/0001-openwrt-move-layer-db-to-temp-folder.patch @@ -10,7 +10,7 @@ Signed-off-by: Paul Spooren --- a/src/database.c +++ b/src/database.c -@@ -1627,7 +1627,7 @@ const char *apk_db_layer_name(int layer) +@@ -1631,7 +1631,7 @@ const char *apk_db_layer_name(int layer) { switch (layer) { case APK_DB_LAYER_ROOT: return "lib/apk/db"; From e031dab93ec3a066880ff25e0f42d6bef1e3001a Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Wed, 13 Nov 2024 14:25:26 +0100 Subject: [PATCH 30/35] base-files: move apk distfeeds into directory Analog to how we handle distfeeds with opkg, have the base feeds defined in a file in repositories.d instead of the base /etc/apk/repositories. Signed-off-by: Jonas Gorski Link: https://github.com/openwrt/openwrt/pull/16940 Signed-off-by: Christian Marangi --- package/base-files/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 7ac4ea557f9f10..2725bcb90b3d22 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -250,9 +250,9 @@ endif rm -f $(1)/etc/banner.failsafe,) ifneq ($(CONFIG_USE_APK),) - mkdir -p $(1)/etc/apk/ - $(call FeedSourcesAppendAPK,$(1)/etc/apk/repositories) - $(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories + mkdir -p $(1)/etc/apk/repositories.d + $(call FeedSourcesAppendAPK,$(1)/etc/apk/repositories.d/distfeeds.list) + $(VERSION_SED_SCRIPT) $(1)/etc/apk/repositories.d/distfeeds.list rm -f $(1)/etc/uci-defaults/13_fix-group-user rm -f $(1)/sbin/pkg_check From a6e98a810d4d831caf9f18536701c433b9e57fc8 Mon Sep 17 00:00:00 2001 From: Jonas Gorski Date: Wed, 13 Nov 2024 14:27:16 +0100 Subject: [PATCH 31/35] apk: add a customfeeds.list configuration file Analog to how we handle custom feeds in opkg, add a customfeeds.list for custom package feeds and mark it as a configuration file. Signed-off-by: Jonas Gorski Link: https://github.com/openwrt/openwrt/pull/16940 Signed-off-by: Christian Marangi --- package/system/apk/Makefile | 12 +++++++++++- package/system/apk/files/customfeeds.list | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 package/system/apk/files/customfeeds.list diff --git a/package/system/apk/Makefile b/package/system/apk/Makefile index 4dbd0f854f37b4..fbb9ef85ee301e 100644 --- a/package/system/apk/Makefile +++ b/package/system/apk/Makefile @@ -14,7 +14,7 @@ PKG_VERSION=3.0.0_pre$(subst -,,$(PKG_SOURCE_DATE)) PKG_MAINTAINER:=Paul Spooren PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=LICENSE -PKG_INSTALL:=1 +PKG_INSTALL:=2 HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST) HOST_BUILD_DEPENDS:=lua/host @@ -68,6 +68,13 @@ MESON_ARGS += \ $(MESON_COMMON_ARGS) \ -Dcrypto_backend=$(BUILD_VARIANT) +define Package/apk/conffiles +/etc/apk/repositories.d/customfeeds.list +endef + +Package/apk-mbedtls/conffiles = $(Package/apk/conffiles) +Package/apk-openssl/conffiles = $(Package/apk/conffiles) + define Package/apk/default/install $(INSTALL_DIR) $(1)/lib/apk/db @@ -76,6 +83,9 @@ define Package/apk/default/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libapk.so.* $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/etc/apk/repositories.d + $(INSTALL_DATA) ./files/customfeeds.list $(1)/etc/apk/repositories.d/customfeeds.list endef Package/apk-mbedtls/install = $(Package/apk/default/install) diff --git a/package/system/apk/files/customfeeds.list b/package/system/apk/files/customfeeds.list new file mode 100644 index 00000000000000..c75016bfc8cfea --- /dev/null +++ b/package/system/apk/files/customfeeds.list @@ -0,0 +1,3 @@ +# add your custom package feeds here +# +# http://www.example.com/path/to/files/packages.adb From 65964c42f8744ed8ca09448a155b99e3a99be283 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Fri, 15 Nov 2024 01:32:47 -0500 Subject: [PATCH 32/35] realtek: align kernel config with upstream Since the start of the Realtek target OpenWrt works with RTL83XX as the target architecture. Upstream is using MACH_REALTEK_RTL instead. To simplify further development align that. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/16963 Signed-off-by: Hauke Mehrtens --- .../files-6.6/arch/mips/rtl838x/Platform | 4 +- .../files-6.6/drivers/clk/realtek/Kconfig | 4 +- .../files-6.6/drivers/net/dsa/rtl83xx/Kconfig | 2 +- .../300-mips-add-rtl838x-platform.patch | 51 ++++++++++--------- .../301-gpio-add-rtl8231-driver.patch | 2 +- ...e-dependencies-for-gpio-realtek-otto.patch | 26 ---------- ...pdate-dependency-for-spi-realtek-rtl.patch | 25 --------- ...pdate-dependency-for-irq-realtek-rtl.patch | 25 --------- ...date-dependency-for-realtek-otto-wdt.patch | 32 ------------ ...net-add-support-for-rtl838x-ethernet.patch | 2 +- .../realtek/patches-6.6/720-add-rtl-phy.patch | 2 +- target/linux/realtek/rtl838x/config-6.6 | 2 +- target/linux/realtek/rtl839x/config-6.6 | 2 +- target/linux/realtek/rtl930x/config-6.6 | 2 +- target/linux/realtek/rtl931x/config-6.6 | 2 +- 15 files changed, 39 insertions(+), 144 deletions(-) delete mode 100644 target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch delete mode 100644 target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch delete mode 100644 target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch delete mode 100644 target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch diff --git a/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform b/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform index 98f18cac1be13b..e824dee7b724d4 100644 --- a/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform @@ -1,5 +1,5 @@ # # Realtek RTL838x SoCs # -cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80100000 +cflags-$(CONFIG_MACH_REALTEK_RTL) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ +load-$(CONFIG_MACH_REALTEK_RTL) += 0xffffffff80100000 diff --git a/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig b/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig index 4cf3cd963399a2..62b704077ac75f 100644 --- a/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig +++ b/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig @@ -2,13 +2,13 @@ menuconfig COMMON_CLK_REALTEK bool "Support for Realtek's clock controllers" - depends on RTL83XX + depends on MACH_REALTEK_RTL if COMMON_CLK_REALTEK config COMMON_CLK_RTL83XX bool "Clock driver for Realtek RTL83XX" - depends on RTL83XX + depends on MACH_REALTEK_RTL select SRAM help This driver adds support for the Realtek RTL83xx series basic clocks. diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig index 3124ee8d20c219..0af4abcfb9cbd2 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config NET_DSA_RTL83XX tristate "Realtek RTL838x/RTL839x switch support" - depends on RTL83XX + depends on MACH_REALTEK_RTL select NET_DSA_TAG_TRAILER help This driver adds support for Realtek RTL83xx series switching. diff --git a/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch index 7adbbbc517431b..bb89a7864fe49a 100644 --- a/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch @@ -9,64 +9,67 @@ configurations for the SoCs, which are introduced in addition. Submitted-by: Birger Koblitz --- - arch/mips/Kbuild.platforms | 1 + - arch/mips/Kconfig | 57 ++++++++++++++ - 2 files changed, 58 insertions(+) - --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms @@ -22,6 +22,7 @@ platform-$(CONFIG_MACH_NINTENDO64) += n6 platform-$(CONFIG_PIC32MZDA) += pic32/ platform-$(CONFIG_RALINK) += ralink/ platform-$(CONFIG_MIKROTIK_RB532) += rb532/ -+platform-$(CONFIG_RTL83XX) += rtl838x/ ++platform-$(CONFIG_MACH_REALTEK_RTL) += rtl838x/ platform-$(CONFIG_SGI_IP22) += sgi-ip22/ platform-$(CONFIG_SGI_IP27) += sgi-ip27/ platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -968,8 +968,58 @@ config CAVIUM_OCTEON_SOC - Hikari - Say Y here for most Octeon reference boards. +@@ -620,21 +620,23 @@ config RALINK -+config RTL83XX -+ bool "Realtek based platforms" -+ select DMA_NONCOHERENT -+ select IRQ_MIPS_CPU + config MACH_REALTEK_RTL + bool "Realtek RTL838x/RTL839x based machines" +- select MIPS_GENERIC + select DMA_NONCOHERENT + select IRQ_MIPS_CPU +- select CSRC_R4K +- select CEVT_R4K + select SYS_HAS_CPU_MIPS32_R1 + select SYS_HAS_CPU_MIPS32_R2 + select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_MIPS16 +- select SYS_SUPPORTS_MULTITHREADING +- select SYS_SUPPORTS_VPE_LOADER + select BOOT_RAW + select PINCTRL + select USE_OF + select NO_EXCEPT_FILL -+ select SYS_HAS_CPU_MIPS32_R1 -+ select SYS_HAS_CPU_MIPS32_R2 -+ select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_HIGHMEM -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select SYS_SUPPORTS_MIPS16 + select SYS_HAS_EARLY_PRINTK + select SYS_HAS_EARLY_PRINTK_8250 + select USE_GENERIC_EARLY_PRINTK_8250 -+ select BOOT_RAW -+ select PINCTRL + select ARCH_HAS_RESET_CONTROLLER + select RESET_CONTROLLER -+ select USE_OF -+ + + config SGI_IP22 + bool "SGI IP22 (Indy/Indigo2)" +@@ -970,6 +972,36 @@ config CAVIUM_OCTEON_SOC + endchoice +config RTL838X + bool "Realtek RTL838X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select CPU_SUPPORTS_CPUFREQ + select MIPS_EXTERNAL_TIMER + +config RTL839X + bool "Realtek RTL839X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select CPU_SUPPORTS_CPUFREQ + select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING + +config RTL930X + bool "Realtek RTL930X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select MIPS_CPU_SCACHE + select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING diff --git a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch index a1778764206d12..f64e2cf94eff8c 100644 --- a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch +++ b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch @@ -31,7 +31,7 @@ Submitted-by: John Crispin +config GPIO_RTL8231 + tristate "RTL8231 GPIO" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Say yes here to support Realtek RTL8231 GPIO expansion chips. + diff --git a/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch b/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch deleted file mode 100644 index 2b466340e6343a..00000000000000 --- a/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9bac1c20b8f39f2e0e342b087add5093b94feaed Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Wed, 5 May 2021 22:05:39 +0900 -Subject: realtek: backport gpio-realtek-otto driver from 5.13 to 5.10 - -This patch backports "gpio-realtek-otto" driver to Kernel 5.10. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi ---- - drivers/gpio/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -527,8 +527,8 @@ config GPIO_RDA - - config GPIO_REALTEK_OTTO - tristate "Realtek Otto GPIO support" -- depends on MACH_REALTEK_RTL -- default MACH_REALTEK_RTL -+ depends on RTL83XX -+ default RTL838X - select GPIO_GENERIC - select GPIOLIB_IRQCHIP - help diff --git a/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch b/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch deleted file mode 100644 index 01530257b857d9..00000000000000 --- a/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0b000cbfe0aa0323bffa855ef8449c0687a4c071 Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Thu, 6 May 2021 19:30:58 +0900 -Subject: realtek: backport spi-realtek-rtl driver from 5.12 to 5.10 - -This patch backports "spi-realtek-rtl" driver to Kernel 5.10 from 5.12. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi ---- - drivers/spi/Makefile | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -114,7 +114,7 @@ obj-$(CONFIG_SPI_QUP) += spi-qup.o - obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o - obj-$(CONFIG_SPI_ROCKCHIP_SFC) += spi-rockchip-sfc.o - obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o --obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o -+obj-$(CONFIG_RTL83XX) += spi-realtek-rtl.o - obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o - obj-$(CONFIG_SPI_RSPI) += spi-rspi.o - obj-$(CONFIG_SPI_RZV2M_CSI) += spi-rzv2m-csi.o diff --git a/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch b/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch deleted file mode 100644 index 0ecc33376e1c02..00000000000000 --- a/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2cd00b51470a30198b048a5fca48a04db77e29cc Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi -Date: Fri, 21 May 2021 23:16:37 +0900 -Subject: [PATCH] realtek: backport irq-realtek-rtl driver from 5.12 to 5.10 - -This patch backports "irq-realtek-rtl" driver to Kernel 5.10 from 5.12. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi ---- - drivers/irqchip/Makefile | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -114,7 +114,7 @@ obj-$(CONFIG_LOONGSON_PCH_MSI) += irq-l - obj-$(CONFIG_LOONGSON_PCH_LPC) += irq-loongson-pch-lpc.o - obj-$(CONFIG_MST_IRQ) += irq-mst-intc.o - obj-$(CONFIG_SL28CPLD_INTC) += irq-sl28cpld.o --obj-$(CONFIG_MACH_REALTEK_RTL) += irq-realtek-rtl.o -+obj-$(CONFIG_RTL83XX) += irq-realtek-rtl.o - obj-$(CONFIG_WPCM450_AIC) += irq-wpcm450-aic.o - obj-$(CONFIG_IRQ_IDT3243X) += irq-idt3243x.o - obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o diff --git a/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch b/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch deleted file mode 100644 index c9dab65b72cea5..00000000000000 --- a/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b8fc5eecdc5d33cf261986436597b5482ab856da Mon Sep 17 00:00:00 2001 -From: Sander Vanheule -Date: Sun, 14 Nov 2021 19:45:32 +0100 -Subject: [PATCH] realtek: Backport Realtek Otto WDT driver - -Add patch submitted upstream to linux-watchdog and replace the MIPS -architecture symbols. Requires one extra patch for the DIV_ROUND_* -macros, which have moved to a different header since 5.10. - -Submitted-by: Sander Vanheule -Tested-by: Stijn Segers -Tested-by: Paul Fertser -Tested-by: Stijn Tintel ---- - drivers/watchdog/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -977,10 +977,10 @@ config RTD119X_WATCHDOG - - config REALTEK_OTTO_WDT - tristate "Realtek Otto MIPS watchdog support" -- depends on MACH_REALTEK_RTL || COMPILE_TEST -+ depends on RTL83XX - depends on COMMON_CLK - select WATCHDOG_CORE -- default MACH_REALTEK_RTL -+ default RTL83XX - help - Say Y here to include support for the watchdog timer on Realtek - RTL838x, RTL839x, RTL930x SoCs. This watchdog has pretimeout diff --git a/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch index 9d79ea565d2ccb..e0c10bca633fad 100644 --- a/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch +++ b/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch @@ -29,7 +29,7 @@ Submitted-by: John Crispin + +config NET_RTL838X + tristate "Realtek rtl838x Ethernet MAC support" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Say Y here if you want to use the Realtek rtl838x Gbps Ethernet MAC. + diff --git a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch index 78a57f0a3e9810..43d4a7d4fccf51 100644 --- a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch +++ b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch @@ -20,7 +20,7 @@ Submitted-by: Birger Koblitz +config REALTEK_SOC_PHY + tristate "Realtek SoC PHYs" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Supports the PHYs found in combination with Realtek Switch SoCs + diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index ad2c1b43cce8d7..44c1d7e0645c9d 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -116,6 +116,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -192,7 +193,6 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL838X=y # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y # CONFIG_RTL930X is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index a357eb39666015..630027bf8133bb 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -115,6 +115,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -204,7 +205,6 @@ CONFIG_RFS_ACCEL=y CONFIG_RPS=y # CONFIG_RTL838X is not set CONFIG_RTL839X=y -CONFIG_RTL83XX=y # CONFIG_RTL930X is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index af5f2ca7a313b4..5a29bdc3c1ba78 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -97,6 +97,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -172,7 +173,6 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y # CONFIG_RTL838X is not set # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y CONFIG_RTL930X=y # CONFIG_RTL931X is not set CONFIG_SERIAL_MCTRL_GPIO=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index 736f4720296d8c..df235defe83c84 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -106,6 +106,7 @@ CONFIG_KMAP_LOCAL=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -195,7 +196,6 @@ CONFIG_RFS_ACCEL=y CONFIG_RPS=y # CONFIG_RTL838X is not set # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y CONFIG_RTL930X=y CONFIG_RTL931X=y CONFIG_SENSORS_GPIO_FAN=y From f5132df69db50a99e556e6fbd165002aac0e3e38 Mon Sep 17 00:00:00 2001 From: Ryan Keane Date: Thu, 7 Nov 2024 21:50:58 -0800 Subject: [PATCH 33/35] elfutils: Update to 0.192 Add a patch still under review to fix some errors. Refresh patch: - 003-libintl-compatibility.patch - 005-build_only_libs.patch - 006-Fix-build-on-aarch64-musl.patch Add patch: - 102-fix-potential-deref-of-null-error.patch Release notes are in the link below. Link: https://inbox.sourceware.org/elfutils-devel/CAJDtP-T3+gXqHWp3T0mejWWbPr0_1tHetEXwfB67-o+zz7ShiA@mail.gmail.com/T/#u Signed-off-by: Ryan Keane Link: https://github.com/openwrt/openwrt/pull/16886 Signed-off-by: Robert Marko --- package/libs/elfutils/Makefile | 4 +- .../patches/003-libintl-compatibility.patch | 2 +- .../patches/005-build_only_libs.patch | 2 +- .../006-Fix-build-on-aarch64-musl.patch | 4 +- ...02-fix-potential-deref-of-null-error.patch | 55 +++++++++++++++++++ 5 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index ac5841c604b235..b8bb50b564c93f 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=elfutils -PKG_VERSION:=0.191 +PKG_VERSION:=0.192 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) -PKG_HASH:=df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871 +PKG_HASH:=616099beae24aba11f9b63d86ca6cc8d566d968b802391334c91df54eab416b4 PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-3.0-or-later diff --git a/package/libs/elfutils/patches/003-libintl-compatibility.patch b/package/libs/elfutils/patches/003-libintl-compatibility.patch index 1271796af54fd4..eda9f2204a928c 100644 --- a/package/libs/elfutils/patches/003-libintl-compatibility.patch +++ b/package/libs/elfutils/patches/003-libintl-compatibility.patch @@ -11,7 +11,7 @@ Requires.private: zlib @LIBZSTD@ --- a/configure.ac +++ b/configure.ac -@@ -717,6 +717,9 @@ dnl AM_GNU_GETTEXT_REQUIRE_VERSION suppo +@@ -728,6 +728,9 @@ dnl AM_GNU_GETTEXT_REQUIRE_VERSION suppo AM_GNU_GETTEXT_VERSION([0.19.6]) AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6]) diff --git a/package/libs/elfutils/patches/005-build_only_libs.patch b/package/libs/elfutils/patches/005-build_only_libs.patch index 598b734874e764..177ac659e62403 100644 --- a/package/libs/elfutils/patches/005-build_only_libs.patch +++ b/package/libs/elfutils/patches/005-build_only_libs.patch @@ -8,4 +8,4 @@ + libasm EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING SECURITY \ - COPYING COPYING-GPLV2 COPYING-LGPLV3 + COPYING COPYING-GPLV2 COPYING-LGPLV3 CONDUCT diff --git a/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch b/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch index d8066c5ca717cf..a7786ed2c011a0 100644 --- a/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch +++ b/package/libs/elfutils/patches/006-Fix-build-on-aarch64-musl.patch @@ -32,8 +32,8 @@ Signed-off-by: Hongxu Jia +# include # include # include - /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */ -@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t + # include +@@ -94,7 +94,7 @@ aarch64_set_initial_registers_tid (pid_t Dwarf_Word dwarf_fregs[32]; for (int r = 0; r < 32; r++) diff --git a/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch b/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch new file mode 100644 index 00000000000000..6710e4ef9cf176 --- /dev/null +++ b/package/libs/elfutils/patches/102-fix-potential-deref-of-null-error.patch @@ -0,0 +1,55 @@ +strip.c: Pointer `arhdr` created at strip.c:2741 and then dereferenced without NULL-check. +The same situation for the `arhdr` pointer at the objdump.c:313 and +the `h` pointer at the readelf.c:13545. + +Triggers found by static analyzer Svace. + +Signed-off-by: Maks Mishin +--- + src/objdump.c | 5 +++++ + src/readelf.c | 5 +++++ + src/strip.c | 5 +++++ + 3 files changed, 15 insertions(+) + +--- a/src/objdump.c ++++ b/src/objdump.c +@@ -311,6 +311,11 @@ handle_ar (int fd, Elf *elf, const char + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); ++ if (arhdr == NULL) ++ { ++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); ++ exit (1); ++ } + + /* Skip over the index entries. */ + if (strcmp (arhdr->ar_name, "/") != 0 +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -13543,6 +13543,11 @@ dump_archive_index (Elf *elf, const char + as_off, fname, elf_errmsg (-1)); + + const Elf_Arhdr *h = elf_getarhdr (subelf); ++ if (h == NULL) ++ { ++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); ++ exit (1); ++ } + + printf (_("Archive member '%s' contains:\n"), h->ar_name); + +--- a/src/strip.c ++++ b/src/strip.c +@@ -2739,6 +2739,11 @@ handle_ar (int fd, Elf *elf, const char + { + /* The the header for this element. */ + Elf_Arhdr *arhdr = elf_getarhdr (subelf); ++ if (arhdr == NULL) ++ { ++ printf ("cannot get arhdr: %s\n", elf_errmsg (-1)); ++ exit (1); ++ } + + if (elf_kind (subelf) == ELF_K_ELF) + result |= handle_elf (fd, subelf, new_prefix, arhdr->ar_name, 0, NULL); From 63caa2b1685ef5d2b4259784085f64cb9e5574a8 Mon Sep 17 00:00:00 2001 From: Ryan Keane Date: Wed, 13 Nov 2024 11:46:38 -0800 Subject: [PATCH 34/35] elfutils: Add mirrors.kernel.org as mirrror Add mirrors.kernel.org as mirror, listed on sourceware mirror sites page. Link: https://sourceware.org/mirrors.html Signed-off-by: Ryan Keane Link: https://github.com/openwrt/openwrt/pull/16886 Signed-off-by: Robert Marko --- package/libs/elfutils/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index b8bb50b564c93f..7b31331e0bfbbb 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -11,7 +11,8 @@ PKG_VERSION:=0.192 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) +PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION) \ + https://mirrors.kernel.org/sourceware/$(PKG_NAME)/$(PKG_VERSION) PKG_HASH:=616099beae24aba11f9b63d86ca6cc8d566d968b802391334c91df54eab416b4 PKG_MAINTAINER:=Luiz Angelo Daros de Luca From afffcd09e5f15be53f327a80ee87d391312eb805 Mon Sep 17 00:00:00 2001 From: Ryan Keane Date: Thu, 7 Nov 2024 22:36:23 -0800 Subject: [PATCH 35/35] elfutils: Backport some patches to fix errors On aarch64 musl gcc 14.x compiler, trying compiling elfutils 0.192 with lto option enabled will cause null-dereference error. Example error message: ... elf_compress.c: In function 'elf_compress': elf_compress.c:675:26: error: potential null pointer dereference [-Werror=null-dereference] 675 | shdr->sh_flags |= SHF_COMPRESSED; | ^ elf_compress_gnu.c: In function 'elf_compress_gnu': elf_compress_gnu.c:127:25: error: potential null pointer dereference [-Werror=null-dereference] 127 | shdr->sh_size = new_size; | ^ ^ ... This is a false postive warning but will abort compilation if gcc has `-Werror` flag. This commit add a patch for this, see the bugzilla report below. This commit backports a series of patches to fix some errors. Add patch: - 007-add-libeu-symbols-to-libelf.patch - 008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch - 009-fix-null-dereference-with-lto.patch Link: https://sourceware.org/bugzilla/show_bug.cgi?id=32311 Signed-off-by: Ryan Keane Link: https://github.com/openwrt/openwrt/pull/16886 Signed-off-by: Robert Marko --- .../007-add-libeu-symbols-to-libelf.patch | 31 +++ ...fix-autoconf-ENABLE_IMA_VERIFICATION.patch | 24 +++ .../009-fix-null-dereference-with-lto.patch | 193 ++++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch create mode 100644 package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch create mode 100644 package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch diff --git a/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch b/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch new file mode 100644 index 00000000000000..23489b562570e7 --- /dev/null +++ b/package/libs/elfutils/patches/007-add-libeu-symbols-to-libelf.patch @@ -0,0 +1,31 @@ +From f5d6e088f84dd05278c4698a21cbf1ff4569978d Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 22 Oct 2024 15:03:42 +0200 +Subject: [PATCH] libelf: Add libeu objects to libelf.a static archive + +libelf might use some symbols from libeu.a, specifically the eu-search +wrappers. But we don't ship libeu.a separately. So include the libeu +objects in the libelf.a archive to facilitate static linking. + + * libelf/Makefile.am (libeu_objects): New variable. + (libelf_a_LIBADD): New, add libeu_objects. + +https://sourceware.org/bugzilla/show_bug.cgi?id=32293 + +Signed-off-by: Mark Wielaard +--- + libelf/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/libelf/Makefile.am ++++ b/libelf/Makefile.am +@@ -122,6 +122,9 @@ libelf.so: $(srcdir)/libelf.map $(libelf + @$(textrel_check) + $(AM_V_at)ln -fs $@ $@.$(VERSION) + ++libeu_objects = $(shell $(AR) t ../lib/libeu.a) ++libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects)) ++ + install: install-am libelf.so + $(mkinstalldirs) $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so diff --git a/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch b/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch new file mode 100644 index 00000000000000..e5732d2b0821fd --- /dev/null +++ b/package/libs/elfutils/patches/008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch @@ -0,0 +1,24 @@ +From f3c664d069d81a4872a1ec8241ee709f37c53e9c Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Tue, 29 Oct 2024 14:16:57 -0400 +Subject: [PATCH] configure.ac: Fix ENABLE_IMA_VERIFICATION conditional + +Fix test statement for ENABLE_IMA_VERIFICATION always evalutating to +false due to a missing 'x'. + +Signed-off-by: Aaron Merey +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -895,7 +895,7 @@ AS_IF([test "x$enable_debuginfod" != "xn + AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"]) + AS_IF([test "x$enable_debuginfod_ima_verification" = "xyes"],AC_DEFINE([ENABLE_IMA_VERIFICATION],[1],[Build IMA verification])) + AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Define to 1 if libarchive is available])) +-AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"]) ++AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "x$enable_debuginfod_ima_verification" = "xyes"]) + AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"]) + + dnl for /etc/profile.d/elfutils.{csh,sh} diff --git a/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch b/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch new file mode 100644 index 00000000000000..1179a1e1a01f67 --- /dev/null +++ b/package/libs/elfutils/patches/009-fix-null-dereference-with-lto.patch @@ -0,0 +1,193 @@ +From 8707194a9f2f0b13e53041b03ebfdbdbd2942e43 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 5 Nov 2024 23:31:14 +0100 +Subject: [PATCH 1/1] libelf: Only fetch shdr once in elf_compress[_gnu] + +Some compilers assume the second call to elf[32|64]_getshdr can fail +and produce error: potential null pointer dereference. Just store the +result of the first call and reuse (when not NULL). + + * libelf/elf_compress.c (elf_compress): Store getshdr result in + a shdr union var. + * libelf/elf_compress_gnu.c (): Likewise + +https://sourceware.org/bugzilla/show_bug.cgi?id=32311 + +Signed-off-by: Mark Wielaard +--- + libelf/elf_compress.c | 55 +++++++++++++++++++++------------------ + libelf/elf_compress_gnu.c | 45 ++++++++++++++------------------ + 2 files changed, 48 insertions(+), 52 deletions(-) + +--- a/libelf/elf_compress.c ++++ b/libelf/elf_compress.c +@@ -584,25 +584,30 @@ elf_compress (Elf_Scn *scn, int type, un + Elf64_Xword sh_flags; + Elf64_Word sh_type; + Elf64_Xword sh_addralign; ++ union shdr ++ { ++ Elf32_Shdr *s32; ++ Elf64_Shdr *s64; ++ } shdr; + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- if (shdr == NULL) ++ shdr.s32 = elf32_getshdr (scn); ++ if (shdr.s32 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s32->sh_flags; ++ sh_type = shdr.s32->sh_type; ++ sh_addralign = shdr.s32->sh_addralign; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- if (shdr == NULL) ++ shdr.s64 = elf64_getshdr (scn); ++ if (shdr.s64 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s64->sh_flags; ++ sh_type = shdr.s64->sh_type; ++ sh_addralign = shdr.s64->sh_addralign; + } + + if ((sh_flags & SHF_ALLOC) != 0) +@@ -679,17 +684,17 @@ elf_compress (Elf_Scn *scn, int type, un + correctly and ignored when SHF_COMPRESSED is set. */ + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = new_size; +- shdr->sh_addralign = __libelf_type_align (ELFCLASS32, ELF_T_CHDR); +- shdr->sh_flags |= SHF_COMPRESSED; ++ shdr.s32->sh_size = new_size; ++ shdr.s32->sh_addralign = __libelf_type_align (ELFCLASS32, ++ ELF_T_CHDR); ++ shdr.s32->sh_flags |= SHF_COMPRESSED; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = new_size; +- shdr->sh_addralign = __libelf_type_align (ELFCLASS64, ELF_T_CHDR); +- shdr->sh_flags |= SHF_COMPRESSED; ++ shdr.s64->sh_size = new_size; ++ shdr.s64->sh_addralign = __libelf_type_align (ELFCLASS64, ++ ELF_T_CHDR); ++ shdr.s64->sh_flags |= SHF_COMPRESSED; + } + + __libelf_reset_rawdata (scn, out_buf, new_size, 1, ELF_T_CHDR); +@@ -731,17 +736,15 @@ elf_compress (Elf_Scn *scn, int type, un + correctly and ignored when SHF_COMPRESSED is set. */ + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = scn->zdata_size; +- shdr->sh_addralign = scn->zdata_align; +- shdr->sh_flags &= ~SHF_COMPRESSED; ++ shdr.s32->sh_size = scn->zdata_size; ++ shdr.s32->sh_addralign = scn->zdata_align; ++ shdr.s32->sh_flags &= ~SHF_COMPRESSED; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = scn->zdata_size; +- shdr->sh_addralign = scn->zdata_align; +- shdr->sh_flags &= ~SHF_COMPRESSED; ++ shdr.s64->sh_size = scn->zdata_size; ++ shdr.s64->sh_addralign = scn->zdata_align; ++ shdr.s64->sh_flags &= ~SHF_COMPRESSED; + } + + __libelf_reset_rawdata (scn, scn->zdata_base, +--- a/libelf/elf_compress_gnu.c ++++ b/libelf/elf_compress_gnu.c +@@ -59,25 +59,30 @@ elf_compress_gnu (Elf_Scn *scn, int infl + Elf64_Xword sh_flags; + Elf64_Word sh_type; + Elf64_Xword sh_addralign; ++ union shdr ++ { ++ Elf32_Shdr *s32; ++ Elf64_Shdr *s64; ++ } shdr; + if (elfclass == ELFCLASS32) + { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- if (shdr == NULL) ++ shdr.s32 = elf32_getshdr (scn); ++ if (shdr.s32 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s32->sh_flags; ++ sh_type = shdr.s32->sh_type; ++ sh_addralign = shdr.s32->sh_addralign; + } + else + { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- if (shdr == NULL) ++ shdr.s64 = elf64_getshdr (scn); ++ if (shdr.s64 == NULL) + return -1; + +- sh_flags = shdr->sh_flags; +- sh_type = shdr->sh_type; +- sh_addralign = shdr->sh_addralign; ++ sh_flags = shdr.s64->sh_flags; ++ sh_type = shdr.s64->sh_type; ++ sh_addralign = shdr.s64->sh_addralign; + } + + /* Allocated sections, or sections that are already are compressed +@@ -122,15 +127,9 @@ elf_compress_gnu (Elf_Scn *scn, int infl + sh_flags won't have a SHF_COMPRESSED hint in the GNU format. + Just adjust the sh_size. */ + if (elfclass == ELFCLASS32) +- { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = new_size; +- } ++ shdr.s32->sh_size = new_size; + else +- { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = new_size; +- } ++ shdr.s64->sh_size = new_size; + + __libelf_reset_rawdata (scn, out_buf, new_size, 1, ELF_T_BYTE); + +@@ -187,15 +186,9 @@ elf_compress_gnu (Elf_Scn *scn, int infl + sh_flags won't have a SHF_COMPRESSED hint in the GNU format. + Just adjust the sh_size. */ + if (elfclass == ELFCLASS32) +- { +- Elf32_Shdr *shdr = elf32_getshdr (scn); +- shdr->sh_size = size; +- } ++ shdr.s32->sh_size = size; + else +- { +- Elf64_Shdr *shdr = elf64_getshdr (scn); +- shdr->sh_size = size; +- } ++ shdr.s64->sh_size = size; + + __libelf_reset_rawdata (scn, buf_out, size, sh_addralign, + __libelf_data_type (&ehdr, sh_type,