I have read the instructions in the model's page (https://openwrt.org/toh/avm/avm_fritz_box_4040).
It should not be all that difficult, as you upload it via simple ftp commands, but it did not work..
First of all it is quite difficult to get connect using ftp to the router at the right moment.
If you do it to late, it is up and running and you get connection refused errors, too early and it does not respond.
The original firmware was upgraded to version 7.10 in my router, may that is causing some problems.
I am using windows 10.
First of all "ftp -n -p 192.168.178.1" does not work in my windows machine, -p option is unknown.
I guess -p option is for passive mode, which is anyway given as a command.
The couple of times that I could get into it, it did not worked, either.
I gave this instructions which work correctly:
quote user adam2
quote pass adam2
quote IMAGE FLSH
binary
But if I use "put firmware.bin mtd1" I receive the error "502 unknown command".
passive command is not known, either.
I have tried to use
quote pasv
which works and enter passive mode.
But when I use:
put firmware.bin mtd1
it keeps saying "502 unknown command" blocks for a long time and there is no message telling you the transfer is complete.
Now I cannot connect using ftp command anymore, as it allays rejects connection.
If you wait too much it says that it does not accept connection.
Sometime it responds just before the LAN led is lit.
But it says that the software has cancelled connection after initial connect.
At the end of the device page in openWRT there is a link to an python script used to upload gluon firmware to Fritzbox.
I have tested it. It repeatedly tries to connect to the router while it is booting until it gets a connection, and then uploads the given firmware.
I use "python fritzflash.py --image openwrt.bin".
It gets connection and it uploads the firmware and tells you everything is OK, but when the router reboots, it blocks flashing the red info led.
Reading the python script it seems that it does not a "put openwrt.bin mtd1" coomand, but "quote STOR mtd1" and after that ir writes de binary file.
But something does not work. The script itself tell you that 4040 model has problems with this script.
I had to revert to the original firmware.
The toot from AVM to reflash, seems to erase mtd1 prior to flashing, and it seems that it writes some other partitions, mtd2... mtd4.
How can I flash the firmware?
May be that they have made some changes in version 7.10 and have dropped put command from the ftp server?
Thank you for your advice.