OpenWrt Kernel Module Creation Howto

About OpenWrt Kernel Module Compilation

You are planning to compile a kernel module? This howto will explain what you have to do, to have your kernel module installable as an ipkg.

Enable the kernel options

Enable the kernel options you want by modifying build_mipsel/linux/.config. We are assuming, that 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 are not getting lost, when doing a 'make dirclean'. Here we assume that you are compiling for Broadcom chipset based devices:

 $ cp .config ../../../target/linux/linux-2.4/config/brcm 

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 is 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-kbd
Priority: optional
Section: sys
Maintainer: Markus Becker <mab@comnets.uni-bremen.de>
Source: buildroot internal
Description: 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

最新文章

  1. 常用doc命令
  2. MySQL数据类型——数值类型
  3. MPlayer-2016-bin-noConsole
  4. Android 5.x特性概览二
  5. Android Studio 实用插件整理
  6. jsp中四种传递参数的方法
  7. 学习Windows Azure 视频集合大全
  8. Memcache的基本应用
  9. [置顶] Android图片异步加载之Android-Universal-Image-Loader
  10. C语言之循环结构
  11. 管理 Machine - 每天5分钟玩转 Docker 容器技术(47)
  12. 五分钟学习React(二):我的第一个Hello World
  13. jstl标签库示例一
  14. 查看linux的进程到底用了多少内存
  15. 套接字工厂——ServerSocketFactory
  16. jQuery在页面加载的时候自动调用某个函数的方法
  17. 为什么我的Linux ls命令不能用了?
  18. 查询大数据表的效率对比:Linq to SQL、Entity Framework、企业库存储过程、ADO.Net
  19. guzzle http异步 post
  20. 2019.1.22 zigbee test

热门文章

  1. QT,QLabel添加超链接
  2. VS2017 打包成exe
  3. docker-compose进入容器出现unable to find user root: no matching entries in passwd file
  4. SQLServer —— 用户权限操作
  5. 【JZOJ4887】【NOIP2016提高A组集训第13场11.11】最大匹配
  6. Linux 下的mysql+centos7+主从复制
  7. 解决:&quot;UnicodeEncodeError: &#39;ascii&#39; codec can&#39;t encode character u&#39;\xa0&#39; in position&quot;错误
  8. python的sorted排序具体解释
  9. 笔记:在 Windows 10 WSL Ubuntu 18.04 安装 Odoo12 (2019-06-09)
  10. 洛谷 1463[SDOI2005] 反素数ant