How to RNDIS/Ethernet Gadget in Android working

I recently ported Android to my B7 board using the guide below.

The guide uses kernel 2.6.27 which compiled and ran just fine until I
decided to set the USB driver mode to 'Both host and peripheral'. The
kernel actually only compiled when USB driver mode was set to 'USB
Host' and any atttempt to use add Peripheral support ended up with
errors in the musb driver. (see error below)

I couldn't find any solutions to this problem on the internet, but I
finally found out what was wrong so I thought I'd share. Hopefully
it'll help someone..

When you add support for a peripheral device (by chaning the driver
mode), make sure to change the 'USB Peripheral Controller' option to
'Inventra HDRC USB Peripheral'.
This setting can be found under 'Device Drivers -> USB Support -> USB
Gadget Support'.

This will get rid of errors like,

In file included from drivers/usb/musb/musb_core.c:108:
drivers/usb/musb/musb_core.h:94:2: error: #error bogus Kconfig
drivers/usb/musb/musb_core.c: In function 'musb_free':
drivers/usb/musb/musb_core.c:1832: error: 'dev_attr_srp' undeclared
(first use in this function)
drivers/usb/musb/musb_core.c:1832: error: (Each undeclared identifier
is reported only once
drivers/usb/musb/musb_core.c:1832: error: for each function it appears
drivers/usb/musb/musb_core.c: In function 'musb_init_controller':
drivers/usb/musb/musb_core.c:1904: error: label 'bad_config' used but
not defined

when trying to build the kernel.

These errors do not only occur in 2.6.27, but in 2.6.28 too.


Hello again,

Thought I'd add what other options are needed to get this to work.

When using the configuration file (from the guide) described below I
had to change the following 3 settings to enable peripheral support.
(still refers to 2.6.27)

1. In 'Device Drivers -> USB Support' set 'Inventra Highspeed Dual
Role Controller' to support both host and peripherals

2. In 'Device Drivers -> USB Support -> USB Gadget Support' change
'USB Gadget Drivers' from modular to built-in (ie. change the M to an

3. In 'Device Drivers -> USB Support -> USB Gadget Support' set 'USB
Peripheral Controller' to 'Inventra HDRC USB Peripheral'. (This is the
cause of the errors described below)