OpenWrt Kernel module Creation howtoabout OpenWrt Kernel module compilation
Planning to compile a kernel module? This howto would explain what we have to does, to the your kernel module installable as an ipkg.
Enable the kernel options
Enable the kernel options want by modifying Build_mipsel/linux/.config. We are assuming, so you already had your kernel compiled once here. You can do the modification by hand or by
$ cd build_mipsel/linux$ make Menuconfig
and copy it, so your changes is not the getting lost, when doing a ' make Dirclean '. Here we assume this is compiling for Broadcom chipset based devices:
Create a buildroot option
Create a buildroot option by modifying/inserting into target/linux/config.in, e.g.
Config Br2_package_kmod_usb_keyboard        tristate "support for USB keyboards"        default m        depends Br2_package_ Kmod_usb_controller
Define the binary files for the kernel module
Define the binary files for the kernel module by modifying/inserting into target/linux/linux-2.4/makefile, e.g.
$ (eval $ (call kmod_template,usb_keyboard,usb-kbd,$ (Modules_dir)/KERNEL/DRIVERS/INPUT/INPUT.O $ (MODULES_DIR)/ KERNEL/DRIVERS/INPUT/KEYBDEV.O $ (modules_dir)/KERNEL/DRIVERS/USB/USBKBD.O, config_usb_keyb,kmod-usb-core,60, Input Keybdev usbkbd))
Where Config_usb_keyb is the kernel option, Usb_keyboard was the last part of Br2_package_kmod_usb_keyboard and USB-KBD is Part of the filename of the created ipkg.
Specify the ipkg control file
Create e.g. Target/linux/control/kmod-usb-kbd.control with content similar to this:
Package:kmod-usb-kbdpriority:optionalsection:sysmaintainer:markus Becker <[email Protected]>Source: BuildRoot Internaldescription:kernel support for USB keyboards
Compile the kernel module
Enable the kernel module with
$ make Menuconfig
In Topdir and selecting it. Compile with
$ make Dirclean && make
OpenWrt Kernel Module Creation Howto