Carl | 1 Mar 2011 05:40

listing all modules compiled into a kernel instance

Kernel drivers can be (and in at least one case are) compiled into the 
kernel but are not reported when queried for, at least not in a way that 
I am aware of. For example, the ucom driver is present in the GENERIC 
kernel in this way. My expectation was that "kldstat -v" would list it, 
if present, but it does not. A design flaw?

# ls /boot/kernel/ucom.ko
/boot/kernel/ucom.ko
# grep ucom /usr/src/sys/i386/conf/GENERIC
# kldstat -v | grep ucom
# kldload ucom.ko
# tail -n 1 /var/log/messages
Feb 28 18:18:15 xxxxxx kernel: interface ucom.1 already present in the 
KLD 'kernel'!

How does one query an existing kernel for *all* compiled-in modules?

I'm using FreeBSD-8.1-RELEASE-amd64/i386.

Carl                                                   / K0802647

_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

Daniel O'Connor | 1 Mar 2011 12:49
Picon
Favicon

Re: listing all modules compiled into a kernel instance


On 01/03/2011, at 15:10, Carl wrote:
> Kernel drivers can be (and in at least one case are) compiled into the kernel but are not reported when
queried for, at least not in a way that I am aware of. For example, the ucom driver is present in the GENERIC
kernel in this way. My expectation was that "kldstat -v" would list it, if present, but it does not. A design flaw?

Sounds like a bug, but I'm not sure where..

Maybe ucom doesn't appear because it doesn't have a DRIVER_MODULE() declaration (because it isn't a driver).

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

Damien Fleuriot | 1 Mar 2011 13:03

Re: listing all modules compiled into a kernel instance

On 3/1/11 5:40 AM, Carl wrote:
> Kernel drivers can be (and in at least one case are) compiled into the
> kernel but are not reported when queried for, at least not in a way that
> I am aware of. For example, the ucom driver is present in the GENERIC
> kernel in this way. My expectation was that "kldstat -v" would list it,
> if present, but it does not. A design flaw?
> 
> # ls /boot/kernel/ucom.ko
> /boot/kernel/ucom.ko
> # grep ucom /usr/src/sys/i386/conf/GENERIC
> # kldstat -v | grep ucom
> # kldload ucom.ko
> # tail -n 1 /var/log/messages
> Feb 28 18:18:15 xxxxxx kernel: interface ucom.1 already present in the
> KLD 'kernel'!
> 
> How does one query an existing kernel for *all* compiled-in modules?
> 
> I'm using FreeBSD-8.1-RELEASE-amd64/i386.
> 
> Carl                                                   / K0802647
> 

Well AFAIK kldstat -v should return them all...

Also, as a side note to your question, find below an excerpt from ucom's
man page:

SYNOPSIS
     To compile this driver into the kernel, place the following line in
(Continue reading)

Maxim Khitrov | 1 Mar 2011 12:20

Re: listing all modules compiled into a kernel instance

On Mon, Feb 28, 2011 at 11:40 PM, Carl <k0802647 <at> telus.net> wrote:
> Kernel drivers can be (and in at least one case are) compiled into the
> kernel but are not reported when queried for, at least not in a way that I
> am aware of. For example, the ucom driver is present in the GENERIC kernel
> in this way. My expectation was that "kldstat -v" would list it, if present,
> but it does not. A design flaw?
>
> # ls /boot/kernel/ucom.ko
> /boot/kernel/ucom.ko
> # grep ucom /usr/src/sys/i386/conf/GENERIC
> # kldstat -v | grep ucom
> # kldload ucom.ko
> # tail -n 1 /var/log/messages
> Feb 28 18:18:15 xxxxxx kernel: interface ucom.1 already present in the KLD
> 'kernel'!
>
> How does one query an existing kernel for *all* compiled-in modules?
>
> I'm using FreeBSD-8.1-RELEASE-amd64/i386.
>
> Carl                                                   / K0802647

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

See config(8) for more details.
(Continue reading)

Bruce Cran | 1 Mar 2011 13:24
Picon
Gravatar

Re: listing all modules compiled into a kernel instance

On Tue, 1 Mar 2011 06:20:29 -0500
Maxim Khitrov <max <at> mxcrypt.com> 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:

It seems it can also list static components:

> kldstat -v
Id Refs Address    Size     Name
 1    1 0xc0400000 4c51b4   kernel (/boot/kernel/kernel)
        Contains modules:
                Id Name
                95 if_lo
                86 elf32
                87 shell
                96 igmp
                97 mld
                90 sysvmsg
                91 sysvsem
		[...]

--

-- 
Bruce Cran
_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"
(Continue reading)

Damien Fleuriot | 1 Mar 2011 14:19

Re: listing all modules compiled into a kernel instance

On 3/1/11 12:20 PM, Maxim Khitrov wrote:
> On Mon, Feb 28, 2011 at 11:40 PM, Carl <k0802647 <at> telus.net> wrote:
>> Kernel drivers can be (and in at least one case are) compiled into the
>> kernel but are not reported when queried for, at least not in a way that I
>> am aware of. For example, the ucom driver is present in the GENERIC kernel
>> in this way. My expectation was that "kldstat -v" would list it, if present,
>> but it does not. A design flaw?
>>
>> # ls /boot/kernel/ucom.ko
>> /boot/kernel/ucom.ko
>> # grep ucom /usr/src/sys/i386/conf/GENERIC
>> # kldstat -v | grep ucom
>> # kldload ucom.ko
>> # tail -n 1 /var/log/messages
>> Feb 28 18:18:15 xxxxxx kernel: interface ucom.1 already present in the KLD
>> 'kernel'!
>>
>> How does one query an existing kernel for *all* compiled-in modules?
>>
>> I'm using FreeBSD-8.1-RELEASE-amd64/i386.
>>
>> Carl                                                   / K0802647
> 
> 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
> 
(Continue reading)

John Baldwin | 1 Mar 2011 14:00
Picon
Favicon

Re: listing all modules compiled into a kernel instance

On Tuesday, March 01, 2011 6:49:17 am Daniel O'Connor wrote:
> 
> On 01/03/2011, at 15:10, Carl wrote:
> > Kernel drivers can be (and in at least one case are) compiled into the kernel but are not reported when
queried for, at least not in a way that 
I am aware of. For example, the ucom driver is present in the GENERIC kernel in this way. My expectation was
that "kldstat -v" would list it, if 
present, but it does not. A design flaw?
> 
> Sounds like a bug, but I'm not sure where..
> 
> 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.

--

-- 
John Baldwin
_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

Carl | 1 Mar 2011 21:01

Re: listing all modules compiled into a kernel instance

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.

Who should submit a bug report?
(Continue reading)

Jason Helfman | 1 Mar 2011 21:41

Re: listing all modules compiled into a kernel instance

On Tue, Mar 01, 2011 at 12:01:48PM -0800, Carl thus spake:
>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.
>
(Continue reading)

Warren Block | 1 Mar 2011 23:33
Favicon

Re: listing all modules compiled into a kernel instance

On Tue, 1 Mar 2011, Jason Helfman wrote:

> On Tue, Mar 01, 2011 at 12:01:48PM -0800, Carl thus spake:
>> 
>> 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.
>> 
>> Who should submit a bug report?
>
> There was a documentation bug that was put in regarding the ucom device, and
> it was to update the device name in the documentation.
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=155074
>
> I don't know if a PR is still required, but this may be worth a look first.

usb_quirk.4 appears to be a copy and edit of ucom.4.  The device name 
edit was missed, so it still referred to ucom.

I don't think this affects what you're talking about.
_______________________________________________
freebsd-hackers <at> freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"

(Continue reading)


Gmane