[OpenWrt-Devel] [PATCH RFT] kernel: mtdsplit_uimage: debug buf/header sizes

John Crispin blogic at openwrt.org
Thu Feb 12 15:04:05 EST 2015


[    0.564000] Creating 4 MTD partitions on "spi32766.0":
[    0.568000] 0x000000000000-0x000000010000 : "uboot"
[    0.572000] 0x000000010000-0x000000020000 : "uboot-env"
[    0.580000] 0x000000020000-0x000000030000 : "calibration"
[    0.584000] 0x000000050000-0x000000ff0000 : "firmware"
[    0.596000] mtdsplit_uimage: [__mtdsplit_parse_uimage] buf:c0049000
sizeof(*buf):1
[    0.600000] mtdsplit_uimage: [__mtdsplit_parse_uimage] sizeof(*header):64
[    0.608000] mtdsplit_uimage: [read_uimage_header] buf:c0049000
header_len:1
[    0.616000] mtdsplit_uimage: [uimage_find_edimax] buf:c0049000 len:1
FW_EDIMAX_OFFSET + sizeof(*header):84
[    0.624000] mtdsplit_uimage: Buffer too small for checking Edimax header
[    0.784000] Dedicated partitioner didn't split firmware partition,
please fill a bug report!
[    0.788000] 0x000000172108-0x000000ff0000 : "rootfs"
[    0.796000] mtd: partition "rootfs" must either start or end on erase
block boundary or be smaller than an erase block -- forcing read-only
[    0.808000] mtd: device 4 (rootfs) set to be root filesystem
[    0.812000] 1 squashfs-split partitions found on MTD device rootfs
[    0.820000] 0x000000340000-0x000000ff0000 : "rootfs_data"
[    1.916000] Realtek RTL8366RB ethernet switch driver version 0.2.4
[    1.924000] rtl8366rb rtl8366rb: using GPIO pins 491 (SDA) and 493 (SCK)
[    1.928000] rtl8366rb rtl8366rb: RTL5937 ver. 3 chip found





On 12/02/2015 12:47, Rafał Miłecki wrote:
> ---
> John can you give it a try, please?
> ---
>  .../generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c  | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
> index 2bb5e9a..4abc4be 100644
> --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
> +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
> @@ -20,6 +20,8 @@
>  
>  #include "mtdsplit.h"
>  
> +static int first_try = 1;
> +
>  /*
>   * uimage_header itself is only 64B, but it may be prepended with another data.
>   * Currently the biggest size is for Edimax devices: 20B + 64B
> @@ -60,6 +62,8 @@ read_uimage_header(struct mtd_info *mtd, size_t offset, u_char *buf,
>  	size_t retlen;
>  	int ret;
>  
> +	if (first_try)
> +		pr_info("[%s] buf:%p header_len:%zu\n", __FUNCTION__, buf, header_len);
>  	ret = mtd_read(mtd, offset, header_len, &retlen, buf);
>  	if (ret) {
>  		pr_debug("read error in \"%s\"\n", mtd->name);
> @@ -106,11 +110,15 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master,
>  		ret = -ENOMEM;
>  		goto err_free_parts;
>  	}
> +	if (first_try)
> +		pr_info("[%s] buf:%p sizeof(*buf):%u\n", __FUNCTION__, buf, sizeof(*buf));
>  
>  	/* find uImage on erase block boundaries */
>  	for (offset = 0; offset < master->size; offset += master->erasesize) {
>  		struct uimage_header *header;
>  
> +		if (first_try)
> +			pr_info("[%s] sizeof(*header):%u\n", __FUNCTION__, sizeof(*header));
>  		uimage_size = 0;
>  
>  		ret = read_uimage_header(master, offset, buf, sizeof(*buf));
> @@ -308,8 +316,13 @@ static ssize_t uimage_find_edimax(u_char *buf, size_t len)
>  {
>  	struct uimage_header *header;
>  
> +	if (first_try)
> +		pr_info("[%s] buf:%p len:%zu FW_EDIMAX_OFFSET + sizeof(*header):%u\n", __FUNCTION__, buf, len, FW_EDIMAX_OFFSET + sizeof(*header));
> +
>  	if (len < FW_EDIMAX_OFFSET + sizeof(*header)) {
> -		pr_err("Buffer too small for checking Edimax header\n");
> +		if (first_try)
> +			pr_err("Buffer too small for checking Edimax header\n");
> +		first_try = 0;
>  		return -ENOSPC;
>  	}
>  
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list