anoopajay87
January 24th, 2012, 06:47 AM
hi guys,
i was trying to run the simple hello world program...
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
i used the following make file..
obj-m += hello.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
i was able to built the make file and isert the module in to kernel using insmod command
but when i tried using this command "sudo insmod ./hello.ko"
i was not able to get the result displayed on the command line,instead the result was written in the system log(syslog)
how can i get the result displayed in the command line on executing the program?
can you please help me?
i was trying to run the simple hello world program...
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
i used the following make file..
obj-m += hello.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
i was able to built the make file and isert the module in to kernel using insmod command
but when i tried using this command "sudo insmod ./hello.ko"
i was not able to get the result displayed on the command line,instead the result was written in the system log(syslog)
how can i get the result displayed in the command line on executing the program?
can you please help me?