Merge Mainline

This commit is contained in:
AmadeusGhost 2020-09-01 19:06:02 +08:00
commit f04c82b5bd
73 changed files with 1675 additions and 141 deletions

View File

@ -250,7 +250,7 @@ define Image/mkfs/squashfs
"$(call mkfs_target_dir,$(1))" > $@.fakeroot-script
echo "$(Image/mkfs/squashfs-common)" >> $@.fakeroot-script
chmod +x $@.fakeroot-script
$(STAGING_DIR_HOST)/bin/fakeroot $@.fakeroot-script
$(FAKEROOT) "$@.fakeroot-script"
endef
else
define Image/mkfs/squashfs

View File

@ -9,10 +9,6 @@ ifndef DUMP
include $(INCLUDE_DIR)/feeds.mk
endif
# invoke ipkg-build with some default options
IPKG_BUILD:= \
$(SCRIPT_DIR)/ipkg-build -c -o 0 -g 0
IPKG_REMOVE:= \
$(SCRIPT_DIR)/ipkg-remove
@ -185,6 +181,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,LicenseFiles,$(LICENSE_FILES)
)$$(call addfield,Section,$(SECTION)
)$$(call addfield,Require-User,$(USERID)
)$$(call addfield,SourceDateEpoch,$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(SOURCE))
)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
)$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed
)$(if $(filter essential,$(PKG_FLAGS)),Essential: yes
@ -196,6 +193,7 @@ $(_endef)
$$(IPKG_$(1)) : export CONTROL=$$(Package/$(1)/CONTROL)
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
$$(IPKG_$(1)) : export PKG_SOURCE_DATE_EPOCH=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh $(SOURCE))
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
@rm -rf $$(IDIR_$(1)); \
$$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(call gen_ipkg_wildcard,$(1))))
@ -262,7 +260,7 @@ $(_endef)
endif
$(INSTALL_DIR) $$(PDIR_$(1))
$(IPKG_BUILD) $$(IDIR_$(1)) $$(PDIR_$(1))
$(FAKEROOT) $(SCRIPT_DIR)/ipkg-build -m "$(PKG_FILE_MODES)" $$(IDIR_$(1)) $$(PDIR_$(1))
@[ -f $$(IPKG_$(1)) ]
$(1)-clean:

View File

@ -32,7 +32,7 @@ VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE))
VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots)
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/snapshots)
VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)

View File

@ -84,7 +84,7 @@ $(curdir)/index: FORCE
mkdir -p $$d; \
cd $$d || continue; \
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages; \
grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require|SourceDateEpoch)' Packages.manifest > Packages; \
case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \
$(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
{ echo ""; echo ""; } >> Packages;; \

View File

@ -183,7 +183,7 @@ if VERSIONOPT
config VERSION_REPO
string
prompt "Release repository"
default "http://downloads.openwrt.org/snapshots"
default "https://downloads.openwrt.org/snapshots"
help
This is the repository address embedded in the image, it defaults
to the trunk snapshot repo; the url may contain the following placeholders:

View File

@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=strace
PKG_VERSION:=5.5
PKG_VERSION:=5.8
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION)
PKG_HASH:=9f58958c8e59ea62293d907d10572e352b582bd7948ed21aa28ebb47e5bf30ff
PKG_HASH:=df4a669f7fff9cc302784085bd4b72fab216a426a3f72c892b28a537b71e7aa9
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=LGPL-2.1-or-later
@ -32,10 +32,6 @@ include $(INCLUDE_DIR)/package.mk
HOST_CFLAGS += -I$(LINUX_DIR)/user_headers/include
ifeq ($(ARCH),aarch64)
CONFIGURE_ARGS += --enable-mpers=check
endif
CONFIGURE_VARS+= \
LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
@ -73,7 +69,8 @@ endef
CONFIGURE_ARGS += \
--with-libdw=$(if $(CONFIG_STRACE_LIBDW),yes,no) \
--with-libunwind=$(if $(CONFIG_STRACE_LIBUNWIND),yes,no)
--with-libunwind=$(if $(CONFIG_STRACE_LIBUNWIND),yes,no) \
--enable-mpers=no
MAKE_FLAGS := \
CCOPT="$(TARGET_CFLAGS)"

View File

@ -12,7 +12,7 @@ PKG_VERSION:=3.130.20.0
PKG_RELEASE:=1
PKG_SOURCE:=wl_apsta-$(PKG_VERSION).o
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
PKG_SOURCE_URL:=https://downloads.openwrt.org/sources
PKG_HASH:=7dba610b1d96dd14e901bcbce14cd6ecd1b1ac6f5c0035b0d6b6dc46a7c3ef90
include $(INCLUDE_DIR)/package.mk

View File

@ -13,7 +13,7 @@ PKG_VERSION:=5.10.56.27.3
PKG_RELEASE:=10
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
PKG_SOURCE_URL:=https://downloads.openwrt.org/sources
ifeq ($(ARCH),mipsel)
PKG_HASH:=26a8c370f48fc129d0731cfd751c36cae1419b0bc8ca35781126744e60eae009

View File

@ -14,7 +14,7 @@ PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_HASH:=707f515eb727c032418c4da67d7e86884bb56cdc2a606e8f6ded6057d8767e57
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
PKG_SOURCE_URL:=https://mirror2.openwrt.org/sources
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_CHECK_FORMAT_SECURITY:=0

View File

@ -0,0 +1,93 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libaudit
PKG_VERSION:=2.8.5
PKG_RELEASE:=1
PKG_SOURCE_NAME:=audit
PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://people.redhat.com/sgrubb/audit
PKG_HASH:=0e5d4103646e00f8d1981e1cd2faea7a2ae28e854c31a803e907a383c5e2ecb7
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:linux_audit_project:linux_audit
PKG_FIXUP:=autoreconf
PKG_USE_MIPS16:=0
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
define Package/libaudit
CATEGORY:=Libraries
TITLE:=Linux Auditing Framework (shared library)
URL:=http://people.redhat.com/sgrubb/audit/
endef
define Package/libaudit/description
This package contains the audit shared library.
endef
CONFIGURE_VARS += \
LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \
CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \
CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
CC_FOR_BUILD="$(HOSTCC)"
CONFIGURE_ARGS += \
--without-libcap-ng \
--disable-systemd \
--without-python \
--without-python3 \
--disable-zos-remote
HOST_CONFIGURE_ARGS += \
--without-python \
--without-python3 \
--disable-zos-remote \
--without-libcap-ng
ifeq ($(ARCH),aarch64)
CONFIGURE_ARGS += --with-aarch64
else ifeq ($(ARCH),arm)
CONFIGURE_ARGS += --with-arm
endif
# We can't use the default, as the default passes $(MAKE_ARGS), which
# overrides CC, CFLAGS, etc. and defeats the *_FOR_BUILD definitions
# passed in CONFIGURE_VARS
define Build/Compile
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib
endef
define Build/Install
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH)/lib $(MAKE_INSTALL_FLAGS) install
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH)/init.d $(MAKE_INSTALL_FLAGS) install
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
endef
define Package/libaudit/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so.* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/etc
$(CP) $(PKG_INSTALL_DIR)/etc/libaudit.conf $(1)/etc/
endef
$(eval $(call BuildPackage,libaudit))

View File

