load a driver during autoconfiguration
Warner Losh
imp at bsdimp.com
Mon Mar 9 18:03:25 UTC 2015
> On Mar 9, 2015, at 10:01 AM, John Baldwin <jhb at FreeBSD.org> wrote:
>
> On Friday, March 06, 2015 04:15:22 PM Matías Perret Cantoni wrote:
>> Hello!
>>
>> I just wrote a simple newbus driver that works just fine when I load it
>> manually with kldload(8).
>>
>> Now I'd like the system to load it automatically at boot time. I've already
>> added the corresponding node on the dts file.
>>
>> So my questions are:
>>
>> Can I just place the driver under some directory so that the system can
>> probe it during auto-configuration?
>>
>> Or do I need to re-compile the whole kernel for this? In that case where
>> should I place my sources before compiling?
>
> One option is to always load the driver using an entry in loader.conf or in
> the kld_list variable in /etc/rc.conf. Another option to do on-demand loading
> is to write a custom devd handler. You can find some examples in
> /etc/devd/usb.conf (note that that file is auto-generated). I'm not sure what
> is output for a nomatch entry for an fdt bus. For devices that appear at
> runtime you can run 'cat /var/run/devd.pipe' in a window to see event details
> to use to write your match rule. However, for boot time events I think you
> will need to resort to looking at the code to decipher what variables are
> passed that you want to match on.
devinfo -v will tell you the pnp info, which is what you’ll need to match the
device. This will load the driver after boot. It’s almost always easier, however,
to just add the driver to your /boot/loader.conf file.
Sometime before BSDcan this year, there will be the option to automatically load
drivers based on PNP information from the parent bus coupled with the tables
compiled into the .ko files, but that’s not possible today.
Warner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-drivers/attachments/20150309/745c88aa/attachment.sig>
More information about the freebsd-drivers
mailing list