Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2011 17:13:40 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Carl <k0802647@telus.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: listing all modules compiled into a kernel instance
Message-ID:  <201103011713.40140.jhb@freebsd.org>
In-Reply-To: <4D6D50AC.701@telus.net>
References:  <4D6C78D3.5090803@telus.net> <201103010800.35666.jhb@freebsd.org> <4D6D50AC.701@telus.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, March 01, 2011 3:01:48 pm Carl wrote:
> On 2011-03-01 3:20 AM, Maxim Khitrov wrote:
> > kldstat provides information about components that were loaded
> > dynamically. If your kernel was built with INCLUDE_CONFIG_FILE option
> > (enabled by default in GENERIC), then you can see the static
> > components using:
> >
> > config -x /boot/kernel/kernel
> 
> As has been shown though, "kldstat -v" actually does show static 
> components, at least those declared with DRIVER_MODULE(), and "config 
> -x" does not improve on the situation at all because components like 
> ucom were not cited in the configuration file. IMHO, there needs to be a 
> reliable way to query an existing kernel that yields a _complete_ list 
> of which components are actually included.
> 
> On 2011-03-01 5:00 AM, John Baldwin wrote:
> >> Maybe ucom doesn't appear because it doesn't have a DRIVER_MODULE()
> >> declaration (because it isn't a driver).
> >
> > Yes, that would explain it.
> 
> I can explicitly include ucom in a kernel by adding "device ucom" in the 
> configuration file, in which case it would call DRIVER_MODULE(), right? 
> That would then make it appear in the "kldstat -v" list? So why is it a 
> driver when it's done explicitly, but not a driver when done implicitly? 
> That makes no sense to me since the functionality doesn't change. IMHO, 
> this is a bug that needs to be fixed, not just for ucom but any 
> implicitly included driver.

No, the _source_ code of device ucom has to explicitly say "I am a module 
named 'foo'" using a DECLARE_MODULE() macro (or another macro such as 
DRIVER_MODULE() that invokes DECLARE_MODULE()).  The 'device ucom' in a config 
file does not generate this, that is just an instruction that config(8) uses 
when looking in sys/conf/files to see which C source files to include in the 
kernel build.

-- 
John Baldwin



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