tn3399_openwrt/tools
Sander Vanheule 14464e1128 firmware-utils/tplink-safeloader: add compat level
TP-Link has introduced a compatibility level to prevent certain
downgrades. This information is stored in the soft-version partition,
changing the data length from 0xc to 0x10.

The compatibility level doesn't change frequently. For example, it has
the following values for the EAP245v3 (released 2018-Q4):
* FW v2.2.0  (2019-05-30): compat_level=0
* FW v2.3.0  (2019-07-31): compat_level=0
* FW v2.3.1  (2019-10-29): compat_level=1
* FW v2.20.0 (2020-04-23): compat_level=1

Empty flash values (0xffffffff) are interpreted as compat_level=0.
If a firmware upgrade file has a soft-version block without
compatibility level (data length < 0x10), this is also interpreted as
compat_level=0.

By including a high enough compatibility level in factory images, stock
firmware can be convinced to accept the image. A compatibility level
aware firmware will keep the original value.

Example upgrade log of TP-Link EAP245v3 FWv2.3.0 to FWv2.20.0:
    [NM_Debug](nm_fwup_verifyFwupFile) 02073: curSoftVer:2.3.0 Build
        20190731 Rel. 51932,newSoftVer:2.20.0 Build 20200423 Rel. 36779
    ...
    AddiHardwareVer check: NEW(0x1) >= CUR(0x0), Success.
    ...
    [NM_NOTICE](updateDataToNvram) 00575: Restore old additionalHardVer:
    0x0.(new 0x1)
    [NM_NOTICE](updateDataToNvram) 00607: PTN 07: name = soft-version,
        base = 0x00092000, size = 0x00000100 Bytes, upDataType = 1,
        upDataStart = 7690604b, upDataLen = 00000018
    [NM_Debug](updateDataToNvram) 00738: PTN 07: write bytes = 000002eb

Other firmware upgrades have been observed to modify the compabitility
stored level (e.g. TP-Link EAP225-Outdoor FWv1.4.1 to FWv1.7.0).
Therefore, it seems to be the safest option to set the OpenWrt
compatibility level to the highest known value instead of the highest
possible value (0xfffffffe), to ensure users do not get unexpectedly
refused firmware upgrades when using a device reverted back to stock.

To remain compatible with existing devices and not produce different
images, the image builder doesn't store a compatibility level if it is
zero.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2020-09-09 20:41:50 +03:00
..
autoconf treewide: clean up download hashes 2016-12-16 22:39:22 +01:00
autoconf-archive tools: add autoconf-archive 2020-05-20 15:37:16 +02:00
automake tools/automake: Revert "Do not use $(V) - force AM_V=1" 2019-11-06 00:21:15 +01:00
b43-tools tools/b43-tools/b43-fwsquash: convert to Python 3 with 2-to-3 2019-07-26 08:09:16 +02:00
bc Revert "bc: update to 1.07.1" 2019-05-22 21:27:44 +02:00
bison tools/bison: update to 3.7.1 2020-08-23 11:29:24 +02:00
cbootimage tools: add cbootimage for tegra 2019-04-06 14:48:46 +02:00
cbootimage-configs tools: add cbootimage-configs for tegra 2019-04-06 14:48:46 +02:00
ccache tools/ccache: update to 3.7.11 2020-08-23 19:40:51 +02:00
cmake tools/cmake: update to 3.18.2 2020-08-23 19:40:42 +02:00
coreutils tools/coreutils: update to 8.32 2020-08-30 22:21:34 +02:00
dosfstools add PKG_CPE_ID ids to package and tools 2017-11-17 02:24:35 +01:00
e2fsprogs tools/e2fsprogs: fix build under macos 2020-04-10 11:52:00 +01:00
elftosb treewide: clean up download hashes 2016-12-16 22:39:22 +01:00
expat tools/expat: change package source to GitHub 2019-11-24 23:17:34 +01:00
fakeroot tools: fakeroot: use TCP as IPC transport 2020-09-09 13:33:50 +02:00
findutils tools/findutils: Update to 4.7.0 2020-04-09 22:08:38 +02:00
firmware-utils firmware-utils/tplink-safeloader: add compat level 2020-09-09 20:41:50 +03:00
flex flex: Add a lex symlink 2018-11-25 19:23:03 +01:00
flock tools/flock: add PKG_{VERSION,RELEASE} 2020-07-23 11:30:22 +02:00
genext2fs treewide: clean up download hashes 2016-12-16 22:39:22 +01:00
gengetopt tools/gengetopt: Update to 2.23 2019-07-08 16:42:26 +02:00
gmp tools/gmp: Remove obsolete options 2020-02-18 21:39:23 +01:00
include build: fix kernel 5.4 on macos 2020-03-14 13:20:06 +00:00
isl tools/isl: update to 0.20 2019-02-26 23:20:04 +01:00
kernel2minor tools: kernel2minor: update to latest version 2018-07-12 18:15:33 +02:00
libelf tools: libelf: fix headers to trigger -Wundef warnings 2019-09-03 10:44:21 +02:00
libressl tools/libressl: Update to 3.0.2 2020-02-18 21:38:51 +01:00
libtool add PKG_CPE_ID ids to package and tools 2017-11-17 02:24:35 +01:00
lzma treewide: https for downloads.openwrt.org sources 2020-08-31 11:26:10 +01:00
lzma-old treewide: https for downloads.openwrt.org sources 2020-08-31 11:26:10 +01:00
m4 tools: m4: fix compilation with glibc 2.28 2018-08-10 06:29:32 +02:00
make-ext4fs make_ext4fs: Update to version 2020-01-05 2020-01-05 20:04:37 +01:00
missing-macros tools: drop PKG_VERSION for purely local packages 2020-07-23 10:54:33 +02:00
mkimage tools/mkimage: create .itb file with read-access for group,other not just owner. 2020-07-23 14:25:10 -04:00
mklibs tools/mklibs: update to 0.1.44 and convert to Python 3 2019-07-26 23:50:21 +02:00
mm-macros tools/mm-macros: Update to 1.0.0 2020-04-09 22:09:21 +02:00
mpc tools/mpc: update to 1.2.0 2020-08-27 21:18:16 +02:00
mpfr tools/mpfr: update to 4.1.0 2020-08-23 19:40:32 +02:00
mtd-utils tools: mtd-utils: Update to version 2.1.2 2020-08-26 23:29:35 +02:00
mtools tools/mtools: Update to 4.0.24 2020-04-09 22:09:04 +02:00
padjffs2 tools: drop PKG_VERSION for purely local packages 2020-07-23 10:54:33 +02:00
patch tools/patch: apply upstream patch for cve-2019-13638 2019-08-13 10:00:10 +02:00
patch-image rb532: drop target 2020-09-02 16:29:22 +02:00
patchelf tools/patchelf: Update to 0.10 2020-02-18 21:39:03 +01:00
pkgconf pkgconf: always retain -I and -L flags 2020-03-15 20:32:10 +01:00
qemu tools: qemu: Add patches to support adapter_type and monolithicFlat 2019-12-23 00:22:06 +01:00
quilt tools/quilt: update to 0.66 2019-11-24 21:35:45 +01:00
sdimage tools/sdimage: Fix build with host Linux headers < 3.18 2018-12-16 14:03:35 +01:00
sed tools/sed: Update to 4.8 2020-02-18 21:39:14 +01:00
sparse sparse: updated to version 0.5.2 2018-06-08 09:56:26 +02:00
squashfs squashfs: Fix compile with GCC 10 2020-05-24 14:38:40 +02:00
squashfskit4 tools/squashfskit4: fix build on non-linux systems 2020-09-01 17:01:56 +02:00
sstrip tools/sstrip: add PKG_{VERSION,RELEASE} 2020-07-23 11:30:14 +02:00
tar tools: tar: update to version 1.32 2019-03-10 21:36:28 +01:00
xz tools/xz: Update to 5.2.5 2020-04-09 22:09:13 +02:00
zip tools: zip: add option for reproducible archives 2019-01-15 19:11:53 +01:00
zlib tools: zlib: do not hardcode the install prefix in zlib.pc 2018-05-24 17:07:10 +02:00
zstd tools: add zstd 2020-05-31 11:03:30 +02:00
Makefile tools: sort alphabetically 2020-09-02 16:29:22 +02:00