我正在编写一个内核模块来接收 mpc8308 (PowerPC) 板的中断。当我为 Ubuntu 和我当前版本的内核编写代码时,它可以很好地处理键盘中断,但是当我为 mpc8308 板(2.6.29.6 内核)交叉构建它并且我想用insmod
命令将它加载到内核中时,我得到了错误:
insmod: cannot insert './intrpt.ko': Function not implemented
我的代码是:
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#define DRIVER_AUTHOR "AVM"
#define DRIVER_DESC "A sample driver"
static irqreturn_t irq_handler(int irq, void *dev_id, struct pt_regs *regs)
{
printk(KERN_ALERT "Hello Interrupt world.\n");
return IRQ_HANDLED;
}
/*
* Initialize the module − register the IRQ handler
*/
int init_module()
{
free_irq(1, NULL);
return request_irq(1, irq_handler, IRQF_SHARED, "test_keyboard_irq_handler",
(void *)(irq_handler));
}
/*
* Cleanup
*/
void cleanup_module()
{
free_irq(1, NULL);
}
MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_SUPPORTED_DEVICE("testdevice");
和输出modinfo ./intrpt.ko
是:
filename: ./intrpt.ko
description: A sample driver
author:
license: GPL
depends:
vermagic: 2.6.29.6-rt23 mod_unload