• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 698
  • Last Modified:

How to add a debug flag while compiling the kernel

Hi all,

I tried adding the -DDEBUG flag in the top level make file
but I get this error when I do "make bzImage"

In file included from init/do_mounts.c:913:
init/../lib/inflate.c: In function `inflate':
init/../lib/inflate.c:999: warning: implicit declaration of function `fprintf'
init/../lib/inflate.c:999: `stderr' undeclared (first use in this function)
init/../lib/inflate.c:999: (Each undeclared identifier is reported only once
init/../lib/inflate.c:999: for each function it appears in.)
make: *** [init/do_mounts.o] Error 1                          


How do I set the Debug flag while compiling the linux kernel.

Also I wonder if I have to edit the toplevel Makefile
can I do it using "make menuconfig" .Please let me know


Thanks
0
sanjay_thakur
Asked:
sanjay_thakur
2 Solutions
 
bryanhCommented:
Don't know what you man by the "Debug flag," but you're probably interested in the kernel debug configuration option.  You can set that with make menuconfig by choosing "kernel hacking" from the first menu and "kernel debugging" from the next.

By setting -DDEBUG, you found somewhat of a bug in a piece of code that was designed for user space and ported to the kernel.  But no one expects you to define DEBUG.
0
 
garbouaCommented:
function fprintf is a "user space function" and should not exist in a kernel module.  check out the file inflate.c and remove the fprintf. You should submit a correction, or a bug report :-)
0
 
garbouaCommented:
ps what kernel are you trying to build?
0
 
sanjay_thakurAuthor Commented:
I am trying to build linux kernel version 2.4 for Power PC
440.
0
 
jmcgOwnerCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: bryanh {http:#8030982} & garboua {http:#8061817}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now