How to compile OpenWrt?

I have a router that does not have support for openwrt but I found other models and if there is support but the CPU frequency is not the same as my router and I would like to modify or edit the .bin

You will find comprehensive information about how to build OpenWrt from source in wiki, but -while a necessary requirement- that won't help you for an unsupported device. Porting a new device to OpenWrt does require quite significant source changes (in the best case at least DTS and firstboot adaptions for the networking), if you're starting from zero you'll have quite an endeavour ahead of you.

1 Like

you see this is my router model TL-WR841HP v5 [https://deviwiki.com/wiki/TP-LINK_TL-WR841HP_v5.x](https://deviwiki.com/wiki/TP-LINK/_TL-WR841HP/_v5.x](https://deviwiki.com/wiki/TP-LINK_TL-WR841HP_v5.x)?fbclid=IwAR3NLygAHdDAJXgjjDYoBr4PtjPNBFYEZ-62KfRqsCgyzZn4uhePc_ErCs0)

It is not OpenWrt compatible, but then I found this TL-WR840N v4 router [https://openwrt.org/toh/hwdata/tp-link/tp-link_tl-wr840n_v4](https://openwrt.org/toh/hwdata/tp-link/tp-link/_tl-wr840n/v4](https://openwrt.org/toh/hwdata/tp-link/tp-link_tl-wr840n_v4)?fbclid=IwAR0s8NB5ONH7fmbNFCR5lIgHV5HEFsOOHh2-c3IKoIp4FSM22hYsED5-d4) which have the same storage and ram Soc mediatek the difference is the my router frequency is 575mhz but the other router is 580mhz

Or it can be quite simple if there are only a few hardware changes to a device that OpenWRT supports. I've added support for a couple and it took a few hours each.

It's worth understanding how to get a serial connection to the device hardware, although you may never need it if things go well.

Then a few 10s of GB of disk space for a virtualised Debian or similar system, and follow the well publicised guides to build firmware.

there will be a guide for newbies like me?

It perhaps depends what you're new to. If you understand Linux pretty well, can create users, make use of native tools like find to understand what is where in the OpenWRT tree while you hack in a new device then this guide should be enough (its what I used): https://openwrt.org/docs/guide-developer/build-system/install-buildsystem.

If you're not sure on those things then it may be tough to get going.

1 Like

but this model TL-WR840N v4 already has openwrt because I not only modify those frequency parameters from 580 to 575 mhz and already

Not sure what you're asking. I think the actual change you need to make will be quite simple if that other device is similar enough. For just personal use you could modify the config for that device and load the resultant firmware. To do it properly you'll need to add a new device to the build system so it shows up in menus.

Have you tried running the stock OpenWRT 840 firmware on your device? It may be rejected if thee is some check being done. If so you'd often be able to load it via serial line during device boot. I'd have thought the SoC speed wouldn't make a difference to much unless it is using hardware timing control.

If you understand those ideas you're in a good position to get things working.

if i managed to run openwrt on my router tl-wr841hp v5 ! seems to work fine but i still want to modify these parameters 116473577_307218333664847_1199805198189727947_n|666x500

Looks like you're in a good position then. If that screen shot means you have OpenWRT running on the device it should be easy to keep it running while making the changes you want.

I'm not sure how you will detect the benefit of the change if everything is currently working OK, but as long as you do that's all that matters.

well but how could you modify the parameters would be by ssh?

I'm not sure what parameter you mean. I can't see anything relating to SoC MHz on your screenshot.

The SoC frequency will be non-modifiable. What problem are you seeing from it being different to the original platform of that firmware?

what I want to modify are the leds, according to the download and upload speed they vary, they don't give the contractor plan of my isp sqm it doesn't seem to work well

So nothing to do with SoC freq?

Depending on the version of OpenWRT you have some of the LED config is in an editable script file. A good way to start is find the commit that added the device you want to use as a base to the OpenWRT build tree (and then any later commits that changed it) and see what was in there. You'll often find it adds LED and button configurations, or points you to the ones it borrowed from another target device (because they were the same). Once you understand how they work on that device look at similar devices in the same or "nearby" files to understand the subtleties of managing colour, meaning when on / off / flashing, etc. Then try tweaking the control of what already works so you know you're hacking in the right zone:change an LED colour, swap what two LEDs do, etc.

You'll then know if they are binary or config changes are needed, and be able to plan to make them. You may find that getting Image Builder installed is enough for you to hack the changes in. No need for underlying binary builds.

Maybe I am not making myself understood or it will be my bad English. There is another problem when I turn off the power at home, my router doesn't seem to start well or it repeats or is factory reset, the settings I make are cleared.

Where do you make those changes that are lost? I have a problem with a "tiny" (its a type of build for 4MB flash) device that is right on the edge of what fits the device. I don't fully understand the mechanism (I haven't thought hard about it), but it won't keep config across power off / on. Putting what i want into the filesystem of Image Builder so it is a part of the flash fixes this.

Where do I find that editable script?

I already have openwrt as shown in this guide
https://openwrt.org/docs/guide-developer/build-system/install-buildsystem

what happens next?

In the Wiki entry that you linked for the 840 device it shows the commit that added the device: https://git.lede-project.org/?p=source.git;a=commit;h=24043a0d2e01b9843c0dc529205b3b0bc7ecbbf9.

Be sure to read the notes there, they are interesting and it looks like you'll need to add a TFTP server to your build environment.

The first file in that commit references the LED config script that I'm referring to.

Use a Terminal / Shell window to switch to the openwrt folder shown in your image. Use this guide: https://openwrt.org/docs/guide-developer/build-system/use-buildsystem.

At the "make menuconfig" step select the first three items to match the entries at https://openwrt.org/toh/hwdata/tp-link/tp-link_tl-wr840n_v4. Once you have a build image edit sources and rebuild as necessary.