# autodetect network card



## MG (May 15, 2010)

Does anyone know how to make a custum kernel autodetect a network card and load it's kernel module?
GENERIC always loads the detected NIC's automatically but my stripped kernel is missing that part. pciconf -l and dmesg show the device, and I can kldload it.
It's just the boot autodetect/autoload code that needs to be trigerred but I don't know where to look for it.

my custom kernel config:

```
cpu         I686_CPU
ident       TEST4 
options     SCHED_ULE             # ULE scheduler
options     PREEMPTION            # Enable kernel thread preemption
options     INET                  # InterNETworking
options     INET6                 # IPv6 communications protocols
options     SCTP                  # Stream Control Transmission Protocol
options     FFS                   # Berkeley Fast Filesystem
options     SOFTUPDATES           # Enable FFS soft updates support
options     UFS_DIRHASH           # Improve performance on big directories
options     UFS_GJOURNAL          # Enable gjournal-based UFS journaling
options     CD9660                        # ISO 9660 Filesystem
options     PROCFS                        # Process filesystem (requires PSEUDOFS)
options     PSEUDOFS              # Pseudo-filesystem framework
options     GEOM_PART_GPT         # GUID Partition Tables.
options     GEOM_LABEL            # Provides labelization
options     COMPAT_43TTY          # BSD 4.3 TTY compat [KEEP THIS!]
options     STACK                       # stack(9) support
options     SYSVSHM                       # SYSV-style shared memory
options     SYSVMSG                       # SYSV-style message queues
options     SYSVSEM                       # SYSV-style semaphores
options     _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options     KBD_INSTALL_CDEV      # install a CDEV entry in /dev
options     AUDIT                       # Security event auditing
device        eisa
device        pci
device        ata
device        atadisk             # ATA disk drives
device        atapicd             # ATAPI CDROM drives
options       ATA_STATIC_ID       # Static device numbering
device        kbdmux              # keyboard multiplexer
device        vga               # VGA video card driver
device        sc
device        miibus              # MII bus support
device        loop                # Network loopback
device        random              # Entropy device
device        ether               # Ethernet support
device        pty               # Pseudo-ttys (telnet etc)
device        md                # Memory "disks"
device        gif               # IPv6 and IPv4 tunneling
device        faith               # IPv6-to-IPv4 relaying (translation)
device        uhci                # UHCI PCI->USB interface
device        ehci                # EHCI PCI->USB interface (USB 2.0)
device        usb         # USB Bus (required)
device          uhid              # "Human Interface Devices"
device          ukbd              # Keyboard
device          ums               # Mouse
device        atkbd
device        atkbdc
device        bpf
device        psm
```


----------



## phoenix (May 15, 2010)

The kernel doesn't load modules.

ifconfig(8) loads (most) network drivers on demand.

If you know which driver to use, you can edit /boot/loader.conf with an entry like:

```
if_dev_load="YES"
```
 (replace if_dev with the module naem from /boot/kernel/*.ko).  This will load the driver at boot.


----------



## MG (May 15, 2010)

doh! There's no filesystem access until the bootloader is executed. Forgot that...


----------

