I am compiling a kernel for my raspberry pi (on the pi). I checked necessary configuration and enabled DEBUG_INFO=y and REDUCED_DEBUG=n.

But when I issue the command make I get the following error:

scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  LD      kernel/debug/kdb/built-in.o
kernel/debug/kdb/kdb_main.o: file not recognized: File truncated
scripts/Makefile.build:387: recipe for target 'kernel/debug/kdb/built-in.o' failed
make[3]: *** [kernel/debug/kdb/built-in.o] Error 1
scripts/Makefile.build:455: recipe for target 'kernel/debug/kdb' failed
make[2]: *** [kernel/debug/kdb] Error 2
scripts/Makefile.build:455: recipe for target 'kernel/debug' failed
make[1]: *** [kernel/debug] Error 2
Makefile:797: recipe for target 'kernel' failed
make: *** [kernel] Error 2

I could build my kernel and reboot it properly without the DEBUG_INFO etc. ( actually I had forgot to enable them) and I could load a module also.

How can I enable debugging feature and make this build. I Intend to write gpio drivers later.

Edit: Comment:

The Makefile has following for DEBUG_INFO:

KBUILD_AFLAGS   += -gdwarf-2
KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
$(call cc-option,-fno-var-tracking)

But I don't get it...what is this -femit-struct-debug-baseonly, -fno-var-tracking

  • Do a "make clean", then add "V=1" (i.e "make V=1") to the make command and post the last part of the compile process. V=1 will make the compile more verbose, so you can see what the actual error is. As for the extra options you have to read more about gcc's options: gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html – sessyargc.jp Oct 14 '14 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.