This old platform(no DTS) is using nvram numeric fields (or "unknown" string) for its board_name [1]. Allow ASU sysupgrades by preserving that value in /tmp/sysinfo/boardtype for board-detection/configuration logic, and derive a canonical board_name from /tmp/sysinfo/model in the form "vendor,device-variant". Only a few target profile image names are not consistent in the last suffix, uniform them. A few images with (NA) and (ROW) variants are only meant to be compatible with the upgrade process in the OEM firmware using these NETGEAR_BOARD_ID and NETGEAR_REGION fields but the images are compatibles(only if the NETGEAR_BOARD_ID is shared,due to platform check) [2] (i.e. netgear_wnr3500l). Add SUPPORTED_DEVICES to one of these variant in order to allow ASU sysupgrade profile identification. *Since this target has never implemented fwtool's SUPPORTED_DEVICES metadata check, there is no risk of breaking forceless sysupgrade with new board_name values. [1]: bcm47xx board info https://github.com/gregkh/linux/blob/master/arch/mips/bcm47xx/board.c [2]: sysupgrade platform check https://github.com/openwrt/openwrt/blob/main/target/linux/bcm47xx/base-files/lib/upgrade/platform.sh Fixes: 7d10f2c1e851 "brcm47xx: rework model detection" Fixes: https://github.com/openwrt/asu/issues/419 (Netgear wnr3500L) Closes: https://github.com/openwrt/asu/issues/878 Fixes: https://github.com/openwrt/asu/issues/1042 (Asus RT-N16) Fixes: https://forum.openwrt.org/t/luci-attended-sysupgrade-support-thread/230552/115 (Asus RT-N16) Signed-off-by: Mario Andrés Pérez <mapb_@outlook.com> Link: https://github.com/openwrt/openwrt/pull/21147 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
24 lines
680 B
Plaintext
24 lines
680 B
Plaintext
do_sysinfo_bcm47xx() {
|
|
local boardtype="$(nvram get boardtype)"
|
|
local boardnum="$(nvram get boardnum)"
|
|
local model="$(sed -ne 's/^machine[ \t]*: //p' /proc/cpuinfo)"
|
|
|
|
[ -z "$model" ] && model="unknown"
|
|
[ -z "$boardtype" ] && boardtype="unknown"
|
|
|
|
[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
|
|
echo "$boardtype${boardnum:+:$boardnum}" > /tmp/sysinfo/boardtype
|
|
echo "$model" > /tmp/sysinfo/model
|
|
# Generate board_name in the form <vendor,device-variant> for ASU sysupgrades
|
|
printf '%s' "$model" | awk '{
|
|
$0 = tolower($0);
|
|
if (NF>=2) {
|
|
sub(/ /, ",");
|
|
gsub(/ /, "-");
|
|
}
|
|
print;
|
|
}' > /tmp/sysinfo/board_name
|
|
}
|
|
|
|
boot_hook_add preinit_main do_sysinfo_bcm47xx
|