G'day guru's
The problem is about linking intermediate objects in different directories and
module dependency namespace mangling.
Specific example:
USB builds a number of modules. The important one in this case is usbcore.o,
which is currently built from the following logic:
list-multi := usbcore.o
usbcore-objs := usb.o usb-debug.o hub.o
ifeq ($(CONFIG_USB_DEVICEFS),y)
usbcore-objs += devio.o inode.o drivers.o devices.o
endif
obj-$(CONFIG_USB) += usbcore.o
usbcore.o: $(usbcore-objs)
$(LD) -r -o $@ $(usbcore-objs)
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.
So now we have some additional lines in drivers/usb/Config.in:
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
if [ "$CONFIG_EHCI_HCD" != "n" -o "$CONFIG_OHCI_HCD" != "n" ]; then
define_tristate CONFIG_USB_HCD $CONFIG_USB
fi
and some additional lines in drivers/usb/Makefile:
subdir-$(CONFIG_USB_HCD) += hcd
ifeq ($(CONFIG_USB_HCD),y)
obj-y += hcd/hcd.o
endif
subdir-$(CONFIG_EHCI_HCD) += hcd
ifeq ($(CONFIG_EHCI_HCD),y)
obj-y += hcd/ehci-hcd.o
endif
subdir-$(CONFIG_OHCI_HCD) += hcd
ifeq ($(CONFIG_OHCI_HCD),y)
obj-y += hcd/ohci-hcd.o
endif
and a new drivers/usb/hcd/Makefile:
#
# Makefile for USB Host Controller Driver
# framework and drivers
#
O_TARGET :=
# "hcd.o" is (like) usbcore -- eventually link with it
ifneq ($(CONFIG_USB_HCD),n)
obj-$(CONFIG_USB) += hcd.o
export-objs += hcd.o
endif
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 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)
I see the same when I "strings vmlinux | grep usb_hcd".
Those are the unresolved references.
I seems that part of the kernel versioning symbol munging doesn't recurse (ore
perhaps, doesn't fully recurse) subdirectories. I then modified the relevant
part of the drivers/usb/Makefile to read:
subdir-$(CONFIG_USB_HCD) += hcd
ifeq ($(CONFIG_USB_HCD),y)
obj-y += hcd/hcd.o
export-objs += hcd/hcd.o
endif
But no change. I tried a few other random changes, but nothing I could come up
with gets rid of the __VERSIONED_SYMBOL stuff, except, of course, compiling
without module versioning.
Can anyone enlighten me here? The main thing that I'd like is "how to fix it",
but understanding why it works when all built in, or all modules would be nice
to know as well.
If you want to access any of the code for trials, it is available on the Linux
USB sourceforge CVS (e.g.
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/linux-usb/hcd/). There is
probably some other improvements that can be made to the Makefile and
configuration setup for this bit of the USB subsystem - any suggestions with
respect to this would be appreciated as well.
Thanks for your time.
Brad
_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/kbuild-devel