Find the answer to your Linux question:
Results 1 to 2 of 2
Hello all, I have 2 simple modules. The first one exports 2 functions and the second one uses those exported functions. These work perfectly on Redhat 5.0 or Suse Enterprise ...
  1. #1
    Just Joined!
    Join Date
    Mar 2006
    Posts
    25

    Thumbs up Module does not load into Suse Enterprise Server 11 kernel

    Hello all,

    I have 2 simple modules. The first one exports 2 functions and the second one uses those exported functions. These work perfectly on Redhat 5.0 or Suse Enterprise Server10 but not on Suse Enterprise Server 11.

    In order to be able to compile the modules on Suse Enterprise Server 11, I do "make cloneconfig" then "make modules_prepare" in /usr/src/linux.

    At first the kernel of Suse Enterprise 11 complains "invalid module format" when I insert the first module in using "insmod mod1.ko". so I recompile the modules using modversions (copy Module.symvers from /usr/src/linux-2.6.27.19-5-obj/i386/pae to /usr/src/linux and do "make" again). This time the first module loads OK but the second module does not load. The kernel displays these error messages:
    "insmod: error inserting 'mod2.ko': -1 Unknown symbol in module"
    "mod2: no symbol version for export1"
    "mod2: Unknown symbol export1"

    My questions are: does the way to export symbol change in kernel version 2.6.26 and later (SuSe Enterprise server has kernel 2.6.27)? Is there an extra step to prepare for compiling kernel module (usually I do "make cloneconfig" then "make modules_prepare" in /usr/src/linux)? Is there anyone out there that ran into this problem before? Is there a solution for this? The source files are shown below.

    Your help is greatly appreciated. Thank you.

    /***********/
    /* module1.c */
    /***********/

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

    MODULE_LICENSE ("Proprietary");

    void export1(void);
    void export2(void);

    static int hello_init(void)
    {
    printk(KERN_ALERT "Hello, world\n");
    return 0;
    }
    static void hello_exit(void)
    {
    printk(KERN_ALERT "Goodbye, cruel world\n");
    }

    void export1(void)
    {
    printk(KERN_ALERT "Hello, there\n");
    }

    void export2(void)
    {
    printk(KERN_ALERT "Poor you, goodbye\n");
    }

    EXPORT_SYMBOL(export1);
    EXPORT_SYMBOL(export2);

    module_init(hello_init);
    module_exit(hello_exit);

    /********************/
    /* Makefile of module1.c */
    /********************/
    EXTRA_CFLAGS += -DMODVERSIONS

    KVERSION = $(shell uname -r)
    KDIR = /usr/src/linux

    obj-m += mod1.o
    mod1-objs := module1.o

    all:
    make -C $(KDIR) M=$(PWD) modules
    clean:
    make -C $(KDIR) M=$(PWD) clean

    /***********/
    /* module2.c */
    /***********/
    #include <linux/init.h>
    #include <linux/module.h>

    MODULE_LICENSE ("Proprietary");

    extern void export1(void);
    extern void export2(void);


    static int hello_init(void)
    {
    export1();
    return 0;
    }
    static void hello_exit(void)
    {
    export2();
    }

    module_init(hello_init);
    module_exit(hello_exit);

    /********************/
    /* Makefile of module2.c */
    /********************/
    EXTRA_CFLAGS += -DMODVERSIONS

    KVERSION = $(shell uname -r)
    KDIR = /usr/src/linux

    obj-m += mod2.o
    mod2-objs := module2.o

    all:
    make -C $(KDIR) M=$(PWD) modules
    clean:
    make -C $(KDIR) M=$(PWD) clean

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    Please do not post duplicate threads. If you feel that a post is better elsewhere, use the report button to ask a moderator to move it for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...