Modify

Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#11420 closed defect (fixed)

[PATCH] brcm47xx flash map fix for wgt634u bootloader size

Reported by: b.sander Owned by: hauke
Priority: normal Milestone: Barrier Breaker 14.07
Component: kernel Version: Trunk
Keywords: wgt634u flash map bootloader size Cc:

Description

Hi,

the bcm47xxpart driver only searches the TRX header for getting the bootloader size. But on wgt634u the kernel decompressor is an ELF executable with an attached TRX header. So what we got here is a growing memory leak - after every flash we lose 0x20000 bytes, which will be add to the bootloader size.

[    0.960000] bcm47xx_pflash: Flash device: 0x2000000 at 0x1fc00000
[    0.968000] bcm47xx_part: bootloader size: 786432
[    0.972000] bcm47xx_part: Looking for dual image
[    0.980000] bcm47xx_part: TRX offset : 0
[    0.984000] 4 bcm47xx partitions found on MTD device Physically mapped flash
[    0.988000] Creating 4 MTD partitions on "Physically mapped flash":
[    0.996000] 0x000000000000-0x0000000c0000 : "cfe"
[    1.012000] 0x0000000c0000-0x0000007e0000 : "linux"
[    1.024000] 0x0000001ab000-0x0000007e0000 : "rootfs"

... next time it will be

[    0.968000] bcm47xx_part: bootloader size: 917504
[    0.972000] bcm47xx_part: Looking for dual image
[    0.980000] bcm47xx_part: TRX offset : 0
[    1.228000] bcm47xx_part: Updating TRX offsets and length:
[    1.232000] bcm47xx_part: old trx = [0x0000001c, 0x00000828, 0x000e9800], len=0x00601000 crc32=0xf087edcc
[    1.244000] bcm47xx_part: new trx = [0x0000001c, 0x00000828, 0x000e9800], len=0x000e9800 crc32=0xdfe37024
[    3.488000] bcm47xx_part: Done
[    3.492000] 4 bcm47xx partitions found on MTD device Physically mapped flash
[    3.500000] Creating 4 MTD partitions on "Physically mapped flash":
[    3.504000] 0x000000000000-0x0000000e0000 : "cfe"
[    3.520000] 0x0000000e0000-0x0000007e0000 : "linux"

Here is the patch!

--- linux/drivers/mtd/bcm47xxpart.c.bak	2012-05-08 17:30:18.000000000 +0200
+++ linux/drivers/mtd/bcm47xxpart.c	2012-05-08 18:02:03.367245223 +0200
@@ -67,6 +67,11 @@
 	u32 offsets[TRX_MAX_OFFSET];	/* Offsets of partitions from start of header */
 };
 
+/* for WGT634U search the ELF-header of
+ * the kernel decompressor instead of TRX
+ */
+#define WGT634U_ELF_MAGIC	0x464c457f /*  ".ELF"  */
+
 /* for Edimax Print servers which use an additional header
  * then the firmware on flash looks like :
  * EDIMAX HEADER | TRX HEADER
@@ -120,7 +125,8 @@
 		}
 
 		/* found a TRX header */
-		if (le32_to_cpu(trx->magic) == TRX_MAGIC)
+		if (le32_to_cpu(trx->magic) == TRX_MAGIC ||
+		    le32_to_cpu(trx->magic) == WGT634U_ELF_MAGIC)
 			goto found;
 	}
 

after patching we get this:

[    0.960000] bcm47xx_pflash: Flash device: 0x2000000 at 0x1fc00000
[    0.968000] bcm47xx_part: bootloader size: 524288
[    0.972000] bcm47xx_part: Looking for dual image
[    0.980000] bcm47xx_part: TRX offset : 0
[    1.236000] bcm47xx_part: Updating TRX offsets and length:
[    1.244000] bcm47xx_part: old trx = [0x0000001c, 0x00000828, 0x000e9800], len=0x00601000 crc32=0xcca44b08
[    1.252000] bcm47xx_part: new trx = [0x0000001c, 0x00000828, 0x000e9800], len=0x000e9800 crc32=0xbe744d96
[    3.468000] bcm47xx_part: Done
[    3.472000] 4 bcm47xx partitions found on MTD device Physically mapped flash
[    3.480000] Creating 4 MTD partitions on "Physically mapped flash":
[    3.484000] 0x000000000000-0x000000080000 : "cfe"
[    3.500000] 0x000000080000-0x0000007e0000 : "linux"
[    3.512000] 0x000000229800-0x0000007e0000 : "rootfs"

Regards,
b.sander

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by florian

  • Owner changed from developers to hauke
  • Status changed from new to assigned

comment:2 Changed 5 years ago by hauke

  • Resolution set to fixed
  • Status changed from assigned to closed

Thank you for the patch, this is fixed in r33935.

comment:3 Changed 5 years ago by hauke

The patch was reverted in r34201 again.

russell had problems with this patch on his wgt634u.

Did you use the generic image for sysupgrade or the special wgt634u image? You should use the generic one.

Please reopen if this problem still exists.

comment:4 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.