You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Linus Walleij 30b4b7ee09 mtd: Make fixwrgg command work on DIR-685
The D-Link DIR-685 has the same problem as the
D-Link DAP-2695: when flashing the factory image, the
checksum includes the whole flashed image, even the
rootfs_data part with the end of filesystem mark.
Also the whole flashed image is stored in the flash,
so on the first boot, the whole rootfs image is loaded
into memory with the kernel.

This is fixed using the fixwrgg command to mtd, but
for this to work we need to make fixwrgg work with
the Little-Endian ARM DIR-685.

The code tries to be endian agnostic but this fails
because the WRGG image loader doesn't. On ARM, the
file size is stored in little endian format, and on
big-endian systems it is stored in big endian format,
so we can just drop all the friendly htonl() that
will make the shdr->size big endian: this will
actually break the little endian systems, and on
the big endian systems the native endianness will
still be correct.

The magic number is always stored in little endian
format however, so make sure this is always read
in LE32 format. I chose to create a straight-forward
le32_to_cpu() static inline that IMO is simple and
easy to read.

Cc: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years ago
..
Makefile mtd: base-files: Unify dual-firmware devices (Linksys) 5 years ago
crc32.c packages: clean up the package folder 11 years ago
crc32.h packages: clean up the package folder 11 years ago
fis.c treewide: replace nbd@openwrt.org with nbd@nbd.name 8 years ago
fis.h packages: clean up the package folder 11 years ago
imagetag.c treewide: replace nbd@openwrt.org with nbd@nbd.name 8 years ago
jffs2.c treewide: replace nbd@openwrt.org with nbd@nbd.name 8 years ago
jffs2.h packages: clean up the package folder 11 years ago
linksys_bootcount.c mtd: base-files: Unify dual-firmware devices (Linksys) 5 years ago
md5.c packages: clean up the package folder 11 years ago
md5.h packages: clean up the package folder 11 years ago
mtd.c mtd: add logic for TP-Link ramips recovery magic 5 years ago
mtd.h mtd: add logic for TP-Link ramips recovery magic 5 years ago
seama.c mtd: fix endianness detection on musl 8 years ago
seama.h mtd: seama: add md5 to header struct 8 years ago
tpl_ramips_recoveryflag.c mtd: add logic for TP-Link ramips recovery magic 5 years ago
trx.c mtd: improve check for TRX header being already fixed 6 years ago
wrg.c mtd: add fixwrg command 6 years ago
wrgg.c mtd: Make fixwrgg command work on DIR-685 5 years ago
wrgg.h mtd: add fixwrgg command 8 years ago