How to make openwrt build that the router's stock firmware will accept?

I have a tp link mr600 v2 router and there is already a way to install openwrt on the system using serial connection but I would like to invest some time to enable the stock firmware to accept the openwrt firmware file in upgrade.

I am new to this so would need some direction or guides, I don't know what this procedure is called.

Please provide some guidance, articles that I can read and work on this.

I am not new to programming and linux systems so I think I can do it.

If I'm not mistaken, the tplink-safeloader is the tool for this:
https://github.com/openwrt/firmware-utils/blob/master/src/tplink-safeloader.c

2 Likes

Analyze a stock firmware upgrade file using a hex editor and try to make sense of it - depending on the manufacturer, this may be easy or difficult. tplink-safeloader already mentioned is a likely guess for this device. You may want to have a look at the source code to understand what it does and then see what/if it applies to your device.

2 Likes

So compare the official firmware and openwrt firmware, then take out the differences, try to make the openwrt firmware file similar to the official firmware.

If possible, would you(or anyone) be able to share article, reading material which can help me understand what I am looking for?

First effort would be to run "strings" on the firmware image and determine similar models from the safeloader tag. You may find identical device supported albeit under different name in different (form) case. Dont flash it right away, need to confirm flash layout so that at least ethernet is UP for further activites.

Thanks.

Just curious, Is there some tool that can help me "smoke test" my build before flashing to actual hardware?

Attached serial cable and confirmation that OEM bootloader can reflash back OEM software as it was before your intervention.

I ran binwalk on the firmware file and was able to extract the filesystem squashfs.

This device is already supported, it's just not flashable from stock.

@imbdb In this case, I'd say the code is the documentation. I'm serious, I'm not aware of any guide for doing this. Once you've figured out the basics, it's not too hard. I can have a look later tonight when I have access to my computer. NB: I had an MR600v2, but I sold it some time ago. So while I'm familiar with the device, I cannot do any testing.

Thanks but I don't have a serial cable, I am a total beginner and don't even know the type of serial cable that cab be used to connect to this router and where to connect it from.
I think I should first focus on understanding the whole safeloader and then move to serial cable.

I love the fact that the code is so well commented.

I have the device and I am frustrated that tplink removed the option to use that router as a wifi repeater.
So I have decided that I will make it flashable to get that option.

After running strings on firmware file, I was able to get the bootargs

bootargs=console=ttyS1
115200
root=/dev/mtdblock2
rootfstype=squashfs
init=/sbin/init
printk.time=1
flash_size=0x1000000
part_num=6
partitions=
    0000000000020000uboot
    0002000000200000os-image
    0022000000da0000file-system
    00fc000000010000rom-config
    00fd000000010000user-config
    00ff000000010000radio
    

The partitions look similar to the code on this file https://github.com/openwrt/firmware-utils/blob/bd7fcc74b43e9c6b08d376aacd5e7a04b9f8e9b6/src/tplink-safeloader.c#L1526

But rom-config is no where in the file.
Am I understanding this correctly?

Partition names yes, offsets totally not.

Can you post firmware upgrade downliad page for others to "have a look"

Never attempt any of this without serial! I thought you already have this - my bad. It is very, very likely that your first attempt requires serial anyway, so make sure you have that before even thinking about coming up with a stock-flashable solution!

Firmware download link: https://static.tp-link.com/upload/firmware/2023/202303/20230314/Archer_MR600(EU)_V2_220826.zip

Firmware download page: https://www.tp-link.com/in/support/download/archer-mr600/v2/#Firmware

I am completely lost at this.
The firmware file that I have doesn't have a partition entry for serial-number in the bootargs.

And this does not work? Not upload via OEM upgrade dialog btw

https://firmware-selector.openwrt.org/?version=23.05.3&target=ramips%2Fmt7621&id=tplink_mr600-v2-eu
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=78110c3b5fce119d13cd45dadd33ca396c8ce197
https://firmware-selector.openwrt.org/?version=23.05.3&target=ramips%2Fmt7621&id=tplink_mr600-v2-eu

This does work but It requires a serial connection with the router which I have no experience with.
I am trying to create a stock flashable image to avoid the serial connection.

You need serial cable. Probably worth getting on any of original MR600 threads.

A serial UART to USB adapter is easily obtained and inexpensive in most places around the world, and is a really useful tool to have. Since you said that you are not new to programming and linux, the learning curve should be pretty simple. You may need to do a little soldering, depending on the design on the router, but that's pretty simple -- usually good size pads (often through hole).