2

I'm writing a kernel module that receives interrupts for mpc8308 (PowerPC) board. when I make the code for Ubuntu and my current version of kernel it works well with interrupt of keyboard, but when I Cross build it for mpc8308 board (2.6.29.6 kernel) and I want to load it into kernel with insmod command I get error:

insmod: cannot insert './intrpt.ko': Function not implemented

my code is:

#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");

and output of modinfo ./intrpt.ko is:

filename:       ./intrpt.ko
description:    A sample driver
author:          
license:        GPL
depends:        
vermagic:       2.6.29.6-rt23 mod_unload 
AVM
  • 106
  • 2
  • 7
  • Googling for insmod error message "Function not implemented" find [that question](http://stackoverflow.com/questions/9431560/loading-kernel-module-in-android-kernel). Looks like you have no module support in your target kernel. – Tsyvarev May 23 '16 at 07:55
  • I have previously loaded another module that just contains printk and it works, that mean my target kernel supports module loading. it seems that the problem is from request_irq function. – AVM May 23 '16 at 08:15
  • 1
    Hm, then it is `request_irq` which returns `-ENOSYS` error code. I found [this check](http://lxr.free-electrons.com/source/kernel/irq/manage.c#L1112), which return given code: `if (desc->irq_data.chip == &no_irq_chip)`. It means that there is no controller support for given `irq`. – Tsyvarev May 23 '16 at 08:36
  • 1
    to determine irq numbers available on mpc8308, I looked mpc8308rdb.dts file on internet (but I can't find it in my linux source files or Cross toolchain why?) and I found serial1 irq is 10. with this information insmod steel not worked, but by some try it works for irq=20. that's all, thanks – AVM May 23 '16 at 12:31

0 Answers0