#14745: changeset 34554 breaks crc check on wrtu54g-tm
-----------------------+-----------------------------------
Reporter: lorenzen | Owner: developers
Type: defect | Status: new
Priority: normal | Milestone: Barrier Breaker 14.07
Component: packages | Version: Trunk
Resolution: | Keywords: adm8668
-----------------------+-----------------------------------
Comment (by lorenzen):
r42170 reverses r34554, and the router is back in business.
but it just happens that I was looking into this, and have made a fix so
r34554 can be made to work as expected.
The patch below is relative to r42162
{{{
diff --git a/target/linux/adm8668/files/drivers/mtd/maps/adm8668.c
b/target/linux/adm8668/files/drivers/mtd/maps/adm8668.c
index e07bb40..3885fe7 100644
--- a/target/linux/adm8668/files/drivers/mtd/maps/adm8668.c
+++ b/target/linux/adm8668/files/drivers/mtd/maps/adm8668.c
@@ -167,7 +167,7 @@ found:
return NR_PARTS;
}
- if (be32_to_cpu(uhdr.ih_size) != (linux_len - sizeof(uhdr))) {
+ if (be32_to_cpu(uhdr.ih_size) != (linux_len - sizeof(uhdr))) { //
First boot after flash - fix uboot crc
u32 data;
size_t data_len = 0;
unsigned char *block;
@@ -180,16 +180,32 @@ found:
pr_info(PFX " old: [size: %8d crc32: 0x%08x]\n",
be32_to_cpu(uhdr.ih_size),
be32_to_cpu(uhdr.ih_dcrc));
- if (mtd_read(master, offset, sizeof(data), &data_len,
(char *)&data)) {
- pr_err(PFX "failed to read data\n");
+ data_len = linux_len - sizeof(uhdr);
+
+//#define DO_IT_THE_WAY_IT_WAS_DONE_BEFORE_r34554
+#ifdef DO_IT_THE_WAY_IT_WAS_DONE_BEFORE_r34554
+#define WINDOW_ADDR 0x10000000
+ block = (unsigned char *)(WINDOW_ADDR | 0xA0000000 |
offset);
+#else
+ block = vmalloc(data_len);
+ if (!block)
+ return -ENOMEM;
+
+ if (mtd_read(master, offset, data_len, &data_len, block))
{
+ pr_err(PFX "failed to read mtd%d
linux\n",PART_LINUX);
goto out;
}
+#endif
/* Update the data length & crc32 */
uhdr.ih_size = cpu_to_be32(linux_len - sizeof(uhdr));
- uhdr.ih_dcrc = crc32_le(~0, (char *)&data, linux_len -
sizeof(uhdr)) ^ (~0);
+ uhdr.ih_dcrc = crc32_le(~0, block, linux_len -
sizeof(uhdr)) ^ (~0);
uhdr.ih_dcrc = cpu_to_be32(uhdr.ih_dcrc);
+#ifndef DO_IT_THE_WAY_IT_WAS_DONE_BEFORE_r34554
+ vfree(block);
+#endif
+
pr_info(PFX " new: [size: %8d crc32: 0x%08x]\n",
be32_to_cpu(uhdr.ih_size),
be32_to_cpu(uhdr.ih_dcrc));
}}}
--
Ticket URL: <https://dev.openwrt.org/ticket/14745#comment:3>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets