Basically you’d download the kernel source which comes with the particular L4T release you are using. Recently R31.1 was released, and you are probably running R31.0.1 (original shipped release) or R31.0.2 (the first update you could flash). Right now the URLs for R31.0.x are missing due to the new release of R31.1, and I don’t know how the kernel might differ between your release and R31.1. On the other hand, R31.1 is recommended. Is there any chance you can flash R31.1 first, and then if the issue remains, download kernel source for R31.1?
Once you have kernel source it is much easier to explain. But basically the “—” and “+++” just names the same file in two different versions, and the lines starting with “+” or “-” are lines to add or remove. So for example, once you have kernel source, you would find subdirectory “kernel/nvidia/”. Within that, if you use “ls” on the path named by the patch, then you’d see the specific file. For that example note that both files have in common “drivers/pci/host/pcie-tegra-dw.c”. So from the “kernel/nvidia/” subdirectory this should work:
If you used an editor you could edit “pcie-tegra-dw.c”. Your goal would be to remove the “-” lines and insert the “+” lines. The patch utility does this automatically, but sometimes the tool syntax is a bit of a pain to explain and makes it sound more complicated than it really is. I’ll give an example though based on that first patch.
If you copy and paste that patch as a file named “my_diff1.patch”, and place it in some location outside of the kernel (so you don’t have to leave a mess in kernel source), then you can use it as follows…I assume the “my_diff1.patch” is located at “~/my_diff1.patch”:
patch -p1 < ~/my_patch1.patch
The “-p1” is because you are stripping off the “a/” and “b/” prefix (one level) of the “—” and “+++” lines at the start. Patch now knows it can see the old version of “pcie-tegra-dw.c” at “drivers/pci/host/pcie-tegra-dw.c”. Then the patch utility will do the work. Had you not stripped off the leading “a/” and “b/” via one level of prefix stripping, then the tool would have been able to find the file.
In places where the patch found and updated the right code block it will tell you a “hunk” succeeded. In some cases where parts of patches are already in place only the parts which needed update will be noted as succeeded. If you examine the file after the patch you will note the “-” lines were removed and the “+” lines were added.
If instead of “cd kernel/nvidia” you had done “cd kernel/nvidia/drivers/pci/host”, then you would need the “-p1” to instead be “-p5” to strip four more leading directories.
After that you need to compile the kernel. Docs with the release provide instructions for that.