Adding a new device to FreeBSD kernel

I have customized a device driver with a new name foo, I also added this directory /usr/src/sys/modules/foo with a proper Makefile:
Code:
#$FreeBSD: src/sys/modules/foo/Makefile,v 1

.PATH:  ${.CURDIR}/../../dev/e1000
KMOD    = if_foo
SRCS    = device_if.h bus_if.h pci_if.h opt_inet.h
SRCS    += if_foo.c $(SHARED_SRCS)
SHARED_SRCS = e1000_api.c e1000_phy.c e1000_nvm.c e1000_mac.c e1000_manage.c
SHARED_SRCS += e1000_80003es2lan.c e1000_82542.c e1000_82541.c e1000_82543.c
SHARED_SRCS += e1000_82540.c e1000_ich8lan.c e1000_82571.c e1000_osdep.c
SHARED_SRCS += e1000_82575.c e1000_vf.c e1000_mbx.c

CFLAGS += -I${.CURDIR}/../../dev/e1000 -DSMP

# DEVICE_POLLING gives you non-interrupt handling
# not advisable since MSIX gives better results
#CFLAGS  += -DDEVICE_POLLING

.include <bsd.kmod.mk>
When I add that device to kernel
Code:
device     foo
I get this error while building:
Code:
config: Error: device "foo" is unknown
config: 1 errors
*** Error code 1
1 error
*** Error code 2
1 error
Am I missing something?
 
Have a look through /src/sys/modules/Makefile. For starters, you would need to add at the beginning:
SUBDIR= \
foo \
Among other things probably. You have not informed the Makefile in /usr/src about the location of your foo module files.
 
Beeblebrox said:
Have a look through /src/sys/modules/Makefile.

I have added some lines to /usr/src/sys/modules/Makefile (Wherever I saw an igb I added foo at the next line). But I still face the same problem.
You also said about /usr/src/Makefile, Is there something to add/change there?
 
Back
Top