I upgraded my ZyXEL P2812-HNU-F1 from 24.04-0-rc7 to 24.04.0 using the webinterface. Then I got a warning that the image is not compatible due to a changed kernel partition size, and compat version was changed from 1.1=>2.0.
Of course that didn't happen between rc7 and release, so I checked the files.
rc7 /etc/board.json contains
"system": {
"compat_version": "2.0"
},
and /etc/board.d/05_compat-version
case "$(board_name)" in
zyxel,p-2812hnu-f1)
ucidef_set_compat_version "2.0"
;;
*)
ucidef_set_compat_version "1.1"
;;
esac
I checked with sh -x script if board_name indeed expanded to 'zyxel,p-2812hnu-f1', and it did.
So why does sysupgrade think it's 1.1?
And another question, how does it know that the image is 2.0? I untarred the bin file, and expected a textfile specifying this. But it contains a text file CONTROL, containing the text 'BOARD=P2812HNUF1' (without quotes) a file kernel containing a uImage, and a file root contining a squashfs.
I checked some other random sysupgrade.bin files, in case it's a bug for this box/target, but none seem to specify a compat_version.
Does sysupgrade mount the squashfs to read this information?
Additionally, you can extract that data by fwtool command on OpenWrt CLI.
root@OpenWrt:/tmp# ls -alh openwrt-*
-rw-r--r-- 1 root root 7.6M Feb 8 23:51 openwrt-24.10.0-lantiq-xrx200-zyxel_p-2812hnu-f1-squashfs-sysupgrade.bin
root@OpenWrt:/tmp#
root@OpenWrt:/tmp# fwtool -i metadata.json openwrt-24.10.0-lantiq-xrx200-zyxel_p-2812hnu-f1-squashfs-sysupgrade.bin
root@OpenWrt:/tmp#
root@OpenWrt:/tmp# cat metadata.json
{ "metadata_version": "1.1", "compat_version": "2.0", "compat_message": "kernel and ubi partitions had to be resized. Upgrade manually using initramfs, and change u-boot environment to load 5MiB for uImage.", "new_supported_devices": ["zyxel,p-2812hnu-f1","P2812HNUF1"], "supported_devices": ["zyxel,p-2812hnu-f1 P2812HNUF1 - Image version mismatch: image 2.0, device 1.0. Please wipe config during upgrade (force required) or reinstall. Reason: kernel and ubi partitions had to be resized. Upgrade manually using initramfs, and change u-boot environment to load 5MiB for uImage."], "version": { "dist": "OpenWrt", "version": "24.10.0", "revision": "r28427-6df0e3d02a", "target": "lantiq/xrx200", "board": "P2812HNUF1" } }
root@OpenWrt:/tmp#
root@OpenWrt:/tmp# cat metadata.json | jsonfilter -e '@.compat_version'
2.0
root@OpenWrt:/tmp#
root@OpenWrt:/tmp# . /usr/share/libubox/jshn.sh
root@OpenWrt:/tmp# json_load_file metadata.json
root@OpenWrt:/tmp# json_dump -i
{
"metadata_version": "1.1",
"compat_version": "2.0",
"compat_message": "kernel and ubi partitions had to be resized. Upgrade manually using initramfs, and change u-boot environment to load 5MiB for uImage.",
"new_supported_devices": [
"zyxel,p-2812hnu-f1",
"P2812HNUF1"
],
"supported_devices": [
"zyxel,p-2812hnu-f1 P2812HNUF1 - Image version mismatch: image 2.0, device 1.0. Please wipe config during upgrade (force required) or reinstall. Reason: kernel and ubi partitions had to be resized. Upgrade manually using initramfs, and change u-boot environment to load 5MiB for uImage."
],
"version": {
"dist": "OpenWrt",
"version": "24.10.0",
"revision": "r28427-6df0e3d02a",
"target": "lantiq/xrx200",
"board": "P2812HNUF1"
}
}
Regarding the other question, why does sysupgrade think I'm on compat_version 1.1, I stumbled upon this thread, which states it is in /etc/config/system. And indeed in that file compat_version is 1.1. After upgrading from 23.05 to 24.10-rc7 I just put back my old config.
So until next upgrade I'll assume sysupgrade reads the config, and not board.json.
Yes, I had that figured out. In fact, it's a flaw in the compat_version system. The reason for the bump from 1.1 to 2.0 was the enlarged kernel partition. The config is still compatible. So the value in board.json should be evaluated, and not the one in /etc/config/system. In this case.