Skip to main content

Thread: Kernel Programming in C


i trying learn karnel programming system programming lab @ university. so, tried first sample hello-1.c
code:
#include <linux/module.h> #include <linux/kernel.h>  int init_module(void) {     printk(kern_info "hello world 1.\n");     return 0; }  void cleanup_module(void) {     printk(kern_info "goodbye cruel world 1.\n"); }
to compile file, i've written following makefile
code:
obj-m += hello-1.o  all:     make -c /lib/modules/$(shell uname -r)/build m=$(pwd) modules  clean:     make -c /lib/modules/$(shell uname -r)/build m=$(pwd) clean
when try run file using make command (obviously using sudo) following error:
code:
zobayer@zobayer:~/lab/system/kernel$ sudo make [sudo] password zobayer:  make -c /lib/modules/2.6.38-8-generic/build m= modules make[1]: entering directory `/usr/src/linux-headers-2.6.38-8-generic'   hostcc  scripts/basic/fixdep   hostcc  scripts/basic/docproc   hostcc  scripts/kconfig/conf.o   hostcc  scripts/kconfig/kxgettext.o   hostcc  scripts/kconfig/zconf.tab.o   hostld  scripts/kconfig/conf scripts/kconfig/conf --silentoldconfig kconfig make[1]: leaving directory `/usr/src/linux-headers-2.6.38-8-generic' make[1]: entering directory `/usr/src/linux-headers-2.6.38-8-generic'   chk     include/linux/version.h   chk     include/generated/utsrelease.h   upd     include/generated/utsrelease.h make[2]: *** no rule make target `kernel/bounds.c', needed `kernel/bounds.s'.  stop. make[1]: *** [prepare0] error 2 make[1]: leaving directory `/usr/src/linux-headers-2.6.38-8-generic' make: *** [all] error 2 zobayer@zobayer:~/lab/system/kernel$
can please tell me what's wrong here?

in makefile have:

code:
make -c /lib/modules/$(shell uname -r)/build m=$(pwd) modules
but when run it, it's displayed as:

code:
make -c /lib/modules/2.6.38-8-generic/build m= modules
as can see there's nothing after m=, $(pwd) failing print out working directory.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Kernel Programming in C


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support