From e22b863f26e80500f4cbf9270072943bf8387551 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 9 May 2023 21:15:28 +0200 Subject: [PATCH 1/3] Add Systemtap package --- systemtap/Makefile | 79 +++++++++++++++++++ ...gure-write-a-python-location-into-th.patch | 25 ++++++ ...ython-modules-to-correct-library-dir.patch | 56 +++++++++++++ ...staprun-address-ncurses-6.3-failures.patch | 61 ++++++++++++++ ...-don-t-support-installing-a-non-root.patch | 37 +++++++++ systemtap/patches/basename.patch | 24 ++++++ systemtap/patches/conversion.patch | 15 ++++ systemtap/patches/include-fix.patch | 22 ++++++ systemtap/patches/types.patch | 60 ++++++++++++++ 9 files changed, 379 insertions(+) create mode 100644 systemtap/Makefile create mode 100644 systemtap/patches/0001-Do-not-let-configure-write-a-python-location-into-th.patch create mode 100644 systemtap/patches/0001-Install-python-modules-to-correct-library-dir.patch create mode 100644 systemtap/patches/0001-staprun-address-ncurses-6.3-failures.patch create mode 100644 systemtap/patches/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch create mode 100644 systemtap/patches/basename.patch create mode 100644 systemtap/patches/conversion.patch create mode 100644 systemtap/patches/include-fix.patch create mode 100644 systemtap/patches/types.patch diff --git a/systemtap/Makefile b/systemtap/Makefile new file mode 100644 index 000000000..6b3a704cc --- /dev/null +++ b/systemtap/Makefile @@ -0,0 +1,79 @@ +# +# Copyright (C) 2018-2022 Ycarus (Yannick Chabanois) for OpenMPTCProuter +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=systemtap +PKG_RELEASE:=1 +PKG_VERSION:=4.9 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://sourceware.org/systemtap/ftp/releases/ +PKG_HASH:=d01033baea9d0af52a65e70167816931f4b856427a53ff2ab30e4b45f6ad3a98 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_DEPENDS:=systemtap/host +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/systemtap + SUBMENU:=System + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Simplify the gathering of information + URL:=http://sourceware.org/systemtap/wiki + DEPENDS:=@(LINUX_5_15||LINUX_6_1) +libelf +libdw + MAINTAINER:=Ycarus (Yannick Chabanois) +endef + +define Package/systemtap/description + SystemTap (stap) is a scripting language and tool for dynamically instrumenting running production Linux-based operating systems. +endef + +CONFIGURE_ARGS += --without-rpm \ + --without-nss --without-avahi --without-dyninst \ + --disable-server --disable-grapher --enable-prologues \ + --without-python2-probes --disable-translator \ + --disable-libvirt --disable-sqlite --disable-monitor --without-python3-probes \ + ac_cv_prog_have_javac=no \ + ac_cv_prog_have_jar=no + +HOST_CONFIGURE_ARGS += --without-rpm \ + --without-nss --without-avahi --without-dyninst \ + --disable-server --disable-grapher --enable-prologues \ + --without-python2-probes \ + --disable-libvirt --disable-sqlite --disable-monitor --without-python3-probes \ + ac_cv_prog_have_javac=no \ + ac_cv_prog_have_jar=no + +define Package/systemtap/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/include + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/share + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/* $(1)/usr/share/ +endef + +define Host/install + $(INSTALL_DIR) $(STAGING_DIR_HOST)/usr/bin + $(INSTALL_DIR) $(STAGING_DIR_HOST)/usr/include + $(INSTALL_DIR) $(STAGING_DIR_HOST)/usr/lib + $(INSTALL_DIR) $(STAGING_DIR_HOST)/usr/share + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(STAGING_DIR_HOST)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(STAGING_DIR_HOST)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(STAGING_DIR_HOST)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/share/* $(STAGING_DIR_HOST)/usr/share/ +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,systemtap)) diff --git a/systemtap/patches/0001-Do-not-let-configure-write-a-python-location-into-th.patch b/systemtap/patches/0001-Do-not-let-configure-write-a-python-location-into-th.patch new file mode 100644 index 000000000..742b1187f --- /dev/null +++ b/systemtap/patches/0001-Do-not-let-configure-write-a-python-location-into-th.patch @@ -0,0 +1,25 @@ +From ab29615ed6c2e779b472903564dc683dc1015de7 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 22 Feb 2017 13:37:33 +0200 +Subject: [PATCH] Do not let configure write a python location into the dtrace + binary + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin +--- + dtrace.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dtrace.in b/dtrace.in +index 5e1cf8079..a24229cbc 100644 +--- a/dtrace.in ++++ b/dtrace.in +@@ -1,4 +1,4 @@ +-#!@preferred_python@ ++#!/usr/bin/python3 + # vim: et sta sts=4 sw=4 ts=8 + + # This handles the systemtap equivalent of +-- +2.11.0 + diff --git a/systemtap/patches/0001-Install-python-modules-to-correct-library-dir.patch b/systemtap/patches/0001-Install-python-modules-to-correct-library-dir.patch new file mode 100644 index 000000000..48cf4aee8 --- /dev/null +++ b/systemtap/patches/0001-Install-python-modules-to-correct-library-dir.patch @@ -0,0 +1,56 @@ +From 2ada22f05460223924efe54080cb4419e2b4c276 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Fri, 24 Feb 2017 17:53:02 +0200 +Subject: [PATCH] Install python modules to correct library dir. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin + +Add OE's CFLAGS which contains `-fdebug-prefix-map' options to +setup.py + +Supply "--root" directory to the "install" command, and use +it as a prefix to strip off the purported filename encoded +in bytecode files. (It strips build path prefix from .pyc files) + +Signed-off-by: Hongxu Jia +--- + python/Makefile.am | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/python/Makefile.am b/python/Makefile.am +index a254480..578602f 100644 +--- a/python/Makefile.am ++++ b/python/Makefile.am +@@ -8,6 +8,10 @@ AUTOMAKE_OPTIONS = subdir-objects + AM_CPPFLAGS = -I$(srcdir)/../includes + AM_CPPFLAGS += -I$(abs_builddir)/../includes/sys + ++# Add OE's CFLAGS which contains `-fdebug-prefix-map' options to ++# fix build path issue ++AM_CPPFLAGS += $(CFLAGS) ++ + # Any script in the following variable will get byte-compiled at + # install time. + pkglibexecpython_PYTHON = +@@ -47,7 +51,7 @@ install-exec-local: + if HAVE_PYTHON2_PROBES + (cd $(srcdir); CFLAGS="$(AM_CPPFLAGS)" $(PYTHON) setup.py build \ + --build-base $(shell readlink -f $(builddir))/py2build \ +- install --prefix $(DESTDIR)$(prefix) \ ++ install --root $(DESTDIR) --prefix $(prefix) --prefix $(prefix) --install-lib=${pythondir} \ + --single-version-externally-managed \ + --record $(shell readlink -f $(builddir))/py2build/install_files.txt \ + --verbose) +@@ -55,7 +59,7 @@ endif + if HAVE_PYTHON3_PROBES + (cd $(srcdir); CFLAGS="$(AM_CPPFLAGS)" $(PYTHON3) setup.py build \ + --build-base $(shell readlink -f $(builddir))/py3build \ +- install --prefix $(DESTDIR)$(prefix) \ ++ install --root $(DESTDIR) --prefix $(prefix) --install-lib=${python3dir} \ + --single-version-externally-managed \ + --record $(shell readlink -f $(builddir))/py3build/install_files.txt \ + --verbose) +-- +2.7.4 + diff --git a/systemtap/patches/0001-staprun-address-ncurses-6.3-failures.patch b/systemtap/patches/0001-staprun-address-ncurses-6.3-failures.patch new file mode 100644 index 000000000..1decf2159 --- /dev/null +++ b/systemtap/patches/0001-staprun-address-ncurses-6.3-failures.patch @@ -0,0 +1,61 @@ +From 191f528da19193d713d94ee252e2485efd9af4d3 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Mon, 25 Oct 2021 17:59:24 +0200 +Subject: [PATCH] staprun: address ncurses 6.3 failures + +Upstream-Status: Submitted [by email to smakarov@redhat.com,systemtap@sourceware.org] +Signed-off-by: Alexander Kanavin +--- + staprun/monitor.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/staprun/monitor.c b/staprun/monitor.c +index 478634c09..f4fbfd686 100644 +--- a/staprun/monitor.c ++++ b/staprun/monitor.c +@@ -448,12 +448,12 @@ void monitor_render(void) + if (active_window == 0) + wattron(status, A_BOLD); + wprintw(status, "\n%*s\t%*s\t%*s\t%*s\t%*s\t%*s\t%s\n", +- width[p_index], HIGHLIGHT("index", p_index, comp_fn_index), +- width[p_state], HIGHLIGHT("state", p_state, comp_fn_index), +- width[p_hits], HIGHLIGHT("hits", p_hits, comp_fn_index), +- width[p_min], HIGHLIGHT("min", p_min, comp_fn_index), +- width[p_avg], HIGHLIGHT("avg", p_avg, comp_fn_index), +- width[p_max], HIGHLIGHT("max", p_max, comp_fn_index), ++ (int)width[p_index], HIGHLIGHT("index", p_index, comp_fn_index), ++ (int)width[p_state], HIGHLIGHT("state", p_state, comp_fn_index), ++ (int)width[p_hits], HIGHLIGHT("hits", p_hits, comp_fn_index), ++ (int)width[p_min], HIGHLIGHT("min", p_min, comp_fn_index), ++ (int)width[p_avg], HIGHLIGHT("avg", p_avg, comp_fn_index), ++ (int)width[p_max], HIGHLIGHT("max", p_max, comp_fn_index), + HIGHLIGHT("name", p_name, comp_fn_index)); + if (active_window == 0) + wattroff(status, A_BOLD); +@@ -466,17 +466,17 @@ void monitor_render(void) + json_object *probe, *field; + probe = json_object_array_get_idx(jso_probe_list, i); + json_object_object_get_ex(probe, "index", &field); +- wprintw(status, "%*s\t", width[p_index], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_index], json_object_get_string(field)); + json_object_object_get_ex(probe, "state", &field); +- wprintw(status, "%*s\t", width[p_state], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_state], json_object_get_string(field)); + json_object_object_get_ex(probe, "hits", &field); +- wprintw(status, "%*s\t", width[p_hits], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_hits], json_object_get_string(field)); + json_object_object_get_ex(probe, "min", &field); +- wprintw(status, "%*s\t", width[p_min], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_min], json_object_get_string(field)); + json_object_object_get_ex(probe, "avg", &field); +- wprintw(status, "%*s\t", width[p_avg], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_avg], json_object_get_string(field)); + json_object_object_get_ex(probe, "max", &field); +- wprintw(status, "%*s\t", width[p_max], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_max], json_object_get_string(field)); + getyx(status, discard, cur_x); + json_object_object_get_ex(probe, "name", &field); + wprintw(status, "%.*s", max_cols-cur_x-1, json_object_get_string(field)); +-- +2.20.1 + diff --git a/systemtap/patches/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch b/systemtap/patches/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch new file mode 100644 index 000000000..e2f8b3b05 --- /dev/null +++ b/systemtap/patches/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch @@ -0,0 +1,37 @@ +From 3e13a006fe3dff9489269274093bf868532036e2 Mon Sep 17 00:00:00 2001 +From: Saul Wold +Date: Tue, 5 Sep 2017 16:02:55 -0700 +Subject: [PATCH] staprun/stapbpf: don't support installing a non-root + +Since we are in a known environment and installing as root and +expect to be running as root, don't create the group or chmod +the binaries. + +Upstream-Status: Inappropriate [Embedded] +Signed-off-by: Saul Wold +--- + stapbpf/Makefile.am | 14 +++++++------- + staprun/Makefile.am | 12 ++++++------ + 2 files changed, 13 insertions(+), 13 deletions(-) + +Index: git/stapbpf/Makefile.am +=================================================================== +--- git.orig/stapbpf/Makefile.am ++++ git/stapbpf/Makefile.am +@@ -41,10 +41,10 @@ + + # Why the "id -u" condition? This way, an unprivileged user can run + # make install, and have "sudo stap ...." or "sudo stapbpf ...." work later. +-install-exec-hook: +- if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \ +- || groupadd -f -g 156 -r stapusr); then \ +- chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \ +- && chmod 04110 "$(DESTDIR)$(bindir)/stapbpf"; \ +- fi ++#install-exec-hook: ++## if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \ ++## || groupadd -f -g 156 -r stapusr); then \ ++## chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \ ++# && chmod 04110 "$(DESTDIR)$(bindir)/stapbpf"; \ ++# fi + endif diff --git a/systemtap/patches/basename.patch b/systemtap/patches/basename.patch new file mode 100644 index 000000000..12e072b5d --- /dev/null +++ b/systemtap/patches/basename.patch @@ -0,0 +1,24 @@ +--- a/buildrun.cxx 2023-05-03 10:17:44.338633166 +0200 ++++ b/buildrun.cxx 2023-05-03 10:18:48.465507072 +0200 +@@ -943,7 +943,8 @@ + if (remotedir.empty()) + opt_u.append(s.uprobes_path); + else +- opt_u.append(remotedir + "/" + basename(s.uprobes_path.c_str())); ++ //opt_u.append(remotedir + "/" + basename(s.uprobes_path.c_str())); ++ opt_u.append(remotedir + "/" + s.uprobes_path.substr(s.uprobes_path.rfind('/')+1)); + } + cmd.push_back(opt_u); + } +--- a/remote.cxx 2023-05-03 13:52:06.614257954 +0200 ++++ b/remote.cxx 2023-05-03 13:53:19.784994466 +0200 +@@ -472,7 +472,8 @@ + + if (!s->uprobes_path.empty()) + { +- string remoteuprobes = basename(s->uprobes_path.c_str()); ++ //string remoteuprobes = basename(s->uprobes_path.c_str()); ++ string remoteuprobes = s->uprobes_path.substr(s->uprobes_path.rfind('/')+1); + if ((rc = send_file(s->uprobes_path, remoteuprobes))) + return rc; + diff --git a/systemtap/patches/conversion.patch b/systemtap/patches/conversion.patch new file mode 100644 index 000000000..225d92279 --- /dev/null +++ b/systemtap/patches/conversion.patch @@ -0,0 +1,15 @@ +--- a/util.cxx 2023-05-03 13:20:34.930972141 +0200 ++++ b/util.cxx 2023-05-03 13:21:15.398273958 +0200 +@@ -257,8 +257,10 @@ + { + char *dirc, *basec, *bname, *dname; + +- dirc = strdupa (path.c_str()); +- basec = strdupa (path.c_str()); ++ dirc = strdup (path.c_str()); ++ basec = strdup (path.c_str()); + dname = dirname (dirc); + bname = basename (basec); ++ free(dirc); ++ free(basec); + directory = dname; diff --git a/systemtap/patches/include-fix.patch b/systemtap/patches/include-fix.patch new file mode 100644 index 000000000..d12ab4f33 --- /dev/null +++ b/systemtap/patches/include-fix.patch @@ -0,0 +1,22 @@ +--- a/staprun/staprun.h 2023-05-03 21:59:59.097825632 +0200 ++++ b/staprun/staprun.h 2023-05-03 22:00:06.457699309 +0200 +@@ -30,7 +30,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +--- a/stapbpf/stapbpf.cxx 2023-05-03 22:02:20.483398963 +0200 ++++ b/stapbpf/stapbpf.cxx 2023-05-03 22:02:34.879151884 +0200 +@@ -34,7 +34,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/systemtap/patches/types.patch b/systemtap/patches/types.patch new file mode 100644 index 000000000..b27405fcd --- /dev/null +++ b/systemtap/patches/types.patch @@ -0,0 +1,60 @@ +--- a/util.h 2023-05-03 08:32:15.445228767 +0200 ++++ b/util.h 2023-05-03 08:33:38.683781936 +0200 +@@ -16,6 +16,27 @@ + #include + #include + #include ++#include ++#include ++ ++typedef off_t __off_t; ++typedef signed char __int8_t; ++typedef unsigned char __uint8_t; ++typedef signed short int __int16_t; ++typedef unsigned short int __uint16_t; ++typedef signed int __int32_t; ++typedef unsigned int __uint32_t; ++#if __WORDSIZE == 64 ++typedef signed long int __int64_t; ++typedef unsigned long int __uint64_t; ++#elif defined(__GNUC__) ++__extension__ typedef signed long long int __int64_t; ++__extension__ typedef unsigned long long int __uint64_t; ++#endif ++ ++#ifndef FNM_EXTMATCH ++#define FNM_EXTMATCH 0 ++#endif + + extern "C" { + #if ENABLE_NLS +@@ -415,6 +415,9 @@ + const sigset_t *sigmask); + #endif + ++#ifndef __GLIBC__ ++#define canonicalize_file_name(name) realpath(name,NULL) ++#endif + + int read_from_file (const std::string &fname, int &data); + template +--- a/tapsets.cxx 2023-05-03 09:17:52.009600253 +0200 ++++ b/tapsets.cxx 2023-05-03 09:18:02.989408144 +0200 +@@ -51,7 +51,6 @@ + #include + #include + #include +-#include + #include + #include + #include +--- a/staprun/staprun.h 2023-05-03 21:56:21.277564278 +0200 ++++ b/staprun/staprun.h 2023-05-03 21:57:10.364721740 +0200 +@@ -48,6 +48,7 @@ + #include + #endif + ++typedef off_t __off_t; + + /* define gettext options if NLS is set */ + #if ENABLE_NLS From dfaa6ba1f009e0e762b85c29e29776f11259c9ab Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 15 May 2023 21:01:36 +0200 Subject: [PATCH 2/3] Update golang and enable MPTCP by default --- golang/golang-package.mk | 2 +- golang/golang-values.mk | 2 +- golang/golang/Makefile | 24 +++++++--- ...-ARM-ARM64-only-if-gold-is-available.patch | 48 ------------------- .../patches/001-default-enable-mptcp.patch | 11 +++++ 5 files changed, 31 insertions(+), 56 deletions(-) delete mode 100644 golang/golang/patches/001-cmd-link-use-gold-on-ARM-ARM64-only-if-gold-is-available.patch create mode 100644 golang/golang/patches/001-default-enable-mptcp.patch diff --git a/golang/golang-package.mk b/golang/golang-package.mk index 7144a4524..fcc3f3aec 100644 --- a/golang/golang-package.mk +++ b/golang/golang-package.mk @@ -213,7 +213,7 @@ GO_PKG_BUILD_VARS= \ GOPATH="$(GO_PKG_BUILD_DIR)" \ GOCACHE="$(GO_BUILD_CACHE_DIR)" \ GOMODCACHE="$(GO_MOD_CACHE_DIR)" \ - GOENV=off + GOENV=off GOPROXY="direct" GO_PKG_VARS= \ $(GO_PKG_TARGET_VARS) \ diff --git a/golang/golang-values.mk b/golang/golang-values.mk index 3c170f308..f0581f419 100644 --- a/golang/golang-values.mk +++ b/golang/golang-values.mk @@ -30,7 +30,7 @@ unexport \ GOPATH \ GOROOT \ GOTMPDIR \ - GOWORK + GOWORK GOPROXY # Unmodified: # GOINSECURE # GOPRIVATE diff --git a/golang/golang/Makefile b/golang/golang/Makefile index 6f6f28b24..1047d5b6b 100644 --- a/golang/golang/Makefile +++ b/golang/golang/Makefile @@ -7,8 +7,10 @@ include $(TOPDIR)/rules.mk +#GO_VERSION_MAJOR_MINOR:=1.20 +#GO_VERSION_PATCH:=3 GO_VERSION_MAJOR_MINOR:=1.20 -GO_VERSION_PATCH:=3 +GO_VERSION_PATCH:=999 PKG_NAME:=golang PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) @@ -18,9 +20,14 @@ GO_SOURCE_URLS:=https://dl.google.com/go/ \ https://mirrors.ustc.edu.cn/golang/ \ https://mirrors.nju.edu.cn/golang/ -PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz -PKG_SOURCE_URL:=$(GO_SOURCE_URLS) -PKG_HASH:=e447b498cde50215c4f7619e5124b0fc4e25fb5d16ea47271c47f278e7aa763a +#PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz +#PKG_SOURCE_URL:=$(GO_SOURCE_URLS) +#PKG_HASH:=e447b498cde50215c4f7619e5124b0fc4e25fb5d16ea47271c47f278e7aa763a +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/golang/go.git +PKG_SOURCE_VERSION:=a5350558e6e2db16bfe09f2ba8104549c6598c46 +PKG_SOURCE_DATE:=2023-05-05 +PKG_SOURCE_SUBDIR:=go-$(PKG_VERSION) PKG_MAINTAINER:=Jeffery To PKG_LICENSE:=BSD-3-Clause @@ -100,7 +107,7 @@ include ../golang-compiler.mk include ../golang-package.mk PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)" -HOST_UNPACK:=$(HOST_TAR) -C "$(HOST_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)" +#HOST_UNPACK:=$(HOST_TAR) -C "$(HOST_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)" BOOTSTRAP_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_SOURCE)" BOOTSTRAP_1_17_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_1_17_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_1_17_SOURCE)" @@ -234,10 +241,13 @@ HOST_GO_VARS= \ CXX="$(HOSTCXX_NOCACHE)" define Host/Configure + sed -i 's/1\.21/1.20/g' $(HOST_BUILD_DIR)/src/go.mod + sed -i 's/21/20/g' $(HOST_BUILD_DIR)/src/internal/goversion/goversion.go $(call GoCompiler/Bootstrap/CheckHost,$(BOOTSTRAP_GO_VALID_OS_ARCH)) $(call GoCompiler/Host/CheckHost,$(HOST_GO_VALID_OS_ARCH)) mkdir -p "$(GO_BUILD_CACHE_DIR)" + echo "go$(PKG_VERSION)" > $(HOST_BUILD_DIR)/VERSION endef define Host/Compile @@ -334,12 +344,14 @@ PKG_GO_INSTALL_ARGS= \ $(if $(filter $(GO_PKG_ENABLE_PIE),1),-buildmode pie) define Build/Configure + sed -i 's/1\.21/1.20/g' $(HOST_BUILD_DIR)/src/go.mod + sed -i 's/21/20/g' $(HOST_BUILD_DIR)/src/internal/goversion/goversion.go mkdir -p "$(GO_BUILD_CACHE_DIR)" + echo "go$(PKG_VERSION)" > $(PKG_BUILD_DIR)/VERSION endef define Build/Compile @echo "Building target Go first stage" - $(call GoCompiler/Package/Make, \ GOROOT_BOOTSTRAP="$(HOST_GO_ROOT)" \ GO_GCC_HELPER_CC="$(HOSTCC)" \ diff --git a/golang/golang/patches/001-cmd-link-use-gold-on-ARM-ARM64-only-if-gold-is-available.patch b/golang/golang/patches/001-cmd-link-use-gold-on-ARM-ARM64-only-if-gold-is-available.patch deleted file mode 100644 index 683480442..000000000 --- a/golang/golang/patches/001-cmd-link-use-gold-on-ARM-ARM64-only-if-gold-is-available.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 5ccf9f47bf4f5ba53e0ab7338a7fd4626714cfb2 Mon Sep 17 00:00:00 2001 -From: Jeffery To -Date: Tue, 23 Nov 2021 15:05:37 +0800 -Subject: [PATCH] cmd/link: use gold on ARM/ARM64 only if gold is available - -COPY relocation handling on ARM/ARM64 has been fixed in recent versions -of the GNU linker. This switches to gold only if gold is available. - -Fixes #22040. ---- - src/cmd/link/internal/ld/lib.go | 19 +++++++------------ - 1 file changed, 7 insertions(+), 12 deletions(-) - ---- a/src/cmd/link/internal/ld/lib.go -+++ b/src/cmd/link/internal/ld/lib.go -@@ -1535,25 +1535,20 @@ func (ctxt *Link) hostlink() { - } - - if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && buildcfg.GOOS == "linux" { -- // On ARM, the GNU linker will generate COPY relocations -- // even with -znocopyreloc set. -+ // On ARM, older versions of the GNU linker will generate -+ // COPY relocations even with -znocopyreloc set. - // https://sourceware.org/bugzilla/show_bug.cgi?id=19962 - // -- // On ARM64, the GNU linker will fail instead of -- // generating COPY relocations. -+ // On ARM64, older versions of the GNU linker will fail -+ // instead of generating COPY relocations. - // -- // In both cases, switch to gold. -- altLinker = "gold" -- -- // If gold is not installed, gcc will silently switch -- // back to ld.bfd. So we parse the version information -- // and provide a useful error if gold is missing. -+ // In both cases, switch to gold if gold is available. - name, args := flagExtld[0], flagExtld[1:] - args = append(args, "-fuse-ld=gold", "-Wl,--version") - cmd := exec.Command(name, args...) - if out, err := cmd.CombinedOutput(); err == nil { -- if !bytes.Contains(out, []byte("GNU gold")) { -- log.Fatalf("ARM external linker must be gold (issue #15696), but is not: %s", out) -+ if bytes.Contains(out, []byte("GNU gold")) { -+ altLinker = "gold" - } - } - } diff --git a/golang/golang/patches/001-default-enable-mptcp.patch b/golang/golang/patches/001-default-enable-mptcp.patch new file mode 100644 index 000000000..68de599e2 --- /dev/null +++ b/golang/golang/patches/001-default-enable-mptcp.patch @@ -0,0 +1,11 @@ +--- a/src/net/dial.go 2023-05-06 10:33:54.275030044 +0200 ++++ b/src/net/dial.go 2023-05-06 10:34:29.218440686 +0200 +@@ -18,7 +18,7 @@ + + // For the moment, MultiPath TCP is not used by default + // See go.dev/issue/56539 +- defaultMPTCPEnabled = false ++ defaultMPTCPEnabled = true + ) + + // mptcpStatus is a tristate for Multipath TCP, see go.dev/issue/56539 From 9c1c926ad4885b60f5c5b38cac8f18ebfceb2805 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 16 May 2023 14:01:23 +0200 Subject: [PATCH 3/3] Fix ndpi-netfilter compilation on all platforms --- ndpi-netfilter2/Makefile | 2 ++ ndpi-netfilter2/patches/outline-atomics.patch | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ndpi-netfilter2/Makefile b/ndpi-netfilter2/Makefile index a91cdaaf7..7eee4b671 100644 --- a/ndpi-netfilter2/Makefile +++ b/ndpi-netfilter2/Makefile @@ -20,6 +20,8 @@ PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=https://github.com/vel21ripn/nDPI.git PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_BUILD_PARALLEL:=0 + PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk diff --git a/ndpi-netfilter2/patches/outline-atomics.patch b/ndpi-netfilter2/patches/outline-atomics.patch index a0935ecea..72dace62c 100644 --- a/ndpi-netfilter2/patches/outline-atomics.patch +++ b/ndpi-netfilter2/patches/outline-atomics.patch @@ -1,17 +1,13 @@ --- a/ndpi-netfilter/src/Makefile 2022-08-03 21:27:52.321058402 +0200 +++ b/ndpi-netfilter/src/Makefile 2022-08-03 21:28:27.572452447 +0200 -@@ -5,6 +5,14 @@ +@@ -5,6 +5,10 @@ ccflags-y += -I${src}/${NDPI_SRC}/include -I${src}/${NDPI_SRC}/lib -I${src}/../libre -I${src}/${NDPI_SRC}/lib/third_party/include ccflags-y += -DHAVE_CONFIG_H -DNDPI_LIB_COMPILATION -DOPENDPI_NETFILTER_MODULE -DNDPI_DETECTION_SUPPORT_IPV6 -g ccflags-y += -Wno-declaration-after-statement -+ifneq ($(KERNEL_RELEASE),5.4) -+ifeq ($(ARCH),arm64) -+ ccflags-y += -mno-outline-atomics -+endif -+ifeq ($(ARCH),aarch64) -+ ccflags-y += -mno-outline-atomics -+endif -+endif ++cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \ ++ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) ++mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "") ++ccflags-y += $(mno_outline_atomics) #ccflags-y += -Wshadow-local # Needed for pahole #ccflags-y += -femit-struct-debug-detailed=any