Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Can not modprobe any driver

Hi guys

I have strange situation. Some time ago I realized that I can not load any module to Linux (I'm working with MMU). I wrote then simple driver to check:

# include <linux/init.h># include <linux/module.h>

static int __init hello_init(void)

{

printk(KERN_ALERT "Hello module is running\n");

return 0;

}

static void __exit hello_exit(void)

{

printk(KERN_ALERT "Hello module is exit\n");

}

module_init(hello_init);

module_exit(hello_exit);

When I use this drives as module in configuration, I put modprobe hello and system hangs. But when I add this driver to the kernel as static driver this driver is loading without problems. I see on the console:ttyJ0 at MMIO 0x4001450 (irq = 2) is a Altera JTAG UART

console [ttyJ0] enabled, bootconsole disabled

console [ttyJ0] enabled, bootconsole disabled

ttyS0 at MMIO 0x4001400 (irq = 1) is a Altera UART

hello module is running

mice: PS/2 mouse device common for all mice

TCP cubic registered

NET: Registered protocol family 17

Freeing unused kernel memory: 2720k freed (0xc21cd000 - 0xc2474000)

Welcome to

____ _ _

/ __| ||_|

_ _| | | | _ ____ _ _ _ _

| | | | | | || | _ \| | | |\ \/ /

| |_| | |__| || | | | | |_| |/

| ___\____|_||_|_| |_|\____|\_/\_/

| |

|_|

For further information check:

http://www.uclinux.org/

BusyBox v1.16.2 (2013-06-14 13:30:28 CEST) hush - the humble shell

Enter 'help' for a list of built-in commands.

root:/>

What is here going on? Why I can not load any driver? When I use insmod the situation is the same... :/

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    That's great! :)

    I made changees as you mentioned in kernel.c for using kmalloc intead vmalloc and now loading modules is working.

    But this situation is really really strange. I used insmod while I was programming my module for custom hardware in FPGA in two last weeks. I loaded modules via NFS. Everything was ok... When my driver was finished I changed to put it into the kernel and I didn't use dynamic loading. And sometime ago I tried load the driver again and it was not working... I didn't know what was going on. But now when I made changes as you Kazu said it comes back to work... But befere it wokrs with vmalloc I think..