Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Mar 2015 12:03:13 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-drivers@freebsd.org, =?utf-8?Q?Mat=C3=ADas_Perret_Cantoni?= <perretcantonim@gmail.com>
Subject:   Re: load a driver during autoconfiguration
Message-ID:  <21B44158-07C3-47AE-8132-BE5F2B408697@bsdimp.com>
In-Reply-To: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx>
References:  <CADLKG03WSkbPPWwDkxd3NPa1q0cVP8C0JvA0T=Jwy2=wGv_tiA@mail.gmail.com> <5070289.9Ox4kP5ZdP@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


> On Mar 9, 2015, at 10:01 AM, John Baldwin <jhb@FreeBSD.org> wrote:
>=20
> On Friday, March 06, 2015 04:15:22 PM Mat=EDas Perret Cantoni wrote:
>> Hello!
>>=20
>> I just wrote a simple newbus driver that works just fine when I load =
it
>> manually with kldload(8).
>>=20
>> Now I'd like the system to load it automatically at boot time. I've =
already
>> added the corresponding node on the dts file.
>>=20
>> So my questions are:
>>=20
>> Can I just place the driver under some directory so that the system =
can
>> probe it during auto-configuration?
>>=20
>> Or do I need to re-compile the whole kernel for this? In that case =
where
>> should I place my sources before compiling?
>=20
> 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=92ll need to =
match the
device. This will load the driver after boot. It=92s 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=92s not possible today.

Warner


--Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJU/eBhAAoJEGwc0Sh9sBEAz2MQAKl+uqfOAgW33UU1aU1SUHAq
BWRekPCqXJS74DYj2PC2Vs6QfJxqS1RqeEWysErGhS8XW+t+yuVqi2QTTIc1DErB
8e0UiTBItxMBRWBj6nS6qq+ulCmvnJWiIvL3R/r303pu2qXH5elNWm/j/G8/FlUC
+WphHb86oPlbMRBhW8TVJcQ52fNPYtHQcwTmDLgu6T/L+Umty7vu0XJyUiod760m
LsorjwzbxX/DJ8VcT/CJg6h9e3MjxfQTEEb8s3y47nvZp7mpUxDeS+7xJTKoiQ1e
6rhDRIAKcE9ScyVRNt2RqIE7fz4El3Wj7smJSORSAlIvEetzEfzpl9xAdibhfy08
W4QJhDQyAJtwR+kvbeNS8fgB54REexG1Di5qMM9ngT9g8Y3bzxCLCkYw3216HerL
X2+aWBVOBjuk78hFSDIvZ665jzbj6wi7RWwczYnqetkB3mbp5YIQ11+imTGcxGkq
kN2UZgTS4maD4C5hoj71exyyC+jw9pb87kaBNqDqsEpq1UIojlu1pS5xB+mQ7cXL
NB0H/W9eJPMo/vpJoC2/kVZs0BL75L4i3bHl9bOhCeduAEfmgaSdj3EyYuyW67sr
BrI6oj2b0qJVAW0XX7gf4YbYZw2q+Znc30/SwIEGcOJK2IAe/48dkiRyBct9tP2D
Zg4W4tmM3inKIvrSKVJL
=gcoj
-----END PGP SIGNATURE-----

--Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?21B44158-07C3-47AE-8132-BE5F2B408697>