load a driver during autoconfiguration

Warner Losh imp at bsdimp.com
Wed Apr 1 19:21:15 UTC 2015


> On Apr 1, 2015, at 12:18 PM, Matías Perret Cantoni <perretcantonim at gmail.com> wrote:
> 
> 
> 
> 2015-03-09 15:03 GMT-03:00 Warner Losh <imp at bsdimp.com>:
> 
> > On Mar 9, 2015, at 10:01 AM, John Baldwin <jhb at FreeBSD.org> wrote:
> >
> (trimming a little)
> > 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
> 
> Hello. Thank you and sorry for the delay.
> 
> I tried using the kld_list variable of /etc/rc.conf and it worked just fine: my driver gets loaded on boot time.
> 
> On the other hand I couldn't get the loader.conf alternative to work: I created a loader.conf file in /boot (since there wasn't one) with only one line in it:
> 
> myDriver_load="YES"
> 
> The driver is not loaded after boot and dmesg doesn't shows any message about my driver.

Is there a myDriver.ko in your load path?

> I suspect that loader doesn't reads my file, because I also tried to change the autoboot delay of loader by overriding on my file, the autoboot_delay variable that's defined in /boot/defaults/loader.conf :
> 
> # cat /boot/loader.conf
> loader_delay="1"
> autoboot_delay="1"
> myDriver_load="YES"
> 
> But loader still waits 10 seconds before booting:
> ...
> -
> /boot/kernel/kernel data=0x4b3fc8+0x2c038 syms=[0x4+0x78c40+0x4+0x4b17f]
> Hit [Enter] to boot immediately, or any other key for command prompt.
> Booting [/boot/kernel/kernel] in 9 seconds ...
> ...
> 
> 
> Do you think that loader is reading my file or not? If there is more information that I can provide, just tell me!

I think that you’re not doing the interface quite right.

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/20150401/626435ae/attachment.sig>


More information about the freebsd-drivers mailing list