Kernel Programming

ben darby ben at cvrse.com
Fri Apr 6 11:59:41 UTC 2007


* Shrikar archak wrote:
> Hi ,
> I am a newbie to kernel programming and trying out some simple examples
> given in a tutorial
> the program is given below
>
<snip> hello1.c
> 
> ============================================
> I get the following error when i try to compile
> I have installed the kernel headers as well
> 
> 
> shrikar at shrikar-desktop:~/kernel-programming$  gcc -D__KERNEL__  -DMODULE
> -DLINUX -Wall -c hello1.c
> In file included from /usr/include/linux/sched.h:16,
>                 from /usr/include/linux/module.h:9,
>                 from hello1.c:1:
> /usr/include/linux/signal.h:2:2: warning: #warning "You should include <
> signal.h>. This time I will do it for you."
> In file included from /usr/include/linux/resource.h:4,
<snip>

create a Makefile in ~/kernel-programming containing:

#### start file #####
obj-m += hello1.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
#### end file ####

and then run 'make' to build the module, 'sudo insmod hello1.ko', etc.


-- 
ben darby
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070406/2d9c4311/attachment.sig>


More information about the ubuntu-users mailing list