From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) by mx.groups.io with SMTP id smtpd.web09.3005.1614300890517946684 for ; Thu, 25 Feb 2021 16:54:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Du4e89Mr; spf=pass (domain: gmail.com, ip: 209.85.217.45, mailfrom: christian.betz@gmail.com) Received: by mail-vs1-f45.google.com with SMTP id m18so3615888vsg.7 for ; Thu, 25 Feb 2021 16:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cEvsXIbs7Y1EyHTKi8O68ZVqKrKQtikBQ5fS5xaawWA=; b=Du4e89MrzmHLS02CybMdbSWe8CsKztOd44K24CJxNce8/3FLDGdsPdUR9gf1ybgXvB b71kW8pfWzJmqiyfrJuXS5vfN1Y5Yg/qcKbDkqnkH664MzjVcKAVTmGEl5VSPb2mzFVB LEkdS4Jlz6W1W3hk+FyRwi/C8gNk0a1WVznvfL/siafBgvr8oIS0v1WAvTOd6T48YyW1 wQljsMmqZrY+XBBI55mqQVmsa/lNjuKbblOBsgiu8z59+jMW4yUoOV/8ZQEKrWo663eh Fh/0NaKpriun8AzmZ0tDB7AVLD/3os3aAsIjByatSi1YVlwWlxXFtweJ+SX1aTuEh/5v WReQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cEvsXIbs7Y1EyHTKi8O68ZVqKrKQtikBQ5fS5xaawWA=; b=QxsbTJ62BU4m47GR0zQrmYWzSs3WYnUeRj0ei/VykcNXtENoEBModvthBAvQYxSyc9 7CLG1inpBWt/yG0Iw4GzaQH4DpGVOfc7dsD2/7IM1lCi6Pm/D0/h94gQI177T1nZo8Im Au1uHbfAFBnaEJzaheBBFCbtscXegus4bX5KNTrWuPOsqYoJCWF5NED9q778mXnN9fle X0C6M2nhna0RSsFGWGkbWnL2AMgjQfhjf/9LkpTG2wvERlcfglOIf5TptUlgW0h+SeDB gzKGsPkLDVrz0S98BUbp6ipW5aX2NoWYfJJrSxIi93c3PlI4Sl0yAtg3S1xZkKrjmAa0 ez3w== X-Gm-Message-State: AOAM530iseW/aRLlFP3IYpOCx6XzvElz1JEIPzX0oUEFCW0Jav5kGmxP UPdQCilSIJ6qss/0xIV1IF5ddw+ElxzxqDsDDhA= X-Google-Smtp-Source: ABdhPJw5/M9AIc/R3gtd7rig1Z3pW7yKTf7K0zr018Ny7j87aH5JQ4/yek65qba4Dn0j6bR2TZKzYWO/qRRKmAcL0ng= X-Received: by 2002:a05:6102:1275:: with SMTP id q21mr344829vsg.43.1614300889323; Thu, 25 Feb 2021 16:54:49 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "Christian Betz" Date: Thu, 25 Feb 2021 19:54:38 -0500 Message-ID: Subject: Re: [meta-freescale] Wireguard recipe To: "Zunzunegui Abad, Mario-Sergio" Cc: "meta-freescale@lists.yoctoproject.org" Content-Type: multipart/alternative; boundary="000000000000119ad905bc32b7df" --000000000000119ad905bc32b7df Content-Type: text/plain; charset="UTF-8" Hello, >From my experience there are a number of steps; let me try and save you some trouble! (1) create patch for wireguard in your layer. i needed this for linux-fslc kernel on yocto dunfell as of linux kernel version 5.4.83. (i haven't tried later versions or merged dunfell branch since december, you may not need this patch right now) filename: ./recipes-wireguard/wireguard/files/wireguard-compat.patch -------snip------ diff --git a/src/compat/compat-asm.h b/src/compat/compat-asm.h index 53b33d4..1240bc3 100644 --- a/src/compat/compat-asm.h +++ b/src/compat/compat-asm.h @@ -41,8 +41,10 @@ #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) +/* #define SYM_FUNC_START ENTRY #define SYM_FUNC_END ENDPROC +*/ #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) -------snip------ (2) create bbappend in your layer to apply patch filename: ./recipes-wireguard/wireguard/wireguard-module_%.bbappend -------snip------ # Patch to make wireguard compile on Yocto SRC_URI_append_yourboardname = " file://wireguard-compat.patch;striplevel=2" -------snip------ (3) fix bug with systemd location in recipe (if you are using systemd) filename: ./recipes-wireguard/wireguard/wireguard-tools_%.bbappend -------snip------ # Fix bug with systemd unit in wrong location # TODO: check if this is fixed upstream do_install () { oe_runmake DESTDIR="${D}" PREFIX="${prefix}" SYSCONFDIR="${sysconfdir}" \ SYSTEMDUNITDIR="${systemd_unitdir}/system" \ WITH_SYSTEMDUNITS=${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'yes', '', d)} \ WITH_BASHCOMPLETION=yes \ WITH_WGQUICK=yes \ install } -------snip------ (4) make sure you have a kernel cfg for everything wireguard needs: stock linux-fslc seems to be missing some things wireguard needs. filename: ./recipes-bsp/linux-fslc/files/wireguard-extra-kernel-options.cfg -------snip------ CONFIG_SKB_EXTENSIONS=y CONFIG_XFRM=y CONFIG_NET_IPIP=y CONFIG_NET_UDP_TUNNEL=y CONFIG_NET_FOU=y CONFIG_IPV6_FOU=y CONFIG_NF_CONNTRACK=y CONFIG_NF_CONNTRACK_PROCFS=y CONFIG_NF_CT_PROTO_DCCP=y CONFIG_NF_CT_PROTO_SCTP=y CONFIG_NF_CT_PROTO_UDPLITE=y CONFIG_NETFILTER_XTABLES=y CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y CONFIG_NF_DEFRAG_IPV4=y CONFIG_NF_DEFRAG_IPV6=y CONFIG_LIBCRC32C=y -------snip------ (5) add the kernel config in a bbappend for linux-fslc. filename: grep wireguard recipes-bsp/linux-fslc/linux-fslc_%.bbappend -------snip------ # Add custom kernel options for wireguard, wireless PCI # Enable wireguard module SRC_URI += "file://wireguard-extra-kernel-options.cfg" -------snip------ (6) add "wireguard-tools kernel-module-wireguard" to your image, i.e.: filename: recipes-mycompany/images/myproduct-image.bb -------snip------ ... IMAGE_INSTALL_append = " wireguard-tools kernel-module-wireguard" ... -------snip------ On Thu, Feb 25, 2021 at 8:36 AM Zunzunegui Abad, Mario-Sergio < mario.zunzunegui@airbus.com> wrote: > [Edited Message Follows] > Airbus Amber > > Hello. > > I am trying to install WireGuard in Yocto. > > I have included the code and recipe and compiled all with bitbake and > generated an image. > > > > I have added the code provided by NXP in folder > sources/meta-openembedded/meta-networking/recipes-kernel. > > > > Also added "wireguard-tools" in IMAGE_INSTALL_append in > meta-freescale/recipes-fsl/images/fsl-image-core.bb, then run "bitbake > fsl-image-core" > > > > I can generate public and private keys with wg command. > > > > But when I try to configure WireGuard, it seems that it is not loaded the > module. > > > > root@vpx3-152:~# modprobe wireguard > > modprobe: FATAL: Module wireguard not found. > > root@vpx3-152:~# > > > > What I am doing wrong? > > Regards. > > > > #Yocto-wireguard > > > > -- "the new garbage collector will be an arena-based, quad-color incremental, generational, non-copying, high-speed, cache-optimized garbage collector" -- LuaJIT Roadmap --000000000000119ad905bc32b7df Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

From my experience there are a n= umber of steps; let me try and save you some trouble!

<= div>(1) create patch=C2=A0for wireguard=C2=A0in your layer. i needed this= =C2=A0for linux-fslc kernel on yocto dunfell as of linux kernel version 5.= 4.83. (i haven't tried later versions or merged=C2=A0 dunfell branch si= nce december, you may not need this patch right now)

filename: ./recipes-wireguard/wireguard/files/wireguard-compat.patch
-------snip------
diff --git a/src/compat/compat-asm.h b/src/comp= at/compat-asm.h
index 53b33d4..1240bc3 100644
--- a/src/compat/compat= -asm.h
+++ b/src/compat/compat-asm.h
@@ -41,8 +41,10 @@
=C2=A0#end= if
=C2=A0
=C2=A0#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)+/*
=C2=A0#define SYM_FUNC_START ENTRY
=C2=A0#define SYM_FUNC_END E= NDPROC
+*/
=C2=A0#endif
=C2=A0
=C2=A0#if LINUX_VERSION_CODE >= ;=3D KERNEL_VERSION(5, 5, 0)
-------snip------

=
(2) create bbappend in your layer to apply patch

f= ilename: ./recipes-wireguard/wireguard/wireguard-module_%.bbappend
-----= --snip------
# Patch to make wireguard compile on Yocto
SR= C_URI_append_yourboardname =3D " file://wireguard-compat.patch;striple= vel=3D2"
-------snip------

(3) fix bug= with systemd location in recipe (if you are using systemd)

f= ilename: ./recipes-wireguard/wireguard/wireguard-tools_%.bbappend
-------snip------
# Fix bug with systemd unit in = wrong location
# TODO: check if this is fixed upstream
do_install () = {
=C2=A0 =C2=A0 oe_runmake DESTDIR=3D"${D}" PREFIX=3D"${p= refix}" SYSCONFDIR=3D"${sysconfdir}" \
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 SYSTEMDUNITDIR=3D"${systemd_unitdir}/system" \
=C2= = =A0 =C2=A0 =C2=A0 =C2=A0 WITH_SYSTEMDUNITS=3D${@bb.utils.contains('DIS= TRO_FEATURES', 'systemd', 'yes', '', d)} \
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 WITH_BASHCOMPLETION=3Dyes \
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 WITH_WGQUICK=3Dyes \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 install<= br>}
-------snip------

(4) make sure y= ou have a kernel cfg for everything wireguard needs:

stock linux-fslc seems to be missing some things wireguard needs.<= div>
filename: ./recipes-bsp/linux-fslc/files/wireguard= -extra-kernel-options.cfg
-------snip------
CONFIG_SKB_EXTENSIONS=3Dy
CONFIG_XFRM=3Dy
CONFIG_NET_IPIP=3Dy
= CONFIG_NET_UDP_TUNNEL=3Dy
CONFIG_NET_FOU=3Dy
CONFIG_IPV6_FOU=3Dy
C= ONFIG_NF_CONNTRACK=3Dy
CONFIG_NF_CONNTRACK_PROCFS=3Dy
CONFIG_NF_CT_PR= OTO_DCCP=3Dy
CONFIG_NF_CT_PROTO_SCTP=3Dy
CONFIG_NF_CT_PROTO_UDPLITE= =3Dy
CONFIG_NETFILTER_XTABLES=3Dy
CONFIG_NETFILTER_XT_MATCH_HASHLIMI= T=3Dy
CONFIG_NF_DEFRAG_IPV4=3Dy
CONFIG_NF_DEFRAG_IPV6=3Dy
CONFIG_L= IBCRC32C=3Dy
-------snip------

(5) add the kernel config in a bbappend for linux-fslc.

filename: grep wireguard recipes-bsp/linux-fslc/linux-fslc_%.bb= append
-------snip------
# Add cust= om kernel options for wireguard, wireless PCI
# Enable wireguard module<= br>SRC_URI +=3D "file://wireguard-extra-kernel-options.cfg"
=
-------snip------

(= 6) add "wireguard-tools kernel-module-wireguard" to your image, i= .e.:

filename: recipes-mycompany/images/myproduct-image.bb
-------sn= ip------
...
IMAGE_INSTALL_append = = =3D "=C2=A0wireguard-tools kernel-module-wireguard"
..= .
-------snip------

On Thu, Feb 25, 20= 21 at 8:36 AM Zunzunegui Abad, Mario-Sergio <mario.zunzunegui@airbus.com> wrote:

[Edited Message Follows]<= /p>

Airbus Amber

Hello.

I am trying to install WireGua= rd in Yocto.

I have included the code and r= ecipe and compiled all with bitbake and generated an image.

=C2=A0

I have added the code provided by NXP in folder so= urces/meta-openembedded/meta-networking/recipes-kernel.

=C2=A0

Also added =C2=A0"wireguard-tools" in IM= AGE_INSTALL_append in meta-freescale/recipes-fsl/images/fsl-image-core.bb, then run "b= itbake fsl-image-core"

=C2=A0

I can generate public and priv= ate keys with wg command.

=C2=A0

But when I try to configure Wi= reGuard, it seems that it is not loaded the module.

=C2=A0

root@vpx3-152:~# modprobe wire= guard

modprobe: FATAL: Module wiregu= ard not found.

root@vpx3-152:~#

=C2=A0

What I am doing wrong?<= /p>

Regards.

=C2=A0

#Yocto-wireguard






--
"the new garbage collector will be an aren= a-based, quad-color incremental, generational, non-copying, high-speed, cac= he-optimized garbage collector" -- LuaJIT Roadmap
--000000000000119ad905bc32b7df--