From d1fc2ea8c78db13a07c129296453454f72108bec Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 22 May 2024 11:38:49 +0200 Subject: [PATCH 01/19] host-build: always define Host/Prepare/Default We currently skip defining Host/Prepare/Default if HOST_UNPACK is not defined. This is mostly the case for Host packages that just provide files with the src directory and don't need to be downloaded/extracted. This was probably done lots of times ago due to quilt causing error as the patches directory wasn't present. This has changed now and quilt can correctly detect if no patches needs to be applied (instead of terminating with error) Always define Host/Prepare/Default to make tools/refresh correctly works as HOST_QUILT is hardcoded enabled for this make target and will complain for tool not prepared for quilt patches. Signed-off-by: Christian Marangi (cherry picked from commit 725389b7c745b0fa68426986c9bca14171f16887) --- include/host-build.mk | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/host-build.mk b/include/host-build.mk index dba6b819da6349..2d0c416f6e25a9 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -35,13 +35,11 @@ include $(INCLUDE_DIR)/autotools.mk _host_target:=$(if $(HOST_QUILT),,.) Host/Patch:=$(Host/Patch/Default) -ifneq ($(strip $(HOST_UNPACK)),) - define Host/Prepare/Default - $(HOST_UNPACK) +define Host/Prepare/Default + $(if $(strip $(HOST_UNPACK)),$(HOST_UNPACK)) [ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR) $(Host/Patch) - endef -endif +endef define Host/Prepare $(call Host/Prepare/Default) From 9897724adaaefdbd4da0067dced23efa9c536643 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 22 May 2024 11:53:52 +0200 Subject: [PATCH 02/19] tools/missing-macros: install files from HOST_BUILD_DIR instead of src Install files from HOST_BUILD_DIR instead of src. These files are now correctly copied to HOST_BUILD_DIR and can be referenced from there. (cherry picked from commit 46bcbe42236bbe058eaeb89a0d1a4f22926cfdf9) [ rebased on top of openwrt-23.05 ] Signed-off-by: Christian Marangi --- tools/missing-macros/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/missing-macros/Makefile b/tools/missing-macros/Makefile index 1e423621bdcef2..0b1d568cbd000d 100644 --- a/tools/missing-macros/Makefile +++ b/tools/missing-macros/Makefile @@ -20,9 +20,9 @@ endef define Host/Install $(INSTALL_DIR) $(STAGING_DIR_HOST)/share/aclocal - $(INSTALL_DATA) ./src/m4/*.m4 $(STAGING_DIR_HOST)/share/aclocal/ + $(INSTALL_DATA) $(HOST_BUILD_DIR)/m4/*.m4 $(STAGING_DIR_HOST)/share/aclocal/ $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin - $(INSTALL_BIN) ./src/bin/* $(STAGING_DIR_HOST)/bin/ + $(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/* $(STAGING_DIR_HOST)/bin/ endef $(eval $(call HostBuild)) From aa77c796fec90e3e328c5b33d9239bd4910f1e9a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 22 May 2024 11:56:45 +0200 Subject: [PATCH 03/19] tools/padjffs2: use Host/Prepare/Default instead of raw commands Now that Host/Prepare/Default is always defined, we can use that instead of using raw commands to move files from the src directory to HOST_BUILD_DIR. Signed-off-by: Christian Marangi (cherry picked from commit 01048c7456785bc4a45452c84d8f31635e1fa60b) --- tools/padjffs2/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/padjffs2/Makefile b/tools/padjffs2/Makefile index 422d14db301053..b893fadce51337 100644 --- a/tools/padjffs2/Makefile +++ b/tools/padjffs2/Makefile @@ -13,8 +13,7 @@ PKG_RELEASE:=1 include $(INCLUDE_DIR)/host-build.mk define Host/Prepare - mkdir -p $(HOST_BUILD_DIR) - $(CP) ./src/* $(HOST_BUILD_DIR)/ + $(call Host/Prepare/Default) find $(HOST_BUILD_DIR) -name .svn | $(XARGS) rm -rf endef From 61c50bd2ce4e1027544361291b789921cbe96166 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 25 Sep 2023 02:26:43 +0200 Subject: [PATCH 04/19] quilt.mk: use CURDIR instead of ./ for PATCH_DIR and FILES_DIR To better reference them for diagnostic use, reference the PATCH_DIR and FILES_DIR with the absolute path instead of using ./ and reference by the relative location. No behaviour change intended. Signed-off-by: Christian Marangi (cherry picked from commit bb1bfb46020b38179ef97d30333c90ab00b71c97) --- include/quilt.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/quilt.mk b/include/quilt.mk index 18cafe60a280bb..140d3905283f5a 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -34,8 +34,8 @@ endif ifneq ($(if $(DUMP),1,$(__quilt_inc)),1) __quilt_inc:=1 -PATCH_DIR?=./patches -FILES_DIR?=./files +PATCH_DIR?=$(CURDIR)/patches +FILES_DIR?=$(CURDIR)/files HOST_PATCH_DIR?=$(PATCH_DIR) HOST_FILES_DIR?=$(FILES_DIR) From 349c3c1605cd3bbed1579a096af6a7b6be3c518c Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 25 Sep 2023 02:29:31 +0200 Subject: [PATCH 05/19] quilt.mk: don't error on refresh/update if patches doesn't exist The current code fails if we have package or host tools with no patches to apply. The error printend is the following: (taking ubus as an example) make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/scripts/config' make[2]: 'conf' is up to date. make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/scripts/config' make[1]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt' make[2]: Entering directory '/home/ansuel/openwrt-ansuel/openwrt/package/system/ubus' The source directory contains no quilt patches. make[2]: *** [Makefile:81: quilt-check] Error 1 make[2]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt/package/system/ubus' time: package/system/ubus/refresh#0.06#0.00#0.07 ERROR: package/system/ubus failed to build. make[1]: *** [package/Makefile:120: package/system/ubus/refresh] Error 1 make[1]: Leaving directory '/home/ansuel/openwrt-ansuel/openwrt' make: *** [/home/ansuel/openwrt-ansuel/openwrt/include/toplevel.mk:232: package/ubus/refresh] Error 2 We exit 1 after saying that there are no patches because later in the function quilt pop fails to execute. Having no patches for a package and calling refresh should not be a critical error and the function should just do nothing. To handle this improve quilt.mk with the following addition. - If we don't have any patch for the package, we print a warning and we create an empty series. This is useful to trick quilt and make it do nothing. We also create a status file .quilt_no_patch to detect in the other function that we don't have patches to handle. - In refresh makefile target, we check if .quilt_no_patch exist and we skip quilt cleanup if this exist. - In RefreshDir function we change the logic and now we delete the patches directory and not only the content. This is done as a cleanup to clean case with empty patches directory. - In RefreshDir we check if .quilt_no_patch exist and we skip creating the patches directory and copying the refreshed patches. - In RefreshDir we delete at the end any trace of .quilt_no_patch if present. This is needed to support run like package/refresh that will run the refresh process on any package present in the buildroot. Signed-off-by: Christian Marangi (cherry picked from commit 9536446965e853231e34c4e5dc4cf13f838b9e90) --- include/quilt.mk | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/include/quilt.mk b/include/quilt.mk index 140d3905283f5a..a58390f6c5471d 100644 --- a/include/quilt.mk +++ b/include/quilt.mk @@ -106,13 +106,14 @@ define Kernel/Patch/Default endef define Quilt/RefreshDir - mkdir -p $(2) - -rm -f $(2)/* 2>/dev/null >/dev/null - @( \ + -rm -rf $(2) 2>/dev/null >/dev/null + [ -f $(1)/.quilt_no_patch ] || mkdir -p $(2) + @[ -f $(1)/.quilt_no_patch ] || { \ for patch in $$$$($(if $(3),grep "^$(3)",cat) $(1)/patches/series | awk '{print $$$$1}'); do \ $(CP) -v "$(1)/patches/$$$$patch" $(2); \ done; \ - ) + } + @-rm -f $(1)/.quilt_no_patch 2>/dev/null >/dev/null; endef define Quilt/Refresh/Host @@ -156,7 +157,7 @@ define Quilt/Template } @[ -f "$(1)/patches/series" ] || { \ echo "The source directory contains no quilt patches."; \ - false; \ + touch $(1)/patches/series $(1)/.quilt_no_patch; \ } @[ -n "$$$$(ls $(1)/patches/series)" -o \ "$$$$(cat $(1)/patches/series | $(MKHASH) md5)" = "$$(sort $(1)/patches/series | $(MKHASH) md5)" ] || { \ @@ -165,10 +166,12 @@ define Quilt/Template } $(3)refresh: $(3)quilt-check - @cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null - @cd "$(1)"; while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \ - QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \ - done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null + @[ -f $(1)/.quilt_no_patch ] || { \ + cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null; \ + while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \ + QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \ + done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null; \ + } $(Quilt/Refresh/$(4)) $(3)update: $(3)quilt-check From 28bf0137b4d6f73bb2ad94e286f3ac2a5d6388c6 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 22 May 2024 12:41:10 +0200 Subject: [PATCH 06/19] tools: refresh all patches Refresh all tools patches now that tools/refresh correctly works. CI now checks for them and actively complain if tools have unrefreshed patches. Signed-off-by: Christian Marangi --- .../021-merge-and-improve-makefiles.patch | 10 +++--- tools/ccache/patches/100-honour-copts.patch | 2 +- tools/elftosb/patches/001-libm.patch | 6 ++-- .../elftosb/patches/002-fix-header-path.patch | 5 ++- .../001-add-cmake-ENABLE-configurables.patch | 14 ++++---- ...01-add-make-ENABLE_DOCS-configurable.patch | 14 ++++---- ...makefile-install-links-from-same-dir.patch | 23 ++++++------ tools/lzma/patches/001-large_files.patch | 8 ++--- tools/lzma/patches/002-lzmp.patch | 36 +++++++------------ tools/lzma/patches/003-compile_fixes.patch | 14 ++++---- ...1-add-cmake-ENABLE_DOCS-configurable.patch | 8 ++--- tools/patch/patches/050-CVE-2019-13636.patch | 15 +++----- tools/patch/patches/060-CVE-2019-13638.patch | 9 ++--- 13 files changed, 67 insertions(+), 97 deletions(-) diff --git a/tools/bzip2/patches/021-merge-and-improve-makefiles.patch b/tools/bzip2/patches/021-merge-and-improve-makefiles.patch index 9d98c34bdbb417..f21d55e0e287f6 100644 --- a/tools/bzip2/patches/021-merge-and-improve-makefiles.patch +++ b/tools/bzip2/patches/021-merge-and-improve-makefiles.patch @@ -22,7 +22,7 @@ --- a/Makefile +++ b/Makefile -@@ -21,11 +21,38 @@ +@@ -21,11 +21,38 @@ RANLIB=ranlib LDFLAGS= BIGFILES=-D_FILE_OFFSET_BITS=64 @@ -64,7 +64,7 @@ OBJS= blocksort.o \ huffman.o \ -@@ -35,15 +62,38 @@ +@@ -35,15 +62,38 @@ OBJS= blocksort.o \ decompress.o \ bzlib.o @@ -109,7 +109,7 @@ rm -f libbz2.a $(AR) cq libbz2.a $(OBJS) @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ -@@ -51,8 +101,18 @@ +@@ -51,8 +101,18 @@ libbz2.a: $(OBJS) echo $(RANLIB) libbz2.a ; \ $(RANLIB) libbz2.a ; \ fi @@ -129,7 +129,7 @@ test: bzip2 @cat words1 ./bzip2 -1 < sample1.ref > sample1.rb2 -@@ -69,69 +129,153 @@ +@@ -69,69 +129,153 @@ test: bzip2 cmp sample3.tst sample3.ref @cat words3 @@ -318,7 +318,7 @@ distclean: clean -@@ -189,7 +333,6 @@ +@@ -189,7 +333,6 @@ dist: check manual $(DISTNAME)/bzmore.1 \ $(DISTNAME)/bzgrep \ $(DISTNAME)/bzgrep.1 \ diff --git a/tools/ccache/patches/100-honour-copts.patch b/tools/ccache/patches/100-honour-copts.patch index da72af922d0049..91dc35536fb80c 100644 --- a/tools/ccache/patches/100-honour-copts.patch +++ b/tools/ccache/patches/100-honour-copts.patch @@ -1,6 +1,6 @@ --- a/src/ccache.cpp +++ b/src/ccache.cpp -@@ -1813,6 +1813,7 @@ get_manifest_key(Context& ctx, Hash& has +@@ -1815,6 +1815,7 @@ get_manifest_key(Context& ctx, Hash& has "CPLUS_INCLUDE_PATH", "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH", // clang diff --git a/tools/elftosb/patches/001-libm.patch b/tools/elftosb/patches/001-libm.patch index 02705d24bb7ff8..6b49ac1af22811 100644 --- a/tools/elftosb/patches/001-libm.patch +++ b/tools/elftosb/patches/001-libm.patch @@ -1,6 +1,6 @@ ---- elftosb-10.12.01/makefile.rules 2012-03-15 11:01:44.979020178 -0400 -+++ elftosb-10.12.01/makefile.rules 2012-03-15 11:01:16.332761989 -0400 -@@ -101,7 +101,7 @@ +--- a/makefile.rules ++++ b/makefile.rules +@@ -101,7 +101,7 @@ OBJ_FILES_KEYGEN = \ keygen.o diff --git a/tools/elftosb/patches/002-fix-header-path.patch b/tools/elftosb/patches/002-fix-header-path.patch index 5e3b5091b90f59..5099b296447f80 100644 --- a/tools/elftosb/patches/002-fix-header-path.patch +++ b/tools/elftosb/patches/002-fix-header-path.patch @@ -5,9 +5,8 @@ others once multiarch becomes more common. This patch makes the types a relative path, and allows the system to use whatever include paths it feels are correct. -diff -Naurp elftosb-10.12.01-orig/common/stdafx.h elftosb-10.12.01/common/stdafx.h ---- elftosb-10.12.01-orig/common/stdafx.h 2012-07-12 13:30:10.990249396 -0400 -+++ elftosb-10.12.01/common/stdafx.h 2012-07-12 13:30:06.858249391 -0400 +--- a/common/stdafx.h ++++ b/common/stdafx.h @@ -27,7 +27,7 @@ // For Linux systems only, types.h only defines the signed // integer types. This is not professional code. diff --git a/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch b/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch index 9ab27fc924acdb..e0ba4101672480 100644 --- a/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch +++ b/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch @@ -1,6 +1,6 @@ ---- a/CMakeLists.txt 2022-11-28 06:34:39.171209779 -0800 -+++ b/CMakeLists.txt 2022-11-28 06:33:13.368239757 -0800 -@@ -51,8 +51,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,8 +51,11 @@ endif() project(lzo VERSION 2.10 LANGUAGES C) # configuration options @@ -14,7 +14,7 @@ if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED) set(ENABLE_STATIC ON) endif() -@@ -127,14 +130,20 @@ +@@ -127,14 +130,20 @@ macro(lzo_add_executable t) endif() endmacro() # main test driver @@ -35,7 +35,7 @@ # some boring internal test programs if(0) lzo_add_executable(align tests/align.c) -@@ -144,7 +153,7 @@ +@@ -144,7 +153,7 @@ if(0) endif() # miniLZO @@ -44,7 +44,7 @@ add_executable(testmini minilzo/testmini.c minilzo/minilzo.c) target_include_directories(testmini PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/lzo") # needed for "lzoconf.h" endif() -@@ -263,8 +272,10 @@ +@@ -263,8 +272,10 @@ add_test(NAME lzotest-03 COMMAND lzotest if(DEFINED CMAKE_INSTALL_FULL_LIBDIR) @@ -57,7 +57,7 @@ set(f include/lzo/lzo1.h include/lzo/lzo1a.h include/lzo/lzo1b.h include/lzo/lzo1c.h include/lzo/lzo1f.h include/lzo/lzo1x.h -@@ -285,7 +296,7 @@ +@@ -285,7 +296,7 @@ if(ENABLE_SHARED) ) endif() diff --git a/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch index 5d6dca33f31c3d..938e93cecf9da3 100644 --- a/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch +++ b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch @@ -1,6 +1,6 @@ -+++ a/programs/Makefile 2022-08-15 15:45:31.000000000 -0700 ---- b/programs/Makefile 2022-11-28 16:34:21.315593784 -0800 -@@ -66,6 +66,7 @@ +--- a/programs/Makefile ++++ b/programs/Makefile +@@ -66,6 +66,7 @@ LZ4_VERSION=$(LIBVER) MD2ROFF = ronn MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)" @@ -8,7 +8,7 @@ default: lz4-release -@@ -120,6 +121,7 @@ +@@ -120,6 +121,7 @@ lz4c32: CFLAGS += -m32 lz4c32 : $(SRCFILES) $(CC) $(FLAGS) $^ -o $@$(EXT) @@ -16,7 +16,7 @@ lz4.1: lz4.1.md $(LIBVER_SRC) cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@ -@@ -130,6 +132,7 @@ +@@ -130,6 +132,7 @@ clean-man: preview-man: clean-man man man ./lz4.1 @@ -24,7 +24,7 @@ clean: ifeq ($(WINBASED),yes) -@@ -172,16 +175,19 @@ +@@ -172,16 +175,19 @@ man1dir ?= $(MAN1DIR) install: lz4 @echo Installing binaries in $(DESTDIR)$(bindir) @@ -45,7 +45,7 @@ @echo lz4 installation completed uninstall: -@@ -189,10 +195,12 @@ +@@ -189,10 +195,12 @@ uninstall: $(RM) $(DESTDIR)$(bindir)/unlz4$(EXT) $(RM) $(DESTDIR)$(bindir)/lz4$(EXT) $(RM) $(DESTDIR)$(bindir)/lz4c$(EXT) diff --git a/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch index 159dc67f1afc21..684907146007ca 100644 --- a/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch +++ b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch @@ -1,7 +1,6 @@ -diff -ur a/lib/Makefile b/lib/Makefile ---- a/lib/Makefile 2022-12-04 23:49:06.336839263 -0800 -+++ b/lib/Makefile 2022-12-05 00:00:59.172307488 -0800 -@@ -195,8 +195,8 @@ +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -195,8 +195,8 @@ install: lib liblz4.pc $(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir) else $(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir) @@ -12,10 +11,9 @@ diff -ur a/lib/Makefile b/lib/Makefile endif endif @echo Installing headers in $(DESTDIR)$(includedir) -diff -ur a/Makefile b/Makefile ---- a/Makefile 2022-12-04 23:49:06.336839263 -0800 -+++ b/Makefile 2022-12-04 23:42:09.693836654 -0800 -@@ -77,12 +77,12 @@ +--- a/Makefile ++++ b/Makefile +@@ -77,12 +77,12 @@ build_tests: .PHONY: clean clean: @@ -34,10 +32,9 @@ diff -ur a/Makefile b/Makefile $(RM) lz4$(EXT) $(RM) -r $(CMAKE_BUILD_DIR) @echo Cleaning completed -diff -ur a/programs/Makefile b/programs/Makefile ---- a/programs/Makefile 2022-12-04 23:49:06.336839263 -0800 -+++ b/programs/Makefile 2022-12-04 23:42:30.849582910 -0800 -@@ -138,7 +138,7 @@ +--- a/programs/Makefile ++++ b/programs/Makefile +@@ -138,7 +138,7 @@ clean: ifeq ($(WINBASED),yes) $(RM) *.rc endif @@ -46,7 +43,7 @@ diff -ur a/programs/Makefile b/programs/Makefile $(RM) core *.o *.test tmp* \ lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \ unlz4$(EXT) lz4cat$(EXT) -@@ -177,16 +177,16 @@ +@@ -177,16 +177,16 @@ install: lz4 @echo Installing binaries in $(DESTDIR)$(bindir) $(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) diff --git a/tools/lzma/patches/001-large_files.patch b/tools/lzma/patches/001-large_files.patch index b95fe9e90fd192..65603f49763358 100644 --- a/tools/lzma/patches/001-large_files.patch +++ b/tools/lzma/patches/001-large_files.patch @@ -1,8 +1,6 @@ -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc -=================================================================== ---- lzma-4.65.orig/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:00:54.000000000 +0200 -@@ -3,7 +3,7 @@ +--- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc ++++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc +@@ -3,7 +3,7 @@ CXX = g++ -O2 -Wall CXX_C = gcc -O2 -Wall LIB = -lm RM = rm -f diff --git a/tools/lzma/patches/002-lzmp.patch b/tools/lzma/patches/002-lzmp.patch index 72d881cdb2c15c..f1d45f45ff65b4 100644 --- a/tools/lzma/patches/002-lzmp.patch +++ b/tools/lzma/patches/002-lzmp.patch @@ -1,7 +1,5 @@ -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp 2009-06-01 22:01:10.000000000 +0200 +--- /dev/null ++++ b/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp @@ -0,0 +1,895 @@ +/* + * LZMA command line tool similar to gzip to encode and decode LZMA files. @@ -898,10 +896,8 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzmp.cpp + return STATUS_OK; +} + -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h 2009-06-01 22:01:10.000000000 +0200 +--- /dev/null ++++ b/CPP/7zip/Compress/LZMA_Alone/Exception.h @@ -0,0 +1,45 @@ +/* A couple of exceptions for lzmp. + * @@ -948,10 +944,8 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/Exception.h + +#endif + -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc -=================================================================== ---- lzma-4.65.orig/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:00:54.000000000 +0200 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc 2009-06-01 22:06:13.000000000 +0200 +--- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc ++++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc @@ -1,9 +1,10 @@ -PROG = lzma +PROG = lzma_alone @@ -965,7 +959,7 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc ifdef SystemDrive IS_MINGW = 1 -@@ -45,12 +46,35 @@ +@@ -45,12 +46,35 @@ OBJS = \ Lzma86Dec.o \ Lzma86Enc.o \ @@ -1002,17 +996,15 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/makefile.gcc LzmaAlone.o: LzmaAlone.cpp $(CXX) $(CFLAGS) LzmaAlone.cpp -@@ -131,5 +153,5 @@ +@@ -131,5 +155,5 @@ Lzma86Enc.o: ../../../../C/LzmaUtil/Lzma $(CXX_C) $(CFLAGS) ../../../../C/LzmaUtil/Lzma86Enc.c clean: - -$(RM) $(PROG) $(OBJS) + -$(RM) $(PROG) $(PROG2) $(OBJS) -Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h 2009-06-01 22:01:10.000000000 +0200 +--- /dev/null ++++ b/CPP/7zip/Compress/LZMA_Alone/lzma_version.h @@ -0,0 +1,31 @@ +#ifndef LZMA_VERSION_H +#define LZMA_VERSION_H @@ -1045,11 +1037,9 @@ Index: lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_version.h + "named COPYING.\n"; + +#endif /* ifndef LZMA_VERSION_H */ -Index: lzma-4.65/CPP/Common/C_FileIO.h -=================================================================== ---- lzma-4.65.orig/CPP/Common/C_FileIO.h 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65/CPP/Common/C_FileIO.h 2009-06-01 22:06:56.000000000 +0200 -@@ -24,6 +24,7 @@ +--- a/CPP/Common/C_FileIO.h ++++ b/CPP/Common/C_FileIO.h +@@ -24,6 +24,7 @@ public: bool Close(); bool GetLength(UInt64 &length) const; off_t Seek(off_t distanceToMove, int moveMethod) const; diff --git a/tools/lzma/patches/003-compile_fixes.patch b/tools/lzma/patches/003-compile_fixes.patch index 49ae66b9c42850..06f7a54aef978c 100644 --- a/tools/lzma/patches/003-compile_fixes.patch +++ b/tools/lzma/patches/003-compile_fixes.patch @@ -1,7 +1,6 @@ -diff -urN lzma-4.65/CPP/7zip/Common/FileStreams.h lzma-4.65.new/CPP/7zip/Common/FileStreams.h ---- lzma-4.65/CPP/7zip/Common/FileStreams.h 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65.new/CPP/7zip/Common/FileStreams.h 2009-06-01 22:30:01.000000000 +0200 -@@ -72,6 +72,7 @@ +--- a/CPP/7zip/Common/FileStreams.h ++++ b/CPP/7zip/Common/FileStreams.h +@@ -72,6 +72,7 @@ class COutFileStream: public IOutStream, public CMyUnknownImp { @@ -9,10 +8,9 @@ diff -urN lzma-4.65/CPP/7zip/Common/FileStreams.h lzma-4.65.new/CPP/7zip/Common/ #ifdef USE_WIN_FILE NWindows::NFile::NIO::COutFile File; #else -diff -urN lzma-4.65/CPP/Common/MyWindows.h lzma-4.65.new/CPP/Common/MyWindows.h ---- lzma-4.65/CPP/Common/MyWindows.h 2009-05-15 23:33:51.000000000 +0200 -+++ lzma-4.65.new/CPP/Common/MyWindows.h 2009-06-01 22:29:26.000000000 +0200 -@@ -101,8 +101,11 @@ +--- a/CPP/Common/MyWindows.h ++++ b/CPP/Common/MyWindows.h +@@ -101,8 +101,11 @@ typedef LONG SCODE; #ifdef __cplusplus diff --git a/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch index 01ebd33a399ae7..27af782c1cc6b6 100644 --- a/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch +++ b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch @@ -1,6 +1,6 @@ ---- a/CMakeLists.txt 2017-08-10 04:19:45.000000000 -0700 -+++ b/CMakeLists.txt 2022-11-28 17:21:03.453548350 -0800 -@@ -50,6 +50,9 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -50,6 +50,9 @@ endif() project(lzop VERSION 1.04 LANGUAGES C) @@ -10,7 +10,7 @@ # install directories if(NOT CMAKE_INSTALL_PREFIX) message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.") -@@ -186,9 +189,11 @@ +@@ -186,9 +189,11 @@ if(DEFINED CMAKE_INSTALL_FULL_LIBDIR) install(TARGETS lzop DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") diff --git a/tools/patch/patches/050-CVE-2019-13636.patch b/tools/patch/patches/050-CVE-2019-13636.patch index e62c3d41753c7f..d819838bba44f7 100644 --- a/tools/patch/patches/050-CVE-2019-13636.patch +++ b/tools/patch/patches/050-CVE-2019-13636.patch @@ -14,8 +14,6 @@ with O_CREAT | O_EXCL to avoid following symlinks in that case as well. src/util.c | 14 +++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) -diff --git a/src/inp.c b/src/inp.c -index 32d0919..22d7473 100644 --- a/src/inp.c +++ b/src/inp.c @@ -238,8 +238,13 @@ plan_a (char const *filename) @@ -52,11 +50,9 @@ index 32d0919..22d7473 100644 || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r"))) pfatal ("Can't open file %s", quotearg (filename)); if (TMPINNAME_needs_removal) -diff --git a/src/util.c b/src/util.c -index 1cc08ba..fb38307 100644 --- a/src/util.c +++ b/src/util.c -@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original) +@@ -388,7 +388,7 @@ create_backup (char const *to, const str try_makedirs_errno = ENOENT; safe_unlink (bakname); @@ -65,7 +61,7 @@ index 1cc08ba..fb38307 100644 { if (errno != try_makedirs_errno) pfatal ("Can't create file %s", quotearg (bakname)); -@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode, +@@ -579,10 +579,13 @@ create_file (char const *file, int open_ static void copy_to_fd (const char *from, int tofd) { @@ -80,7 +76,7 @@ index 1cc08ba..fb38307 100644 pfatal ("Can't reopen file %s", quotearg (from)); while ((i = read (fromfd, buf, bufsize)) != 0) { -@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost, +@@ -625,6 +628,8 @@ copy_file (char const *from, char const else { assert (S_ISREG (mode)); @@ -89,7 +85,7 @@ index 1cc08ba..fb38307 100644 tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode, to_dir_known_to_exist); copy_to_fd (from, tofd); -@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost, +@@ -640,9 +645,12 @@ copy_file (char const *from, char const void append_to_file (char const *from, char const *to) { @@ -103,6 +99,3 @@ index 1cc08ba..fb38307 100644 pfatal ("Can't reopen file %s", quotearg (to)); copy_to_fd (from, tofd); if (close (tofd) != 0) --- -cgit v1.0-41-gc330 - diff --git a/tools/patch/patches/060-CVE-2019-13638.patch b/tools/patch/patches/060-CVE-2019-13638.patch index 38caff628aafa6..590cf186e7c67e 100644 --- a/tools/patch/patches/060-CVE-2019-13638.patch +++ b/tools/patch/patches/060-CVE-2019-13638.patch @@ -9,11 +9,9 @@ command to avoid quoting vulnerabilities. src/pch.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -diff --git a/src/pch.c b/src/pch.c -index 4fd5a05..16e001a 100644 --- a/src/pch.c +++ b/src/pch.c -@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname, +@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char c *outname_needs_removal = true; copy_file (inname, outname, 0, exclusive, instat.st_mode, true); } @@ -23,7 +21,7 @@ index 4fd5a05..16e001a 100644 fflush (stdout); pid = fork(); -@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname, +@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char c else if (pid == 0) { dup2 (tmpfd, 0); @@ -33,6 +31,3 @@ index 4fd5a05..16e001a 100644 _exit (2); } else --- -cgit v1.0-41-gc330 - From 0f1b249eac45506e1b1a090d3286d5cf01563fcc Mon Sep 17 00:00:00 2001 From: Rany Hany Date: Mon, 6 May 2024 01:39:58 +0300 Subject: [PATCH 07/19] mediatek: fix broken PCIe caused by update to 5.15.158 The patch "710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch" makes use of "syscon_regmap_lookup_by_phandle" which requires that "syscon" be in the compatible list. Without this patch, PCIe probe will fail with the following error: [ 1.287467] mtk-pcie 1a143000.pcie: host bridge /pcie@1a143000 ranges: [ 1.294019] mtk-pcie 1a143000.pcie: Parsing ranges property... [ 1.299901] mtk-pcie 1a143000.pcie: MEM 0x0020000000..0x0027ffffff -> 0x0020000000 [ 1.307954] mtk-pcie 1a143000.pcie: missing hifsys node [ 1.313185] mtk-pcie: probe of 1a143000.pcie failed with error -22 Fixes: 01c58a0d2a ("kernel: bump 5.15 to 5.15.158") Signed-off-by: Rany Hany (cherry picked from commit 8607372b410fbb24b08de97ff5941341d0870d6f) --- ...-pci-pcie-mediatek-add-support-for-coherent-DMA.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch b/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch index a3247f1779ac9f..917a458d308003 100644 --- a/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch +++ b/target/linux/mediatek/patches-5.15/710-pci-pcie-mediatek-add-support-for-coherent-DMA.patch @@ -30,6 +30,15 @@ Signed-off-by: Felix Fietkau #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 7>; +@@ -937,7 +943,7 @@ + }; + + hifsys: clock-controller@1af00000 { +- compatible = "mediatek,mt7622-hifsys"; ++ compatible = "mediatek,mt7622-hifsys", "syscon"; + reg = <0 0x1af00000 0 0x70>; + #clock-cells = <1>; + }; --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -20,6 +20,7 @@ From a6bb1df40bc8819ac01ee169c429f0f36c25ed38 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Wed, 3 Apr 2024 14:32:08 -0500 Subject: [PATCH 08/19] wifi-scripts: fix creation of IBSS in legacy (non-HT) mode When an IBBS interface is configured for IBSS legacy mode, wdev.htmode is empty. This is empty string results in an empty positional argument to the "ibbs join" command, for example: iw dev phy0-ibss0 ibss join crymesh 2412 '' fixed-freq beacon-interval 100 This empty argument is interpreted as an invalid HT mode by 'iw', causing the entire command to fail and print a "usage" message: daemon.notice netifd: radio0 (4527): Usage: iw [options] \ dev ibss join ... Although nobody will ever need more than 640K of IBSS, explicitly use "NOHT" if an HT mode is not given. This fixes the problem. Fixes: e56c5f7b276a ("hostapd: add ucode support, use ucode for the main ubus object") Signed-off-by: Alexandru Gagniuc Signed-off-by: Felix Fietkau [extend to cover more cases] (cherry picked from commit cee9fcdb7350911f474544189817d25fd4070111) --- package/network/services/hostapd/files/wdev.uc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package/network/services/hostapd/files/wdev.uc b/package/network/services/hostapd/files/wdev.uc index ff4d629fd64d0e..d505e3035ffbb2 100644 --- a/package/network/services/hostapd/files/wdev.uc +++ b/package/network/services/hostapd/files/wdev.uc @@ -32,10 +32,11 @@ function iface_start(wdev) wdev_config.macaddr = phydev.macaddr_next(); wdev_create(phy, ifname, wdev_config); wdev_set_up(ifname, true); + let htmode = wdev.htmode || "NOHT"; if (wdev.freq) - system(`iw dev ${ifname} set freq ${wdev.freq} ${wdev.htmode}`); + system(`iw dev ${ifname} set freq ${wdev.freq} ${htmode}`); if (wdev.mode == "adhoc") { - let cmd = ["iw", "dev", ifname, "ibss", "join", wdev.ssid, wdev.freq, wdev.htmode, "fixed-freq" ]; + let cmd = ["iw", "dev", ifname, "ibss", "join", wdev.ssid, wdev.freq, htmode, "fixed-freq" ]; if (wdev.bssid) push(cmd, wdev.bssid); for (let key in [ "beacon-interval", "basic-rates", "mcast-rate", "keys" ]) @@ -43,7 +44,7 @@ function iface_start(wdev) push(cmd, key, wdev[key]); system(cmd); } else if (wdev.mode == "mesh") { - let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, wdev.htmode ]; + let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, htmode ]; for (let key in [ "mcast-rate", "beacon-interval" ]) if (wdev[key]) push(cmd, key, wdev[key]); From c82c1178c1577422b62c90a52fa412929696d491 Mon Sep 17 00:00:00 2001 From: Paul Geraedts Date: Sat, 24 Feb 2024 09:01:01 +0100 Subject: [PATCH 09/19] mediatek: filogic: fix failsafe mode on devices with no lan1 Default to lan4 port, instead of (missing) lan1 port, to fix failsafe mode on Xiaomi AX3000T, WR30U, AX6000 Build system: x86/64 Build-tested: mediatek/filogic/xiaomi_mi-router-ax3000t-ubootmod Run-tested: mediatek/filogic/xiaomi_mi-router-ax3000t-ubootmod Signed-off-by: Paul Geraedts (cherry picked from commit 8256d06933e7542ecdd427b6a0ef4e87bb37d3f4) --- .../mediatek/base-files/lib/preinit/05_set_preinit_iface | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface index d45f20fe620721..8cab27a232c767 100644 --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -10,6 +10,15 @@ set_preinit_iface() { ip link set eth0 up ifname=eth0 ;; + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-ubootmod|\ + xiaomi,mi-router-wr30u-stock|\ + xiaomi,mi-router-wr30u-ubootmod|\ + xiaomi,redmi-router-ax6000-stock|\ + xiaomi,redmi-router-ax6000-ubootmod) + ip link set eth0 up + ifname=lan4 + ;; *) ip link set eth0 up ifname=lan1 From f11e6e221ea14e4d8e7261f58815b246828197b7 Mon Sep 17 00:00:00 2001 From: Dim Fish Date: Mon, 27 Nov 2023 12:01:34 +0300 Subject: [PATCH 10/19] mediatek: filogic: add support for Xiaomi AX3000T **SoC**: MediaTek MT7981B 2x A53 **Flash**: ESMT F50L1G41LB 128MB **RAM**: NT52B128M16JR-FL 256MB **Ethernet**: 4x 10/100/1000 Mbps **Switch**: MediaTek MT7531AE **WiFi**: MediaTek MT7976C **Buttons**: Reset, Mesh **Power**: DC 12V 1A 1. Get ssh access. Supported stock firmware **1.0.47** ``` curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20set%20ssh_en%3D1%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20commit%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Ased%20-i%20's%2Fchannel%3D.*%2Fchannel%3D%22debug%22%2Fg'%20%2Fetc%2Finit.d%2Fdropbear%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A" curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=********/api/misystem/arn_switch" -d "open=1&model=1&level=%0Apasswd%20-d%20root%0A ``` 2. Backup stock partitions ``` nanddump -f /tmp/BL2.bin /dev/mtd1 nanddump -f /tmp/Nvram.bin /dev/mtd2 nanddump -f /tmp/Bdata.bin /dev/mtd3 nanddump -f /tmp/Factory.bin /dev/mtd4 nanddump -f /tmp/FIP.bin /dev/mtd5 nanddump -f /tmp/ubi.bin /dev/mtd8 nanddump -f /tmp/KF.bin /dev/mtd12 ``` Then transfer them to your computer in a safe place. 3. Get firmware information `cat /proc/cmdline` 4. Copy openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi to **/tmp** and flash If **firmware=0** ``` ubiformat /dev/mtd9 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi nvram set boot_wait=on nvram set uart_en=1 nvram set flag_boot_rootfs=1 nvram set flag_last_success=1 nvram set flag_boot_success=1 nvram set flag_try_sys1_failed=0 nvram set flag_try_sys2_failed=0 nvram commit reboot ``` If **firmware=1** ``` ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi nvram set boot_wait=on nvram set uart_en=1 nvram set flag_boot_rootfs=0 nvram set flag_last_success=0 nvram set flag_boot_success=1 nvram set flag_try_sys1_failed=0 nvram set flag_try_sys2_failed=0 nvram commit reboot ``` Then reboot your router, it should boot to the OpenWrt initramfs system now. 5. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin `sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin` 1. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb `ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb` `reboot` 2. Install kmod-mtd-rw `opkg update && opkg install kmod-mtd-rw` `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1` 3. Format ubi and create new ubootenv volume ``` ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8 ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB ``` 4. *(Optional **-10Mb** free space) Add recovery boot feature.* ``` ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB ubiupdatevol /dev/ubi0_2 /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb ``` 5. Flash Openwrt U-Boot ``` mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin BL2 mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip FIP ``` 6. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb `sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb` 1. Force flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb `sysupgrade -F -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb` 2. Format ubi and Nvram ``` ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8 mtd erase Nvram ``` 3. Install kmod-mtd-rw `opkg update && opkg install kmod-mtd-rw` `insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1` 4. Flash stock images from backup ``` mtd write /tmp/BL2.bin BL2 mtd write /tmp/FIP.bin FIP mtd write /tmp/ubi.bin ubi ``` Then reboot your router, waiting it finished rollback in minutes. `ubiformat /dev/mtd7 -y -f /tmp/ubi.bin` Then reboot your router, waiting it finished rollback in minutes. Signed-off-by: Dim Fish (cherry picked from commit 7dbcc1215a56cc1da68c81bf92d7efa174c5e051) --- .../uboot-envtools/files/mediatek_filogic | 2 + package/boot/uboot-mediatek/Makefile | 13 + .../440-add-xiaomi_mi-router-ax3000t.patch | 414 ++++++++++++++++++ ...981b-xiaomi-mi-router-ax3000t-ubootmod.dts | 16 + .../dts/mt7981b-xiaomi-mi-router-ax3000t.dts | 34 ++ .../dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi | 29 ++ .../dts/mt7981b-xiaomi-mi-router-common.dtsi | 245 +++++++++++ .../dts/mt7981b-xiaomi-mi-router-wr30u.dtsi | 252 +---------- .../filogic/base-files/etc/board.d/01_leds | 2 +- .../filogic/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 4 + target/linux/mediatek/image/filogic.mk | 45 ++ 12 files changed, 820 insertions(+), 240 deletions(-) create mode 100644 package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi create mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 3551ab9c7d3fab..65a17bde0ea1a4 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -77,6 +77,7 @@ zbtlink,zbt-z8102ax) ubnt,unifi-6-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" ;; +xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) @@ -89,6 +90,7 @@ qihoo,360t7|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ +xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) . /lib/upgrade/nand.sh diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index d0e59d10179a79..7fdad5c744833f 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -320,6 +320,18 @@ define U-Boot/mt7981_qihoo_360t7 DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 endef +define U-Boot/mt7981_xiaomi_mi-router-ax3000t + NAME:=Xiaomi Router AX3000T + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=xiaomi_mi-router-ax3000t-ubootmod + UBOOT_CONFIG:=mt7981_xiaomi_mi-router-ax3000t + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr3 + DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3 +endef + define U-Boot/mt7981_xiaomi_mi-router-wr30u NAME:=Xiaomi Router WR30U BUILD_SUBTARGET:=filogic @@ -554,6 +566,7 @@ UBOOT_TARGETS := \ mt7981_rfb-sd \ mt7981_rfb-snfi \ mt7981_qihoo_360t7 \ + mt7981_xiaomi_mi-router-ax3000t \ mt7981_xiaomi_mi-router-wr30u \ mt7986_bananapi_bpi-r3-emmc \ mt7986_bananapi_bpi-r3-sdmmc \ diff --git a/package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch b/package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch new file mode 100644 index 00000000000000..9b50166a941eb3 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/440-add-xiaomi_mi-router-ax3000t.patch @@ -0,0 +1,414 @@ +--- /dev/null ++++ b/configs/mt7981_xiaomi_mi-router-ax3000t_defconfig +@@ -0,0 +1,163 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7981=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981_xiaomi_mi-router-ax3000t" ++CONFIG_DEFAULT_ENV_FILE="xiaomi_mi-router-ax3000t_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_xiaomi_mi-router-ax3000t.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7981> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++# CONFIG_CMD_EXT4 is not set ++# CONFIG_CMD_FAT is not set ++CONFIG_CMD_FDT=y ++# CONFIG_CMD_FS_GENERIC is not set ++# CONFIG_CMD_FS_UUID is not set ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_MTD=y ++# CONFIG_CMD_PCI is not set ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++# CONFIG_CMD_PWM is not set ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_USB is not set ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++# CONFIG_DM_USB is not set ++# CONFIG_DM_PWM is not set ++# CONFIG_PWM_MTK is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++# CONFIG_DM_SCSI is not set ++# CONFIG_AHCI is not set ++CONFIG_PHY=y ++# CONFIG_PHY_MTK_TPHY is not set ++CONFIG_PHY_FIXED=y ++CONFIG_MTK_AHCI=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++# CONFIG_PCI is not set ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++# CONFIG_DM_PCI is not set ++# CONFIG_PCIE_MEDIATEK is not set ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++# CONFIG_USB is not set ++# CONFIG_USB_HOST is not set ++# CONFIG_USB_XHCI_HCD is not set ++# CONFIG_USB_XHCI_MTK is not set ++# CONFIG_USB_STORAGE is not set ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 ++CONFIG_USE_IPADDR=y ++CONFIG_IPADDR="192.168.1.1" ++CONFIG_USE_SERVERIP=y ++CONFIG_SERVERIP="192.168.1.254" +--- /dev/null ++++ b/arch/arm/dts/mt7981_xiaomi_mi-router-ax3000t.dts +@@ -0,0 +1,187 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2022 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Xiaomi Router AX3000T"; ++ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x10000000>; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ gpios = <&gpio 1 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ }; ++ ++ mesh { ++ label = "mesh"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ linux,code = ; ++ linux,input-type = ; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led_status_blue { ++ label = "blue:status"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ ++ led_status_yellow { ++ label = "yellow:status"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ mediatek,force-highspeed; ++ status = "okay"; ++}; ++ ++ð { ++ 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; ++ }; ++}; ++ ++&pinctrl { ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_1"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <2>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x00 0x100000>; ++ }; ++ ++ partition@100000 { ++ label = "Nvram"; ++ reg = <0x100000 0x40000>; ++ }; ++ ++ partition@140000 { ++ label = "Bdata"; ++ reg = <0x140000 0x40000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@580000 { ++ label = "crash"; ++ reg = <0x580000 0x40000>; ++ }; ++ ++ partition@5c0000 { ++ label = "crash_log"; ++ reg = <0x5c0000 0x40000>; ++ }; ++ ++ partition@600000 { ++ label = "ubi"; ++ reg = <0x600000 0x7000000>; ++ }; ++ ++ partition@7600000 { ++ label = "KF"; ++ reg = <0x7600000 0x40000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/xiaomi_mi-router-ax3000t_env +@@ -0,0 +1,55 @@ ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootargs=console=ttyS0,115200n8 console_msg_format=syslog ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb ++bootled_pwr=yellow:status ++bootled_rec=blue:status ++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 production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off ++boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts new file mode 100644 index 00000000000000..809e625ce1ebc5 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t-ubootmod.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-ax3000t.dtsi" + +/ { + model = "Xiaomi Mi Router AX3000T (OpenWrt U-Boot layout)"; + compatible = "xiaomi,mi-router-ax3000t-ubootmod", "mediatek,mt7981"; +}; + +&partitions { + partition@600000 { + label = "ubi"; + reg = <0x600000 0x7000000>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts new file mode 100644 index 00000000000000..cc0d44fdf5d48d --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dts @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-ax3000t.dtsi" + +/ { + model = "Xiaomi Mi Router AX3000T"; + compatible = "xiaomi,mi-router-ax3000t", "mediatek,mt7981"; +}; + +&spi_nand { + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; +}; + +&partitions { + // ubi_kernel is the ubi partition in stock. + partition@600000 { + label = "ubi_kernel"; + reg = <0x600000 0x2200000>; + }; + + /* ubi is the result of squashing + * consecutive stock partitions: + * - ubi1 + * - overlay + * - data + */ + partition@2800000 { + label = "ubi"; + reg = <0x2800000 0x4e00000>; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi new file mode 100644 index 00000000000000..7b6fde8465c682 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-ax3000t.dtsi @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981b-xiaomi-mi-router-common.dtsi" + +&gmac0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 (-2)>; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + status = "okay"; + + nfc@57 { + compatible = "nt082c"; + reg = <0x57>; + }; +}; + +&pio { + i2c_pins: i2c-pins { + mux { + function = "i2c"; + groups = "i2c0_1"; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi new file mode 100644 index 00000000000000..d6872395a9017a --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-common.dtsi @@ -0,0 +1,245 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981.dtsi" + +/ { + aliases { + serial0 = &uart0; + led-boot = &led_status_yellow; + led-failsafe = &led_status_yellow; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0 0x40000000 0 0x10000000>; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-mesh { + label = "mesh"; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + button-reset { + label = "reset"; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + + led_status_blue: led-status-blue { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + led_status_yellow: led-status-yellow { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; +}; + +&mdio_bus { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00 0x100000>; + read-only; + }; + + partition@100000 { + label = "Nvram"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "Bdata"; + reg = <0x140000 0x40000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "crash"; + reg = <0x580000 0x40000>; + read-only; + }; + + partition@5c0000 { + label = "crash_log"; + reg = <0x5c0000 0x40000>; + read-only; + }; + + partition@7600000 { + label = "KF"; + reg = <0x7600000 0x40000>; + read-only; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi index d09ae2a3e78111..87a2493a2383b4 100644 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi +++ b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u.dtsi @@ -1,249 +1,23 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include -#include +#include "mt7981b-xiaomi-mi-router-common.dtsi" -#include "mt7981.dtsi" - -/ { - aliases { - serial0 = &uart0; - led-boot = &led_system_yellow; - led-failsafe = &led_system_yellow; - led-running = &led_system_blue; - led-upgrade = &led_system_yellow; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory { - reg = <0 0x40000000 0 0x10000000>; - }; - - gpio-keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&pio 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - mesh { - label = "mesh"; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_system_blue: system_blue { - label = "blue:system"; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; - }; - - led_system_yellow: system_yellow { - label = "yellow:system"; - gpios = <&pio 10 GPIO_ACTIVE_LOW>; - }; - - led_network_blue { - label = "blue:network"; - gpios = <&pio 11 GPIO_ACTIVE_LOW>; - }; - - led_network_yellow { - label = "yellow:network"; - gpios = <&pio 12 GPIO_ACTIVE_LOW>; - }; - }; -}; - -ð { - status = "okay"; - - gmac0: mac@0 { - compatible = "mediatek,eth-mac"; - reg = <0>; - phy-mode = "2500base-x"; - - nvmem-cells = <&macaddr_factory_4>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <(-1)>; - - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; +&gmac0 { + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 (-1)>; }; -&mdio_bus { - switch: switch@1f { - compatible = "mediatek,mt7531"; - reg = <31>; - reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; - interrupt-controller; - #interrupt-cells = <1>; - interrupt-parent = <&pio>; - interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; +&leds { + led-wan-blue { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; -}; - -&switch { - ports { - #address-cells = <1>; - #size-cells = <0>; - - port@0 { - reg = <0>; - label = "wan"; - }; - - port@1 { - reg = <1>; - label = "lan2"; - }; - - port@2 { - reg = <2>; - label = "lan3"; - }; - - port@3 { - reg = <3>; - label = "lan4"; - }; - - port@6 { - reg = <6>; - ethernet = <&gmac0>; - phy-mode = "2500base-x"; - fixed-link { - speed = <2500>; - full-duplex; - pause; - }; - }; + led-wan-yellow { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; }; }; - -&spi0 { - pinctrl-names = "default"; - pinctrl-0 = <&spi0_flash_pins>; - status = "okay"; - - spi_nand: flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "spi-nand"; - reg = <0>; - - spi-max-frequency = <52000000>; - spi-tx-bus-width = <4>; - spi-rx-bus-width = <4>; - - partitions: partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "BL2"; - reg = <0x00 0x100000>; - read-only; - }; - - partition@100000 { - label = "Nvram"; - reg = <0x100000 0x40000>; - }; - - partition@140000 { - label = "Bdata"; - reg = <0x140000 0x40000>; - }; - - factory: partition@180000 { - label = "Factory"; - reg = <0x180000 0x200000>; - read-only; - - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_4: macaddr@4 { - reg = <0x4 0x6>; - }; - }; - - partition@380000 { - label = "FIP"; - reg = <0x380000 0x200000>; - read-only; - }; - - partition@580000 { - label = "crash"; - reg = <0x580000 0x40000>; - read-only; - }; - - partition@5c0000 { - label = "crash_log"; - reg = <0x5c0000 0x40000>; - read-only; - }; - - partition@7600000 { - label = "KF"; - reg = <0x7600000 0x40000>; - read-only; - }; - }; - }; -}; - -&pio { - spi0_flash_pins: spi0-pins { - mux { - function = "spi"; - groups = "spi0", "spi0_wp_hold"; - }; - - conf-pu { - pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; - drive-strength = ; - bias-pull-up = ; - }; - - conf-pd { - pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; - drive-strength = ; - bias-pull-down = ; - }; - }; -}; - -&wifi { - status = "okay"; - - mediatek,mtd-eeprom = <&factory 0x0>; -}; - -&uart0 { - status = "okay"; -}; - -&watchdog { - status = "okay"; -}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 96793e39cd89eb..16330069982109 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -39,7 +39,7 @@ routerich,ax3000) xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod) - ucidef_set_led_netdev "wan" "wan" "blue:network" "wan" + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ;; xiaomi,redmi-router-ax6000-stock|\ xiaomi,redmi-router-ax6000-ubootmod) diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 8843f056821991..687a5b3f8d439c 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -68,6 +68,8 @@ mediatek_setup_interfaces() tplink,tl-xdr6086) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 ;; + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ @@ -141,6 +143,8 @@ mediatek_setup_macs() wan_mac=$(macaddr_add "$lan_mac" 1) label_mac=$wan_mac ;; + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ 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 aae78647d042c4..3a508acfd91d4d 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -49,6 +49,7 @@ xiaomi_initial_setup() local board=$(board_name) case "$board" in + xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" ;; @@ -122,6 +123,7 @@ platform_do_upgrade() { tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ + xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) @@ -137,6 +139,7 @@ platform_do_upgrade() { EMMC_ROOT_DEV="$(cmdline_get_var root)" emmc_do_upgrade "$1" ;; + xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) CI_KERN_UBIPART=ubi_kernel @@ -223,6 +226,7 @@ platform_pre_upgrade() { asus,tuf-ax6000) asus_initial_setup ;; + xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) xiaomi_initial_setup diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 3a8f67dcad2b8c..1a8f0b37456d56 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -716,6 +716,51 @@ define Device/unielec_u7981-01-nand endef TARGET_DEVICES += unielec_u7981-01-nand +define Device/xiaomi_mi-router-ax3000t + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router AX3000T + DEVICE_DTS := mt7981b-xiaomi-mi-router-ax3000t + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS := initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel +endif + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_mi-router-ax3000t + +define Device/xiaomi_mi-router-ax3000t-ubootmod + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router AX3000T (OpenWrt U-Boot layout) + DEVICE_DTS := mt7981b-xiaomi-mi-router-ax3000t-ubootmod + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + IMAGES := sysupgrade.itb + KERNEL_INITRAMFS_SUFFIX := -recovery.itb + 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 | append-metadata + ARTIFACTS := preloader.bin bl31-uboot.fip + ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3 + ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot xiaomi_mi-router-ax3000t +ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) + ARTIFACTS += initramfs-factory.ubi + ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel +endif +endef +TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod + define Device/xiaomi_mi-router-wr30u-112m-nmbm DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router WR30U (112M UBI with NMBM-Enabled layout) From 51822a907e18fe699fc8f6e68a6ffa6bcc6a098a Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Tue, 23 Jan 2024 19:20:47 +0800 Subject: [PATCH 11/19] mediatek: drop NMBM layout for Xiaomi WR30U This reverts commit dcdcfc15115a1038e90f21f5aa41726d9c7e2fe5. This is a firmware for third-party u-boot mod, which should not be carried here by us. Signed-off-by: Chuanhong Guo (cherry picked from commit 1b7e62b20b1735fcdc498a35e005afcd775abcf4) --- .../uboot-envtools/files/mediatek_filogic | 1 - ...7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts | 22 ------------------- .../filogic/base-files/etc/board.d/01_leds | 1 - .../filogic/base-files/etc/board.d/02_network | 2 -- target/linux/mediatek/image/filogic.mk | 17 -------------- 5 files changed, 43 deletions(-) delete mode 100644 target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 65a17bde0ea1a4..48e59d6a6a6efa 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -78,7 +78,6 @@ ubnt,unifi-6-plus) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x10000" ;; xiaomi,mi-router-ax3000t|\ -xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" diff --git a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts b/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts deleted file mode 100644 index 7244cdfd610343..00000000000000 --- a/target/linux/mediatek/dts/mt7981b-xiaomi-mi-router-wr30u-112m-nmbm.dts +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -/dts-v1/; -#include "mt7981b-xiaomi-mi-router-wr30u.dtsi" - -/ { - model = "Xiaomi Mi Router WR30U (112M UBI with NMBM-Enabled layout)"; - compatible = "xiaomi,mi-router-wr30u-112m-nmbm", "mediatek,mt7981"; -}; - -&spi_nand { - mediatek,nmbm; - mediatek,bmt-max-ratio = <1>; - mediatek,bmt-max-reserved-blocks = <64>; -}; - -&partitions { - partition@600000 { - label = "ubi"; - reg = <0x600000 0x7000000>; - }; -}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 16330069982109..7d7d41362cfdea 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -36,7 +36,6 @@ routerich,ax3000) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" ucidef_set_led_netdev "wan-off" "wan-off" "red:wan" "wan" "link" ;; -xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 687a5b3f8d439c..0eb27744e9d54d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -70,7 +70,6 @@ mediatek_setup_interfaces() ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-ax3000t-ubootmod|\ - xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-stock|\ @@ -145,7 +144,6 @@ mediatek_setup_macs() ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-ax3000t-ubootmod|\ - xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-stock|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 1a8f0b37456d56..872a5592f4145f 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -761,23 +761,6 @@ endif endef TARGET_DEVICES += xiaomi_mi-router-ax3000t-ubootmod -define Device/xiaomi_mi-router-wr30u-112m-nmbm - DEVICE_VENDOR := Xiaomi - DEVICE_MODEL := Mi Router WR30U (112M UBI with NMBM-Enabled layout) - DEVICE_DTS := mt7981b-xiaomi-mi-router-wr30u-112m-nmbm - DEVICE_DTS_DIR := ../dts - UBINIZE_OPTS := -E 5 - BLOCKSIZE := 128k - PAGESIZE := 2048 - DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - ARTIFACTS := initramfs-factory.ubi - ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel -endif - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata -endef -TARGET_DEVICES += xiaomi_mi-router-wr30u-112m-nmbm - define Device/xiaomi_mi-router-wr30u-stock DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router WR30U (stock layout) From 9f9b600cd615a56c0839a58a4641beb4a90fa9e9 Mon Sep 17 00:00:00 2001 From: Hank Moretti Date: Mon, 28 Aug 2023 15:45:05 +0000 Subject: [PATCH 12/19] mediatek: fix sysupgrade error for WR30U The NMBM-Enabled layout did not use fit image, it just need default process. So it was been removed in platform.sh. It will fix sysupgrade error for xiaomi,mi-router-wr30u-112m-nmbm. Signed-off-by: Hank Moretti (cherry picked from commit 02214ab8dce59ee6b599f8dfdacb0297dc5dcc24) --- target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh | 1 - 1 file changed, 1 deletion(-) 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 3a508acfd91d4d..693d5753a5e541 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -124,7 +124,6 @@ platform_do_upgrade() { tplink,tl-xdr6086|\ tplink,tl-xdr6088|\ xiaomi,mi-router-ax3000t-ubootmod|\ - xiaomi,mi-router-wr30u-112m-nmbm|\ xiaomi,mi-router-wr30u-ubootmod|\ xiaomi,redmi-router-ax6000-ubootmod) CI_KERNPART="fit" From ed3a80d088b6a41cb1d9d4ee257c20f412ef709f Mon Sep 17 00:00:00 2001 From: Luis Mita Date: Tue, 7 May 2024 11:48:37 -0400 Subject: [PATCH 13/19] mediatek: add support for Cudy TR3000 v1 Hardware: - SoC: MediaTek MT7981B - CPU: 2x 1.3 GHz Cortex-A53 - Flash: 128 MiB SPI NAND - RAM: 512 MiB - WLAN: 2.4 GHz, 5 GHz (MediaTek MT7976CN, 802.11ax) - Ethernet: 1x 10/100/1000/2500 Mbps RTL8221B WAN, 1x10/100/1000 Mbps MT7981 LAN - USB 3.0 port - Buttons: 1 Reset button, 1 slider button - LEDs: 1x Red, 1x White - Serial console: internal test points, 115200 8n1 - Power: 5 VDC, 3 A MAC addresses: +---------+-------------------+-----------+ | | MAC | Algorithm | +---------+-------------------+-----------+ | WAN | 80:af:ca:xx:xx:x1 | label+1 | | LAN | 80:af:ca:xx:xx:x0 | label | | WLAN 2g | 80:af:ca:xx:xx:x0 | label | | WLAN 5g | 82:af:ca:xx:xx:x0 | | +---------+-------------------+-----------+ Installation: The installation must be done via TFTP by disassembling the router. On other occasions Cudy has distributed intermediate firmware to make installation easier, and so I recommend checking the Wiki for this device if there is a more convenient solution than the one below. To install using TFTP: 1. Connect to UART. 2. With the router off, press the RESET button. While the router is turning on, the button should continue to be pressed for at least 5 seconds. 3. A u-boot shell will automatically open. 4. Connect to LAN and set your IP to 192.168.1.88/24. Configure a TFTP server and an OpenWrt initramfs-kernel.bin firmware file. 5. Run these steps in u-boot using the name of your file. setenv bootfile initramfs-kernel.bin tftpboot bootm 6. If you can reach LuCI or SSH now, just use the sysupgrade image with the 'Keep settings' option turned off. Signed-off-by: Luis Mita (cherry picked from commit 63b8d98dd0d2f7797ea5b5f25978590982bbbb5d) --- .../lib/preinit/05_set_preinit_iface | 1 + .../mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 232 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 + target/linux/mediatek/image/filogic.mk | 17 ++ 5 files changed, 252 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface index 8cab27a232c767..bd0ed335823a18 100644 --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -1,5 +1,6 @@ set_preinit_iface() { case $(board_name) in + cudy,tr3000-v1|\ glinet,gl-mt3000) ip link set eth1 up ifname=eth1 diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts new file mode 100644 index 00000000000000..2d18af860e2482 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include + +#include "mt7981.dtsi" + +/ { + model = "Cudy TR3000 v1"; + compatible = "cudy,tr3000-v1", "mediatek,mt7981-spim-snand-rfb"; + + aliases { + label-mac-device = &gmac1; + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + mode { + label = "mode"; + linux,input-type = ; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: led_0 { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + led_1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + }; + + usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + + gpio = <&pio 9 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 1>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_bdinfo_de00 0>; + }; +}; + +&mdio_bus { + phy1: phy@1 { + reg = <1>; + compatible = "ethernet-phy-ieee802.3-c45"; + phy-mode = "2500base-x"; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + realtek,aldps-enable; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@380000 { + label = "bdinfo"; + reg = <0x380000 0x0040000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + compatible = "mac-base"; + reg = <0xde00 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + + }; + + partition@3C0000 { + label = "FIP"; + reg = <0x3C0000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x5C0000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; + +&wifi { + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 0eb27744e9d54d..6885d5ff2420c4 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -39,6 +39,7 @@ mediatek_setup_interfaces() h3c,magic-nx30-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 ;; + cudy,tr3000-v1|\ glinet,gl-mt3000) ucidef_set_interfaces_lan_wan eth1 eth0 ;; diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3441b41861d4d3..a3d8b387db3786 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -57,6 +57,7 @@ case "$board" in esac [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress ;; + cudy,tr3000-v1|\ cudy,re3000-v1) addr=$(mtd_get_mac_binary bdinfo 0xde00) [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 872a5592f4145f..41de08f490c75d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -317,6 +317,23 @@ define Device/cudy_re3000-v1 endef TARGET_DEVICES += cudy_re3000-v1 +define Device/cudy_tr3000-v1 + DEVICE_VENDOR := Cudy + DEVICE_MODEL := TR3000 + DEVICE_VARIANT := v1 + DEVICE_DTS := mt7981b-cudy-tr3000-v1 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += R47 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware mt7981-wo-firmware +endef +TARGET_DEVICES += cudy_tr3000-v1 + define Device/cudy_wr3000-v1 DEVICE_VENDOR := Cudy DEVICE_MODEL := WR3000 From 6d6384fb45fc29054a0320e7523682f2654c6a33 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 12 Oct 2023 06:23:02 +0200 Subject: [PATCH 14/19] libxml2: update to 2.11.6 Release Notes: - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.5 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.6 Signed-off-by: Nick Hainke (cherry picked from commit 62277c485e79f6fe453a8a1bd54f271ae17c7490) --- package/libs/libxml2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index ed1965c0195418..b13e875de74ac5 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.11.4 +PKG_VERSION:=2.11.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=737e1d7f8ab3f139729ca13a2494fd17bf30ddb4b7a427cf336252cab57f57f7 +PKG_HASH:=c90eee7506764abbe07bb616b82da452529609815aefef423d66ef080eb0c300 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING From a8a8fbcaffe7d7d795c32ee4105c5528eb2a2778 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Mon, 4 Dec 2023 17:03:21 +0100 Subject: [PATCH 15/19] libxml2: update to 2.12.1 Release Notes: - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.0 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.1 Remove patch: - 010-iconv.patch Signed-off-by: Nick Hainke (cherry picked from commit 2963e1687bcc6b54737f8fd519726eb45c17abb9) --- package/libs/libxml2/Makefile | 4 ++-- package/libs/libxml2/patches/010-iconv.patch | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 package/libs/libxml2/patches/010-iconv.patch diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index b13e875de74ac5..d65085c9c1a624 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.11.6 +PKG_VERSION:=2.12.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=c90eee7506764abbe07bb616b82da452529609815aefef423d66ef080eb0c300 +PKG_HASH:=8982b9ccdf7f456e30d8f7012d50858c6623e495333b6191def455c7e95427eb PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/libxml2/patches/010-iconv.patch b/package/libs/libxml2/patches/010-iconv.patch deleted file mode 100644 index 92b09685c56461..00000000000000 --- a/package/libs/libxml2/patches/010-iconv.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -469,6 +469,9 @@ if(LIBXML2_WITH_PROGRAMS) - add_executable(LibXml2::${PROGRAM} ALIAS ${PROGRAM}) - target_compile_definitions(${PROGRAM} PRIVATE SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") - target_link_libraries(${PROGRAM} LibXml2) -+ if(LIBXML2_WITH_ICONV AND NOT Iconv_IS_BUILT_IN) -+ target_link_libraries(${PROGRAM} iconv) -+ endif() - if(HAVE_LIBHISTORY) - target_link_libraries(${PROGRAM} history) - endif() From 6ea90db85736fb21b2c43bef69acbd0434282126 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 4 Jan 2024 00:30:57 +0100 Subject: [PATCH 16/19] libxml2: update to 2.12.3 Release Notes: - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.2 - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.3 Signed-off-by: Nick Hainke (cherry picked from commit 08ad3c963377ee853f87935929d33f19e5e34ef9) --- package/libs/libxml2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index d65085c9c1a624..9e70a0bd0a4bcf 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.12.1 +PKG_VERSION:=2.12.3 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=8982b9ccdf7f456e30d8f7012d50858c6623e495333b6191def455c7e95427eb +PKG_HASH:=8c8f1092340a89ff32bc44ad5c9693aff9bc8a7a3e161bb239666e5d15ac9aaa PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING From ced6809554259bbb789e98f1e5e73b54fd70c216 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 24 Jan 2024 13:09:40 +0100 Subject: [PATCH 17/19] libxml2: update to 2.12.4 Release Notes: - https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.4 Signed-off-by: Nick Hainke (cherry picked from commit d82930c7c776d974e717ec958ca0c1019fea3b8f) --- package/libs/libxml2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index 9e70a0bd0a4bcf..030f7e45e8553b 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.12.3 +PKG_VERSION:=2.12.4 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=8c8f1092340a89ff32bc44ad5c9693aff9bc8a7a3e161bb239666e5d15ac9aaa +PKG_HASH:=497360e423cf0bd99eacdb7c6215dea92e6d6e89ee940393c2bae0e77cb9b7d0 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING From 968d9430c687beada3eea768ed1bcd973d07f407 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Mon, 12 Feb 2024 23:48:46 +0100 Subject: [PATCH 18/19] libxml2: update to 2.12.5 Release Notes: https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.5 Fixes: CVE-2024-25062 Signed-off-by: Nick Hainke (cherry picked from commit c47b7571f0f874c746c5823f5e4d0f1b9b932697) --- package/libs/libxml2/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index 030f7e45e8553b..86fa3707710f98 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.12.4 +PKG_VERSION:=2.12.5 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=497360e423cf0bd99eacdb7c6215dea92e6d6e89ee940393c2bae0e77cb9b7d0 +PKG_HASH:=a972796696afd38073e0f59c283c3a2f5a560b5268b4babc391b286166526b21 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING From 08becaf62f4232f6bc60d899271529d66300d6ae Mon Sep 17 00:00:00 2001 From: Rodrigo Balerdi Date: Fri, 10 May 2024 03:35:43 -0300 Subject: [PATCH 19/19] ipq806x: rt4230w-rev6: fix status reporting via the LEDs There is a custom LED controller between the 3 SoC GPIO outputs and the red and blue LEDs of the device. It implements a strange mapping that includes fixed, flashing, and breathing modes. The current DTS configuration causes OpenWrt to flash the LEDs over the controller's own flashing, resulting in chaotic output in boot, failsafe, and upgrade modes. This change fixes the LEDs in the best way possible as long as each OpenWrt running state is limited to be signaled by a single led. Signed-off-by: Rodrigo Balerdi Link: https://github.com/openwrt/openwrt/pull/15440 Signed-off-by: Christian Marangi (cherry picked from commit 0868268c9fd4397411e9629eedda35b1547e798e) --- .../arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts index 8d9601b6324728..77bb7a5cd55ab0 100644 --- a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts +++ b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts @@ -13,10 +13,10 @@ }; aliases { - led-boot = &ledctrl3; + led-boot = &ledctrl1; led-failsafe = &ledctrl1; - led-running = &ledctrl2; - led-upgrade = &ledctrl3; + led-running = &ledctrl3; + led-upgrade = &ledctrl1; }; chosen { @@ -54,6 +54,7 @@ ledctrl2: ledctrl2 { label = "ledctrl2"; gpios = <&qcom_pinmux 23 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "default-on"; }; ledctrl3: ledctrl3 {