2012/6/19 Roman A. aka BasicXP <[email protected]>:
> 20.06.2012, в 0:19, Rafał Miłecki <[email protected]> написал(а):
>
>> I wanted to generate chk image for WNDR4500. For that I need to hack
>> target/linux/brcm47xx/image/Makefile
>>
>> For chk files mkchkimg is used with 2 parameters I've to find out:
>> board_id and region. My guess is I have to extract that parameters
>> from stock (original) firmware to understand what my router accepts.
>> Is that right?
>>
>> For that purpose I've downloaded WNDR4500-V1.0.0.103_1.0.21.chk and
>> opened it in hexeditor. Checking range 0x28 - 0x39 gave me a board_id
>> (it was easy to find). It seems to be:
>> U12H189T00_NETGEAR
>>
>> Unfortunately I don't know where to look for region. Does someone know
>> it's location in .chk file, or is there a application to automatically
>> extract it?
>
> Turns out the region is 0x0002 for worldwide. If you have a WNDR4500 
> yourself, try running routerinfo, it will give you the information you need.

Interesting, "routerinfo" indeeds shows 0x0002:
> Board ID - U12H189T00_NETGEAR
> region_num - 0x0002

However I took a look at tools/firmware-utils/src/mkchkimg.c and found
interesting thing:

hdr->magic = htonl (0x2a23245e);
hdr->reserved[0] = (unsigned char)(region & 0xff);

struct chk_header {
        uint32_t magic;
        uint32_t header_len;
        uint8_t  reserved[8];
        uint32_t kernel_chksum;
        uint32_t rootfs_chksum;
        uint32_t kernel_len;
        uint32_t rootfs_len;
        uint32_t image_chksum;
        uint32_t header_chksum;
        /* char board_id[] - upto MAX_BOARD_ID_LEN */
};

And that allows me to read sth different from
WNDR4500-V1.0.0.103_1.0.21.chk hexdump. It looks like that:

2A23245E 0000003A 01010000 67010015

So it seems that:
reserved[0] = 0x01
reserved[1] = 0x01
reserved[2] = 0x00
reserved[3] = 0x00
reserved[4] = 0x67
reserved[5] = 0x01
reserved[6] = 0x00
reserved[7] = 0x15

I don't see any "0x02" here, especially in reserver[0]. If reserver[0]
is really a region, it seems to be 0x01 for me.

-- 
Rafał
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to