# How to apply custom patches to wireless kernel drivers

## abduct

Hi, I build my kernel (3.18.x) with all related drivers pre-built and with loadable modules disabled.

I am wanting to build and use the ath9k_ht driver for my external wireless card with the Atheros AR9271 chipset. I've also found a few patches I would like to include, namely:

http://patches.aircrack-ng.org/channel-negative-one-maxim.patch and http://patches.aircrack-ng.org/mac80211.compat08082009.wl_frag+ack_v1.patch

I have searched the unpatched files and these changes are not present. Can/Do I simply copy paste the changes or is there a specific patching tool to do this. Is this okay to do? All the sources link to downloading the compat-wireless drivers from orbit-lab.org, which I can no longer find working links to. Even if I did since loadable module support is disabled it wouldn't be of much use.

So:

1) Can I use these patches on the Linux kernel itself

2) How do I apply such patches in a safe manner? (there must be some kind of automated patching utility I am not aware of).

Thanks for the help.

----------

## khayyam

 *abduct wrote:*   

> I have searched the unpatched files and these changes are not present. Can/Do I simply copy paste the changes or is there a specific patching tool to do this. Is this okay to do? All the sources link to downloading the compat-wireless drivers from orbit-lab.org, which I can no longer find working links to. Even if I did since loadable module support is disabled it wouldn't be of much use.

 

abduct ... you should be aware that much can happen in the 6 years since these patches were released, and that the method, or issue, such a patch was addressing may nolonger be used, or present. In the case of the two patches above only the later will apply, and given its age you don't know what other components of NL80211/MAC80211 have since changed, and so what effect the patch may have (and note the "FIXME" provided in the frag+ack patch). 

```
# patch -p1 --dry-run -d /usr/src/linux <channel-negative-one-maxim.patch

checking file net/wireless/chan.c

Hunk #1 FAILED at 49.

Hunk #2 FAILED at 76.

2 out of 2 hunks FAILED

# patch -p1 --dry-run -d /usr/src/linux <mac80211.compat08082009.wl_frag+ack_v1.patch

checking file net/mac80211/tx.c

Hunk #1 succeeded at 778 (offset 101 lines).
```

Also, aircrack-ng functions perfectly fine without them, so I expect (and as my memory serves) there is no need for them.

Note, the above code should provide an answer to the question re patch tool.

best ... khay

----------