@ -0,0 +1,133 @@
From c39a071e7c021f6ff3554aca2758e97b47a9777c Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Tue, 26 Feb 2019 18:33:33 -0500
Subject: [PATCH] Add substitue functions for strndupa & rawmemchr
(cherry picked from commit d579a08bb1cde71f939c13ac6b2261052ae9f77e)
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
auparse/auparse.c | 12 +++++++++++-
auparse/interpret.c | 9 ++++++++-
configure.ac | 14 +++++++++++++-
src/ausearch-lol.c | 12 +++++++++++-
4 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/auparse/auparse.c b/auparse/auparse.c
index 650db02..2e1c737 100644
--- a/auparse/auparse.c
+++ b/auparse/auparse.c
@@ -1,5 +1,5 @@
/* auparse.c --
- * Copyright 2006-08,2012-17 Red Hat Inc., Durham, North Carolina.
+ * Copyright 2006-08,2012-19 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
@@ -1118,6 +1118,16 @@ static int str2event(char *s, au_event_t *e)
return 0;
}
+#ifndef HAVE_STRNDUPA
+static inline char *strndupa(const char *old, size_t n)
+{
+ size_t len = strnlen(old, n);
+ char *tmp = alloca(len + 1);
+ tmp[len] = 0;
+ return memcpy(tmp, old, len);
+}
+#endif
+
/* Returns 0 on success and 1 on error */
static int extract_timestamp(const char *b, au_event_t *e)
{
diff --git a/auparse/interpret.c b/auparse/interpret.c
index 51c4a5e..67b7b77 100644
--- a/auparse/interpret.c
+++ b/auparse/interpret.c
@@ -853,6 +853,13 @@ err_out:
return print_escaped(id->val);
}
+// rawmemchr is faster. Let's use it if we have it.
+#ifdef HAVE_RAWMEMCHR
+#define STRCHR rawmemchr
+#else
+#define STRCHR strchr
+#endif
+
static const char *print_proctitle(const char *val)
{
char *out = (char *)print_escaped(val);
@@ -863,7 +870,7 @@ static const char *print_proctitle(const char *val)
// Proctitle has arguments separated by NUL bytes
// We need to write over the NUL bytes with a space
// so that we can see the arguments
- while ((ptr = rawmemchr(ptr, '\0'))) {
+ while ((ptr = STRCHR(ptr, '\0'))) {
if (ptr >= end)
break;
*ptr = ' ';
diff --git a/configure.ac b/configure.ac
index 6e345f1..6f3007e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
dnl
define([AC_INIT_NOTICE],
[### Generated automatically using autoconf version] AC_ACVERSION [
-### Copyright 2005-18 Steve Grubb <sgrubb@redhat.com>
+### Copyright 2005-19 Steve Grubb <sgrubb@redhat.com>
###
### Permission is hereby granted, free of charge, to any person obtaining a
### copy of this software and associated documentation files (the "Software"),
@@ -72,6 +72,18 @@ dnl; posix_fallocate is used in audisp-remote
AC_CHECK_FUNCS([posix_fallocate])
dnl; signalfd is needed for libev
AC_CHECK_FUNC([signalfd], [], [ AC_MSG_ERROR([The signalfd system call is necessary for auditd]) ])
+dnl; check if rawmemchr is available
+AC_CHECK_FUNCS([rawmemchr])
+dnl; check if strndupa is available
+AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [[
+ #define _GNU_SOURCE
+ #include <string.h>
+ int main() { (void) strndupa("test", 10); return 0; }]])],
+ [AC_DEFINE(HAVE_STRNDUPA, 1, [Let us know if we have it or not])],
+ []
+)
ALLWARNS=""
ALLDEBUG="-g"
diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c
index 5d17a72..758c33e 100644
--- a/src/ausearch-lol.c
+++ b/src/ausearch-lol.c
@@ -1,6 +1,6 @@
/*
* ausearch-lol.c - linked list of linked lists library
-* Copyright (c) 2008,2010,2014,2016 Red Hat Inc., Durham, North Carolina.
+* Copyright (c) 2008,2010,2014,2016,2019 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This software may be freely redistributed and/or modified under the
@@ -152,6 +152,16 @@ static int compare_event_time(event *e1, event *e2)
return 0;
}
+#ifndef HAVE_STRNDUPA
+static inline char *strndupa(const char *old, size_t n)
+{
+ size_t len = strnlen(old, n);
+ char *tmp = alloca(len + 1);
+ tmp[len] = 0;
+ return memcpy(tmp, old, len);
+}
+#endif
+
/*
* This function will look at the line and pick out pieces of it.
*/
--
2.21.0

View File

@ -0,0 +1,26 @@
From 017e6c6ab95df55f34e339d2139def83e5dada1f Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Fri, 10 Jan 2020 21:13:50 -0500
Subject: [PATCH 01/30] Header definitions need to be external when building
with -fno-common (which is default in GCC 10) - Tony Jones
---
src/ausearch-common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ausearch-common.h b/src/ausearch-common.h
index 6669203..3040547 100644
--- a/src/ausearch-common.h
+++ b/src/ausearch-common.h
@@ -50,7 +50,7 @@ extern pid_t event_pid;
extern int event_exact_match;
extern uid_t event_uid, event_euid, event_loginuid;
extern const char *event_tuid, *event_teuid, *event_tauid;
-slist *event_node_list;
+extern slist *event_node_list;
extern const char *event_comm;
extern const char *event_filename;
extern const char *event_hostname;
--
2.26.2

View File

@ -7,19 +7,20 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libcxx
PKG_VERSION:=9.0.1
PKG_RELEASE:=4
PKG_VERSION:=10.0.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.llvm.org/git/libcxx
PKG_SOURCE_VERSION:=2076f539f410805ef88692b9c0ce0a0b882a7680
PKG_MIRROR_HASH:=d527880a18dec9109575c76717cf5288fb91c11381b9d261cae2e5bebcbdab2e
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
PKG_HASH:=270f8a3f176f1981b0f6ab8aa556720988872ec2b48ed3b605d0ced8d09156c7
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).src
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=libcxxabi
CMAKE_BINARY_SUBDIR:=build
include $(INCLUDE_DIR)/package.mk
@ -34,12 +35,11 @@ define Package/libcxx
endef
define Package/libcxx/description
LLVM C++ library targeting C++11 and above
libc++ is an implementation of the C++ standard library, targeting C++11, C++14 and above.
endef
CMAKE_OPTIONS += \
-DLIBCXX_CXX_ABI="libsupc++" \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="$(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++/$(CONFIG_GCC_VERSION);$(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/include/c++/$(CONFIG_GCC_VERSION)/$(REAL_GNU_TARGET_NAME)" \
-DLIBCXX_CXX_ABI="libcxxabi" \
-DLIBCXX_ENABLE_ASSERTIONS=OFF \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \

View File

@ -13,7 +13,7 @@ do
-static) [ "$WRAPPER_LIBS" != "-lc -lgcc_s -lssp_nonshared -lgcc_eh" ] && WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared -lgcc_eh" ;;
esac
done
[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR -lc++ -lsupc++ $WRAPPER_LIBS"
[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR -lc++ -lc++abi $WRAPPER_LIBS"
exec CXX -fno-builtin -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS
exec CXX -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS

View File

@ -1,14 +0,0 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -524,9 +524,9 @@ remove_flags(-Wno-pedantic -pedantic-err
if (LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL)
# musl's pthread implementations uses volatile types in their structs which is
# not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
- set(LIBCXX_STANDARD_VER c++14 CACHE STRING "internal option to change build dialect")
+ set(LIBCXX_STANDARD_VER c++2a CACHE STRING "internal option to change build dialect")
else()
- set(LIBCXX_STANDARD_VER c++11 CACHE STRING "internal option to change build dialect")
+ set(LIBCXX_STANDARD_VER c++2a CACHE STRING "internal option to change build dialect")
endif()
add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
add_compile_flags_if_supported("/std:${LIBCXX_STANDARD_VER}")

View File

@ -0,0 +1,13 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -760,6 +760,10 @@ function(cxx_link_system_libraries targe
target_link_libraries(${target} PRIVATE atomic)
endif()
+ if (LIBCXX_HAS_MUSL_LIBC)
+ target_link_libraries(${target} PRIVATE ssp_nonshared)
+ endif()
+
if (MINGW)
target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
endif()

View File

@ -1,35 +0,0 @@
--- a/include/cmath
+++ b/include/cmath
@@ -615,7 +615,7 @@ _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) no
if (__t == 1) return __b;
const _Fp __x = __a + __t * (__b - __a);
- if (__t > 1 == __b > __a)
+ if ((__t > 1) == (__b > __a))
return __b < __x ? __x : __b;
else
return __x < __b ? __x : __b;
--- a/include/memory
+++ b/include/memory
@@ -1696,7 +1696,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_tr
ptrdiff_t _Np = __end1 - __begin1;
__end2 -= _Np;
if (_Np > 0)
- _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
+ __end2 = __begin1;
}
private:
--- a/src/filesystem/filesystem_common.h
+++ b/src/filesystem/filesystem_common.h
@@ -197,8 +197,8 @@ private:
using chrono::duration;
using chrono::duration_cast;
-using TimeSpec = struct ::timespec;
-using StatT = struct ::stat;
+using TimeSpec = struct timespec;
+using StatT = struct stat;
template <class FileTimeT, class TimeT,
bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>

View File

@ -0,0 +1,71 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libcxxabi
PKG_VERSION:=10.0.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
PKG_HASH:=e71bac75a88c9dde455ad3f2a2b449bf745eafd41d2d8432253b2964e0ca14e1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION).src
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt
PKG_BUILD_PARALLEL:=1
CMAKE_BINARY_SUBDIR:=build
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libcxxabi
SECTION:=libs
CATEGORY:=Libraries
TITLE:=LLVM lib++abi
URL:=https://libcxxabi.llvm.org/
DEPENDS:=+libpthread
BUILDONLY:=1
endef
define Package/libcxxabi/description
libc++abi is a new implementation of low level support for a standard C++ library.
endef
CMAKE_OPTIONS += \
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
-DLIBCXXABI_ENABLE_PEDANTIC=OFF \
-DLIBCXXABI_ENABLE_PIC=ON \
-DLIBCXXABI_ENABLE_WERROR=OFF \
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
-DLIBCXXABI_USE_COMPILER_RT=OFF \
-DLIBCXXABI_ENABLE_THREADS=ON \
-DLIBCXXABI_HAS_PTHREAD_API=ON \
-DLIBCXXABI_INCLUDE_TESTS=OFF \
-DLIBCXXABI_LIBDIR_SUFFIX="" \
-DLIBCXXABI_INSTALL_LIBRARY=ON \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBCXXABI_LIBCXX_SRC_DIR=$(BUILD_DIR)/libcxx-$(PKG_VERSION).src \
-DLIBCXXABI_LIBCXX_INCLUDES=$(BUILD_DIR)/libcxx-$(PKG_VERSION).src/include
TARGET_CXXFLAGS += -flto
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
define Build/Prepare
$(MAKE) -C $(TOPDIR)/package/libs/libcxx prepare
$(call Build/Prepare/Default)
endef
define Build/InstallDev
$(call Build/InstallDev/cmake,$(1))
$(INSTALL_DIR) $(1)/usr/include/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include/
endef
$(eval $(call BuildPackage,libcxxabi))

View File

@ -0,0 +1,27 @@
--- a/src/cxa_exception.h
+++ b/src/cxa_exception.h
@@ -27,6 +27,13 @@ _LIBCXXABI_HIDDEN uint64_t __getExceptio
_LIBCXXABI_HIDDEN void __setExceptionClass ( _Unwind_Exception*, uint64_t);
_LIBCXXABI_HIDDEN bool __isOurExceptionClass(const _Unwind_Exception*);
+#if defined(__arm__) && defined(__GNUC__)
+// missing values from _Unwind_Reason_Code enum
+#define _URC_FATAL_PHASE2_ERROR ((_Unwind_Reason_Code)2)
+#define _URC_FATAL_PHASE1_ERROR ((_Unwind_Reason_Code)3)
+#define _URC_NORMAL_STOP ((_Unwind_Reason_Code)4)
+#endif
+
struct _LIBCXXABI_HIDDEN __cxa_exception {
#if defined(__LP64__) || defined(_WIN64) || defined(_LIBCXXABI_ARM_EHABI)
// Now _Unwind_Exception is marked with __attribute__((aligned)),
--- a/src/cxa_personality.cpp
+++ b/src/cxa_personality.cpp
@@ -1108,7 +1108,7 @@ __gxx_personality_v0(_Unwind_State state
// Check the undocumented force unwinding behavior
bool is_force_unwinding = state & _US_FORCE_UNWIND;
- state &= ~_US_FORCE_UNWIND;
+ state = (_Unwind_State)(state & ~_US_FORCE_UNWIND);
scan_results results;
switch (state) {

View File

@ -0,0 +1,71 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libsemanage
PKG_VERSION:=3.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710
PKG_HASH:=22d6c75526e40d1781c30bcf29abf97171bdfe6780923f11c8e1c76a75a21ff8
PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:selinuxproject:libsemanage
HOST_BUILD_DEPENDS:=audit/host libselinux/host bzip2/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
PKG_INSTALL:=1
define Package/libsemanage
SECTION:=libs
DEPENDS:=+libaudit +libselinux +libbz2
CATEGORY:=Libraries
TITLE:=SELinux policy management library
URL:=http://selinuxproject.org/page/Main_Page
endef
define Package/libsemanage/description
libsemanage is the policy management library. It uses
libsepol for binary policy manipulation and libselinux for
interacting with the SELinux system. It also exec's helper
programs for loading policy and for checking whether the
file_contexts configuration is valid (load_policy and
setfiles from policycoreutils) presently, although this may
change at least for the bootstrapping case (for rpm).
endef #'
HOST_MAKE_FLAGS += \
DESTDIR=$(STAGING_DIR_HOSTPKG) \
PREFIX=""
define Build/Configure
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsemanage.pc $(1)/usr/lib/pkgconfig/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
endef
define Package/libsemanage/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsemanage.so.* $(1)/usr/lib/
endef
$(eval $(call HostBuild))
$(eval $(call BuildPackage,libsemanage))

View File

@ -16,6 +16,10 @@ config WOLFSSL_HAS_ARC4
bool "Include ARC4 support"
default y
config WOLFSSL_HAS_CERTGEN
bool "Include certificate generation support"
default y
config WOLFSSL_HAS_TLSV10
bool "Include TLS 1.0 support"
default y

View File

@ -31,7 +31,7 @@ PKG_CONFIG_DEPENDS:=\
CONFIG_WOLFSSL_HAS_DH CONFIG_WOLFSSL_HAS_DTLS \
CONFIG_WOLFSSL_HAS_ECC25519 CONFIG_WOLFSSL_HAS_OCSP \
CONFIG_WOLFSSL_HAS_SESSION_TICKET CONFIG_WOLFSSL_HAS_TLSV10 \
CONFIG_WOLFSSL_HAS_TLSV13 CONFIG_WOLFSSL_HAS_WPAS
CONFIG_WOLFSSL_HAS_TLSV13 CONFIG_WOLFSSL_HAS_WPAS CONFIG_WOLFSSL_HAS_CERTGEN
include $(INCLUDE_DIR)/package.mk
@ -67,6 +67,7 @@ CONFIGURE_ARGS += \
--disable-jobserver \
--$(if $(CONFIG_IPV6),enable,disable)-ipv6 \
--$(if $(CONFIG_WOLFSSL_HAS_AES_CCM),enable,disable)-aesccm \
--$(if $(CONFIG_WOLFSSL_HAS_CERTGEN),enable,disable)-certgen \
--$(if $(CONFIG_WOLFSSL_HAS_CHACHA_POLY),enable,disable)-chacha \
--$(if $(CONFIG_WOLFSSL_HAS_CHACHA_POLY),enable,disable)-poly1305 \
--$(if $(CONFIG_WOLFSSL_HAS_DH),enable,disable)-dh \

View File

@ -0,0 +1,162 @@
#
# Copyright (C) 2020 Tony Ambardar <itugrok@yahoo.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bpftools
PKG_VERSION:=5.8.3
PKG_RELEASE:=1
PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
PKG_HASH:=8ea27e1ed38981f772cc6d5f16ab8dbb8052c3800ba0494bd798fbb95dcc1779
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
PKG_USE_MIPS16:=0
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
LINUX_VERSION:=$(PKG_VERSION)
LINUX_TLD:=linux-$(LINUX_VERSION)
BPF_FILES:= \
kernel/bpf scripts tools/Makefile tools/bpf tools/perf/perf-sys.h \
tools/arch tools/build tools/include tools/lib tools/scripts
TAR_OPTIONS+= \
--transform="s;$(LINUX_TLD)/;$(PKG_NAME)-$(PKG_VERSION)/;" \
$(addprefix $(LINUX_TLD)/,$(BPF_FILES))
include $(INCLUDE_DIR)/package.mk
define Package/bpftool/Default
SECTION:=net
CATEGORY:=Network
TITLE:=bpftool - eBPF subsystem utility
LICENSE:=GPL-2.0-only OR BSD-2-Clause
URL:=http://www.kernel.org
DEPENDS:=+libelf
endef
define Package/bpftool-minimal
$(call Package/bpftool/Default)
TITLE+= (Minimal)
VARIANT:=minimal
DEFAULT_VARIANT:=1
PROVIDES:=bpftool
ALTERNATIVES:=200:/usr/sbin/bpftool:/usr/libexec/bpftool-minimal
endef
define Package/bpftool-full
$(call Package/bpftool/Default)
TITLE+= (Full)
VARIANT:=full
PROVIDES:=bpftool
ALTERNATIVES:=300:/usr/sbin/bpftool:/usr/libexec/bpftool-full
DEPENDS+= +libbfd +libopcodes
endef
define Package/bpftool-minimal/description
A tool for inspection and simple manipulation of eBPF programs and maps.
endef
define Package/bpftool-full/description
A tool for inspection and simple manipulation of eBPF programs and maps.
This full version uses libbfd and libopcodes to support disassembly of
eBPF programs and jited code.
endef
define Package/libbpf
SECTION:=libs
CATEGORY:=Libraries
TITLE:=libbpf - eBPF helper library
VARIANT:=lib
LICENSE:=LGPL-2.1 OR BSD-2-Clause
ABI_VERSION:=0
URL:=http://www.kernel.org
DEPENDS:=+libelf
endef
define Package/libbpf/description
libbpf is a library for loading eBPF programs and reading and manipulating eBPF objects from user-space.
endef
# LTO not compatible with DSO using PIC
ifneq ($(BUILD_VARIANT),lib)
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
TARGET_LDFLAGS += -Wl,--gc-sections
endif
MAKE_FLAGS += \
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
BPFTOOL_VERSION="$(LINUX_VERSION)" \
FEATURES_DUMP="$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt" \
OUTPUT="$(PKG_BUILD_DIR)/" \
prefix="/usr" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
ifeq ($(BUILD_VARIANT),full)
HAVE_LIBBFD:=1
HAVE_LIBCAP:=0
HAVE_CLANG:=0
MAKE_PATH:=tools/bpf/bpftool
else ifeq ($(BUILD_VARIANT),minimal)
HAVE_LIBBFD:=0
HAVE_LIBCAP:=0
HAVE_CLANG:=0
MAKE_PATH:=tools/bpf/bpftool
else ifeq ($(BUILD_VARIANT),lib)
HAVE_LIBBFD:=0
HAVE_LIBCAP:=0
HAVE_CLANG:=0
MAKE_PATH:=tools/lib/bpf
endif
# Perform a "throw-away" make to create a FEATURE-DUMP.* file to edit later.
# The "//" in the make target is actually needed, very unPOSIXly.
define Build/Configure
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/tools/bpf/bpftool \
$(MAKE_FLAGS) FEATURES_DUMP= $(PKG_BUILD_DIR)//libbpf/libbpf.a
(cd $(PKG_BUILD_DIR); cat FEATURE-DUMP.bpftool libbpf/FEATURE-DUMP.libbpf \
| sort | uniq > FEATURE-DUMP.openwrt)
$(SED) 's/feature-libbfd=[01]/feature-libbfd=$(HAVE_LIBBFD)/' \
-e 's/feature-libcap=[01]/feature-libcap=$(HAVE_LIBCAP)/' \
-e 's/feature-clang-bpf-global-var=[01]/feature-clang-bpf-global-var=$(HAVE_CLANG)/' \
$(PKG_BUILD_DIR)/FEATURE-DUMP.openwrt
endef
define Build/InstallDev/libbpf
$(INSTALL_DIR) $(1)/usr/include/bpf
$(CP) $(PKG_INSTALL_DIR)/usr/include/bpf/*.h $(1)/usr/include/bpf/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/libbpf.{a,so*} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/pkgconfig/libbpf.pc \
$(1)/usr/lib/pkgconfig/
endef
ifeq ($(BUILD_VARIANT),lib)
Build/InstallDev=$(Build/InstallDev/libbpf)
endif
define Package/bpftool-$(BUILD_VARIANT)/install
$(INSTALL_DIR) $(1)/usr/libexec
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bpftool \
$(1)/usr/libexec/bpftool-$(BUILD_VARIANT)
endef
define Package/libbpf/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib$(LIB_SUFFIX)/libbpf.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,bpftool-full))
$(eval $(call BuildPackage,bpftool-minimal))
$(eval $(call BuildPackage,libbpf))

View File

@ -0,0 +1,36 @@
From fafb2e7eaec6d33ce16e28f481edf781219d5d27 Mon Sep 17 00:00:00 2001
From: Tony Ambardar <Tony.Ambardar@gmail.com>
Date: Fri, 24 Jul 2020 23:58:17 -0700
Subject: [PATCH] tools/libbpf: ensure no local symbols counted in ABI check
This avoids finding versioned local symbols such as _init and _fini in
the libbpf.so file.
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
---
tools/lib/bpf/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index bf8ed134cb8a..c820b0be9d63 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
sort -u | wc -l)
VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so
awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
sort -u > $(OUTPUT)libbpf_global_syms.tmp; \
readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \
sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \
diff -u $(OUTPUT)libbpf_global_syms.tmp \
--
2.25.1

View File

@ -0,0 +1,46 @@
From 74d0dcf7608b1bab116e297468ac51b57eb97ce0 Mon Sep 17 00:00:00 2001
From: Tony Ambardar <Tony.Ambardar@gmail.com>
Date: Thu, 20 Aug 2020 10:06:24 -0700
Subject: [PATCH] libbpf: fix build failure from uninitialized variable warning
While compiling libbpf, some GCC versions (at least 8.4.0) have difficulty
determining control flow and a emit warning for potentially uninitialized
usage of 'map', which results in a build error if using "-Werror":
In file included from libbpf.c:56:
libbpf.c: In function '__bpf_object__open':
libbpf_internal.h:59:2: warning: 'map' may be used uninitialized in this function [-Wmaybe-uninitialized]
libbpf_print(level, "libbpf: " fmt, ##__VA_ARGS__); \
^~~~~~~~~~~~
libbpf.c:5032:18: note: 'map' was declared here
struct bpf_map *map, *targ_map;
^~~
The warning/error is false based on code inspection, so silence it with a
NULL initialization.
Fixes: 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map support")
Ref: 063e68813391 ("libbpf: Fix false uninitialized variable warning")
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 11e4725b8b1c..a72296797357 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -5028,8 +5028,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
int i, j, nrels, new_sz, ptr_sz = sizeof(void *);
const struct btf_var_secinfo *vi = NULL;
const struct btf_type *sec, *var, *def;
+ struct bpf_map *map = NULL, *targ_map;
const struct btf_member *member;
- struct bpf_map *map, *targ_map;
const char *name, *mname;
Elf_Data *symbols;
unsigned int moff;
--
2.25.1

View File

@ -0,0 +1,26 @@
From 668d1c2951e18512a27aec20b80dea627d01bf04 Mon Sep 17 00:00:00 2001
From: Tony Ambardar <Tony.Ambardar@gmail.com>
Date: Thu, 20 Aug 2020 16:05:48 -0700
Subject: [PATCH] tools/bpftool: allow passing BPFTOOL_VERSION to make
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
---
tools/bpf/bpftool/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 9e85f101be85..d9d821736c31 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -25,7 +25,7 @@ endif
LIBBPF = $(LIBBPF_PATH)libbpf.a
-BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
+BPFTOOL_VERSION ?= $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
$(LIBBPF): FORCE
$(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT))
--
2.25.1

View File

@ -0,0 +1,238 @@
From 6edda7633e4fdf33b91c2e86c05cab805a0dabb3 Mon Sep 17 00:00:00 2001
From: Tony Ambardar <tony.ambardar@gmail.com>
Date: Mon, 20 Jul 2020 19:48:16 -0700
Subject: [PATCH] bpftool: Use only nftw for file tree parsing
The bpftool sources include code to walk file trees, but use multiple
frameworks to do so: nftw and fts. While nftw conforms to POSIX/SUSv3 and
is widely available, fts is not conformant and less common, especially on
non-glibc systems. The inconsistent framework usage hampers maintenance
and portability of bpftool, in particular for embedded systems.
Standardize code usage by rewriting one fts-based function to use nftw and
clean up some related function warnings by extending use of "const char *"
arguments. This change helps in building bpftool against musl for OpenWrt.
Also fix an unsafe call to dirname() by duplicating the string to pass,
since some implementations may directly alter it. The same approach is
used in libbpf.c.
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20200721024817.13701-1-Tony.Ambardar@gmail.com
---
tools/bpf/bpftool/common.c | 137 ++++++++++++++++++++++---------------
tools/bpf/bpftool/main.h | 4 +-
2 files changed, 82 insertions(+), 59 deletions(-)
diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
index 88264abaa738..d8bb4dd18c8a 100644
--- a/tools/bpf/bpftool/common.c
+++ b/tools/bpf/bpftool/common.c
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (C) 2017-2018 Netronome Systems, Inc. */
+#define _GNU_SOURCE
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <fts.h>
+#include <ftw.h>
#include <libgen.h>
#include <mntent.h>
#include <stdbool.h>
@@ -123,24 +124,35 @@ int mount_tracefs(const char *target)
return err;
}
-int open_obj_pinned(char *path, bool quiet)
+int open_obj_pinned(const char *path, bool quiet)
{
- int fd;
+ char *pname;
+ int fd = -1;
- fd = bpf_obj_get(path);
+ pname = strdup(path);
+ if (!pname) {
+ if (!quiet)
+ p_err("mem alloc failed");
+ goto out_ret;
+ }
+
+ fd = bpf_obj_get(pname);
if (fd < 0) {
if (!quiet)
- p_err("bpf obj get (%s): %s", path,
- errno == EACCES && !is_bpffs(dirname(path)) ?
+ p_err("bpf obj get (%s): %s", pname,
+ errno == EACCES && !is_bpffs(dirname(pname)) ?
"directory not in bpf file system (bpffs)" :
strerror(errno));
- return -1;
+ goto out_free;
}
+out_free:
+ free(pname);
+out_ret:
return fd;
}
-int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type)
+int open_obj_pinned_any(const char *path, enum bpf_obj_type exp_type)
{
enum bpf_obj_type type;
int fd;
@@ -353,71 +365,82 @@ void print_hex_data_json(uint8_t *data, size_t len)
jsonw_end_array(json_wtr);
}
+/* extra params for nftw cb */
+static struct pinned_obj_table *build_fn_table;
+static enum bpf_obj_type build_fn_type;
+
+static int do_build_table_cb(const char *fpath, const struct stat *sb,
+ int typeflag, struct FTW *ftwbuf)
+{
+ struct bpf_prog_info pinned_info;
+ __u32 len = sizeof(pinned_info);
+ struct pinned_obj *obj_node;
+ enum bpf_obj_type objtype;
+ int fd, err = 0;
+
+ if (typeflag != FTW_F)
+ goto out_ret;
+
+ fd = open_obj_pinned(fpath, true);
+ if (fd < 0)
+ goto out_ret;
+
+ objtype = get_fd_type(fd);
+ if (objtype != build_fn_type)
+ goto out_close;
+
+ memset(&pinned_info, 0, sizeof(pinned_info));
+ if (bpf_obj_get_info_by_fd(fd, &pinned_info, &len))
+ goto out_close;
+
+ obj_node = calloc(1, sizeof(*obj_node));
+ if (!obj_node) {
+ err = -1;
+ goto out_close;
+ }
+
+ obj_node->id = pinned_info.id;
+ obj_node->path = strdup(fpath);
+ if (!obj_node->path) {
+ err = -1;
+ free(obj_node);
+ goto out_close;
+ }
+
+ hash_add(build_fn_table->table, &obj_node->hash, obj_node->id);
+out_close:
+ close(fd);
+out_ret:
+ return err;
+}
+
int build_pinned_obj_table(struct pinned_obj_table *tab,
enum bpf_obj_type type)
{
- struct bpf_prog_info pinned_info = {};
- struct pinned_obj *obj_node = NULL;
- __u32 len = sizeof(pinned_info);
struct mntent *mntent = NULL;
- enum bpf_obj_type objtype;
FILE *mntfile = NULL;
- FTSENT *ftse = NULL;
- FTS *fts = NULL;
- int fd, err;
+ int flags = FTW_PHYS;
+ int nopenfd = 16;
+ int err = 0;
mntfile = setmntent("/proc/mounts", "r");
if (!mntfile)
return -1;
+ build_fn_table = tab;
+ build_fn_type = type;
+
while ((mntent = getmntent(mntfile))) {
- char *path[] = { mntent->mnt_dir, NULL };
+ char *path = mntent->mnt_dir;
if (strncmp(mntent->mnt_type, "bpf", 3) != 0)
continue;
-
- fts = fts_open(path, 0, NULL);
- if (!fts)
- continue;
-
- while ((ftse = fts_read(fts))) {
- if (!(ftse->fts_info & FTS_F))
- continue;
- fd = open_obj_pinned(ftse->fts_path, true);
- if (fd < 0)
- continue;
-
- objtype = get_fd_type(fd);
- if (objtype != type) {
- close(fd);
- continue;
- }
- memset(&pinned_info, 0, sizeof(pinned_info));
- err = bpf_obj_get_info_by_fd(fd, &pinned_info, &len);
- if (err) {
- close(fd);
- continue;
- }
-
- obj_node = malloc(sizeof(*obj_node));
- if (!obj_node) {
- close(fd);
- fts_close(fts);
- fclose(mntfile);
- return -1;
- }
-
- memset(obj_node, 0, sizeof(*obj_node));
- obj_node->id = pinned_info.id;
- obj_node->path = strdup(ftse->fts_path);
- hash_add(tab->table, &obj_node->hash, obj_node->id);
-
- close(fd);
- }
- fts_close(fts);
+ err = nftw(path, do_build_table_cb, nopenfd, flags);
+ if (err)
+ break;
}
fclose(mntfile);
- return 0;
+ return err;
}
void delete_pinned_obj_table(struct pinned_obj_table *tab)
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
index af9ad56c303a..b02e763f1e9c 100644
--- a/tools/bpf/bpftool/main.h
+++ b/tools/bpf/bpftool/main.h
@@ -140,8 +140,8 @@ int cmd_select(const struct cmd *cmds, int argc, char **argv,
int get_fd_type(int fd);
const char *get_fd_type_name(enum bpf_obj_type type);
char *get_fdinfo(int fd, const char *key);
-int open_obj_pinned(char *path, bool quiet);
-int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type);
+int open_obj_pinned(const char *path, bool quiet);
+int open_obj_pinned_any(const char *path, enum bpf_obj_type exp_type);
int mount_bpffs_for_pin(const char *name);
int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32));
int do_pin_fd(int fd, const char *name);
--
2.17.1

View File

@ -14,9 +14,9 @@ PKG_FLAGS:=essential
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.openwrt.org/project/opkg-lede.git
PKG_SOURCE_DATE:=2020-05-07
PKG_SOURCE_VERSION:=f2166a89b7e96e2c60002959731eebc5f45fa318
PKG_MIRROR_HASH:=67e55cd9fb93bb5b62e2c7b11946483b5570287bd1504aa2a3886d11f8b750b9
PKG_SOURCE_DATE:=2020-08-31
PKG_SOURCE_VERSION:=cf44c2feb606b60ba3f35392e102c281ef6ea0da
PKG_MIRROR_HASH:=0d7be9f8f86864e2a9999145210ecaa286fb85cfae131ec502609a6d1e435871
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@ -1,5 +1,7 @@
#!/bin/sh
OPKG_KEYS="${OPKG_KEYS:-/etc/opkg/keys}"
usage() {
cat <<EOF
Usage: $0 <command> <arguments...>
@ -19,7 +21,7 @@ opkg_key_verify() {
(
zcat "$msgfile" 2>/dev/null ||
cat "$msgfile" 2>/dev/null
) | usign -V -P /etc/opkg/keys -q -x "$sigfile" -m -
) | usign -V -P "$OPKG_KEYS" -q -x "$sigfile" -m -
}
opkg_key_add() {
@ -27,8 +29,8 @@ opkg_key_add() {
[ -n "$key" ] || usage
[ -f "$key" ] || echo "Cannot open file $1"
local fingerprint="$(usign -F -p "$key")"
mkdir -p "/etc/opkg/keys"
cp "$key" "/etc/opkg/keys/$fingerprint"
mkdir -p "$OPKG_KEYS"
cp "$key" "$OPKG_KEYS/$fingerprint"
}
opkg_key_remove() {
@ -36,7 +38,7 @@ opkg_key_remove() {
[ -n "$key" ] || usage
[ -f "$key" ] || echo "Cannot open file $1"
local fingerprint="$(usign -F -p "$key")"
rm -f "/etc/opkg/keys/$fingerprint"
rm -f "$OPKG_KEYS/$fingerprint"
}
case "$1" in

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=busybox
PKG_VERSION:=1.31.1
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_FLAGS:=essential
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
@ -28,6 +28,10 @@ PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
PKG_CPE_ID:=cpe:/a:busybox:busybox
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SUID),)
PKG_FILE_MODES:=/bin/busybox:root:root:4755
endif
include $(INCLUDE_DIR)/package.mk
ifeq ($(DUMP),)
@ -140,9 +144,6 @@ endif
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
$(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
$(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
endif
ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SUID),)
$(INSTALL_SUID) $(PKG_INSTALL_DIR)/bin/busybox $(1)/bin/busybox
endif
-rm -rf $(1)/lib64
endef

View File

@ -13,6 +13,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710
PKG_HASH:=dfc7707070520c93b14fbbdfdbe081364d806bf28e3e79e10318c2594c77bbb2
PKG_INSTALL:=1
PKG_BUILD_DEPENDS:=libselinux
HOST_BUILD_DEPENDS:=libselinux/host
PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>

View File

@ -26,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/policycoreutils
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:= +libsemanage +libcap-ng +BUSYBOX_CONFIG_PAM:libpam
DEPENDS:= +libsemanage +libcap-ng +BUSYBOX_CONFIG_PAM:libpam $(INTL_DEPENDS)
TITLE:=SELinux policy utilities
URL:=http://selinuxproject.org/page/Main_Page
ALTERNATIVES:=\

View File

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=px5g
PKG_NAME:=px5g-mbedtls
PKG_RELEASE:=9
PKG_LICENSE:=LGPL-2.1
@ -55,7 +55,7 @@ endif
TARGET_CFLAGS += -Wl,--gc-sections -Wall -Werror
define Build/Compile
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/px5g px5g.c $(TARGET_LDFLAGS)
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/px5g px5g-mbedtls.c $(TARGET_LDFLAGS)
endef
define Package/px5g-mbedtls/install

View File

@ -0,0 +1,48 @@
# Copyright (C) 2020 Paul Spooren <mail@aparcar.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
include $(TOPDIR)/rules.mk
PKG_NAME:=px5g-wolfssl
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0-or-later
PKG_USE_MIPS16:=0
PKG_MAINTAINER:=Paul Spooren <mail@aparcar.org>
include $(INCLUDE_DIR)/package.mk
define Package/px5g-wolfssl
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Encryption
TITLE:=X.509 certificate generator (using WolfSSL)
DEPENDS:=+libwolfssl
PROVIDES:=px5g
VARIANT:=wolfssl
endef
define Package/px5g-wolfssl/description
Px5g is a tiny X.509 certificate generator.
It suitable to create key files and certificates in DER
and PEM format for use with stunnel, uhttpd and others.
endef
TARGET_LDFLAGS += -lwolfssl
TARGET_CFLAGS += -Wl,--gc-sections
define Build/Compile
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) \
-o $(PKG_BUILD_DIR)/px5g px5g-wolfssl.c $(TARGET_LDFLAGS)
endef
define Package/px5g-wolfssl/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/px5g $(1)/usr/sbin/px5g
endef
$(eval $(call BuildPackage,px5g-wolfssl))

