|
|
Log in / Subscribe / Register

Driver porting: hello world

Driver porting: hello world

Posted Jul 14, 2004 6:59 UTC (Wed) by hemal (guest, #23037)
Parent article: Driver porting: hello world

Hello every1,
I am new to Linux and just installed Fedora Core 2. I tried adding a simple hello world module but I have been getting problems.
This is my hello.c program:

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

static int hello_init(void)
{
printk("<1> Hello, world\n");
return 0;
}

static void hello_exit(void)
{
printk("<1> Goodbye, cruel world\n");
}

module_init(hello_init);
module_exit(hello_exit);


The Makefile for this is:

ifneq ($(KERNELRELEASE),)
obj-m:= hello.o

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

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

so the problem is once I type the command "make" at the shell prompt it gives the following message :

$ make: Nothing to be done for 'default'

I dont know whats the problem. Can any1 please help me out here. Your help will be appreciated.



to post comments

Driver porting: hello world

Posted Jul 15, 2004 11:34 UTC (Thu) by littertiger (guest, #22470) [Link]

My makefile is simple:

obj-m += hello.o
default:
make -C /lib/modules/$(shell uname -r)/build/ SUBDIRS=$(PWD) modules

Driver porting: hello world

Posted Jul 17, 2004 1:14 UTC (Sat) by bhaskie (guest, #23099) [Link] (3 responses)

Towards the end of the Makefile:
----------
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif
----------
add a tab before the $(MAKE)

copy-pasting code results in such errors. read the man pages.
check http://lwn.net/Articles/21823/ , the Makefile has a tab space there.

Driver porting: hello world

Posted May 24, 2006 9:15 UTC (Wed) by Jackie (guest, #37933) [Link] (2 responses)

I am a newer and my makefile is :

ifneq ($(KERNELRELEASE),)
obj-m:=hello.o

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

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

When I type 'make' on the command line, it says:
make[1]: Entering directory `/lib/modules/2.6.12-10-386'
make[1]: *** No rule to make target `mytest'. Stop.
make[1]: Leaving directory `/lib/modules/2.6.12-10-386'
make: *** [default] Error 2

"2.6.12-10-386" is my kernel version.I don't know why and any answer is appreciated.

Driver porting: hello world

Posted May 24, 2006 9:18 UTC (Wed) by Jackie (guest, #37933) [Link]

I am a newer and my makefile is :

ifneq ($(KERNELRELEASE),)
obj-m:=hello.o

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

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

When I type 'make' on the command line, it says:
make[1]: Entering directory `/lib/modules/2.6.12-10-386'
make[1]: *** No rule to make target `hello'. Stop.
make[1]: Leaving directory `/lib/modules/2.6.12-10-386'
make: *** [default] Error 2

"2.6.12-10-386" is my kernel version.I don't know why and any answer is appreciated.

Driver porting: hello world

Posted Jul 17, 2006 13:12 UTC (Mon) by jameswin (guest, #39125) [Link]

Hello!I got the same problem like you.
Could you guide me how to solve the problem.
Thank you in advance.
jameswin

Driver porting: hello world

Posted Jun 21, 2006 9:00 UTC (Wed) by robin48gx (guest, #38475) [Link]

I added a little to this driver, and implemented the read and write
parts.

I put it on the gumstix tikiwiki http://www.gumstix.org/tikiwiki/tiki-index.php?page=kerne...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds