Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jul 2004 15:52:10 +0000 (GMT)
From:      wpaul@FreeBSD.ORG (Bill Paul)
To:        jason-dusek@uiowa.edu (Jason Dusek)
Cc:        freebsd-current@freebsd.org
Subject:   Re: kldload won't load
Message-ID:  <20040713155210.A6EB916A4CF@hub.freebsd.org>
In-Reply-To: <40F30F76.3000602@uiowa.edu> from Jason Dusek at "Jul 12, 2004 05:23:50 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> So, the problem is *not* that kldload can not find the file?

The problem is that the kernel linker can't resolve one of the symbols
_in_ the file. Unfortunately, there's no special errno for 'symbol in
module not found,' so it returns 'file not found' (ENOENT) instead.

> There is something 
> new at the bottom of my dmesg:
> 
>    link_elf: symbol device_get_sysctl_ctx undefined
> 
> What's this mean and how do I fix ndis?

It means that instead of downloading just the NDIS bits (/sys/compat/ndis
and /sys/dev/if_ndis) and dropping them into your 5.2.1 kernel source
tree, you downloaded the _entire_ 5-CURRENT kernel source and tried to
build the NDIS module there instead.

You can't do that. People have added features and made changes to
the NDISulator that depend on changes and features in the 5-CURRENT
source. I've tried to keep the code backwards compatible with
5.2.1-RELEASE by putting in #ifdefs that check __FreeBSD_version,
which is defined in /sys/sys/param.h.

If you had downloaded _just_ /sys/compat/ndis and /sys/dev/if_ndis, you
would have been able to build the code correctly since the compiler would
have picked the right definition of __FreeBSD_version. But instead, you
overwrote all of your kernel source code and clobbered /sys/sys/param.h
with the one from 5-CURRENT as well. Now the compiler thinks it's building
stuff for a 5-CURRENT kernel instead of a 5.2.1-RELEASE kernel.

The end result is that you're building an ndis.ko which would only work
correctly on 5-CURRENT, but you're trying to kldload it into a system
running a kernel from 5.2.1-RELEASE. There was no device_get_sysctl_ctx()
function in 5.2.1-RELEASE, so that obviously won't work.

Again, what you should have done was kept your 5.2.1-RELEASE source tree
and dropped just the bits from /sys/compat/ndis and /sys/dev/if_ndis into
it (you also need /sys/modules/ndis and /sys/modules/if_ndis, which have
just Makefiles in them).

You might notice that /sys/modules/if_ndis/Makefile now tries to
automagically generate pccarddevs.h on the fly. FreeBSD 5.2.1-RELEASE
didn't work that way, so edit the Makefile and remove the reference
to pccarddevs.h from the SRCS list otherwise compiling the module
will fail.

-Bill

--
=============================================================================
-Bill Paul            (510) 749-2329 | Senior Engineer, Master of Unix-Fu
                 wpaul@windriver.com | Wind River Systems
=============================================================================
              <adamw> you're just BEGGING to face the moose
=============================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040713155210.A6EB916A4CF>