View File

@ -0,0 +1,354 @@
// Copyright 2020 Paul Spooren <mail@aparcar.org>
//
// SPDX-License-Identifier: GPL-2.0-or-later
#define _GNU_SOURCE
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <wolfssl/options.h>
#include <wolfssl/wolfcrypt/asn.h>
#include <wolfssl/wolfcrypt/asn_public.h>
#include <wolfssl/wolfcrypt/ecc.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#include <wolfssl/wolfcrypt/rsa.h>
#include <wolfssl/wolfcrypt/settings.h>
#define HEAP_HINT NULL
#define FOURK_SZ 4096
#define WOLFSSL_MIN_RSA_BITS 2048
enum {
EC_KEY_TYPE = 0,
RSA_KEY_TYPE = 1,
};
int write_file(byte *buf, int bufSz, char *path) {
int ret;
FILE *file;
if (path) {
file = fopen(path, "wb");
if (file == NULL) {
perror("Error opening file");
exit(1);
}
} else {
file = stdout;
}
ret = (int)fwrite(buf, 1, bufSz, file);
if (path) {
fclose(file);
}
if (ret > 0) {
/* ret > 0 indicates a successful file write, set to zero for return */
ret = 0;
}
return ret;
}
int write_key(ecc_key *ecKey, RsaKey *rsaKey, int type, int keySz, char *fName,
bool write_pem) {
int ret;
byte der[FOURK_SZ] = {};
byte pem[FOURK_SZ] = {};
int derSz, pemSz;
if (type == EC_KEY_TYPE) {
ret = wc_EccKeyToDer(ecKey, der, sizeof(der));
} else {
ret = wc_RsaKeyToDer(rsaKey, der, sizeof(der));
}
if (ret <= 0) {
fprintf(stderr, "Key To DER failed: %d\n", ret);
}
derSz = ret;
if (write_pem) {
if (type == EC_KEY_TYPE) {
ret = wc_DerToPem(der, derSz, pem, sizeof(pem), ECC_PRIVATEKEY_TYPE);
} else {
ret = wc_DerToPem(der, derSz, pem, sizeof(pem), PRIVATEKEY_TYPE);
}
if (ret <= 0) {
fprintf(stderr, "DER to PEM failed: %d\n", ret);
}
pemSz = ret;
ret = write_file(pem, pemSz, fName);
} else {
ret = write_file(der, derSz, fName);
}
return ret;
}
int gen_key(WC_RNG *rng, ecc_key *ecKey, RsaKey *rsaKey, int type, int keySz,
long exp, int curve) {
int ret;
if (type == EC_KEY_TYPE) {
ret = wc_ecc_init(ecKey);
(void)rsaKey;
} else {
ret = wc_InitRsaKey(rsaKey, NULL);
(void)ecKey;
}
if (ret != 0) {
fprintf(stderr, "Key initialization failed: %d\n", ret);
return ret;
}
if (type == EC_KEY_TYPE) {
fprintf(stderr, "Generating EC private key\n");
ret = wc_ecc_make_key_ex(rng, 32, ecKey, curve);
} else {
fprintf(stderr, "Generating RSA private key, %i bit long modulus\n", keySz);
ret = wc_MakeRsaKey(rsaKey, keySz, WC_RSA_EXPONENT, rng);
}
if (ret != 0) {
fprintf(stderr, "Key generation failed: %d\n", ret);
}
return ret;
}
int selfsigned(WC_RNG *rng, char **arg) {
ecc_key ecKey;
RsaKey rsaKey;
int ret;
char *subject = "";
int keySz = WOLFSSL_MIN_RSA_BITS;
int type = EC_KEY_TYPE;
int exp = WC_RSA_EXPONENT;
int curve = ECC_SECP256R1;
unsigned int days = 3653; // 10 years
char *keypath = NULL, *certpath = NULL;
char fstr[20], tstr[20];
bool pem = true;
Cert newCert;
#ifdef __USE_TIME_BITS64
time_t to, from = time(NULL);
#else
unsigned long to, from = time(NULL);
#endif
byte derBuf[FOURK_SZ] = {};
byte pemBuf[FOURK_SZ] = {};
int pemSz = -1;
int derSz = -1;
char *key, *val, *tmp;
ret = wc_InitCert(&newCert);
if (ret != 0) {
fprintf(stderr, "Init Cert failed: %d\n", ret);
return ret;
}
newCert.isCA = 0;
while (*arg && **arg == '-') {
if (!strncmp(*arg, "-der", 4)) {
pem = false;
} else if (!strncmp(*arg, "-newkey", 6) && arg[1]) {
if (!strncmp(arg[1], "rsa:", 4)) {
type = RSA_KEY_TYPE;
keySz = (unsigned int)atoi(arg[1] + 4);
} else if (!strncmp(arg[1], "ec", 2)) {
type = EC_KEY_TYPE;
} else {
fprintf(stderr, "error: invalid algorithm\n");
return 1;
}
arg++;
} else if (!strncmp(*arg, "-days", 5) && arg[1]) {
days = (unsigned int)atoi(arg[1]);
arg++;
} else if (!strncmp(*arg, "-pkeyopt", 8) && arg[1]) {
if (strncmp(arg[1], "ec_paramgen_curve:", 18)) {
fprintf(stderr, "error: invalid pkey option: %s\n", arg[1]);
return 1;
}
if (!strncmp(arg[1] + 18, "P-256:", 5)) {
curve = ECC_SECP256R1;
} else if (!strncmp(arg[1] + 18, "P-384:", 5)) {
curve = ECC_SECP384R1;
} else if (!strncmp(arg[1] + 18, "P-521:", 5)) {
curve = ECC_SECP521R1;
} else {
fprintf(stderr, "error: invalid curve name: %s\n", arg[1] + 18);
return 1;
}
arg++;
} else if (!strncmp(*arg, "-keyout", 7) && arg[1]) {
keypath = arg[1];
arg++;
} else if (!strncmp(*arg, "-out", 4) && arg[1]) {
certpath = arg[1];
arg++;
} else if (!strcmp(*arg, "-subj") && arg[1]) {
subject = strdupa(arg[1]);
key = arg[1];
do {
tmp = strchr(key, '/');
if (tmp)
*tmp = '\0';
val = strchr(key, '=');
if (val) {
*val = '\0';
++val;
if (!strcmp(key, "C"))
strncpy(newCert.subject.country, val, CTC_NAME_SIZE);
else if (!strcmp(key, "ST"))
strncpy(newCert.subject.state, val, CTC_NAME_SIZE);
else if (!strcmp(key, "L"))
strncpy(newCert.subject.locality, val, CTC_NAME_SIZE);
else if (!strcmp(key, "O"))
strncpy(newCert.subject.org, val, CTC_NAME_SIZE);
else if (!strcmp(key, "OU"))
strncpy(newCert.subject.unit, val, CTC_NAME_SIZE);
else if (!strcmp(key, "CN"))
strncpy(newCert.subject.commonName, val, CTC_NAME_SIZE);
else if (!strcmp(key, "EMAIL"))
strncpy(newCert.subject.email, val, CTC_NAME_SIZE);
else
printf("warning: unknown attribute %s=%s\n", key, val);
}
} while (tmp && (key = ++tmp));
}
arg++;
}
newCert.daysValid = days;
gen_key(rng, &ecKey, &rsaKey, type, keySz, exp, curve);
write_key(&ecKey, &rsaKey, type, keySz, keypath, pem);
from = (from < 1000000000) ? 1000000000 : from;
strftime(fstr, sizeof(fstr), "%Y%m%d%H%M%S", gmtime(&from));
to = from + 60 * 60 * 24 * days;
if (to < from)
to = INT_MAX;
strftime(tstr, sizeof(tstr), "%Y%m%d%H%M%S", gmtime(&to));
fprintf(stderr,
"Generating selfsigned certificate with subject '%s'"
" and validity %s-%s\n",
subject, fstr, tstr);
if (type == EC_KEY_TYPE) {
ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), NULL, &ecKey, rng);
} else {
ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), &rsaKey, NULL, rng);
}
if (ret <= 0) {
fprintf(stderr, "Make Cert failed: %d\n", ret);
return ret;
}
if (type == EC_KEY_TYPE) {
newCert.sigType = CTC_SHA256wECDSA;
ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf),
NULL, &ecKey, rng);
} else {
newCert.sigType = CTC_SHA256wRSA;
ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf),
&rsaKey, NULL, rng);
}
if (ret <= 0) {
fprintf(stderr, "Sign Cert failed: %d\n", ret);
return ret;
}
derSz = ret;
ret = wc_DerToPem(derBuf, derSz, pemBuf, sizeof(pemBuf), CERT_TYPE);
if (ret <= 0) {
fprintf(stderr, "DER to PEM failed: %d\n", ret);
return ret;
}
pemSz = ret;
ret = write_file(pemBuf, pemSz, certpath);
if (ret != 0) {
fprintf(stderr, "Write Cert failed: %d\n", ret);
return ret;
}
if (type == EC_KEY_TYPE) {
wc_ecc_free(&ecKey);
} else {
wc_FreeRsaKey(&rsaKey);
}
return 0;
}
int dokey(WC_RNG *rng, int type, char **arg) {
ecc_key ecKey;
RsaKey rsaKey;
int ret;
int curve = ECC_SECP256R1;
int keySz = WOLFSSL_MIN_RSA_BITS;
int exp = WC_RSA_EXPONENT;
char *path = NULL;
bool pem = true;
while (*arg && **arg == '-') {
if (!strncmp(*arg, "-out", 4) && arg[1]) {
path = arg[1];
arg++;
} else if (!strncmp(*arg, "-3", 2)) {
exp = 3;
} else if (!strncmp(*arg, "-der", 4)) {
pem = false;
}
arg++;
}
if (*arg && type == RSA_KEY_TYPE) {
keySz = (unsigned int)atoi(*arg);
} else if (*arg) {
if (!strncmp(*arg, "P-256", 5)) {
curve = ECC_SECP256R1;
} else if (!strncmp(*arg, "P-384", 5)) {
curve = ECC_SECP384R1;
} else if (!strncmp(*arg, "P-521", 5)) {
curve = ECC_SECP521R1;
} else {
fprintf(stderr, "Invalid Curve Name: %s\n", *arg);
return 1;
}
}
ret = gen_key(rng, &ecKey, &rsaKey, type, keySz, exp, curve);
if (ret != 0)
return ret;
ret = write_key(&ecKey, &rsaKey, type, keySz, path, pem);
if (type == EC_KEY_TYPE) {
wc_ecc_free(&ecKey);
} else {
wc_FreeRsaKey(&rsaKey);
}
return ret;
}
int main(int argc, char *argv[]) {
int ret;
WC_RNG rng;
ret = wc_InitRng(&rng);
if (ret != 0) {
fprintf(stderr, "Init Rng failed: %d\n", ret);
return ret;
}
if (argv[1]) {
if (!strncmp(argv[1], "eckey", 5))
return dokey(&rng, EC_KEY_TYPE, argv + 2);
if (!strncmp(argv[1], "rsakey", 5))
return dokey(&rng, RSA_KEY_TYPE, argv + 2);
if (!strncmp(argv[1], "selfsigned", 10))
return selfsigned(&rng, argv + 2);
}
fprintf(stderr, "PX5G X.509 Certificate Generator Utilit using WolfSSL\n\n");
fprintf(stderr, "Usage: [eckey|rsakey|selfsigned]\n");
return 1;
}

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=util-linux
PKG_VERSION:=2.35.1
PKG_RELEASE:=2
PKG_VERSION:=2.36
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.35
PKG_HASH:=d9de3edd287366cd908e77677514b9387b22bc7b88f45b83e1922c3597f1d7f9
PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
PKG_HASH:=9e4b1c67eb13b9b67feb32ae1dc0d50e08ce9e5d82e1cccd0ee771ad2fa9e0b1
PKG_CPE_ID:=cpe:/a:kernel:util-linux
PKG_LICENSE:=GPL-2.0
@ -126,6 +126,7 @@ define Package/blkdiscard
$(call Package/util-linux/Default)
TITLE:=discard sectors on a device
SUBMENU=Disc
DEPENDS:=libblkid
endef
define Package/blkdiscard/description

