Skip to content

Commit

Permalink
Add external module for UDM 1.11.4
Browse files Browse the repository at this point in the history
Also restructure patches for simpler build code
  • Loading branch information
peacey committed Mar 6, 2022
1 parent 6138ae8 commit 7041f1e
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The Unifi UDM is built on a powerful quad core ARM64 CPU that can sustain up to
1. We first need to download the tar file onto the UDM. Connect to it via SSH and type the following command to download the tar file. You need to download the following tar file. NOTE: always check [this link](https://github.com/tusc/wireguard-kmod/releases) for the latest release.

```sh
curl -LJo wireguard-kmod.tar.Z https://github.com/tusc/wireguard-kmod/releases/download/v01-22-22/wireguard-kmod-01-22-22.tar.Z
curl -LJo wireguard-kmod.tar.Z https://github.com/tusc/wireguard-kmod/releases/download/v03-03-22/wireguard-kmod-03-03-22.tar.Z
```

2. From this directory type the following to extract the files:
Expand Down
2 changes: 1 addition & 1 deletion src/bases/udm-1.11.0/versions.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-v1.11.0.3921-f2e3fac
-v1.11.0.3921-f2e3fac,-v1.11.1.3932-88c26f4,-v1.11.3.3937-2edb570,-v1.11.4.3940-e66d85f
13 changes: 4 additions & 9 deletions src/build-wireguard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@ then
fi
tar -xvjf buildroot-2017.11.1.tar.bz2

# copy wireguard and openresolv packages and add to menu seleciton
# copy packages and patches and add wireguard to buildroot menu selection
cp -pr packages/* buildroot-2017.11.1/package
patch -p0 <patches/wireguard-packages.patch
patch -p0 <patches/openresolv-package.patch
patch -d buildroot-2017.11.1 -p1 <patches/add-kernel-4-19.patch

cp patches/0001-m4-glibc-change-work-around.patch buildroot-2017.11.1/package/m4
cp patches/0001-bison-glibc-change-work-around.patch buildroot-2017.11.1/package/bison
cp patches/944-mpc-relative-literal-loads-logic-in-aarch64_classify_symbol.patch buildroot-2017.11.1/package/gcc/6.4.0
cp patches/0001-dtc-extern-yylloc.patch buildroot-2017.11.1/package/dtc
for patch in patches/*.patch; do
patch -p0 < "$patch"
done

# run make clean after extraction
(cd buildroot-2017.11.1 && make clean || true)
Expand Down
File renamed without changes.
108 changes: 108 additions & 0 deletions src/packages/m4/0002-m4-fix-sigstksz.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
From f9e2b20a12a230efa30f1d479563ae07d276a94b Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Wed, 30 Sep 2020 13:50:36 -0700
Subject: [PATCH] c-stack: stop using SIGSTKSZ
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

It's been proposed to stop making SIGSTKSZ an integer constant:
https://sourceware.org/pipermail/libc-alpha/2020-September/118028.html
Also, using SIGSTKSZ in #if did not conform to current POSIX.
Also, avoiding SIGSTKSZ makes the code simpler and easier to grok.
* lib/c-stack.c (SIGSTKSZ): Remove.
(alternate_signal_stack): Now a 64 KiB array, for simplicity.
All uses changed.

(Note for Ubuntu: The patch originates from gnulib, not m4, and has been
heavily edited to fit the older version used in our current version of m4)

--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -50,15 +50,16 @@
#if ! HAVE_STACK_T && ! defined stack_t
typedef struct sigaltstack stack_t;
#endif
-#ifndef SIGSTKSZ
-# define SIGSTKSZ 16384
-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
- more than the Linux default of an 8k alternate stack when deciding
- if a fault was caused by stack overflow. */
-# undef SIGSTKSZ
-# define SIGSTKSZ 16384
-#endif
+/* Storage for the alternate signal stack.
+ 64 KiB is not too large for Gnulib-using apps, and is large enough
+ for all known platforms. Smaller sizes may run into trouble.
+ For example, libsigsegv 2.6 through 2.8 have a bug where some
+ architectures use more than the Linux default of an 8 KiB alternate
+ stack when deciding if a fault was caused by stack overflow. */
+static max_align_t alternate_signal_stack[(64 * 1024
+ + sizeof (max_align_t) - 1)
+ / sizeof (max_align_t)];
+

#include <stdlib.h>
#include <string.h>
@@ -128,18 +129,6 @@
#if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \
&& HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV

-/* Storage for the alternate signal stack. */
-static union
-{
- char buffer[SIGSTKSZ];
-
- /* These other members are for proper alignment. There's no
- standard way to guarantee stack alignment, but this seems enough
- in practice. */
- long double ld;
- long l;
- void *p;
-} alternate_signal_stack;

static void
null_action (int signo __attribute__ ((unused)))
@@ -205,8 +194,8 @@

/* Always install the overflow handler. */
if (stackoverflow_install_handler (overflow_handler,
- alternate_signal_stack.buffer,
- sizeof alternate_signal_stack.buffer))
+ alternate_signal_stack,
+ sizeof alternate_signal_stack))
{
errno = ENOTSUP;
return -1;
@@ -279,14 +268,14 @@
stack_t st;
struct sigaction act;
st.ss_flags = 0;
+ st.ss_sp = alternate_signal_stack;
+ st.ss_size = sizeof alternate_signal_stack;
# if SIGALTSTACK_SS_REVERSED
/* Irix mistakenly treats ss_sp as the upper bound, rather than
lower bound, of the alternate stack. */
- st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *);
- st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *);
-# else
- st.ss_sp = alternate_signal_stack.buffer;
- st.ss_size = sizeof alternate_signal_stack.buffer;
+ st.ss_size -= sizeof (void *);
+ char *ss_sp = st.ss_sp;
+ st.ss_sp = ss_sp + st.ss_size;
# endif
r = sigaltstack (&st, NULL);
if (r != 0)
--- a/lib/c-stack.h
+++ b/lib/c-stack.h
@@ -34,7 +34,7 @@
A null ACTION acts like an action that does nothing.

