Patching a kmod package like kmod-usb-net-smsc95xx

Hello everyone, I'm having such a hard time about how to perform a patch on a package and understanding general details about it, I'm sorry if these questions are silly I'm such a beginner. So it is not the usual case where I have a code and simply create a package out of it. I need to apply a patch on a kernel module called "kmod-usb-net-smsc95xx". I have only the .ipk file of this and several questions;

  • Firstly I couldn't find a way how to feed it to OpenWrt SDK 19.07.7 as a package, I know normally I need a Makefile, sources and compiled output so is there a way that I can get these out of .ipk file?
  • Secondly, can I use "quilt" on it and simply patch it without performing a ground zero packaging?
  • Not even sure should I use SDK or the ImageBuilder for this..

It'd be great If I can get some clarification or a solution.

No one even have an idea about that?

kernel modules are special packages, they are not "real" packages.
They are build settings for kernel compile. The kernel module code is actually part of Linux kernel package.
See this place is where the kernel config is enabled for that package

If you want to change it, you are making a kernel patch, not editing package configuration. You are changing the kernel source code.

I do not know if SDK can work with kernel patches, I have little experience with SDK, I think it only works with normal packages.
Image Builder surely cannot do that (it just works with packages).

The full buildsystem can do that (obviously) and as you said you should be using Quilt to integrate the patch in the build system. See the articles in this paragraph of the documentation

See the documentation for using quilt inside OpenWrt build system, you should follow the "making kernel patches" section.

1 Like

Ok, thanks for your advice, I will try it with buildsystem. I'll update it for any further problem or success.

Ok, I'm able to patch this "kmod" module with full buildsystem. But when I try this with SDK, I can't find this module on menuconfig GUI even though SDK has the same file and "usb-net-smsc95xx" definiton. I don't get it. Is it certain that SDK has not the ability to patch kernel modules, because there are some other kernel modules modularized on that menuconfig.

I am not used to kernel packages, but I found it in the make menuconfig GUI with help of the wiki.

Kernel modules -> USB Support -> kmod-usb-net-smsc95xx

And I guess it is define in this file

### package/kernel/linux/modules/

define KernelPackage/usb-net-smsc95xx
  TITLE:=SMSC LAN95XX based USB 2.0 10/100 ethernet devices
  AUTOLOAD:=$(call AutoProbe,smsc95xx)
  $(call AddDepends/usb-net, +kmod-lib-crc16)

Edit: Ohh I see that @bobafetthotmail already linked that! sorry.

I can perform patching on full buildsystem but I need to know how to do it on SDK or is it possible, I can see this module has definiton in on SDK as well but doesn't appear on menuconfig. Anyone has an idea?

kmod-usb-net-smsc95xx does not appear in your menuconfig under Kernel Modules -> USB Support ?

1 Like

No it doesn't appear on v19.07.7 SDK but it does appear when I compile from source (buildsystem).

Mhh okay I can confirm that with the bcm2710 19.07.7 toolchain you can't access it via the menuconfig.

But if you type / for search in the menuconfig and search for smsc95 you get

┌──────────────────────── Search Results ──────────────────────┐
│ Symbol: PACKAGE_kmod-usb-net-smsc95xx [=m]                   │  
│ Type  : tristate                                             │  
│   Defined at                            |

And as referenced you can find that (in this SDK) the package is selected as module

7933 config PACKAGE_kmod-usb-net-smsc95xx
7934         tristate
7935         default m

So I guess this module should be compiled as well by default, if I get this right.

Afaik, the SDK package is a cut-down toolchain designed to compile userspace packages only without having to use the full build system if you just need to add a few custom packages to your devices.

It cannot build firmware images or kernel, because kernel in OpenWrt is not handled like a package like in most Linux distros. It is seen as "part of the firmware image". So for example you do not update the kernel alone. If you want to update the kernel you must run a sysupgrade, a full firmware upgrade procedure.

1 Like

I couldn't succeed with the SDK. So I guess SDK can't be used to patch kernel packages, thanks for your efforts anyway..