diff mbox series

[1/4] fwtool.sh: add handling for empty supported device list

Message ID 6huxhufsjnjkj3mcvegzvhcf6g5cyhrbd4v5kx5mqrhp3p42zr@gakauzyokn4x
State New
Headers show
Series [1/4] fwtool.sh: add handling for empty supported device list | expand

Commit Message

Jonas Lochmann Jan. 3, 2026, 4:36 p.m. UTC
For the arm and x86 platform, there are generic builds without any
particular supported devices. Currently, the pre upgrade checks do not
consider this case and warn if the device model is not in the list of
the supported devices of the image.

Signed-off-by: Jonas Lochmann <openwrt@jonaslochmann.de>
---
 package/base-files/files/lib/upgrade/fwtool.sh     | 14 ++++++++++++--
 .../linux/armsr/base-files/lib/upgrade/platform.sh |  1 +
 .../linux/x86/base-files/lib/upgrade/platform.sh   |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh
index 0bc6e6924e..cd3b1ddd16 100644
--- a/package/base-files/files/lib/upgrade/fwtool.sh
+++ b/package/base-files/files/lib/upgrade/fwtool.sh
@@ -101,13 +101,23 @@  fwtool_check_image() {
 		fi
 	done
 
-	v "Device $device not supported by this image"
 	local devices="Supported devices:"
+	local has_devices=0
 	for k in $dev_keys; do
 		json_get_var dev "$k"
 		devices="$devices $dev"
+		has_devices=1
 	done
-	v "$devices"
+
+	if [ "$has_devices" = 0 ]; then
+		# for bios/uefi platforms with generic images
+		[ "$PERMIT_EMPTY_SUPPORTED_DEVICES" = 1 ] && return 0
+
+		v "This image does not support any devices"
+	else
+		v "Device $device not supported by this image"
+		v "$devices"
+	fi
 
 	return 1
 }
diff --git a/target/linux/armsr/base-files/lib/upgrade/platform.sh b/target/linux/armsr/base-files/lib/upgrade/platform.sh
index e72c6955e5..63e85b06b6 100644
--- a/target/linux/armsr/base-files/lib/upgrade/platform.sh
+++ b/target/linux/armsr/base-files/lib/upgrade/platform.sh
@@ -1,6 +1,7 @@ 
 # SPDX-License-Identifier: GPL-2.0-or-later
 
 RAMFS_COPY_BIN="/usr/sbin/blkid"
+PERMIT_EMPTY_SUPPORTED_DEVICES=1
 
 platform_check_image() {
 	local board=$(board_name)
diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh
index 5dad7a538a..014a9b2373 100644
--- a/target/linux/x86/base-files/lib/upgrade/platform.sh
+++ b/target/linux/x86/base-files/lib/upgrade/platform.sh
@@ -1,4 +1,5 @@ 
 RAMFS_COPY_BIN='grub-bios-setup'
+PERMIT_EMPTY_SUPPORTED_DEVICES=1
 
 platform_check_image() {
 	local diskdev partdev diff