1

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
0

I also faced this problem while inserting module into the kernel. Enter your current kernel version correctly go to cd /lib/modules/your-kernel-version-gereric/ directory and check whether build directory is present or not. If present then you can directly compile your module using below command

make -C /lib/modules/$(shell uname -r)/build M=$(PWD)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.