1 (edited by andreasb 2013-05-05 09:03:41)

Topic: define the flash size of WR703N for building

Hi,
I did extend the flash of my WR703N from 4M to 16M. This works well and have no problems. But I want to make a new binary for flashing with a bigger size than 4MB. I can create only a binary with a max size of 4M. If I define more modules and SW with make menuconfig then the make will not create a binary.
I know that I can first create a smaller binary and install later the additional software. But I want to compile all modules what I want into the kernel.
In which file is defined the flash size of this router?

best regards
Andreas

Re: define the flash size of WR703N for building

Hi,
have nobody any idea how I can remove the flash limitation during the make?

best regards
Andreas

3 (edited by hnyman 2013-05-05 07:08:36)

Re: define the flash size of WR703N for building

You should have put a reference to the device in the title... That would help getting answers. Now your title is very generic :-(


The device is strange to me, but I think that the flash size is set here:
https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/image/Makefile#L933

And based on wiki (http://wiki.openwrt.org/toh/tp-link/tl-wr703n#hardware.mods), you might also read https://forum.openwrt.org/viewtopic.php?id=28343

4 (edited by andreasb 2013-05-05 07:49:30)

Re: define the flash size of WR703N for building

Thank you very much!
In this file I did change the size to 16M already. But it doesn't work.
Now I try to set it to 8MB. This works fine. May be, the make of openwrt didn't work general with a flash size more than 8MB.
(I did not wrote the device in the title to become a general answer. I thought this increase the change of an answer. May be, the false way... :-(  )

best regards
Andreas

5 (edited by hnyman 2013-05-05 08:46:08)

Re: define the flash size of WR703N for building

andreasb wrote:

(I did not wrote the device in the title to become a general answer. I thought this increase the change of an answer. May be, the false way... :-(  )

That kind of settings like flash size are so device specific that there is no generic answer. Thatswhy I suggested mentioning the device.

I would guess that those 8M and 4M setttings are defined somewhere in the ar71xx device definitions. Might be that a suitable setting has not yet been defined for 16M in your device type.


Ps.  I have 16 MB WNDR3700 (with the same ar71xx architecture) , so Openwrt itself supports that size quite well. You have just to find, where the definition for your devices gets parsed.

6 (edited by hnyman 2013-05-05 08:44:59)

Re: define the flash size of WR703N for building

I spent a few more minutes debugging this...

The ar71xx image makefile image calls Singleprofile --> Image/Build/Template/TPLINK-LZMA, which then calls external "mktplinkfw" tool to build Tplink image:
https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/image/Makefile#L36
https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/image/Makefile#L586

4Mlzma etc definitions are set here:
https://dev.openwrt.org/browser/trunk/tools/firmware-utils/src/mktplinkfw.c#L160

You need to correctly define there 16Mlzma and then use that both in the image makefile (https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/image/Makefile#L933) and in the device definition here: https://dev.openwrt.org/browser/trunk/tools/firmware-utils/src/mktplinkfw.c#L336

EDIT: you might edit the title in the first message to contain TL-WR703N so that other looking for information can find this discussion more easily.

Re: define the flash size of WR703N for building

Hi,
I did change the line 339 to 16M in mktplink.c now.
But if I change the size in the make file again to 16M then make don't create a binary more.
(openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin has 8.1M if it created)

best regards
Andreas

8 (edited by hnyman 2013-05-05 10:30:22)

Re: define the flash size of WR703N for building

What are all the changes you have done? You could copy the code (svn diff output of those files) here inside [ code ] tags.

I guess that you need at least to:
- define a new section (in lines 160-190) for 16lzma
- define that as the format for 703 in line 339
- change also the image makefile to use that definition (line 933 of makefile)

You might also need to "make dirclean" to ensure that the new mktplinkfw gets surely built. I guess it should be built automatically if you change source, but I am not sure. (you might also "make tools/firmware-utils/clean" , as it is part of that tools package.)

9 (edited by andreasb 2013-05-05 10:49:13)

Re: define the flash size of WR703N for building

Hi,
just I saw the same. The flash layout 16Mlzma didn't exist.
I create it now like follow:
        .id        = "16Mlzma",
        .fw_max_len = 0xfc0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x100000,
Thank you very much! It works well now!

best regards
Andreas

Re: define the flash size of WR703N for building

You might add the correct advice to the wiki article for your device:

http://wiki.openwrt.org/toh/tp-link/tl-wr703n#hardware.mods

Re: define the flash size of WR703N for building

Hi,
ok, but I will describe here exact what I did for a better understanding.

For comparisation this way you have to mind that this change is valid for the openwrt trunk of this day. May be, for later versions have another line in the file.

1. Change the make file: https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/image/Makefile#L933
- $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0x07030101,1,4Mlzma))
+ $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0x07030101,1,16Mlzma))

2. Change the file: https://dev.openwrt.org/browser/trunk/tools/firmware-utils/src/mktplinkfw.c#L158
add a element in the struct "static struct flash_layout layouts[]" for 16MB like follow:

        .id        = "16Mlzma",
        .fw_max_len = 0xfc0000,
        .kernel_la    = 0x80060000,
        .kernel_ep    = 0x80060000,
        .rootfs_ofs    = 0x100000,

Change the entry for the WR703N of the struct "static struct board_info boards[]" in the same file( the entry is now in line line 345)
        .id        = "TL-WR703Nv1",
        .hw_id        = HWID_TL_WR703N_V1,
        .hw_rev        = 1,
        .layout_id    = "4Mlzma",
to
        .id        = "TL-WR703Nv1",
        .hw_id        = HWID_TL_WR703N_V1,
        .hw_rev        = 1,
        .layout_id    = "16Mlzma",

that's all!
Andreas