我正在尝试编译一个使用8021q调用的模块。我在/ lib / modules / [version] / build / net / 8021q中安装了8021q的makefile和kconfig。但是,当我尝试构建时,我收到以下内容:
WARNING: "register_vlan_dev" [/home/user/test/test.ko] undefined!
我是新手来构建模块,那么如何让我的模块看到这个功能呢?
我的代码块(充满错误,但仅作为示例):
int create_and_register(struct gfast_dfe_entry *dfe,
uint16_t port_on_dfe, uint16_t tag)
{
int ret = -ENODEV;
uint16_t portidx = (uint16_t)(0);
static char port_ifname[IFNAMSIZ] = "eth0";
static struct net_device *ports[10];
ports[portidx] = alloc_netdev(privsize, port_ifname, NULL);
if ((ret = register_vlan_dev(ports[portidx])) != 0) {
PWARN("cannot create port%d - register_vlan_dev returned err=%d",
portidx, ret);
rtnl_unlock();
goto err_reg_vlandev;
}
return 0;
err_reg_vlandev:
free_netdev(ports[portidx]);
ports[portidx] = NULL;
return 1;
}
我的makefile:
obj-m += test.o
test-objs := main.o
KERNELPATH:=/lib/modules/$(shell uname -r)/build
all: modules
modules:
make -C $(KERNELPATH) M=$(shell pwd) -Wall modules
clean:
make -C $(KERNELPATH) M=$(shell pwd) clean
感谢您的帮助!