Trying to build Kernel with a Custom Module
by nuxy from LinuxQuestions.org on (#6QZ8H)
Hi everyone!
I am trying to compile Linux Kernel 6.11 with this openvpn module: https://github.com/OpenVPN/ovpn-dco
I've successfully built other kernels with external modules like this before, so here are my steps:
Code:drivers/net/ovpn-dco/netlink.c:42:42: error: implicit declaration of function NLA_POLICY_MAX_LEN'; did you mean NLA_POLICY_MIN_LEN'? [-Werror=implicit-function-declaration]
42 | [OVPN_KEY_DIR_ATTR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
| ^~~~~~~~~~~~~~~~~~
| NLA_POLICY_MIN_LEN
drivers/net/ovpn-dco/netlink.c:42:42: error: initializer element is not constant
drivers/net/ovpn-dco/netlink.c:42:42: note: (near initialization for ovpn_netlink_policy_key_dir[1].type')
drivers/net/ovpn-dco/netlink.c:41:89: warning: missing braces around initializer [-Wmissing-braces]
41 | static const struct nla_policy ovpn_netlink_policy_key_dir[OVPN_KEY_DIR_ATTR_MAX + 1] = {
| ^
drivers/net/ovpn-dco/netlink.c:76:41: error: initializer element is not constant
76 | [OVPN_NEW_PEER_ATTR_LOCAL_IP] = NLA_POLICY_MAX_LEN(sizeof(struct in6_addr)),
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/netlink.c:76:41: note: (near initialization for ovpn_netlink_policy_new_peer[6].type')
drivers/net/ovpn-dco/netlink.c:70:91: warning: missing braces around initializer [-Wmissing-braces]
70 | static const struct nla_policy ovpn_netlink_policy_new_peer[OVPN_NEW_PEER_ATTR_MAX + 1] = {
| ^
CC [M] drivers/net/ovpn-dco/udp.o
cc1: some warnings being treated as errors
make[8]: *** [scripts/Makefile.build:244: drivers/net/ovpn-dco/netlink.o] Error 1
make[8]: *** Waiting for unfinished jobs....
drivers/net/ovpn-dco/tcp.c:180:5: warning: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Wundef]
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 0) && SUSE_PRODUCT_CODE < SUSE_PRODUCT(1, 15, 5, 0)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:180:26: warning: "KERNEL_VERSION" is not defined, evaluates to 0 [-Wundef]
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 0) && SUSE_PRODUCT_CODE < SUSE_PRODUCT(1, 15, 5, 0)
| ^~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:180:40: error: missing binary operator before token "("
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 0) && SUSE_PRODUCT_CODE < SUSE_PRODUCT(1, 15, 5, 0)
| ^
drivers/net/ovpn-dco/tcp.c:201:5: warning: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Wundef]
201 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:201:26: warning: "KERNEL_VERSION" is not defined, evaluates to 0 [-Wundef]
201 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:201:40: error: missing binary operator before token "("
201 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^
drivers/net/ovpn-dco/tcp.c: In function ovpn_tcp_recvmsg':
drivers/net/ovpn-dco/tcp.c:213:5: warning: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Wundef]
213 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:213:26: warning: "KERNEL_VERSION" is not defined, evaluates to 0 [-Wundef]
213 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:213:40: error: missing binary operator before token "("
213 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
I am trying to compile Linux Kernel 6.11 with this openvpn module: https://github.com/OpenVPN/ovpn-dco
I've successfully built other kernels with external modules like this before, so here are my steps:
- Clone kernel: Code:git clone https://git.kernel.org/pub/scm/linux/kernel.....
- Clone openvpn module: Code:git clone https://github.com/OpenVPN/ovpn-dco -b master
- Copy module driver folder to kernel source code
Code:cp ovpn-dco-master/drivers/net/ovpn-dco /linux/drivers/net/ovpn-dco - Copy contents of module ovpn-dco-master/drivers/net/Kconfig to /linux/drivers/net/Kconfig
Code:config OVPN_DCO_V2
tristate "OpenVPN data channel offload (reloaded)"
depends on NET && INET
select NET_UDP_TUNNEL
select DST_CACHE
select CRYPTO
select CRYPTO_AES
select CRYPTO_GCM
select CRYPTO_CHACHA20POLY1305
help
This module enhances the performance of the OpenVPN userspace software
by offloading the data channel processing to kernelspace. - Edit /linux/drivers/net/Makefile and add new module's entry: Code:obj-$(CONFIG_OVPN_DCO_V2) += ovpn-dco-v2.o
- Edit /linux/drivers/net/ovpn-dco/Makefile and add: Code:obj-$(CONFIG_OVPN_DCO_V2) := ovpn-dco-v2.o
- Copy ovpn_dco.h to kernel source uapi directory:
Code:cp ovpn-dco-master/include/uapi/linux/ovpn_dco.h /linux/include/uapi/linux/ovpn_dco.h
Code:drivers/net/ovpn-dco/netlink.c:42:42: error: implicit declaration of function NLA_POLICY_MAX_LEN'; did you mean NLA_POLICY_MIN_LEN'? [-Werror=implicit-function-declaration]
42 | [OVPN_KEY_DIR_ATTR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
| ^~~~~~~~~~~~~~~~~~
| NLA_POLICY_MIN_LEN
drivers/net/ovpn-dco/netlink.c:42:42: error: initializer element is not constant
drivers/net/ovpn-dco/netlink.c:42:42: note: (near initialization for ovpn_netlink_policy_key_dir[1].type')
drivers/net/ovpn-dco/netlink.c:41:89: warning: missing braces around initializer [-Wmissing-braces]
41 | static const struct nla_policy ovpn_netlink_policy_key_dir[OVPN_KEY_DIR_ATTR_MAX + 1] = {
| ^
drivers/net/ovpn-dco/netlink.c:76:41: error: initializer element is not constant
76 | [OVPN_NEW_PEER_ATTR_LOCAL_IP] = NLA_POLICY_MAX_LEN(sizeof(struct in6_addr)),
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/netlink.c:76:41: note: (near initialization for ovpn_netlink_policy_new_peer[6].type')
drivers/net/ovpn-dco/netlink.c:70:91: warning: missing braces around initializer [-Wmissing-braces]
70 | static const struct nla_policy ovpn_netlink_policy_new_peer[OVPN_NEW_PEER_ATTR_MAX + 1] = {
| ^
CC [M] drivers/net/ovpn-dco/udp.o
cc1: some warnings being treated as errors
make[8]: *** [scripts/Makefile.build:244: drivers/net/ovpn-dco/netlink.o] Error 1
make[8]: *** Waiting for unfinished jobs....
drivers/net/ovpn-dco/tcp.c:180:5: warning: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Wundef]
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 0) && SUSE_PRODUCT_CODE < SUSE_PRODUCT(1, 15, 5, 0)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:180:26: warning: "KERNEL_VERSION" is not defined, evaluates to 0 [-Wundef]
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 0) && SUSE_PRODUCT_CODE < SUSE_PRODUCT(1, 15, 5, 0)
| ^~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:180:40: error: missing binary operator before token "("
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 0) && SUSE_PRODUCT_CODE < SUSE_PRODUCT(1, 15, 5, 0)
| ^
drivers/net/ovpn-dco/tcp.c:201:5: warning: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Wundef]
201 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:201:26: warning: "KERNEL_VERSION" is not defined, evaluates to 0 [-Wundef]
201 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:201:40: error: missing binary operator before token "("
201 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^
drivers/net/ovpn-dco/tcp.c: In function ovpn_tcp_recvmsg':
drivers/net/ovpn-dco/tcp.c:213:5: warning: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Wundef]
213 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:213:26: warning: "KERNEL_VERSION" is not defined, evaluates to 0 [-Wundef]
213 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
| ^~~~~~~~~~~~~~
drivers/net/ovpn-dco/tcp.c:213:40: error: missing binary operator before token "("
213 | #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)