问题
I want to analyze usb communication out of my device: SGS4. I see everywhere that the usbmon is needed to be configured and compiled into the kernel. Afaik, this module is not built in the android linux system.
I don't have much experience in compiling a kernel but if this is necessary I would do it.
Can you tell what are the steps of doing so? i.e. how to compile the linux kernel for android such that it would include the usbmon module.
回答1:
I suppose you have access to:
- the sources of the version of Linux currently running on your device. It could be available on Samsung repository if you haven't changed the ROM. Or some custom kernels if you use an alternative ROM (CyanogenMod, Clockwork, ...).
- an ARM toolchain that is proven suited to compile this kernel.
- the version of AOSP currently running on your device (e.g. 4.1.2). You need it to build the new
boot.img
out of the newly compiled kernel imagezImage
.
You need to enable CONFIG_USB_MON
in linux:
$ make CROSS_COMPILE=your/armeabi/toolchain/path menuconfig
type /
to search then enter USB_MON
. The flag is located in:
-> Device Drivers -> USB support (USB_SUPPORT [=n]) -> Support for Host-side USB (USB [=n])
Then rebuild:
$ make CROSS_COMPILE=your/armeabi/toolchain/path zImage
Then please read Documentation/usb/usbmon.txt
directly from your kernel sources.
It should teach you everything you need to know.
来源:https://stackoverflow.com/questions/24117094/usbmon-for-android