LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-28-2009, 02:58 AM   #1
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Rep: Reputation: 23
how do I build debug versions of drivers


I have been given a linux distribution for an embedded ARM target. I execute the following make command to build:

make ARCH=arm CROSS_COMPILE=arm-iwmmxt-linux-gnueabi- O=BUILD zImage

However, I need to build debug versions of the following drivers: usbcore and usbserial.

In gcc I'd just add -g or -ggdb.

How do I do this at the make comamnd line?
 
Old 04-28-2009, 03:09 AM   #2
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Original Poster
Rep: Reputation: 23
I have noted this section in the Makefile:

ifdef CONFIG_DEBUG_INFO
KBUILD_CFLAGS += -g
KBUILD_AFLAGS += -gdwarf-2
endif

Is this the correct way to enable debugging? If so how do I enable this?
 
Old 04-28-2009, 05:32 AM   #3
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
If I understand you correctly your using make to build the cross compiler linux distribution? Or are you using a cross compiler to make an elf/bin file from a PC linux? Or are you making a usb apt for a Arm linux distribution? I don't really understand?

My understanding is that dwarf is needed for the debug output for elf files. There are many any ways to do this but basically you should have somewhere in your make file where you produce your .o files? Something like

%.o : %.c
$(cc) -c $(IFLAGS) $(FLAGS) $(CFLAGS) $< -o $@

You just need to add your flags in here $(KBUILD_CFLAGS) etc.

However if your problem is just with the usb libareis you might fine it easier you build your Arm distribution then build a little ap using the usb stuff and try moding that rather than the whole linux build.
 
Old 04-28-2009, 07:44 AM   #4
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Original Poster
Rep: Reputation: 23
Ok I am using make to cross compile Linux on a x86 Linux Host to a ARM Linux target.

I beleive I have the standard make configration for kernel 2.6.25.7 so I wanted to know how from the command-line using make can I create debug versions? Currently I rebuild the whole kernel + drivers by doing the following:

make ARCH=arm CROSS_COMPILE=arm-iwmmxt-linux-gnueabi- O=BUILD zImage && \
make ARCH=arm CROSS_COMPILE=arm-iwmmxt-linux-gnueabi- O=BUILD modules && \
make ARCH=arm CROSS_COMPILE=arm-iwmmxt-linux-gnueabi- O=BUILD INSTALL_MOD_PATH=`pwd`/BUILD/MODULES modules_install

How do I change the above to make debug versions? I don't need a debug kernel but I do need to debug usbcore and usbserial.

I don't wnat to modify Makefile if not necessary?
 
Old 04-29-2009, 03:50 AM   #5
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
Sorry, have a fair amount of use with cross copmpilers but I've done everything from inside make
 
Old 04-29-2009, 05:48 AM   #6
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Original Poster
Rep: Reputation: 23
OK let me rephrase my question:

To build the kernel I do this:

make ARCH=arm CROSS_COMPILE=arm-iwmmxt-linux-gnueabi- O=BUILD zImage

To build the drivers I do this:

make ARCH=arm CROSS_COMPILE=arm-iwmmxt-linux-gnueabi- O=BUILD modules

How do I just build the usb stuff?

How do I just build the usb stuff for debug?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB drivers and versions anroy Linux - Hardware 2 12-17-2008 07:59 AM
Drivers and kernel versions... generic_user Linux - Kernel 0 07-18-2007 01:22 PM
encore m3 bsp: kernel 2.6 build fails at this point..where do I debug? ashlesha Linux - Kernel 0 08-09-2006 05:55 PM
Build 'n Debug a C/C++ KDevlop cmd prompt project SCOSWriter Linux - Software 2 12-10-2004 10:07 AM
debug build of glibc flok Slackware 2 07-13-2004 11:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration