0

I tried to compile simple kernel module. but accepted below message

--------------------------------------------------------------------------------

make -C /lib/modules/3.18.3/build SUBDIRS=/home/sekwon/study/tree/b+tree modules
make[1]: Entering directory `/home/sekwon/study/linux-3.18.3'
Building modules, stage 2.
MODPOST 1 modules
WARNING: "btree_insert" [/home/sekwon/study/tree/b+tree/lsk_b+tree.ko] undefined!
WARNING: "btree_geo32" [/home/sekwon/study/tree/b+tree/lsk_b+tree.ko] undefined!
WARNING: "btree_init" [/home/sekwon/study/tree/b+tree/lsk_b+tree.ko] undefined!
WARNING: "btree_destroy" [/home/sekwon/study/tree/b+tree/lsk_b+tree.ko] undefined!
make[1]: Leaving directory `/home/sekwon/study/linux-3.18.3'

--------------------------------------------------------------------------------

and this below is my module source code

--------------------------------------------------------------------------------

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

struct btree_head bptree_head;

static int bptree_init(void)
{
   int i, val[10];
   unsigned long key[10];
   int result;
   printk(KERN_ALERT"B+tree start!\n");

   for(i = 0; i < 10; i++)
   {
       key[i] = 1*(i+1);
       val[i] = 10*(i+1);
   }

   result = btree_init(&bptree_head);

   for(i = 0; i < 10; i++)
   {
       result = btree_insert(&bptree_head, &btree_geo32, &key[i], &val[i], 0);
       printk(KERN_ALERT"Insert key(%ld) val(%d)\n",key[i],val[i]);
   }

   printk(KERN_ALERT"Insert finish\n");
   return 0;
}

static void bptree_exit(void)
{
    printk(KERN_ALERT "B+tree finish\n");
    btree_destroy(&bptree_head);
}

module_init(bptree_init);
module_exit(bptree_exit);

MODULE_LICENSE("Dual BSD/GPL");

--------------------------------------------------------------------------------

and this below is my Makefile

--------------------------------------------------------------------------------

obj-m   :=lsk_b+tree.o

KDIR    :=/lib/modules/$(shell uname -r)/build
PWD     :=$(shell pwd)

default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
    rm -rf *.ko
    rm -rf *.mod.*
    rm -rf .*.cmd
    rm -rf *.o

--------------------------------------------------------------------------------

which make problem??

please help me~!!

2
  • You have to run depmod -a to recreate a dependency data base. Commented Jan 24, 2015 at 13:51
  • yeah. I found that btree's functions are not in Module.symvers.... how can I make btree's functions to Module.symvers??? Commented Jan 25, 2015 at 0:55

1 Answer 1

1

I solved this problem!!

I discovered that compiled kernel modules didn't include B Tree module (btree)

so, I tried to change configuration for compiling B Tree module

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.