Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: glennr on October 06, 2021, 09:22:10 PM
-
I'm wanting to get wireguard working on a headless pi running piCore 13 with the intention of using it as a UPS monitoring machine at a remote location.
I have made a tcz package with the required modules using the procedure described here http://forum.tinycorelinux.net/index.php/topic,20692.msg129171.html#msg129171 (http://forum.tinycorelinux.net/index.php/topic,20692.msg129171.html#msg129171) and I am able to successfully load the wireguard module.
I now need a setup script and the wireguard tools.
tce-ab doesn't find anything related to wireguard so I guess that means I need to build it myself.
Is there an example I can follow for both getting the wireguard tools built into a tcz and for the setup scripts?
-
Hi glennr
... Is there an example I can follow for both getting the wireguard tools built into a tcz ...
You can find build notes here:
http://tinycorelinux.net/11.x/x86_64/tcz/src/wireguard/
and here:
http://tinycorelinux.net/10.x/x86/tcz/src/wireguard/
... and for the setup scripts?
You can download and unpack one of the extensions and look at the included files. There are only 4 of them:
/usr/local/tce.installed/wireguard-tools
/usr/local/bin/stat
/usr/local/bin/wg-quick
/usr/local/bin/wg
The first one is a script. It's possible 1 or 2 of the files in /usr/local/bin/ are also scripts.
Here are a couple of threads on the subject by GNUser who submitted the extensions and build notes:
http://forum.tinycorelinux.net/index.php/topic,23867.0.html
http://forum.tinycorelinux.net/index.php/topic,23873.0.html
http://forum.tinycorelinux.net/index.php/topic,24677.msg156878.html#msg156878
-
[Edit: posted this before I saw the previous response, will review after following those suggestions]
[Edit2: after reviewing the above:
The wireguard.ko module is provided in http://www.tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/5.10.16-piCore_modules.tar.xz (http://www.tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/5.10.16-piCore_modules.tar.xz) and I already have that and its dependencies loading ok.
Building wireguard-tools fails as described below]
Following the instructions here https://www.wireguard.com/compilation/
I've installed bunutils, gcc, make, git, linux-5.10.y_api_headers.tcz, libelf-dev, libmnl-dev, glibc_base-dev.tcz
The asm/socket.h header is missing:
$ CC config.o
In file included from /usr/include/sys/socket.h:33,
from /usr/include/netinet/in.h:23,
from /usr/include/arpa/inet.h:22,
from config.c:6:
/usr/include/bits/socket.h:354:11: fatal error: asm/socket.h: No such file or directory
On raspbian it looks like that file is at
/usr/include/arm-linux-gnueabihf/asm/socket.h
which is provided by linux-libc-dev.
What package provides that file in piCore?
-
Hi glennr
According to this:
http://tinycorelinux.net/13.x/armv6/tcz/linux-5.10.y_api_headers.tcz.list
it contains:
usr/include/asm/socket.h
-
Thanks @Rich
I had installed but forgot to do
tce-load -i linux-5.10.y_api_headers.tcz
It's building now.
Once I have this working can I contribute it back to the project?
-
Hi glennr
Instructions for submitting extensions can be found here:
https://web.archive.org/web/20200208152109/http://wiki.tinycorelinux.net/wiki:creating_extensions#submitting
Use the tcesubmit email address, not the picoresubmit address.
-
Thanks.
I have it nearly working now, just lacking persistence of the wg config.
Some notes:
After compiling wireguard-tools I made a tcz to install wg and the wg-quick script to /usr/local/bin using the above procedure[1].
The wg-quick script requires bash, /sbin/ip and stat
tce-load -iw bash
tce-load -iw iproute2
tce-load -iw coreutils
I made /etc/wireguard/wg0.conf with an appropriate configuration and brought the link up with
wg-quick up wg0
Now I need to figure out how to persist the /etc/wireguard/* files and sort out the rest of the packaging such as dependencies and documentation, and possibly add an init.d script.
[1] which I would post in this thread if I could but the server gives me a 500 when I try
-
Hi glennr
I just downloaded and unpacked http://tinycorelinux.net/10.x/x86/tcz/wireguard-tools.tcz.
The tce.installed script looks like this:
tc@E310:~/wg$ cat squashfs-root/usr/local/tce.installed/wireguard-tools
#!/bin/sh
modprobe -a ipv6 wireguard
The extension also contains an empty /etc/wireguard/ directory.