initial buildroot for linux 5.15
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
From 78f7f09028fdd6a5e8e4e4b584749621eaef412f Mon Sep 17 00:00:00 2001
|
||||
From: Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
Date: Sat, 7 Dec 2019 17:24:50 -0800
|
||||
Subject: [PATCH] fix undefined macros in musl
|
||||
|
||||
musl does not define glibc-specific macros, so use a simple version of
|
||||
the macro when it is not defined.
|
||||
|
||||
This is very inefficient, however, but copying the code from glibc is
|
||||
not really possible because it is LGPL while libselinux in Public
|
||||
Domain, and we want to avoid license propagation, so this macro is
|
||||
completely written from scratch, and non-optimal.
|
||||
|
||||
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
|
||||
[Updated for 3.0]
|
||||
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
|
||||
diff --git a/src/booleans.c b/src/booleans.c
|
||||
index ffa8d26..8569002 100644
|
||||
--- a/src/booleans.c
|
||||
+++ b/src/booleans.c
|
||||
@@ -65,6 +65,14 @@ int security_get_boolean_names(char ***names, int *len)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
+/* Simple (but inefficient) version of _D_ALLOC_NAMLEN when
|
||||
+ * building with a C library that misses it (e.g. musl).
|
||||
+ * Note: glibc does a strlen on (d)->d_name, so assume it is safe.
|
||||
+ */
|
||||
+#ifndef _D_ALLOC_NAMLEN
|
||||
+#define _D_ALLOC_NAMLEN(d) (strlen((d)->d_name)+1)
|
||||
+#endif
|
||||
+
|
||||
for (i = 0; i < *len; i++) {
|
||||
n[i] = strdup(namelist[i]->d_name);
|
||||
if (!n[i]) {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From c26495025ab1a2597e5433b67a3bf793d3ce1e08 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Fri, 25 Oct 2019 13:37:14 +0200
|
||||
Subject: [PATCH] Do not use PYCEXT, and rely on the installed file name
|
||||
|
||||
PYCEXT is computed by asking the Python intrepreter what is the
|
||||
file extension used for native Python modules.
|
||||
|
||||
Unfortunately, when cross-compiling, the host Python doesn't give the
|
||||
proper result: it gives the result matching the build machine, and not
|
||||
the target machine. Due to this, the symlink has an incorrect name,
|
||||
and doesn't point to the .so file that was actually built/installed.
|
||||
|
||||
To address this and keep things simple, this patch just changes the ln
|
||||
invocation to rely on the name of the _selinux*.so Python module that
|
||||
was installed.
|
||||
|
||||
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
[Refreshed for 3.1]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
[Refreshed for 3.0]
|
||||
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
|
||||
---
|
||||
src/Makefile | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index 190016e2af34..7ee22fd35da3 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -15,7 +15,6 @@ INCLUDEDIR ?= $(PREFIX)/include
|
||||
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
|
||||
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
|
||||
PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))")
|
||||
-PYCEXT ?= $(shell $(PYTHON) -c 'import importlib.machinery;print(importlib.machinery.EXTENSION_SUFFIXES[0])')
|
||||
RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]')
|
||||
RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]')
|
||||
RUBYINSTALL ?= $(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
|
||||
@@ -184,7 +183,7 @@ install: all
|
||||
install-pywrap: pywrap
|
||||
$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS)
|
||||
install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
|
||||
- ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
|
||||
+ ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux*.so $(DESTDIR)$(PYTHONLIBDIR)/
|
||||
|
||||
install-rubywrap: rubywrap
|
||||
test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL)
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From 5c4ddfc88f0a7f10a5e9edddbdbe8e8ef1f9945e Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Thu, 10 Jun 2021 07:38:02 +0200
|
||||
Subject: [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8
|
||||
|
||||
Fix the following build failure with gcc 4.8 which is raised since
|
||||
version 3.2 and
|
||||
https://github.com/SELinuxProject/selinux/commit/156dd0de5cad31e7d437c64e11a8aef027f0a691
|
||||
|
||||
getseuser.c:53:2: error: 'for' loop initial declarations are only allowed in C99 mode
|
||||
for (int i = 0; i < n; i++)
|
||||
^
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/37eb0952a763256fbf6ef3c668f6c95fbdf2dd35
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
[Upstream status: https://github.com/SELinuxProject/selinux/pull/289]
|
||||
---
|
||||
libselinux/utils/getseuser.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/utils/getseuser.c b/utils/getseuser.c
|
||||
index ce1b7b27..34f2e887 100644
|
||||
--- a/utils/getseuser.c
|
||||
+++ b/utils/getseuser.c
|
||||
@@ -9,7 +9,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
char *seuser = NULL, *level = NULL;
|
||||
char **contextlist;
|
||||
- int rc, n;
|
||||
+ int rc, n, i;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "usage: %s linuxuser fromcon\n", argv[0]);
|
||||
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
|
||||
if (n == 0)
|
||||
printf("no valid context found\n");
|
||||
|
||||
- for (int i = 0; i < n; i++)
|
||||
+ for (i = 0; i < n; i++)
|
||||
printf("Context %d\t%s\n", i, contextlist[i]);
|
||||
|
||||
freeconary(contextlist);
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
config BR2_PACKAGE_LIBSELINUX
|
||||
bool "libselinux"
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on !BR2_STATIC_LIBS
|
||||
select BR2_PACKAGE_LIBSEPOL
|
||||
select BR2_PACKAGE_PCRE
|
||||
select BR2_PACKAGE_MUSL_FTS if !BR2_TOOLCHAIN_USES_GLIBC
|
||||
help
|
||||
libselinux is the runtime SELinux library that provides
|
||||
interfaces (e.g. library functions for the SELinux kernel
|
||||
APIs like getcon(), other support functions like
|
||||
getseuserbyname()) to SELinux-aware applications. libselinux
|
||||
may use the shared libsepol to manipulate the binary policy
|
||||
if necessary (e.g. to downgrade the policy format to an
|
||||
older version supported by the kernel) when loading policy.
|
||||
|
||||
http://selinuxproject.org/page/Main_Page
|
||||
|
||||
comment "libselinux needs a toolchain w/ threads, dynamic library"
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
|
||||
@@ -0,0 +1,5 @@
|
||||
# From: https://github.com/SELinuxProject/selinux/wiki/Releases
|
||||
sha256 df758ef1d9d4811051dd901ea6b029ae334ffd7c671c128beb16bce1e25ac161 libselinux-3.2.tar.gz
|
||||
|
||||
# Hash for license file
|
||||
sha256 86657b4c0fe868d7cbd977cb04c63b6c667e08fa51595a7bc846ad4bed8fc364 LICENSE
|
||||
@@ -0,0 +1,137 @@
|
||||
################################################################################
|
||||
#
|
||||
# libselinux
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBSELINUX_VERSION = 3.2
|
||||
LIBSELINUX_SITE = https://github.com/SELinuxProject/selinux/releases/download/$(LIBSELINUX_VERSION)
|
||||
LIBSELINUX_LICENSE = Public Domain
|
||||
LIBSELINUX_LICENSE_FILES = LICENSE
|
||||
LIBSELINUX_CPE_ID_VENDOR = selinuxproject
|
||||
|
||||
LIBSELINUX_DEPENDENCIES = $(BR2_COREUTILS_HOST_DEPENDENCY) libsepol pcre
|
||||
|
||||
LIBSELINUX_INSTALL_STAGING = YES
|
||||
|
||||
# Set SHLIBDIR to /usr/lib so it has the same value than LIBDIR, as a result
|
||||
# we won't have to use a relative path in 0002-revert-ln-relative.patch
|
||||
LIBSELINUX_MAKE_OPTS = \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
ARCH=$(KERNEL_ARCH) \
|
||||
SHLIBDIR=/usr/lib
|
||||
|
||||
LIBSELINUX_MAKE_INSTALL_TARGETS = install
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
|
||||
LIBSELINUX_DEPENDENCIES += musl-fts
|
||||
LIBSELINUX_MAKE_OPTS += FTS_LDLIBS=-lfts
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
||||
LIBSELINUX_DEPENDENCIES += python3 host-swig
|
||||
|
||||
LIBSELINUX_MAKE_OPTS += \
|
||||
$(PKG_PYTHON_DISTUTILS_ENV) \
|
||||
PYTHON=python$(PYTHON3_VERSION_MAJOR)
|
||||
|
||||
LIBSELINUX_MAKE_INSTALL_TARGETS += install-pywrap
|
||||
|
||||
# dependencies are broken and result in file truncation errors at link
|
||||
# time if the Python bindings are built through the same make
|
||||
# invocation as the rest of the library.
|
||||
define LIBSELINUX_BUILD_PYTHON_BINDINGS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) swigify pywrap
|
||||
endef
|
||||
endif # python3
|
||||
|
||||
# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22. We
|
||||
# set CFLAGS, CPPFLAGS and LDFLAGS here because we want to win over the
|
||||
# CFLAGS/CPPFLAGS/LDFLAGS definitions passed by $(PKG_PYTHON_DISTUTILS_ENV)
|
||||
# when the python binding is enabled.
|
||||
LIBSELINUX_MAKE_OPTS += \
|
||||
CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
|
||||
CPPFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CPPFLAGS))" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread"
|
||||
|
||||
define LIBSELINUX_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) all
|
||||
$(LIBSELINUX_BUILD_PYTHON_BINDINGS)
|
||||
endef
|
||||
|
||||
define LIBSELINUX_INSTALL_STAGING_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) \
|
||||
$(LIBSELINUX_MAKE_INSTALL_TARGETS)
|
||||
endef
|
||||
|
||||
define LIBSELINUX_INSTALL_TARGET_CMDS
|
||||
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) \
|
||||
$(LIBSELINUX_MAKE_INSTALL_TARGETS)
|
||||
if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
|
||||
echo "none /sys/fs/selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
|
||||
endef
|
||||
|
||||
HOST_LIBSELINUX_DEPENDENCIES = \
|
||||
host-libsepol host-pcre host-swig host-python3
|
||||
|
||||
HOST_LIBSELINUX_MAKE_OPTS = \
|
||||
$(HOST_CONFIGURE_OPTS) \
|
||||
PREFIX=$(HOST_DIR) \
|
||||
SHLIBDIR=$(HOST_DIR)/lib \
|
||||
LDFLAGS="$(HOST_LDFLAGS) -lpcre -lpthread" \
|
||||
$(HOST_PKG_PYTHON_DISTUTILS_ENV) \
|
||||
PYTHON=python$(PYTHON3_VERSION_MAJOR)
|
||||
|
||||
define HOST_LIBSELINUX_BUILD_CMDS
|
||||
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) all
|
||||
# Generate python interface wrapper
|
||||
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) swigify pywrap
|
||||
endef
|
||||
|
||||
define HOST_LIBSELINUX_INSTALL_CMDS
|
||||
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) install
|
||||
# Install python interface wrapper
|
||||
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
||||
$(HOST_LIBSELINUX_MAKE_OPTS) install-pywrap
|
||||
endef
|
||||
|
||||
define LIBSELINUX_LINUX_CONFIG_FIXUPS
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_SECURITY_SELINUX)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_INET)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_NET)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_NETWORK)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_SELINUX)
|
||||
$(call KCONFIG_SET_OPT,CONFIG_LSM,"selinux")
|
||||
$(if $(BR2_TARGET_ROOTFS_EROFS),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_EROFS_FS_XATTR)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_EROFS_FS_SECURITY))
|
||||
$(if $(BR2_TARGET_ROOTFS_EXT2),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_EXT2_FS_XATTR)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_EXT2_FS_SECURITY))
|
||||
$(if $(BR2_TARGET_ROOTFS_EXT2_3),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_EXT3_FS_SECURITY))
|
||||
$(if $(BR2_TARGET_ROOTFS_EXT2_4),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_EXT4_FS_SECURITY))
|
||||
$(if $(BR2_TARGET_ROOTFS_F2FS),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_F2FS_FS_XATTR)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_F2FS_FS_SECURITY))
|
||||
$(if $(BR2_TARGET_ROOTFS_JFFS2),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_JFS_SECURITY))
|
||||
$(if $(BR2_TARGET_ROOTFS_SQUASHFS),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_SQUASHFS_XATTR))
|
||||
$(if $(BR2_TARGET_ROOTFS_UBIFS),
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_UBIFS_FS_XATTR)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_UBIFS_FS_SECURITY))
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
$(eval $(host-generic-package))
|
||||
Reference in New Issue
Block a user