On Thu, 14 Jun 2001, Brad Hards wrote:
> So far so good. The problem comes from introducing the new EHCI, and
> associated refactoring of the common host controller code. The new approach is
> that host controllers will live in a subdirectory (drivers/usb/hcd), and we
> will eventually link in the common host controller support infrastructure as
> part of usbcore.o, if we are using any of the "new style" hcd support.
> [... Makefiles removed]
> This works fine as long as (CONFIG_USB=y and CONFIG_EHCI_HCD=y) or
> (CONFIG_USB=m and CONFIG_EHCI_HCD=m), just ignoring CONFIG_OHCI_HCD for now,
> although you can s/EHCI/OHCI in that logic. It doesn't work if CONFIG_USB is
> built in, and you want modular host controller drivers (which is typically the
> case). Specifically, when I modprobe ehci-hcd, I get five unresolved
> references.
>
> When I do a "strings hcd.o", I see the following:
> __VERSIONED_SYMBOL(usb_hcd_pci_probe)
> __VERSIONED_SYMBOL(usb_hcd_pci_remove)
> __VERSIONED_SYMBOL(usb_hcd_pci_suspend)
> __VERSIONED_SYMBOL(usb_hcd_pci_resume)
> __VERSIONED_SYMBOL(usb_hcd_giveback_urb)
There's two possible explanations for this: module versioning
dependencies are broken, the only reliable way to fix this is to make
mrproper and rebuild. The other one is the objects which are exporting
symbols are not listed appropriately in export-objs. I think you've got
the second problem. You get the list for export-objs by "grep
EXPORT_SYMBOL *.c" and replacing .c -> .o. However, your Makefiles are
broken and handling things differently from the rest of the kernel, which
is not good (and may cause all sorts of problems).
I'm appending a patch agains current sf CVS (usb and hcd), which gets
things more in line with how it's done usually.
The following is untested though, because I didn't get the CVS version to
compile for other reasons (supposedly the fact that I didn't update
include/linux/usb*).
[Patch to usb CVS]
Index: Config.in
===================================================================
RCS file: /cvsroot/linux-usb/usb/Config.in,v
retrieving revision 1.23
diff -u -r1.23 Config.in
--- Config.in 2001/06/07 06:30:03 1.23
+++ Config.in 2001/06/14 20:57:27
@@ -24,6 +24,9 @@
dep_tristate ' UHCI Alternate Driver (JE) support' CONFIG_USB_UHCI_ALT
$CONFIG_USB
fi
dep_tristate ' OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support' CONFIG_USB_OHCI
$CONFIG_USB
+ dep_tristate ' EHCI HCD (USB 2.0) support (EXPERIMENTAL)' CONFIG_EHCI_HCD
+$CONFIG_USB $CONFIG_EXPERIMENTAL
+ dep_tristate ' OHCI HCD support (EXPERIMENTAL)' CONFIG_OHCI_HCD $CONFIG_USB
+$CONFIG_EXPERIMENTAL
+ dep_tristate ' UHCI HCD support (EXPERIMENTAL)' CONFIG_UHCI_HCD $CONFIG_USB
+$CONFIG_EXPERIMENTAL
comment 'USB Device Class drivers'
dep_tristate ' USB Audio support' CONFIG_USB_AUDIO $CONFIG_USB $CONFIG_SOUND
I removed the CONFIG_USB_HCD thing, we now always enter drivers/usb/hcd.
(It's not a problem even if we didn't select any host controller, it only
has a tiny performance penalty in this case. I suppose it doesn't really
much sense to compile USB without host controller support, anyway)
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-usb/usb/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- Makefile 2001/01/04 08:41:24 1.16
+++ Makefile 2001/06/14 20:57:27
@@ -2,33 +2,25 @@
# Makefile for the kernel USB device drivers.
#
-# Subdirs.
-
# The target object and module list name.
O_TARGET := usbdrv.o
+# Subdirs.
+
+mod-subdirs := hcd
+subdir-y := hcd
+
# Objects that export symbols.
export-objs := usb.o
# Multipart objects.
-
-list-multi := usbcore.o
-usbcore-objs := usb.o usb-debug.o hub.o
-
-# Optional parts of multipart objects.
-
-ifeq ($(CONFIG_USB_DEVICEFS),y)
- usbcore-objs += devio.o inode.o drivers.o devices.o
-endif
-
-# Object file lists.
-obj-y :=
-obj-m :=
-obj-n :=
-obj- :=
+list-multi := usbcore.o
+usbcore-objs := usb.o usb-debug.o hub.o
+usbcore-objs-$(CONFIG_USB_DEVICEFS) += devio.o inode.o drivers.o devices.o
+usbcore-objs += $(usbcore-objs-y)
# Each configuration option enables a list of files.
@@ -65,13 +57,7 @@
subdir-$(CONFIG_USB_SERIAL) += serial
subdir-$(CONFIG_USB_STORAGE) += storage
-ifeq ($(CONFIG_USB_SERIAL),y)
- obj-y += serial/usb-serial.o
-endif
-
-ifeq ($(CONFIG_USB_STORAGE),y)
- obj-y += storage/storage.o
-endif
+obj-y += $(addsuffix /vmlinux-obj.o, $(subdir-y))
include $(TOPDIR)/Rules.make
Explanation:
"subdir-y := hcd" means we enter hcd unconditionally. As hcd is also
listed in mod-subdirs, we also enter it when making modules, too. This is
not optimal performance-wise, but usually done this way since it's simple.
The usbcore stuff is only rewritten a bit. I suppose that one's a question
of taste.
The obj-y += (subdir-objects) has been simplified by automatically adding
objects in subdir-y. To make this possible, all O_TARGETS now have got the
same name. I chose vmlinux-obj.o, as already used in the ISDN makefiles.
Index: serial/Makefile
===================================================================
RCS file: /cvsroot/linux-usb/usb/serial/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- serial/Makefile 2001/03/11 00:01:51 1.11
+++ serial/Makefile 2001/06/14 20:57:30
@@ -2,7 +2,7 @@
# Makefile for the USB serial device drivers.
#
-O_TARGET := usb-serial.o
+O_TARGET := vmlinux-obj.o
# Object file lists.
Index: storage/Makefile
===================================================================
RCS file: /cvsroot/linux-usb/usb/storage/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- storage/Makefile 2001/01/04 08:41:24 1.9
+++ storage/Makefile 2001/06/14 20:57:31
@@ -5,7 +5,7 @@
# Rewritten to use lists instead of if-statements.
#
-O_TARGET := storage.o
+O_TARGET := vmlinux-obj.o
EXTRA_CFLAGS := -I../../scsi/
list-multi := usb-storage.o
[Patch to hcd CVS]
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-usb/hcd/Makefile,v
retrieving revision 0.1
diff -u -r0.1 Makefile
--- Makefile 2001/06/09 03:45:29 0.1
+++ Makefile 2001/06/14 20:54:04
@@ -3,31 +3,12 @@
# framework and drivers
#
-O_TARGET :=
+O_TARGET := vmlinux-obj.o
-# "hcd.o" is (like) usbcore -- eventually link with it
-ifneq ($(CONFIG_USB_HCD),n)
- obj-$(CONFIG_USB) += hcd.o
- export-objs += hcd.o
-endif
+export-objs := hcd.o hcd-pci.o
obj-$(CONFIG_EHCI_HCD) += ehci-hcd.o
obj-$(CONFIG_OHCI_HCD) += ohci-hcd.o
obj-$(CONFIG_UHCI_HCD) += uhci-hcd.o
-
-# Extract lists of the multi-part drivers.
-# The 'int-*' lists are the intermediate files used to build the multi's.
-multi-y := $(filter $(list-multi), $(obj-y))
-multi-m := $(filter $(list-multi), $(obj-m))
-int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
-int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
-
-# Take multi-part drivers out of obj-y and put components in.
-obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y)
-
-# Translate to Rules.make lists.
-OX_OBJS := $(obj-y)
-MX_OBJS := $(obj-m)
-MIX_OBJS := $(int-m)
include $(TOPDIR)/Rules.make
This should look pretty straight forward now. The last part is only
boilerplate code to go back to the variables used in old-style Makefiles
(2.2)
One additional note: I don't know if initialization order matters (for the
builtin case). In the patch above, objects are linked as listed in obj-y.
This means that the files in the subdirs are linked last.
Hope that helps.
--Kai
_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/kbuild-devel