[openwrt/openwrt] ipq40xx: mikrotik: kernel: pet watchdog during kernel uncompress
LEDE Commits
lede-commits at lists.infradead.org
Sat Oct 18 07:41:57 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/9d531c0c5b4aeda92d711d373c96385325de04ce
commit 9d531c0c5b4aeda92d711d373c96385325de04ce
Author: John Thomson <git at johnthomson.fastmail.com.au>
AuthorDate: Sun Oct 5 13:45:41 2025 +1000
ipq40xx: mikrotik: kernel: pet watchdog during kernel uncompress
kernel 6.9 removed the KConfig entry our RouterBOOT watchdog pet hack was relying on:
Linux df59427a1122 ("ARM: qcom: merge remaining subplatforms into sensible Kconfig entry")
Introduce a new specific KConfig entry for this hack,
and enable it for Mikrotik ipq40xx kernel.
CONFIG_ARCH_QCOM_IPQ40XX_BOOT_COMPRESSED_PET_WATCHDOG_EARLY
With appropriate DEBUG_LL and DEBUG_UNCOMPRESS, this watchdog reset
can be typically seen on console as a reset before "Uncompressing Linux..."
reaches " done, booting the kernel."
RouterBOOT
loading kernel... OK
setting up elf image... OK
jumping to kernel code
Jumping to kernel
DTB:0x80381A60 (0x000048C4)
C:0x800000E0-0x80386420->0x80FAB500-0x81331840
DTB:0x8132CE80 (0x000049B8)
Uncompressing Linux...
Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset), D - Delta, S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.1-00096
versus:
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
On Mikrotik RouterBOOT devices, this is complicated by some RouterBOOT
versions successfully loading the same kernel that other RouterBOOT versions fail. Example:
RouterBOOT backup booter 6.45.9 fine, RouterBOOT booter 7.16 fail
Fixes: openwrt#19841
Signed-off-by: John Thomson <git at johnthomson.fastmail.com.au>
Link: https://github.com/openwrt/openwrt/pull/20305
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
target/linux/ipq40xx/config-6.12 | 1 +
target/linux/ipq40xx/mikrotik/config-default | 1 +
...ompressed-set-ipq40xx-watchdog-to-allow-boot.patch | 19 +++++++++++++++++--
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/target/linux/ipq40xx/config-6.12 b/target/linux/ipq40xx/config-6.12
index 294cd5ccba..320faf6cd8 100644
--- a/target/linux/ipq40xx/config-6.12
+++ b/target/linux/ipq40xx/config-6.12
@@ -11,6 +11,7 @@ CONFIG_ARCH_MULTI_V7=y
CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
CONFIG_ARCH_QCOM=y
+# CONFIG_ARCH_QCOM_IPQ40XX_BOOT_COMPRESSED_PET_WATCHDOG_EARLY is not set
CONFIG_ARCH_QCOM_RESERVE_SMEM=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
diff --git a/target/linux/ipq40xx/mikrotik/config-default b/target/linux/ipq40xx/mikrotik/config-default
index 735476f8a5..c334f8c292 100644
--- a/target/linux/ipq40xx/mikrotik/config-default
+++ b/target/linux/ipq40xx/mikrotik/config-default
@@ -1,3 +1,4 @@
+CONFIG_ARCH_QCOM_IPQ40XX_BOOT_COMPRESSED_PET_WATCHDOG_EARLY=y
CONFIG_CRYPTO_HASH_INFO=y
CONFIG_MIKROTIK=y
CONFIG_MIKROTIK_RB_SYSFS=y
diff --git a/target/linux/ipq40xx/patches-6.12/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch b/target/linux/ipq40xx/patches-6.12/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch
index 4939c56470..cd6527360c 100644
--- a/target/linux/ipq40xx/patches-6.12/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch
+++ b/target/linux/ipq40xx/patches-6.12/302-arm-compressed-set-ipq40xx-watchdog-to-allow-boot.patch
@@ -32,7 +32,7 @@ Signed-off-by: John Thomson <git at johnthomson.fastmail.com.au>
+ * data and functionality from drivers/watchdog/qcom-wdt.c
+ * address from arch/arm/boot/dts/qcom-ipq4019.dtsi
+ */
-+#ifdef CONFIG_ARCH_IPQ40XX
++#ifdef CONFIG_ARCH_QCOM_IPQ40XX_BOOT_COMPRESSED_PET_WATCHDOG_EARLY
+watchdog_set:
+ /* offsets:
+ * 0x04 reset (=1 resets countdown)
@@ -59,8 +59,23 @@ Signed-off-by: John Thomson <git at johnthomson.fastmail.com.au>
+ mov r1, #1
+ str r1, [r0, #0x08] @Enable the watchdog
+watchdog_finished:
-+#endif /* CONFIG_ARCH_IPQ40XX */
++#endif /* CONFIG_ARCH_QCOM_IPQ40XX_BOOT_COMPRESSED_PET_WATCHDOG_EARLY */
+
/*
* The C runtime environment should now be setup sufficiently.
* Set up some pointers, and start decompressing.
+--- a/arch/arm/mach-qcom/Kconfig
++++ b/arch/arm/mach-qcom/Kconfig
+@@ -21,4 +21,12 @@ config ARCH_QCOM_RESERVE_SMEM
+ Reserve 2MB at the beginning of the System RAM for shared mem.
+ This is required on IPQ40xx, MSM8x60 and MSM8960 platforms.
+
++config ARCH_QCOM_IPQ40XX_BOOT_COMPRESSED_PET_WATCHDOG_EARLY
++ bool "Pet ipq40xx watchdog early in boot uncompression"
++ help
++ Pet the IPQ40xx watchdog very early in boot uncompress stage.
++ Use where bootloader sets a watchdog timeout that bites the
++ device before the Linux watchdog device driver can manage it.
++ Required for Mikrotik RouterBOOT on ipq40xx devices
++
+ endif
More information about the lede-commits
mailing list