This last part just adds kbuild support for the three drivers sent in the earlier patches. (There's no "mid-layer".)
- Dave
--- a/Makefile Wed Sep 10 13:58:45 2003
+++ b/Makefile Wed Sep 10 13:58:45 2003
@@ -181,6 +181,7 @@
DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o
DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a
DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o
+DRIVERS-$(CONFIG_USB_GADGET) += drivers/usb/gadget/built-in.o
DRIVERS-y +=drivers/media/media.o
DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o
DRIVERS-$(CONFIG_HIL) += drivers/hil/hil.o
--- a/drivers/Makefile Wed Sep 10 13:58:45 2003
+++ b/drivers/Makefile Wed Sep 10 13:58:45 2003
@@ -8,7 +8,7 @@
mod-subdirs := dio hil mtd sbus video macintosh usb input telephony ide \
message/i2o message/fusion scsi md ieee1394 pnp isdn atm \
- fc4 net/hamradio i2c acpi bluetooth
+ fc4 net/hamradio i2c acpi bluetooth usb/gadget
subdir-y := parport char block net sound misc media cdrom hotplug
subdir-m := $(subdir-y)
@@ -28,6 +28,7 @@
subdir-$(CONFIG_MAC) += macintosh
subdir-$(CONFIG_PPC32) += macintosh
subdir-$(CONFIG_USB) += usb
+subdir-$(CONFIG_USB_GADGET) += usb/gadget
subdir-$(CONFIG_INPUT) += input
subdir-$(CONFIG_PHONE) += telephony
subdir-$(CONFIG_IDE) += ide
--- a/drivers/usb/Config.in Wed Sep 10 13:58:45 2003
+++ b/drivers/usb/Config.in Wed Sep 10 13:58:45 2003
@@ -110,4 +110,7 @@
dep_tristate ' Alcatel Speedtouch USB support' CONFIG_USB_SPEEDTOUCH
$CONFIG_ATM $CONFIG_USB
fi
fi
+
+source drivers/usb/gadget/Config.in
+
endmenu
--- linux-2.4/drivers/usb/gadget/Config.in 1969-12-31 16:00:00.000000000 -0800
+++ tmp-2.4/drivers/usb/gadget/Config.in 2003-09-10 15:19:49.000000000 -0700
@@ -0,0 +1,69 @@
+#
+# USB device-side configuration
+# for 2.4 kbuild, drivers/usb/gadget/Config.in
+#
+# Long term, this likely doesn't all belong in one directory
+# Plan to split it up eventually.
+#
+mainmenu_option next_comment
+comment 'Support for USB gadgets'
+
+bool 'Support for USB Gadgets' CONFIG_USB_GADGET
+if [ "$CONFIG_USB_GADGET" = "y" ]; then
+
+ #
+ # really want _exactly one_ device controller driver at a time,
+ # since they control compile options for gadget drivers.
+ #
+ comment 'USB Peripheral Controller Drivers'
+
+ # assume all the dependencies may be undefined ("== true", yeech)
+ if [ "$CONFIG_PCI" = "y" ] ; then
+ tristate ' NetChip 2280 support' CONFIG_USB_NET2280
+ define_tristate CONFIG_USB_GADGET_CONTROLLER $CONFIG_USB_NET2280
+ fi
+
+ if [ "$CONFIG_USB_GADGET_CONTROLLER" = "y" -o "$CONFIG_USB_GADGET_CONTROLLER" = "m"
] ; then
+
+ #
+ # no reason not to enable more than one gadget driver module, but
+ # for static linking that would make no sense since the usb model
+ # has exactly one of these upstream connections and only one
+ # lowest-level driver can control it.
+ #
+ # gadget drivers are compiled to work on specific hardware, since
+ #
+ # (a) gadget driver need hardware-specific configuration, like what
+ # endpoint names and numbers to use, maxpacket sizes, etc
+ #
+ # (b) specific hardware features like iso endpoints may be required
+ #
+ comment 'USB Gadget Drivers'
+
+ dep_tristate ' Gadget Zero (DEVELOPMENT)' CONFIG_USB_ZERO
$CONFIG_USB_GADGET_CONTROLLER
+ if [ "$CONFIG_USB_ZERO" = "y" -o "$CONFIG_USB_ZERO" = "m" ]; then
+ if [ "$CONFIG_USB_NET2280" = "y" -o "$CONFIG_USB_NET2280" = "m" ]; then
+ define_bool CONFIG_USB_ZERO_NET2280 y
+ fi
+ if [ "$CONFIG_USB_PXA2XX" = "y" -o "$CONFIG_USB_PXA2XX" = "m" ]; then
+ define_bool CONFIG_USB_ZERO_PXA2XX y
+ fi
+ # ...
+ fi
+
+ dep_tristate ' Ethernet Gadget (EXPERIMENTAL)' CONFIG_USB_ETH
$CONFIG_USB_GADGET_CONTROLLER
+ if [ "$CONFIG_USB_ETH" = "y" -o "$CONFIG_USB_ETH" = "m" ]; then
+ if [ "$CONFIG_USB_NET2280" = "y" -o "$CONFIG_USB_NET2280" = "m" ]; then
+ define_bool CONFIG_USB_ETH_NET2280 y
+ fi
+ if [ "$CONFIG_USB_PXA2XX" = "y" -o "$CONFIG_USB_PXA2XX" = "m" ]; then
+ define_bool CONFIG_USB_ETH_PXA2XX y
+ fi
+ # ...
+ fi
+
+ # ... or other gadget drivers: printer class, storage, hid, etc ...
+
+ fi
+fi
+endmenu
--- linux-2.4/drivers/usb/gadget/Makefile 1969-12-31 16:00:00.000000000 -0800
+++ tmp-2.4/drivers/usb/gadget/Makefile 2003-09-10 15:20:34.000000000 -0700
@@ -0,0 +1,31 @@
+#
+# Makefile for USB peripheral controller and gadget drivers
+# for kbuild 2.4
+#
+
+# for static linking
+O_TARGET := built-in.o
+
+list-multi := g_zero.o g_ether.o
+
+obj-$(CONFIG_USB_NET2280) += net2280.o
+
+# only one of these may be statically linked ...
+controller-$(CONFIG_USB_NET2280) += net2280.o
+
+# ... and only one of these, too; kbuild/kconfig don't help though.
+g_zero-objs := zero.o usbstring.o
+obj-$(CONFIG_USB_ZERO) += g_zero.o
+
+g_ether-objs := ether.o usbstring.o
+obj-$(CONFIG_USB_ETH) += g_ether.o
+
+
+export-objs := $(controller-y) $(controller-m)
+
+include $(TOPDIR)/Rules.make
+
+g_zero.o: $(g_zero-objs)
+ $(LD) -r -o $@ $(g_zero-objs)
+g_ether.o: $(g_ether-objs)
+ $(LD) -r -o $@ $(g_ether-objs)