ACTION must be async-signal-safe. ACTION together with its callees
- must not require more than SIGSTKSZ bytes of stack space. Also,
+ must not require more than 64 KiB of stack space. Also,
ACTION should not call longjmp, because this implementation does
not guarantee that it is safe to return to the original stack.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/package/linux-headers/Config.in.host b/package/linux-headers/Config.in.host
diff --git buildroot-2017.11.1.orig/package/linux-headers/Config.in.host buildroot-2017.11.1/package/linux-headers/Config.in.host
index 4d9652b..6fb948e 100644
--- a/package/linux-headers/Config.in.host
+++ b/package/linux-headers/Config.in.host
--- buildroot-2017.11.1.orig/package/linux-headers/Config.in.host
+++ buildroot-2017.11.1/package/linux-headers/Config.in.host
@@ -74,6 +74,11 @@ config BR2_KERNEL_HEADERS_4_13
bool "Linux 4.13.x kernel headers"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_13
Expand Down Expand Up @@ -31,10 +31,10 @@ index 4d9652b..6fb948e 100644
default "4.13.16" if BR2_KERNEL_HEADERS_4_13
+ default "4.19.152" if BR2_KERNEL_HEADERS_4_19
default BR2_DEFAULT_KERNEL_VERSION if BR2_KERNEL_HEADERS_VERSION
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
diff --git buildroot-2017.11.1.orig/toolchain/toolchain-common.in buildroot-2017.11.1/toolchain/toolchain-common.in
index d87d4d7..3c15fec 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
--- buildroot-2017.11.1.orig/toolchain/toolchain-common.in
+++ buildroot-2017.11.1/toolchain/toolchain-common.in
@@ -253,10 +253,15 @@ config BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_13
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
Expand All @@ -51,10 +51,10 @@ index d87d4d7..3c15fec 100644
default "4.13" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_13
default "4.12" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
default "4.11" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_11
diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
diff --git buildroot-2017.11.1.orig/toolchain/toolchain-external/toolchain-external-custom/Config.in.options buildroot-2017.11.1/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index a285340..72efc19 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
--- buildroot-2017.11.1.orig/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ buildroot-2017.11.1/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -93,6 +93,10 @@ choice
m = ( LINUX_VERSION_CODE >> 8 ) & 0xFF
p = ( LINUX_VERSION_CODE >> 0 ) & 0xFF
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7041f1e

Please sign in to comment.