LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how do I build debug versions of drivers (https://www.linuxquestions.org/questions/programming-9/how-do-i-build-debug-versions-of-drivers-722175/)

DEF. 04-28-2009 02:58 AM

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?

DEF. 04-28-2009 03:09 AM

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?

knobby67 04-28-2009 05:32 AM

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.

DEF. 04-28-2009 07:44 AM

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?

knobby67 04-29-2009 03:50 AM

Sorry, have a fair amount of use with cross copmpilers but I've done everything from inside make

DEF. 04-29-2009 05:48 AM

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?


All times are GMT -5. The time now is 04:49 AM.