Quote:
Originally Posted by slzckboy
well,I'm not too familiar with make.
|
Hello,
I think you are skipping some steps. You should learn a bit on make with not-kernel code.
Anyway, you can help yourself by inserting your module in the kernel source tree, so you don't have to bother with makefile and the options passed to GCC for creating a module example:
put your source file in /home/me/ldd3
call it hello.c then
Code:
cd /usr/src/linuxxxx
cd drivers
ln -s /home/me/ldd3
Tell the makefile that there is a module directory in ldd3 that has to be added to the list:
Code:
echo "obj-m += ldd3" >> Makefile
Create a dummy makefile in this directory.
You add hello2.o to the list (+=) of modules the top makefile has to compile.
Code:
cd ldd3
echo "obj-m += hello.o" > Makefile
now go back to the kernel root, it is where you can issue make modules and the Makefile will descent into the whole directories and compiles the list of modules (obj-m).
Code:
cd /usr/src/linux
make modules
cd drivers/ldd3
insmod ./hello.ko
tail /var/log/kern.log