OpenWrt Forum Archive

Topic: How to patch .diff files

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

Hi all,

I would like to tell you that I recently started to mess with compiling and have some basics about programming and compiling but I consider myself a newbie about it all.

I have been reading through the wiki parts related to buildroot (installation, usage and working with patches) but I still don't have a clue on how to apply a .diff file that "teslamint" shared in this link. It talks about .patch files but I don't know if they have the same content as .diff files.

What I am trying to do is to reuse the work teslamint did about creating this patch to be able to compile a firmware that can be loaded into a D-link DIR-615 I1 revision, as it also has an atheros chipset but won't allow to update with a firmware that belongs to a DIR-615 C1.

Thanks in advance for your help.

I would patch it via git, just inside the buildroot directory do: git apply mypatch.diff
this also works if the buildroot isn't downloaded via git.

But the 1.diff file does not patch correctly anymore against the latest trunk, and you have to use atitude adjustment.

dusty wrote:

I have been reading through the wiki parts related to buildroot (installation, usage and working with patches) but I still don't have a clue on how to apply a .diff file that "teslamint" shared in this link. It talks about .patch files but I don't know if they have the same content as .diff files.

As pointed out above, you probably need to know how to create your own new patch file. Perusing this working with patches will definitely make your work more efficient.

The .diff that teslamint posted is very "dirty" it contains patches of files that have nothing to do with hardware support of a
D-link DIR-615 I1.

since it is hosted on github there is a cleaner diff available - clicking on the commit and add .patch to the url

try: https://github.com/teslamint/openwrt/co … e25d.patch

applying the patch with git on trunk buildroot should be easier than the 1.diff posted

If it does not apply cleanly it is often due to the "environment" of the patchfile not matching the target : that means the +/- 3 lines around the changes are not matching and therefore it cannot be applied automatically
In that case you just have to add/edit the line yourself.

The discussion might have continued from here.