LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-06-2010, 09:12 AM   #1
shuge_guet
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
The errors of "The hello world module"


Hey all!I am a newer.I have many questiones when leaning module.
My code:

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

MODULE_LICENSE("Dual BSD/GPL")

static int hello_init(void)
{
printk(KERN_ALERT"Hello World enter\n");
return 0;
}

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

module_init(hello_init);
module_exit(hello_exit);

MODULE_AUTHOR("Shuge");
MODULE_DESCRIPTION("A simple Hello World Module");
MODULE_ALIAS("A simplest module");



make -C /opt/Shuge_Linux/arm/linux-2.6.22.6 M=/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word modules
make[1]: Entering directory `/opt/Shuge_Linux/arm/linux-2.6.22.6'
CC [M] /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.o
In file included from include/asm/system.h:6,
from include/asm/bitops.h:23,
from include/linux/bitops.h:9,
from include/linux/thread_info.h:20,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:49,
from include/linux/module.h:9,
from /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:2:
include/asm/memory.h:27:29: asm/arch/memory.h: No such file or directory
In file included from include/asm/system.h:6,
from include/asm/bitops.h:23,
from include/linux/bitops.h:9,
from include/linux/thread_info.h:20,
from include/linux/preempt.h:9,
from include/linux/spinlock.h:49,
from include/linux/module.h:9,
from /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:2:
include/asm/memory.h: In function `virt_to_phys':
include/asm/memory.h:170: error: `PHYS_OFFSET' undeclared (first use in this function)
include/asm/memory.h:170: error: (Each undeclared identifier is reported only once
include/asm/memory.h:170: error: for each function it appears in.)
include/asm/memory.h: In function `phys_to_virt':
include/asm/memory.h:175: error: `PHYS_OFFSET' undeclared (first use in this function)
include/asm/memory.h: In function `virt_to_bus':
include/asm/memory.h:193: warning: implicit declaration of function `__virt_to_bus'
include/asm/memory.h: In function `bus_to_virt':
include/asm/memory.h:198: warning: implicit declaration of function `__bus_to_virt'
In file included from include/linux/timex.h:187,
from include/linux/jiffies.h:8,
from include/linux/ktime.h:25,
from include/linux/timer.h:5,
from include/linux/workqueue.h:8,
from include/linux/slub_def.h:11,
from include/linux/slab.h:121,
from include/linux/percpu.h:5,
from include/asm-generic/local.h:4,
from include/asm/local.h:1,
from include/linux/module.h:19,
from /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:2:
include/asm/timex.h:15:28: asm/arch/timex.h: No such file or directory
In file included from include/linux/ktime.h:25,
from include/linux/timer.h:5,
from include/linux/workqueue.h:8,
from include/linux/slub_def.h:11,
from include/linux/slab.h:121,
from include/linux/percpu.h:5,
from include/asm-generic/local.h:4,
from include/asm/local.h:1,
from include/linux/module.h:19,
from /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:2:
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: warning: "CLOCK_TICK_RATE" is not defined
include/linux/jiffies.h:225:31: division by zero in #if
include/linux/jiffies.h:225:31: division by zero in #if
In file included from include/asm/hardirq.h:6,
from include/linux/hardirq.h:7,
from include/asm-generic/local.h:5,
from include/asm/local.h:1,
from include/linux/module.h:19,
from /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:2:
include/asm/irq.h:4:27: asm/arch/irqs.h: No such file or directory
/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c: At top level:
/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:6: error: syntax error before "static"
/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c: In function `__inittest':
/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:17: error: `hello_init' undeclared (first use in this function)
make[2]: *** [/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.o] error 1
make[1]: *** [_module_/opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word] error 2
make[1]: Leaving directory `/opt/Shuge_Linux/arm/linux-2.6.22.6'
make: *** [modules] error 2

Last edited by shuge_guet; 04-06-2010 at 09:23 AM.
 
Old 04-06-2010, 09:21 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
What is your question?

Hint: track down the first reported error before worrying about the rest:
Quote:
from /opt/Shuge_Linux/Nfs_Linux/devices/Hello_Word/hello.c:2:
include/asm/memory.h:27:29: asm/arch/memory.h: No such file or directory
How is hello.c relevant?
Find the memory.h file
 
Old 04-06-2010, 10:13 AM   #3
shuge_guet
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to Compile "hello world" Kernel Module (please help!) antdengineer Programming 9 12-04-2010 04:07 AM
What is the error "invalid module format" and "insert kernel module"? shayori Linux - Newbie 8 02-25-2010 03:48 AM
Printk won't "print" from probe() ::::A hello world module-pci device knockout_artist Linux - Kernel 1 08-14-2008 03:41 AM
Unable to compile "hello world" module on openSuse11 knockout_artist Linux - Kernel 6 08-12-2008 04:58 AM
Is ".gz" archive file considered "World-Readable"? NightSky Linux - Newbie 4 12-06-2007 05:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration