OpenWrt Forum Archive

Topic: define the flash size of WR703N for building

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

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

(Last edited by andreasb on 5 May 2013, 09:03)

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

best regards
Andreas

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

(Last edited by andreasb on 5 May 2013, 07:49)

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.

(Last edited by hnyman on 5 May 2013, 08:46)

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/t … kefile#L36
https://dev.openwrt.org/browser/trunk/t … efile#L586

4Mlzma etc definitions are set here:
https://dev.openwrt.org/browser/trunk/t … kfw.c#L160

You need to correctly define there 16Mlzma and then use that both in the image makefile (https://dev.openwrt.org/browser/trunk/t … efile#L933) and in the device definition here: https://dev.openwrt.org/browser/trunk/t … kfw.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.

(Last edited by hnyman on 5 May 2013, 08:44)

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

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.)

(Last edited by hnyman on 5 May 2013, 10:30)

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

(Last edited by andreasb on 5 May 2013, 10:49)

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/t … efile#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/t … kfw.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

To make these changes via a script (works on BB, b41353):

sed -i '/TLWR703/              s/4Mlzma/16Mlzma/'   target/linux/ar71xx/image/Makefile
sed -i '/TL-WR703Nv1/,/layout/{s/4Mlzma/16Mlzma/;}' tools/firmware-utils/src/mktplinkfw.c

FWIW, I did not change fw_max_len, but the thing still built!

(Last edited by zxdavb on 26 Jun 2014, 21:30)

In CC b46441, I use:

sed -i '/tl-wr703n-v1/,/endif/{;s/4mlzma/16mlzma/;}' ./target/linux/ar71xx/image/Makefile
sed -i '/TL-WR703Nv1/,/layout/{;s/4Mlzma/16Mlzma/;}' ./tools/firmware-utils/src/mktplinkfw.c

The discussion might have continued from here.