3

To my understanding, FreeBSD's kernel is configured via text files. Each kernel configuration entry is on a single line. Many entries also have comments set off with a hash mark. The GENERIC conf. file can be found in /usr/src/sys/<'arch'>/conf/GENERIC . Which you would copy and alter as your custom kernel.

Example:

    device      ehci            # EHCI PCI->USB interface (USB 2.0)

But how is this in relation to an actual device? Say I plug in a USB flash-drive, does the USB device perform a handshake, some kind of identification? Furthermore, if the driver is not a core-driver, but a loadable kernel module, does the kernel look up what driver is requested?

As a side question. The KERNCONF='' command simply tells the make(1) the name kernel name?

2 Answers 2

0

The kernel name ist defined by the ident line in the kernel conf file. The KERNCONF variable defines which kernelconf file to use.

The "Device Probe and Attach" section in the FreeBSD architecture handbook describes how a usb device is detected: https://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/usb-devprobe.html

0

The text file only defines what's built into the kernel; stuff you do not put there will generally end up compiled as loadable kernel modules.

And yes, during bootup - or after kldloading a kernel module - the driver's "probe" routine is run; that routine is responsible for figuring out whether there is some hardware supported by the driver. If it is, the "attach" driver function will be run; that one actually attaches the driver instance to a device. FreeBSD generally doesn't try to automatically load kernel modules, so if the driver is not built into the kernel, you must either load it by hand (kldload), or use rc script to load them (using kld_list rc variable), or use bootloader to preload them (by editing /boot/loader.conf).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .