aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2019-03-11 18:05:31 +0100
committerChristian Lamparter <chunkeey@gmail.com>2019-03-13 16:25:34 +0100
commit5389db72e3265198986dfb50a831fb8f8264d346 (patch)
tree6ba5e12db42efe3e96071695a654b4fd733137a4
parentd75db67870fa328d7b3a2aab94168e9e3f6a933d (diff)
downloadupstream-5389db72e3265198986dfb50a831fb8f8264d346.tar.gz
upstream-5389db72e3265198986dfb50a831fb8f8264d346.tar.bz2
upstream-5389db72e3265198986dfb50a831fb8f8264d346.zip
fritz-tools: add support for IPQ40xx platform
AVM devices based on Qualcomm IPQ40xx do not store sector health information in the OOB area. Make this check optional to support this platform. Signed-off-by: David Bauer <mail@david-bauer.net>
-rw-r--r--package/utils/fritz-tools/src/fritz_tffs_nand_read.c12
-rw-r--r--target/linux/ipq40xx/image/Makefile2
-rwxr-xr-xtarget/linux/lantiq/base-files/etc/board.d/02_network4
3 files changed, 13 insertions, 5 deletions
diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
index db77d2f5b4..ded0577cf3 100644
--- a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
+++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
@@ -67,6 +67,7 @@ static char *mtddev;
static char *name_filter = NULL;
static bool show_all = false;
static bool print_all_key_names = false;
+static bool read_oob_sector_health = false;
static bool swap_bytes = false;
static uint8_t readbuf[TFFS_SECTOR_SIZE];
static uint8_t oobbuf[TFFS_SECTOR_OOB_SIZE];
@@ -191,7 +192,7 @@ static int find_entry(uint32_t id, struct tffs_entry *entry)
uint32_t read_id = read_uint32(readbuf, 0x00);
uint32_t read_len = read_uint32(readbuf, 0x04);
uint32_t read_rev = read_uint32(readbuf, 0x0c);
- if (oob_id != read_id || oob_len != read_len || oob_rev != read_rev) {
+ if (read_oob_sector_health && (oob_id != read_id || oob_len != read_len || oob_rev != read_rev)) {
fprintf(stderr, "Warning: sector has inconsistent metadata\n");
continue;
}
@@ -360,6 +361,9 @@ static int show_matching_key_value(struct tffs_key_name_table *key_names)
static int check_sector(off_t pos)
{
+ if (!read_oob_sector_health) {
+ return 1;
+ }
if (read_sectoroob(pos)) {
return 0;
}
@@ -450,6 +454,7 @@ static void usage(int status)
" -h show this screen\n"
" -l list all supported keys\n"
" -n <key name> display the value of the given key\n"
+ " -o read OOB information about sector health\n"
);
exit(status);
@@ -460,7 +465,7 @@ static void parse_options(int argc, char *argv[])
while (1) {
int c;
- c = getopt(argc, argv, "abd:hln:");
+ c = getopt(argc, argv, "abd:hln:o");
if (c == -1)
break;
@@ -489,6 +494,9 @@ static void parse_options(int argc, char *argv[])
show_all = false;
print_all_key_names = false;
break;
+ case 'o':
+ read_oob_sector_health = true;
+ break;
default:
usage(EXIT_FAILURE);
break;
diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile
index 3a7ecf39eb..e2805c1d9e 100644
--- a/target/linux/ipq40xx/image/Makefile
+++ b/target/linux/ipq40xx/image/Makefile
@@ -125,7 +125,7 @@ define Device/avm_fritzbox-7530
$(call Device/FitImageLzma)
DEVICE_DTS := qcom-ipq4019-fritzbox-7530
DEVICE_TITLE := AVM Fritz!Box 7530
- DEVICE_PACKAGES := fritz-caldata ipq-wifi-avm_fritzbox-7530
+ DEVICE_PACKAGES := fritz-caldata fritz-tffs-nand ipq-wifi-avm_fritzbox-7530
IMAGES := sysupgrade.bin
endef
TARGET_DEVICES += avm_fritzbox-7530
diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/base-files/etc/board.d/02_network
index c79fb2d136..a6a9e4d29d 100755
--- a/target/linux/lantiq/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/base-files/etc/board.d/02_network
@@ -169,8 +169,8 @@ avm,fritz7362sl)
avm,fritz7412)
tffsdev=$(find_mtd_chardev "nand-tffs")
annex="b"
- lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
- wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)
+ lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o)
+ wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o)
ucidef_set_interface_lan 'eth0'
;;