Building kernel driver.
-
Hi building gurus,
I spent a few days trying to figure out how to add support of device driver to my Omega2p. I read Building Kernel Modules for the Omega2, but finally, I think it is not my case. I also read official OpenWrt Build system usage.I need the support of usb-eth device LAN78xx. That is part of the kernel but not available for Omega. So after all I read and tried I did
make kernel_menuconfig
In Device Drivers-USB support-<> Support for Host-side USB
and
Device Drivers-Network device support - USB Network Adapters - < or M>Microchip LAN78XX Based USB Ethernet Adaptersthen
make -j4
the build was done, but the support of LAN78XX still missing and module lan78xx is unknown.
Then I think I still miss something or maybe I am wrong/unsure how it all works.
Also I have a question if it is possible to compile it only as a module (.ko or .ipk) and install it later with
insmod
oropkg
. From all I read until now it is not recommended to compile as M better to mark it with * to be a static part of the kernel.Thank you for hints or links how to.
-
@Martin-Vana, kernel objects for Omegas are big problem, same problem with I2S sound card, TFT-displays, RTC and others device drivers.
You have to recompile your own firmware. But why you need external LAN78XX device, Ethernet port is already in Omega, you can only append transformer and RJ-45 or connect expand shield to use it.
-
@Modest-Polykarpovich I need a second interface and PHY is not standard 4 wire ethernet. LAN7801 is only MAC and specific PHY is connected via RGMII. On Win10 computer my HW works, but I need to embed it with Omega.
Recompile own firmware you mean recompile Kernel or something else? Until now I recompile sources from omega repo and all packages I need I found in make_menuconfig. Is there somewhere any tutorial on how to recompile Kernel with own modules? It seems that changes in make kernel_menuconfig do not take effect.
-
@Martin-Vana This guide might be helpful: https://community.onion.io/topic/2830/building-kernel-modules-for-the-omega2
-
@Lazar-Demin thank you for the link, I read it many times as I mentioned it in my first post. But the difference is that Max has own source code with own function. I want a module that's source code is already in kernel mainline with some dependencies and I am not sure if selecting module in
make kernel_menuconfig
is the right way because after compilation the module is still unknown. No .ko or .ipk produced. If I understand it correctly I do not need to modify feeds or do I?
-
@Martin-Vana No need to modify feeds.
From my experiencemake kernel_menuconfig
sets up how kernel modules should be treated - whether they should be built-in to the kernel, or can be loaded as kernel modules.Once you've done your configuration in
make kernel_menuconfig
, you'll need to enable the kernel module for compilation inmake menuconfig
.Then run make, and you'll get an ipk.
-
Thank you for your tips. I was doing everything correctly (maybe). Because I found compiled lan78xx.ko. Previously I was looking in the wrong folder. And my second mistake was that after flashing image into Omega I expected that module will be list when I type
lsmod
but it lists only installed modules but not the statically built-in kernel. Does someone know how to list kernel built-in modules?Tip for somebody who needs a driver that source is part of the kernel already.
make kernel_menuconfig
find there your driver and mark it * for the static part of the kernel or M for a module.make world
or only recompile kernel - it is much faster.
make target/linux/compile
you will find compiled .ko if you want to install it withinsmod
or you can continue with
make target/linux/install
and
make target/install
and you will get new .bin image with recompiled kernel