hi all: I'm confused with pr_debug. My codes is: ########################################### #include <linux/module.h> #include <linux/kernel.h> static int __init init_page_dir(void) { pr_debug("Hello world\n"); return 0; } static void __exit exit_page_dir(void) { pr_debug("\nGoodbye now...\n\n"); } MODULE_LICENSE("GPL"); module_init(init_page_dir); module_exit(exit_page_dir); ########################################### I make it, and insmod it. But the messages of "Hello world" don't show. So, My question is If i want to fix it , I should set the *DEFAULT_MESSAGE_LOGLEVEL and * *rebuild the kernel ?* My kernel version is:2.6.18 OS is: centOS Thank you.
On Wed, Jun 25, 2014 at 02:09:40PM +0800, lx wrote:
hi all: I'm confused with pr_debug. My codes is: ########################################### #include <linux/module.h> #include <linux/kernel.h>
static int __init init_page_dir(void) { pr_debug("Hello world\n"); return 0; }
static void __exit exit_page_dir(void) { pr_debug("\nGoodbye now...\n\n"); }
MODULE_LICENSE("GPL"); module_init(init_page_dir); module_exit(exit_page_dir); ########################################### I make it, and insmod it. But the messages of "Hello world" don't show.
So, My question is If i want to fix it , I should set the *DEFAULT_MESSAGE_LOGLEVEL and * *rebuild the kernel ?*
https://www.kernel.org/doc/local/pr_debug.txt
My kernel version is:2.6.18 OS is: centOS
Thank you.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
refer this :https://www.kernel.org/doc/local/pr_debug.txt On 06/25/2014 11:39 AM, lx wrote:
hi all: I'm confused with pr_debug. My codes is: ########################################### #include <linux/module.h> #include <linux/kernel.h>
static int __init init_page_dir(void) { pr_debug("Hello world\n"); return 0; }
static void __exit exit_page_dir(void) { pr_debug("\nGoodbye now...\n\n"); }
MODULE_LICENSE("GPL"); module_init(init_page_dir); module_exit(exit_page_dir); ########################################### I make it, and insmod it. But the messages of "Hello world" don't show.
So, My question is If i want to fix it , I should set the /DEFAULT_MESSAGE_LOGLEVEL and / /rebuild the kernel ?/
My kernel version is:2.6.18 OS is: centOS
Thank you.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Varka Bhadram <varkabhadram@gmail.com> writes:
refer this :https://www.kernel.org/doc/local/pr_debug.txt
That seems a little outdated since it doesn't mention the extremely useful dynamic debug feature. So please read https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt as well. The ability to dynamically switch on and off debug messages per callsite is extremely useful. And it also enables you to switch on some extra info you often want, like function names, without having to explictly put them into every format string. I recommend setting CONFIG_DYNAMIC_DEBUG and taking a look at /sys/kernel/debug/dynamic_debug/control if you ever do any kernel development. Bjørn
thank you. But the Makefile is so simple and Not use "cc". ################################# obj-m := task_01.o KDIR:=/lib/modules/`uname -r`/build PWD:=$(shell pwd) default: echo $KDIR $(MAKE) -C $(KDIR) M=$(PWD) modules ################################# So, how to add "CFLAGS"? 2014-06-25 16:20 GMT+08:00 Bjørn Mork <bjorn@mork.no>:
Varka Bhadram <varkabhadram@gmail.com> writes:
refer this :https://www.kernel.org/doc/local/pr_debug.txt
That seems a little outdated since it doesn't mention the extremely useful dynamic debug feature. So please read https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt as well.
The ability to dynamically switch on and off debug messages per callsite is extremely useful. And it also enables you to switch on some extra info you often want, like function names, without having to explictly put them into every format string.
I recommend setting CONFIG_DYNAMIC_DEBUG and taking a look at /sys/kernel/debug/dynamic_debug/control if you ever do any kernel development.
Bjørn
On 06/25/2014 03:17 PM, lx wrote:
thank you. But the Makefile is so simple and Not use "cc". ################################# obj-m := task_01.o
CFLAGS_task_01.o := -DDEBUG
KDIR:=/lib/modules/`uname -r`/build PWD:=$(shell pwd)
default: echo $KDIR $(MAKE) -C $(KDIR) M=$(PWD) modules #################################
So, how to add "CFLAGS"?
Thank you. I fix it EXTRA_CFLAGS += -DDEBUG 2014-06-25 17:50 GMT+08:00 Varka Bhadram <varkabhadram@gmail.com>:
On 06/25/2014 03:17 PM, lx wrote:
thank you. But the Makefile is so simple and Not use "cc". ################################# obj-m := task_01.o
CFLAGS_task_01.o := -DDEBUG
KDIR:=/lib/modules/`uname -r`/build PWD:=$(shell pwd)
default: echo $KDIR $(MAKE) -C $(KDIR) M=$(PWD) modules #################################
So, how to add "CFLAGS"?
On Tue, Jun 24, 2014 at 11:09 PM, lx <lxlenovostar@gmail.com> wrote:
hi all: I'm confused with pr_debug. My codes is: ########################################### #include <linux/module.h> #include <linux/kernel.h>
static int __init init_page_dir(void) { pr_debug("Hello world\n");
use printk or do echo "file_name +p" > /sys/kernel/debug/dyanmic_debug/control
return 0; }
static void __exit exit_page_dir(void) { pr_debug("\nGoodbye now...\n\n"); }
MODULE_LICENSE("GPL"); module_init(init_page_dir); module_exit(exit_page_dir); ########################################### I make it, and insmod it. But the messages of "Hello world" don't show.
So, My question is If i want to fix it , I should set the *DEFAULT_MESSAGE_LOGLEVEL and * *rebuild the kernel ?*
My kernel version is:2.6.18 OS is: centOS
Thank you.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Wed, Jun 25, 2014 at 11:39 AM, lx <lxlenovostar@gmail.com> wrote:
hi all: I'm confused with pr_debug. My codes is: ########################################### #include <linux/module.h> #include <linux/kernel.h>
static int __init init_page_dir(void) { pr_debug("Hello world\n"); return 0; }
Add ccflags-y += -DDEBUG in your Kbuild or Makefile that should work.
static void __exit exit_page_dir(void) { pr_debug("\nGoodbye now...\n\n"); }
MODULE_LICENSE("GPL"); module_init(init_page_dir); module_exit(exit_page_dir); ########################################### I make it, and insmod it. But the messages of "Hello world" don't show.
So, My question is If i want to fix it , I should set the DEFAULT_MESSAGE_LOGLEVEL and rebuild the kernel ?
My kernel version is:2.6.18 OS is: centOS
Thank you.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- ---P.K.S
participants (6)
-
anish singh -
Bjørn Mork -
lx -
Pranay Srivastava -
Real Name -
Varka Bhadram