ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] Forcing DEBUG for pr_debug in kernel driver through LTIB


From: Michael Jones
Subject: Re: [Ltib] Forcing DEBUG for pr_debug in kernel driver through LTIB
Date: Tue, 24 Nov 2009 16:51:31 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Franz Trierweiler wrote:
Stuart Hughes a écrit :
Hi Franz,

As far as ltib goes, you can do: ./ltib -p kernel -c and that will unpack the kernel sources and drop you to the kernel config screen. If the kernel config system has a configuration point to set KERN_DEBUG then you can set it there, save and exit and the kernel will build. If there is no config point for it, you'll have to edit the file manually.

Regards, Stuart

Franz Trierweiler wrote:
Hello everybody

Freescale has just issued a new PDK (PDK 1.6) for the iMX25 3-stack evalboard. I have hardwired a SIM interface to my evalboard so that I can scope all electrical signals coming from that cell. The fact is that I am trying to debug the mxc_sim.c source file for this SIM interface. mxc_sim is a SIM driver. In order to achieve this, I would like to enable pr_debug (...) output to my console when this driver is running and watch all debug messages displayed.

The kernel.h shows the pr_debug macro like this:

/* If you are writing a driver, please use dev_dbg instead */
#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
#define pr_debug(fmt, ...) do { \
   dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
   } while (0)
#elif defined(DEBUG)
#define pr_debug(fmt, ...) \
   printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#else
#define pr_debug(fmt, ...) \
   ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
#endif

There seems that if I #define DEBUG somewhere then I will have the messages displayed (or logged) somewhere.

Is there a way of doing this properly in the LTIB configuration when recompiling the kernel ?

Or should I simply #define DEBUG in kernel.h? (This really does not sound the right way).

Or should I simply put DEBUG=ON (or something like this) in the LTIB perl script? (sounds also very dirty).

I really would like to make this in a clean way.

Regards,
Franz

Hi Stuart,

There is no configuration point for KERN_DEBUG but I found a few references to DEBUG in ~/ltib/config/platform/imx/imx25_3stack_defconfig.dev

#
# Kernel hacking
#
# CONFIG_PRINTK_TIME is not set
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=1024
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
# CONFIG_DEBUG_MEMORY_INIT is not set
CONFIG_FRAME_POINTER=y
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
# CONFIG_LATENCYTOP is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_HAVE_FUNCTION_TRACER=y

It is recommended not to edit this file. Thus, I suspect there is a clean way of configuring CONFIG_DEBUG_KERNEL through LTIB. I invoked ltib with --configure and chose "Configure the kernel" (as usual) but never was successful in finding the corresponding options. The --configure option makes changes in ~/ltib/config/platform/imx/imx25_3stack_defconfig.dev, thus I suspect I am not too far from what I am looking for.

I will try to modify the file by hand.

Regards,
Franz


_______________________________________________
LTIB home page: http://ltib.org

Ltib mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/ltib

Hi Franz,

That is a kernel config file, not an LTIB config file, so there must be a configuration point for it in the kernel config menu, not the LTIB config. You can type slash in the kernel config menu to search for a particular CONFIG_ option, e.g. "/DEBUG_KERNEL". Then you'll see where it's defined in the sources and where it is buried in the menu.

In my kernel (2.6.23), this is located in the "Kernel hacking" submenu of the kernel config menu. It looks like it's still there in 2.6.31, too. However, I think DEBUG_KERNEL only makes it possible to enable some other DEBUG options which are in their own menus and Makefiles. I would work the other way around though and look in the Makefile which builds mxc_sim.c. If there are a few lines like e.g.

ifeq ($(CONFIG_DEBUG_MXC_SIM_DRIVER),y)
EXTRA_CFLAGS += -DDEBUG
endif

then you would need to hunt down CONFIG_DEBUG_MXC_SIM_DRIVER in the kernel config. If there's no mention of "-DDEBUG" at all in your mxc_sim.c's Makefile, then you're probably left with #define'ing it yourself in the sources (but consider doing it in mxc_sim.c before including kernel.h and not directly in kernel.h).

sincerely,
Michael

MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, 
Hans-Joachim Reich




reply via email to

[Prev in Thread] Current Thread [Next in Thread]