Patch kernel modules

Is it possible to add patch specific to a kernel modules?

For example i build ath10k from the kernel source but i want to add patches to the code. How to do this?
An alternative would be to create a metapackage that use the kernel source as build dir and compile .ko module on his own. Any idea?

Have a look at this:

About half way down is the section specifically for kernel patches.

patches for wifi are located at package/kernel/mac80211/patches
and the resulting files are (here is an ar71xx target):


I mean for the modules build from the kernel source
That dir is based on backport zip

in the target folder you usually have a folder patches-4.14, if you work for 4.14
or if you want for all targets, use de generic folder

Hello, I'm trying to create a patch for tplinkCPE210_v3. I use Openwrt SNAPSHOT, r7821-bfff412536

I have read

I do the following steps:

  1. cd /TestPatchTplinkCPE210V3/tplinkcpe210v3/openwrt/

  2. make clean

  3. make -j8 V=s

All ok

  1. make target/linux/{clean,prepare} QUILT=1 V=s

  2. cd build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.9.119/

  3. quilt new generic/999-fix_jump.patch

Patch patches/generic/999-fix_jump.patch is now on top

7. quilt edit drivers/net/wireless/ath/ath9k/init.c

8. quilt diff

Index: linux-4.9.119/drivers/net/wireless/ath/ath9k/init.c



+++ linux-4.9.119/drivers/net/wireless/ath/ath9k/init.c

@@ -368,7 +368,7 @@ static void ath9k_init_misc(struct ath_s

struct ath_common *common = ath9k_hw_common(sc->sc_ah);

int i = 0;

  •   setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
  •   /*setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);*/

common->last_rssi = ATH_RSSI_DUMMY_MARKER;

memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);

I decided to stop the timer as a test.

  1. cd /TestPatchTplinkCPE210V3/tplinkcpe210v3/openwrt/

  2. make target/linux/update package/index V=s

  3. make target/linux/{compile,install} QUILT=1 V=s

At the time of assembly, there were no errors. The firmware file was assembled, but as I understand the patch was not overlaid.
I searched all the init.c files and looked at the changes in them. In total there were 3 of them.

Modified file number 2 in the picture. It has a path:


In other directories, the file remains the same. So it should be?

As I understood that the patch did not overlap:

  1. The size of the firmware remained unchanged, as I think it should become smaller, since I commented out one line.
  2. I did not find the modified init.c file in build_dir/target-mips_24kc_musl/linux-ar71xx_generic/backports-2017-11-01

What am I doing wrong?

no "quilt refresh"?

Thanks for your reply.Correctly, I think that this should be done after step number 8? After quilt diff ?

I also tried the 'quilt refresh' after step № 8, the result is the same. maybe an instruction
with mistakes ?

All Thanks!