Re: Simple Hello World error
- From: "miline" <milind.dumbare@xxxxxxxxx>
- Date: 21 Aug 2006 23:11:03 -0700
elliotng.ee@xxxxxxxxx wrote:
Hey everyone,
I am running Linux kernel 2.6.17.8 with ubuntu.
I wrote a simple HelloWorld program, and it is not displaying the init
call on /var/log/kern.log
Here's the hello.c file:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("Dual BSD/GPL");
static int __init hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Here's the Makefile:
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language
ifneq ($(KERNELRELEASE),)
obj-m := HelloWorld.o
# Otherwise we were called directly from the command
# line , invoke the kernel build system.
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
----
sudo insmod ./hello.ko will not display anything in the log
sudo rmmod hello will display the exit statement
It seems your klogd is having problem
Are you able to see other messages in /var/log/kern.log. Check your
/etc/syslog.conf for whether all kern.* messages are sent to
/var/log/kern.log.
Check also wheather its running "/etc/init.d/klogd status"
.
- References:
- Simple Hello World error
- From: elliotng . ee
- Simple Hello World error
- Prev by Date: Re: What is the best tool for traceing the driver??
- Next by Date: PCI IRQ number reported by scanpci and lspci are different.
- Previous by thread: Simple Hello World error
- Next by thread: About serial communication
- Index(es):
Relevant Pages
|