listing all modules compiled into a kernel instance

Damien Fleuriot ml at my.gd
Tue Mar 1 13:19:48 UTC 2011


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
> 
> See config(8) for more details.
> 
> - Max


kldstat also shows statically compiled modules, example below.

Here's my kldstat:

# kldstat
Id Refs Address            Size     Name
 1   16 0xffffffff80100000 91f9f8   kernel
 2    1 0xffffffff80a20000 bbd8     geom_label.ko
 3    1 0xffffffff80a2c000 21058    geom_mirror.ko
 4    1 0xffffffff80a4e000 f078     aio.ko
 5    1 0xffffffff80c22000 104d42   zfs.ko
 6    1 0xffffffff80d27000 f217     krpc.ko
 7    1 0xffffffff80d37000 1a15     opensolaris.ko



Now, looking for my network card:

# kldstat -v |grep bce
                65 pci/bce
                64 bce/miibus



More information about the freebsd-hackers mailing list