Skip to content
Snippets Groups Projects
Commit f937f43d authored by Thierry Escande's avatar Thierry Escande
Browse files

openharmony-standard-3.1: Add security/selinux git repository


This patch adds //base/security/selinux repository needed to build and
install //third_party/selinux:libselinux to the system image.

Since //third_party/selinux needs //third_party/FreeBSD only for the
source files fts.c and fts.h, this patch also adds a dependency on the
musl fts package and uses it instead of the source file from FreeBSD.

Signed-off-by: default avatarThierry Escande <thierry.escande@huawei.com>

Merge me with
parent 2cb0b2ba
No related branches found
No related tags found
1 merge request!30Fix OpenHarmony 3.1 file-rdeps errors
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Apply to //base/security/selinux of OpenHarmony 3.1 codebase.
This makes use of the fts.h header file from //third_party/selinux instead
of //third_party/FreeBSD that we avoid to use.
Signed-off-by: Thierry Escande <thierry.escande@huawei.com>
Upstream-Status: Inappropriate
diff --git a/BUILD.gn b/BUILD.gn
index 2badcfc..95f74fb 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -97,6 +97,7 @@ ohos_shared_library("libhap_restorecon") {
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
+ "-Wno-error=#warnings",
]
install_enable = true
license_file = "$SELINUX_ROOT_DIR/LICENSE"
diff --git a/interfaces/policycoreutils/src/hap_restorecon.cpp b/interfaces/policycoreutils/src/hap_restorecon.cpp
index eca095a..8333562 100644
--- a/interfaces/policycoreutils/src/hap_restorecon.cpp
+++ b/interfaces/policycoreutils/src/hap_restorecon.cpp
@@ -15,7 +15,8 @@
#include "hap_restorecon.h"
#include <fstream>
-#include <include/fts.h>
+#include <fts.h>
+#include <sys/stat.h>
#include <regex>
#include <selinux/label.h>
#include <selinux/restorecon.h>
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Apply to //third_party/selinux of OpenHarmony 3.1 codebase.
This removes the file fts.c from //third_party/FreeBSD and statically
links with musl-fts library when building with the target toolchain
(i.e. musl). When it builds with the native sysroot, it uses the fts
APIs already supported by glibc.
Signed-off-by: Thierry Escande <thierry.escande@huawei.com>
Upstream-Status: Inappropriate
diff --git a/BUILD.gn b/BUILD.gn
index a8fb10db..cd3d3cdd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -137,7 +137,6 @@ ohos_executable("chkcon") {
ohos_shared_library("libselinux") {
output_name = "libselinux"
sources = [
- "$LIBFTS_ROOT_DIR/lib/libc/gen/fts.c",
"$LIBSELINUX_ROOT_DIR/src/avc.c",
"$LIBSELINUX_ROOT_DIR/src/avc_internal.c",
"$LIBSELINUX_ROOT_DIR/src/avc_sidtab.c",
@@ -214,6 +213,11 @@ ohos_shared_library("libselinux") {
"ramdisk",
"updater",
]
+
+ if (current_toolchain != host_toolchain) {
+ ldflags = [ "../../oniro/sysroots/target/usr/lib/libfts.a" ]
+ }
+
license_file = "$LIBSELINUX_ROOT_DIR/LICENSE"
part_name = "selinux"
subsystem_name = "security"
diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
index e2553cda..099cf4e8 100644
--- a/libselinux/src/selinux_restorecon.c
+++ b/libselinux/src/selinux_restorecon.c
@@ -14,7 +14,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <include/fts.h>
+#include <fts.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
diff --git a/BUILD.gn b/BUILD.gn
index a8fb10db..c7ece203 100644
...@@ -50,6 +50,7 @@ SRC_URI += "${GITEE_URL}/security_deviceauth.git;protocol=https;nobranch=1;branc ...@@ -50,6 +50,7 @@ SRC_URI += "${GITEE_URL}/security_deviceauth.git;protocol=https;nobranch=1;branc
SRC_URI += "${GITEE_URL}/security_device_security_level.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=a8326ac7a599d7638a592947888a72b4d076418f;destsuffix=${OH_SRCDIR}/base/security/device_security_level" SRC_URI += "${GITEE_URL}/security_device_security_level.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=a8326ac7a599d7638a592947888a72b4d076418f;destsuffix=${OH_SRCDIR}/base/security/device_security_level"
SRC_URI += "${GITEE_URL}/security_huks.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=e4f0c051cdbea87b93e9879ecac0efd5f2ebf75d;destsuffix=${OH_SRCDIR}/base/security/huks" SRC_URI += "${GITEE_URL}/security_huks.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=e4f0c051cdbea87b93e9879ecac0efd5f2ebf75d;destsuffix=${OH_SRCDIR}/base/security/huks"
SRC_URI += "${GITEE_URL}/security_permission.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=807a32ca68f71834d54375d2f7eaf11f81a1127e;destsuffix=${OH_SRCDIR}/base/security/permission" SRC_URI += "${GITEE_URL}/security_permission.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=807a32ca68f71834d54375d2f7eaf11f81a1127e;destsuffix=${OH_SRCDIR}/base/security/permission"
SRC_URI += "${GITEE_URL}/security_selinux.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=65c7a8741164f8fdead9f5cba52b7c2d32984d8d;destsuffix=${OH_SRCDIR}/base/security/selinux/"
SRC_URI += "${GITEE_URL}/sensors_sensor.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=54999891f299b412a9b0cdbfada6b61e33cd7110;destsuffix=${OH_SRCDIR}/base/sensors/sensor" SRC_URI += "${GITEE_URL}/sensors_sensor.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=54999891f299b412a9b0cdbfada6b61e33cd7110;destsuffix=${OH_SRCDIR}/base/sensors/sensor"
SRC_URI += "${GITEE_URL}/startup_appspawn.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=b7447b8f4f48598068ea5381f1a33905fe552214;destsuffix=${OH_SRCDIR}/base/startup/appspawn_standard" SRC_URI += "${GITEE_URL}/startup_appspawn.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=b7447b8f4f48598068ea5381f1a33905fe552214;destsuffix=${OH_SRCDIR}/base/startup/appspawn_standard"
SRC_URI += "${GITEE_URL}/startup_init_lite.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=5158c9ade29dda41a9a8466ba78d8d17ac007936;destsuffix=${OH_SRCDIR}/base/startup/init_lite" SRC_URI += "${GITEE_URL}/startup_init_lite.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.1.1-Release;rev=5158c9ade29dda41a9a8466ba78d8d17ac007936;destsuffix=${OH_SRCDIR}/base/startup/init_lite"
......
...@@ -18,6 +18,8 @@ DEPENDS += "ruby-native" ...@@ -18,6 +18,8 @@ DEPENDS += "ruby-native"
DEPENDS += "hapsigner-native" DEPENDS += "hapsigner-native"
DEPENDS += "packing-tool-native" DEPENDS += "packing-tool-native"
DEPENDS += "fts"
FILESEXTRAPATHS:prepend := "${THISDIR}/openharmony-${OPENHARMONY_VERSION}:" FILESEXTRAPATHS:prepend := "${THISDIR}/openharmony-${OPENHARMONY_VERSION}:"
FILESEXTRAPATHS:prepend := "${THISDIR}/openharmony-standard-${OPENHARMONY_VERSION}:" FILESEXTRAPATHS:prepend := "${THISDIR}/openharmony-standard-${OPENHARMONY_VERSION}:"
...@@ -68,6 +70,8 @@ SRC_URI += "file://third_party_weston-hdi-display-layer.patch;patchdir=${S}/thir ...@@ -68,6 +70,8 @@ SRC_URI += "file://third_party_weston-hdi-display-layer.patch;patchdir=${S}/thir
SRC_URI += "file://third_party_selinux-flex-bison-path.patch;patchdir=${S}/third_party/selinux" SRC_URI += "file://third_party_selinux-flex-bison-path.patch;patchdir=${S}/third_party/selinux"
SRC_URI += "file://foundation_graphic_standard-flexlexer-h.patch;patchdir=${S}/foundation/graphic/standard" SRC_URI += "file://foundation_graphic_standard-flexlexer-h.patch;patchdir=${S}/foundation/graphic/standard"
SRC_URI += "file://features.json;subdir=${OHOS_BUILD_CONFIGS_DIR}" SRC_URI += "file://features.json;subdir=${OHOS_BUILD_CONFIGS_DIR}"
SRC_URI += "file://third_party_selinux-fts.patch;patchdir=${S}/third_party/selinux"
SRC_URI += "file://base_security_selinux-fts.patch;patchdir=${S}/base/security/selinux"
# Patch to allow /system/profile and /system/usr to be symlinks to /usr/lib/openharmony # Patch to allow /system/profile and /system/usr to be symlinks to /usr/lib/openharmony
SRC_URI += "file://foundation_distributedschedule_safwk-slash-system-symlink.patch;patchdir=${S}/foundation/distributedschedule/safwk" SRC_URI += "file://foundation_distributedschedule_safwk-slash-system-symlink.patch;patchdir=${S}/foundation/distributedschedule/safwk"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment