I wanted to ask if it is as straight forward as the diff below to increase
the flash size of a given target hardware?
Example given: in the below case from 4MB to 16MB?
Is there anything else to be aware of or that needs to be adapted? Any quirks/caveats to look out for?
Is it possible in general to just increase that size to for example
128MByte although you only have 16MByte available at the time. Does it
always adjust to the size availabe or could this damage the device?
thanks a lot for your fast reply and the hint. So I was looking through the file you mentioned and found that for the mt7620n SoC there are different sizes used around 16MByte. I don't quite understand why that is the case and what I have to watch out for to find the right size for my case? What are the indicators on the chosen sizes? Should I try to go with the same calculation as for the 4MB case for vonets which seems 0x3b0000/1024 = 3776k would it be 0xf60000/1024 = 15744k?
You need to understand the areas reserved for various other partitions in the OEM firmware. There may be some calibration data (like "art"), some extra IDs or boot variables (e.g. u-boot env), some special storage area (like "Netgear"), whatever... The reserved area vary by manufacturer and router, independent of the underlying technical chipset.
If you change the memory chip, you need to not only change the size definition, but take care of copying the contents of the possibly moved partitions on flash.
E.g. "art" in the old Atheros chipsets is typically at the end of the flash. So, If you had 4 MB (boot stuff 1 MB + firmware 2,9 MB + art 0,1 MB), and you switch the chip 4 MB --> 16 MB, you need to take care to also copy that "0,1 MB art" to a safe place on the chip, so that you do not overwrite it on the previous place. Otherwise your new 14,9 MB firmware area would overwrite the contents of art at the 3,9 MB on flash.
The OEM stuff ends at 3b0000, so the 3b0000-3fffff is reserved for OEM stuff. You should likely copy those contents to fb0000 and then mark fb0000-ffffff reserved in your new partition definition. (I have not looked what the contents there are, but that is the principle.)
Although im not sure what exactly this reg entry means. I thought it gives the exact start and size of a given partition (in this case firmware).
Because the firmware partition is the last partition in your flash layout you can easily increase the size without thinking about the other partitions.
But what I don't understand is that with the default vonets image config (reg = <0x50000 0x3b0000>;) I actually already have access to 12MB Flash instead of what I suggested less then 4MByte which is the value configred in with reg.
Could someone give me hint how that is achieved? Is this dynamically adapted by the Kernel or how is that actually achieved. Does that mean I won't have to change anything at all since the extra flash is already detected or could this change in the future and then cause any problems?
I did the various files changes for a WT3020 which is a mt7620 based device. The compilation went well. I perfomed the change of the flash chip (8M to 16M) including the copy of the original u-boot, art and nvram (shifted toward the end of the chip). Then i try to install the modified software.
But during the u-boot start it look like the WT3020 u-boot is checking the flash chip type. Looking at the uboot assembly code one can read different flash chip references. Most probably only those ones allowed.
I suspect that u-boot need to be modified so that to include the new chip reference . Any guidance to do that? Including u-boot update in flash?
PS I did the same kind change (moving from 8 to 16M) on another unit based on ath79 where the uboot is more simple (no flash type check) and it works well.