View File

@ -10,7 +10,7 @@
endif # BUILD_LIBUUID
--- a/configure.ac
+++ b/configure.ac
@@ -2496,18 +2496,23 @@ AC_CONFIG_HEADERS([config.h])
@@ -2586,18 +2586,23 @@ AC_CONFIG_HEADERS([config.h])
#
AC_CONFIG_FILES([
Makefile

View File

@ -0,0 +1,26 @@
From 69e4fbfbfd9c42af508954d9fb985c5c7b657784 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 11 Aug 2020 11:02:31 +0200
Subject: [PATCH] hwclock: add fallback if SYS_settimeofday does not exist
It seems Musl-C removes SYS_settimeofday macro at all.
Addresses: https://github.com/karelzak/util-linux/commit/9c6139a72017cecb9145e46102152cb4f456ada6#commitcomment-41290951
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/hwclock.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -675,6 +675,10 @@ display_time(struct timeval hwctime)
*/
#define __set_time(_tv) settimeofday(_tv, NULL)
+#if !defined(SYS_settimeofday) && defined(__NR_settimeofday)
+# define SYS_settimeofday __NR_settimeofday
+#endif
+
static inline int __set_timezone(const struct timezone *tz)
{
#ifdef SYS_settimeofday

View File

@ -266,7 +266,7 @@ endif
BUILD_KEY=$(TOPDIR)/key-build
FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot
FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot -l $(STAGING_DIR_HOST)/lib/libfakeroot.so -f $(STAGING_DIR_HOST)/bin/faked
TARGET_CC:=$(TARGET_CROSS)gcc
TARGET_CXX:=$(TARGET_CROSS)g++
KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh

View File

@ -1,28 +1,33 @@
#!/usr/bin/env bash
export LANG=C
export LC_ALL=C
[ -n "$TOPDIR" ] && cd $TOPDIR
if [ -n "$TOPDIR" ]; then
cd "$TOPDIR" || exit 1
fi
SOURCE="${1:-.}"
try_version() {
[ -f version.date ] || return 1
SOURCE_DATE_EPOCH="$(cat version.date)"
[ -f "$SOURCE/version.date" ] || return 1
SOURCE_DATE_EPOCH=$(cat "$SOURCE/version.date")
[ -n "$SOURCE_DATE_EPOCH" ]
}
try_git() {
[ -e .git ] || return 1
SOURCE_DATE_EPOCH="$(git log -1 --format=format:%ct)"
SOURCE_DATE_EPOCH=$(git -C "$SOURCE" log -1 --format=format:%ct \
"$SOURCE" 2>/dev/null)
[ -n "$SOURCE_DATE_EPOCH" ]
}
try_hg() {
[ -d .hg ] || return 1
SOURCE_DATE_EPOCH="$(hg log --template '{date}' -l 1 | cut -d. -f1)"
SOURCE_DATE_EPOCH=$(hg --cwd "$SOURCE" log --template '{date}' -l 1 \
"$SOURCE" 2>/dev/null | cut -d. -f1)
[ -n "$SOURCE_DATE_EPOCH" ]
}
try_mtime() {
perl -e 'print((stat $ARGV[0])[9])' "$0"
SOURCE_DATE_EPOCH=$(perl -e 'print((stat $ARGV[0])[9])' "$0")
[ -n "$SOURCE_DATE_EPOCH" ]
}

View File

@ -16,16 +16,10 @@ TAR="${TAR:-$(command -v tar)}"
GZIP="$(command -v gzip)"
# try to use fixed source epoch
if [ -n "$SOURCE_DATE_EPOCH" ]; then
if [ -n "$PKG_SOURCE_DATE_EPOCH" ]; then
TIMESTAMP=$(date --date="@$PKG_SOURCE_DATE_EPOCH")
elif [ -n "$SOURCE_DATE_EPOCH" ]; then
TIMESTAMP=$(date --date="@$SOURCE_DATE_EPOCH")
# look up date of last commit
elif [ -d "$TOPDIR/.git" ]; then
GIT="$(command -v git)"
TIMESTAMP=$(cd $TOPDIR; $GIT log -1 -s --format=%ci)
elif [ -d "$TOPDIR/.svn" ]; then
SVN="$(command -v svn)"
TIMESTAMP=$($SVN info "$TOPDIR" | sed -n "s/^Last Changed Date: \(.*\)/\1/p")
else
TIMESTAMP=$(date)
fi
@ -77,23 +71,15 @@ pkg_appears_sane() {
###
# ipkg-build "main"
###
ogargs=""
noclean=0
usage="Usage: $0 [-c] [-C] [-o owner] [-g group] <pkg_directory> [<destination_directory>]"
while getopts "cg:ho:v" opt; do
file_modes=""
usage="Usage: $0 [-v] [-h] [-m] <pkg_directory> [<destination_directory>]"
while getopts "hvm:" opt; do
case $opt in
o ) owner=$OPTARG
ogargs="--owner=$owner"
;;
g ) group=$OPTARG
ogargs="$ogargs --group=$group"
;;
c ) ;;
C ) noclean=1;;
v ) echo $version
exit 0
;;
h ) echo $usage >&2 ;;
m ) file_modes=$OPTARG ;;
\? ) echo $usage >&2
esac
done
@ -144,21 +130,38 @@ tmp_dir=$dest_dir/IPKG_BUILD.$$
mkdir $tmp_dir
echo $CONTROL > $tmp_dir/tarX
# Preserve permissions (-p) when creating data.tar.gz as non-root user
( cd $pkg_dir && $TAR $ogargs -X $tmp_dir/tarX --format=gnu --sort=name -cpf - --mtime="$TIMESTAMP" . | $GZIP -n - > $tmp_dir/data.tar.gz )
cd $pkg_dir
for file_mode in $file_modes; do
case $file_mode in
/*:*:*:*)
;;
*)
echo "ERROR: file modes must use absolute path and contain user:group:mode"
echo "$file_mode"
exit 1
;;
esac
path=$(echo "$file_mode" | cut -d ':' -f 1)
user_group=$(echo "$file_mode" | cut -d ':' -f 2-3)
mode=$(echo "$file_mode" | cut -d ':' -f 4)
chown "$user_group" "$pkg_dir/$path"
chmod "$mode" "$pkg_dir/$path"
done
$TAR -X $tmp_dir/tarX --format=gnu --sort=name -cpf - --mtime="$TIMESTAMP" . | $GZIP -n - > $tmp_dir/data.tar.gz
installed_size=`stat -c "%s" $tmp_dir/data.tar.gz`
sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \
$pkg_dir/$CONTROL/control
( cd $pkg_dir/$CONTROL && $TAR $ogargs --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" . | $GZIP -n - > $tmp_dir/control.tar.gz )
( cd $pkg_dir/$CONTROL && $TAR --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" . | $GZIP -n - > $tmp_dir/control.tar.gz )
rm $tmp_dir/tarX
echo "2.0" > $tmp_dir/debian-binary
pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk
rm -f $pkg_file
( cd $tmp_dir && $TAR $ogargs --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | $GZIP -n - > $pkg_file )
( cd $tmp_dir && $TAR --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | $GZIP -n - > $pkg_file )
rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz
rmdir $tmp_dir

View File

@ -205,4 +205,12 @@ manifest: FORCE
$(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \
$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)"))
.SILENT: help info image manifest
whatdepends: FORCE
ifeq ($(PACKAGE),)
@echo 'Variable `PACKAGE` is not set but required by `whatdepends`'
@exit 1
endif
@$(MAKE) -s package_reload
@$(OPKG) whatdepends -A $(PACKAGE)
.SILENT: help info image manifest whatdepends

View File

@ -13,6 +13,10 @@ choice
config BINUTILS_USE_VERSION_2_34
bool "Binutils 2.34"
select BINUTILS_VERSION_2_34
config BINUTILS_USE_VERSION_2_35
bool "Binutils 2.35"
select BINUTILS_VERSION_2_35
endchoice
config EXTRA_BINUTILS_CONFIG_OPTIONS

View File

@ -5,7 +5,11 @@ config BINUTILS_VERSION_2_34
default y if !TOOLCHAINOPTS
bool
config BINUTILS_VERSION_2_35
bool
config BINUTILS_VERSION
string
default "2.32" if BINUTILS_VERSION_2_32
default "2.34" if BINUTILS_VERSION_2_34
default "2.35" if BINUTILS_VERSION_2_35

View File

@ -23,6 +23,10 @@ ifeq ($(PKG_VERSION),2.34)
PKG_HASH:=f00b0e8803dc9bab1e2165bd568528135be734df3fabf8d0161828cd56028952
endif
ifeq ($(PKG_VERSION),2.35)
PKG_HASH:=1b11659fb49e20e18db460d44485f09442c8c56d5df165de9461eb09c8302f85
endif
HOST_BUILD_PARALLEL:=1
PATCH_DIR:=./patches/$(PKG_VERSION)

View File

@ -0,0 +1,22 @@
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -555,7 +555,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include

View File

@ -0,0 +1,18 @@
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -8075,6 +8075,7 @@ _bfd_mips_elf_create_dynamic_sections (b
name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING";
bh = NULL;
+ if (0) {
if (!(_bfd_generic_link_add_one_symbol
(info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0,
NULL, FALSE, get_elf_backend_data (abfd)->collect, &bh)))
@@ -8087,6 +8088,7 @@ _bfd_mips_elf_create_dynamic_sections (b
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
+ }
if (! mips_elf_hash_table (info)->use_rld_obj_head)
{

View File

@ -0,0 +1,38 @@
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -894,12 +894,12 @@ case "${targ}" in
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
;;
mips64*el-*-linux*)
- targ_defvec=mips_elf32_ntrad_le_vec
- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
+ targ_defvec=mips_elf64_trad_le_vec
+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec"
;;
mips64*-*-linux*)
- targ_defvec=mips_elf32_ntrad_be_vec
- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
+ targ_defvec=mips_elf64_trad_be_vec
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
;;
mips*el-*-linux*)
targ_defvec=mips_elf32_trad_le_vec
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -531,12 +531,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx
;;
mips*-*-windiss) targ_emul=elf32mipswindiss
;;
-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+mips64*el-*-linux-*) targ_emul=elf64ltsmip
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
targ_extra_libpath=$targ_extra_emuls
;;
-mips64*-*-linux-*) targ_emul=elf32btsmipn32
- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+mips64*-*-linux-*) targ_emul=elf64btsmip
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
targ_extra_libpath=$targ_extra_emuls
;;
mips*el-*-linux-*) targ_emul=elf32ltsmip

View File

@ -19,7 +19,7 @@ config GCC_VERSION
default "5.5.0" if GCC_VERSION_5
default "7.5.0" if GCC_VERSION_7
default "9.3.0" if GCC_VERSION_9
default "10.1.0" if GCC_VERSION_10
default "10.2.0" if GCC_VERSION_10
default "8.4.0"
config GCC_USE_IREMAP

View File

@ -44,8 +44,8 @@ ifeq ($(PKG_VERSION),9.3.0)
PKG_HASH:=71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1
endif
ifeq ($(PKG_VERSION),10.1.0)
PKG_HASH:=b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2
ifeq ($(PKG_VERSION),10.2.0)
PKG_HASH:=b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c
endif
PATCH_DIR=../patches/$(GCC_VERSION)

View File

@ -12,7 +12,7 @@ Date: Tue Feb 26 16:16:33 2013 +0000
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3283,18 +3283,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
@@ -3285,18 +3285,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)

View File

@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/target.mk
PKG_NAME:=musl
PKG_VERSION:=1.1.24
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://musl.libc.org/releases/

View File

@ -0,0 +1,102 @@
From 6f1143425a3afc4eb5086e9c90e7efb3affd7cb7 Mon Sep 17 00:00:00 2001
From: Tony Ambardar <Tony.Ambardar@gmail.com>
Date: Sat, 11 Jul 2020 06:35:46 -0700
Subject: [PATCH 2/2] nftw: support common gnu extension
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
---
include/ftw.h | 8 ++++++++
src/misc/nftw.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/include/ftw.h b/include/ftw.h
index b15c062a..ce85deac 100644
--- a/include/ftw.h
+++ b/include/ftw.h
@@ -21,6 +21,14 @@ extern "C" {
#define FTW_CHDIR 4
#define FTW_DEPTH 8
+#ifdef _GNU_SOURCE
+#define FTW_ACTIONRETVAL 16
+#define FTW_CONTINUE 0
+#define FTW_STOP 1
+#define FTW_SKIP_SUBTREE 2
+#define FTW_SKIP_SIBLINGS 3
+#endif
+
struct FTW {
int base;
int level;
diff --git a/src/misc/nftw.c b/src/misc/nftw.c
index 8dcff7fe..0bb7b601 100644
--- a/src/misc/nftw.c
+++ b/src/misc/nftw.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
#include <ftw.h>
#include <dirent.h>
#include <fcntl.h>
@@ -72,8 +73,20 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,
if (!fd_limit) close(dfd);
}
- if (!(flags & FTW_DEPTH) && (r=fn(path, &st, type, &lev)))
- return r;
+ if (!(flags & FTW_DEPTH) && (r=fn(path, &st, type, &lev))) {
+ if (flags & FTW_ACTIONRETVAL)
+ switch (r) {
+ case FTW_SKIP_SUBTREE:
+ h = NULL;
+ case FTW_CONTINUE:
+ break;
+ case FTW_SKIP_SIBLINGS:
+ case FTW_STOP:
+ return r;
+ }
+ else
+ return r;
+ }
for (; h; h = h->chain)
if (h->dev == st.st_dev && h->ino == st.st_ino)
@@ -101,7 +114,10 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,
strcpy(path+j+1, de->d_name);
if ((r=do_nftw(path, fn, fd_limit-1, flags, &new))) {
closedir(d);
- return r;
+ if ((flags & FTW_ACTIONRETVAL) && r == FTW_SKIP_SIBLINGS)
+ break;
+ else
+ return r;
}
}
closedir(d);
@@ -112,8 +128,16 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int,
}
path[l] = 0;
- if ((flags & FTW_DEPTH) && (r=fn(path, &st, type, &lev)))
- return r;
+ if ((flags & FTW_DEPTH) && (r=fn(path, &st, type, &lev))) {
+ if (flags & FTW_ACTIONRETVAL)
+ switch (r) {
+ case FTW_SKIP_SIBLINGS:
+ case FTW_STOP:
+ return r;
+ }
+ else
+ return r;
+ }
return 0;
}
@@ -139,4 +163,5 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str
return r;
}
+#undef nftw64
weak_alias(nftw, nftw64);
--
2.17.1

View File

@ -10,7 +10,7 @@ PKG_NAME:=lzma-old
PKG_VERSION:=4.32
PKG_SOURCE:=lzma-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
PKG_SOURCE_URL:=https://downloads.openwrt.org/sources
PKG_HASH:=49053e4bb5e0646a841d250d9cb81f7714f5fff04a133216c4748163567acc3d
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/lzma-$(PKG_VERSION)

View File

@ -10,7 +10,7 @@ PKG_NAME:=lzma
PKG_VERSION:=4.65
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/
PKG_SOURCE_URL:=https://downloads.openwrt.org/sources
PKG_HASH:=dcbdb5f4843eff638e4a5e8be0e2486a3c5483df73c70823618db8e66f609ec2
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)