From 7c8a36340c3a5f0443329731ada1be43489d3050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 11 Jan 2017 09:53:44 +0100 Subject: [PATCH] kernel: update bcm47xxpart failsafe partition patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit V2 using helper function was sent for upstream kernel Signed-off-by: Rafał Miłecki --- ...part-add-device-specific-workarounds.patch | 2 +- ...move-TRX-parsing-code-to-separated-f.patch | 29 ++++++------ ...support-layouts-with-multiple-TRX-pa.patch | 8 ++-- ...check-for-bad-blocks-when-calculatin.patch | 45 ++++++++++++------- ...bcm47xxpart-detect-T_Meter-partition.patch | 2 +- 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/target/linux/bcm53xx/patches-4.4/901-mtd-bcm47xxpart-add-device-specific-workarounds.patch b/target/linux/bcm53xx/patches-4.4/901-mtd-bcm47xxpart-add-device-specific-workarounds.patch index 7713466807..0ffa82f869 100644 --- a/target/linux/bcm53xx/patches-4.4/901-mtd-bcm47xxpart-add-device-specific-workarounds.patch +++ b/target/linux/bcm53xx/patches-4.4/901-mtd-bcm47xxpart-add-device-specific-workarounds.patch @@ -17,7 +17,7 @@ Signed-off-by: Rafał Miłecki #include -@@ -250,6 +251,28 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -249,6 +250,28 @@ static int bcm47xxpart_parse(struct mtd_ break; } diff --git a/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch b/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch index 09cbec649f..a204fe6625 100644 --- a/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch +++ b/target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch @@ -14,12 +14,12 @@ is more than 1 TRX partition. Signed-off-by: Rafał Miłecki --- - drivers/mtd/bcm47xxpart.c | 124 ++++++++++++++++++++++++++++------------------ - 1 file changed, 77 insertions(+), 47 deletions(-) + drivers/mtd/bcm47xxpart.c | 121 ++++++++++++++++++++++++++++------------------ + 1 file changed, 74 insertions(+), 47 deletions(-) --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -83,6 +83,70 @@ out_default: +@@ -83,6 +83,67 @@ out_default: return "rootfs"; } @@ -28,7 +28,6 @@ Signed-off-by: Rafał Miłecki + struct mtd_partition *parts, + size_t parts_len) +{ -+ struct mtd_partition *part; + struct trx_header header; + size_t bytes_read; + int curr_part = 0; @@ -50,25 +49,23 @@ Signed-off-by: Rafał Miłecki + + /* We have LZMA loader if offset[2] points to sth */ + if (header.offset[2]) { -+ part = &parts[curr_part++]; -+ part->name = "loader"; -+ part->offset = trx->offset + header.offset[i]; ++ bcm47xxpart_add_part(&parts[curr_part++], "loader", ++ trx->offset + header.offset[i], 0); + i++; + } + + if (header.offset[i]) { -+ part = &parts[curr_part++]; -+ part->name = "linux"; -+ part->offset = trx->offset + header.offset[i]; ++ bcm47xxpart_add_part(&parts[curr_part++], "linux", ++ trx->offset + header.offset[i], 0); + i++; + } + + if (header.offset[i]) { + size_t offset = trx->offset + header.offset[i]; ++ const char *name = bcm47xxpart_trx_data_part_name(master, ++ offset); + -+ part = &parts[curr_part++]; -+ part->name = bcm47xxpart_trx_data_part_name(master, offset); -+ part->offset = offset; ++ bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0); + i++; + } + @@ -90,7 +87,7 @@ Signed-off-by: Rafał Miłecki static int bcm47xxpart_parse(struct mtd_info *master, struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -93,9 +157,7 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -93,9 +154,7 @@ static int bcm47xxpart_parse(struct mtd_ size_t bytes_read; uint32_t offset; uint32_t blocksize = master->erasesize; @@ -100,7 +97,7 @@ Signed-off-by: Rafał Miłecki int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; int err; -@@ -182,54 +244,14 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -182,54 +241,14 @@ static int bcm47xxpart_parse(struct mtd_ /* TRX */ if (buf[0x000 / 4] == TRX_MAGIC) { @@ -157,7 +154,7 @@ Signed-off-by: Rafał Miłecki offset = roundup(offset + trx->length, blocksize); /* Next loop iteration will increase the offset */ offset -= blocksize; -@@ -307,9 +329,17 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -307,9 +326,17 @@ static int bcm47xxpart_parse(struct mtd_ parts[i + 1].offset : master->size; parts[i].size = next_part_offset - parts[i].offset; diff --git a/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch b/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch index 1065322fd8..2d97be7508 100644 --- a/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch +++ b/target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch @@ -24,7 +24,7 @@ Signed-off-by: Rafał Miłecki #include #include #include -@@ -147,6 +148,30 @@ static int bcm47xxpart_parse_trx(struct +@@ -144,6 +145,30 @@ static int bcm47xxpart_parse_trx(struct return curr_part; } @@ -55,7 +55,7 @@ Signed-off-by: Rafał Miłecki static int bcm47xxpart_parse(struct mtd_info *master, struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -157,7 +182,8 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -154,7 +179,8 @@ static int bcm47xxpart_parse(struct mtd_ size_t bytes_read; uint32_t offset; uint32_t blocksize = master->erasesize; @@ -65,7 +65,7 @@ Signed-off-by: Rafał Miłecki int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; int err; -@@ -246,7 +272,11 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -243,7 +269,11 @@ static int bcm47xxpart_parse(struct mtd_ if (buf[0x000 / 4] == TRX_MAGIC) { struct trx_header *trx; @@ -78,7 +78,7 @@ Signed-off-by: Rafał Miłecki bcm47xxpart_add_part(&parts[curr_part++], "firmware", offset, 0); -@@ -332,14 +362,20 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -329,14 +359,20 @@ static int bcm47xxpart_parse(struct mtd_ } /* If there was TRX parse it now */ diff --git a/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch index b77845120d..379e551b7f 100644 --- a/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ b/target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch @@ -48,29 +48,44 @@ Signed-off-by: Rafał Miłecki static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master, size_t offset) { -@@ -113,19 +141,22 @@ static int bcm47xxpart_parse_trx(struct +@@ -91,6 +119,7 @@ static int bcm47xxpart_parse_trx(struct + { + struct trx_header header; + size_t bytes_read; ++ size_t offset; + int curr_part = 0; + int i, err; + +@@ -110,21 +139,25 @@ static int bcm47xxpart_parse_trx(struct + + /* We have LZMA loader if offset[2] points to sth */ if (header.offset[2]) { - part = &parts[curr_part++]; - part->name = "loader"; -- part->offset = trx->offset + header.offset[i]; -+ part->offset = bcm47xxpart_real_offset(master, trx->offset, -+ header.offset[i]); +- bcm47xxpart_add_part(&parts[curr_part++], "loader", +- trx->offset + header.offset[i], 0); ++ offset = bcm47xxpart_real_offset(master, trx->offset, ++ header.offset[i]); ++ bcm47xxpart_add_part(&parts[curr_part++], "loader", offset, 0); i++; } if (header.offset[i]) { - part = &parts[curr_part++]; - part->name = "linux"; -- part->offset = trx->offset + header.offset[i]; -+ part->offset = bcm47xxpart_real_offset(master, trx->offset, -+ header.offset[i]); +- bcm47xxpart_add_part(&parts[curr_part++], "linux", +- trx->offset + header.offset[i], 0); ++ offset = bcm47xxpart_real_offset(master, trx->offset, ++ header.offset[i]); ++ bcm47xxpart_add_part(&parts[curr_part++], "linux", offset, 0); i++; } if (header.offset[i]) { - size_t offset = trx->offset + header.offset[i]; -+ size_t offset = bcm47xxpart_real_offset(master, trx->offset, -+ header.offset[i]); +- const char *name = bcm47xxpart_trx_data_part_name(master, +- offset); ++ const char *name; ++ ++ offset = bcm47xxpart_real_offset(master, trx->offset, ++ header.offset[i]); ++ name = bcm47xxpart_trx_data_part_name(master, offset); - part = &parts[curr_part++]; - part->name = bcm47xxpart_trx_data_part_name(master, offset); + bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0); + i++; diff --git a/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch index b39ba3ffd8..a19e943efe 100644 --- a/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ b/target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch @@ -24,7 +24,7 @@ Signed-off-by: Rafał Miłecki #define ML_MAGIC1 0x39685a42 #define ML_MAGIC2 0x26594131 #define TRX_MAGIC 0x30524448 -@@ -298,6 +299,15 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -297,6 +298,15 @@ static int bcm47xxpart_parse(struct mtd_ MTD_WRITEABLE); continue; }