1 Star 0 Fork 1.6K

yuzhenze/security_selinux_adapter_1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BUILD.gn 34.83 KB
一键复制 编辑 原始数据 按行查看 历史
openharmony_ci 提交于 2024-03-14 10:50 . !3866 修复mac流水线报错
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
# Copyright (c) 2021-2023 北京万里红科技有限公司
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
import("selinux.gni")
startup_init_with_param_base = false
if (!use_musl) {
startup_init_with_param_base = true
}
special_build_selinux_gni_exist =
special_build_selinux_gni_path != "" &&
exec_script("/bin/sh",
[
"-c",
"if [ -f " + rebase_path(special_build_selinux_gni_path) +
" ]; then echo true; else echo false; fi",
],
"value")
if (special_build_selinux_gni_exist) {
import(special_build_selinux_gni_path)
}
config("selinux_core_config") {
include_dirs = [ "interfaces/policycoreutils/include" ]
}
ohos_shared_library("libload_policy") {
output_name = "libload_policy"
sources = [ "interfaces/policycoreutils/src/load_policy.cpp" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
deps = [ ":libselinux_klog_static" ]
external_deps = [ "selinux:libselinux" ]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
if (support_developer_mode) {
cflags += [ "-DWITH_DEVELOPER" ]
}
install_enable = true
install_images = [
"system",
"ramdisk",
"updater",
]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_shared_library("librestorecon") {
output_name = "librestorecon"
sources = [ "interfaces/policycoreutils/src/selinux_restorecon.c" ]
public_configs = [ ":selinux_core_config" ]
deps = [ ":libselinux_hilog_static" ]
external_deps = [
"hilog:libhilog",
"selinux:libselinux",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
install_enable = true
install_images = [
"system",
"ramdisk",
"updater",
]
innerapi_tags = [ "platformsdk_indirect" ]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_shared_library("libhap_restorecon") {
output_name = "libhap_restorecon"
sources = [
"interfaces/policycoreutils/src/hap_restorecon.cpp",
"interfaces/policycoreutils/src/sehap_contexts_trie.cpp",
]
public_configs = [ ":selinux_core_config" ]
deps = [
":libselinux_error_static",
":libselinux_hilog_static",
]
external_deps = [ "hilog:libhilog" ]
public_external_deps = [ "selinux:libselinux" ]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
install_enable = true
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_static_library("libselinux_error_static") {
output_name = "libselinux_error_static"
sources = [ "interfaces/policycoreutils/src/selinux_error.cpp" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
cflags = [
"-D_GNU_SOURCE",
"-w",
]
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_static_library("libselinux_klog_static") {
output_name = "libselinux_klog_static"
sources = [ "interfaces/policycoreutils/src/selinux_klog.c" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
external_deps = [ "bounds_checking_function:libsec_shared" ]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_static_library("libselinux_hilog_static") {
output_name = "libselinux_hilog_static"
sources = [ "interfaces/policycoreutils/src/selinux_log.c" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
external_deps = [
"bounds_checking_function:libsec_shared",
"hilog:libhilog",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
part_name = "selinux_adapter"
subsystem_name = "security"
}
if (!startup_init_with_param_base) {
inherited_configs = [
"$BUILD_CONFIG_DIR/compiler:afdo",
"$BUILD_CONFIG_DIR/compiler:afdo_optimize_size",
"$BUILD_CONFIG_DIR/compiler:compiler",
"$BUILD_CONFIG_DIR/compiler:compiler_arm_fpu",
"$BUILD_CONFIG_DIR/compiler:compiler_arm_thumb",
"$BUILD_CONFIG_DIR/compiler:chromium_code",
"$BUILD_CONFIG_DIR/compiler:default_include_dirs",
"$BUILD_CONFIG_DIR/compiler:default_optimization",
"$BUILD_CONFIG_DIR/compiler:default_stack_frames",
"$BUILD_CONFIG_DIR/compiler:default_symbols",
"$BUILD_CONFIG_DIR/compiler:export_dynamic",
"$BUILD_CONFIG_DIR/compiler:no_exceptions",
"$BUILD_CONFIG_DIR/compiler:no_rtti",
"$BUILD_CONFIG_DIR/compiler:runtime_library",
"$BUILD_CONFIG_DIR/compiler:thin_archive",
"$BUILD_CONFIG_DIR/sanitizers:default_sanitizer_flags",
]
}
static_library("libselinux_parameter_static") {
output_name = "libselinux_parameter_static"
sources = [
"interfaces/policycoreutils/src/contexts_trie.c",
"interfaces/policycoreutils/src/selinux_map.c",
"interfaces/policycoreutils/src/selinux_parameter.c",
"interfaces/policycoreutils/src/selinux_share_mem.c",
]
public_configs = [ ":selinux_core_config" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
if (!startup_init_with_param_base) {
ldflags = [ "-nostdlib" ]
configs -= inherited_configs
configs += [ "$BUILD_CONFIG_DIR/compiler:compiler" ]
}
}
ohos_shared_library("libparaperm_checker") {
output_name = "libparaperm_checker"
sources = [ "interfaces/policycoreutils/src/param_checker.c" ]
public_configs = [ ":selinux_core_config" ]
deps = [ ":libselinux_klog_static" ]
deps += [ ":libselinux_parameter_static" ]
external_deps = [
"bounds_checking_function:libsec_shared",
"selinux:libselinux",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
install_images = [
"system",
"updater",
]
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_shared_library("libservice_checker") {
output_name = "libservice_checker"
sources = [ "interfaces/policycoreutils/src/service_checker.cpp" ]
public_configs = [ ":selinux_core_config" ]
deps = [
":libselinux_error_static",
":libselinux_hilog_static",
]
external_deps = [
"bounds_checking_function:libsec_shared",
"hilog:libhilog",
"selinux:libselinux",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
innerapi_tags = [ "chipsetsdk" ]
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_executable("load_policy") {
install_enable = true
sources = [ "interfaces/tools/load_policy/load_policy.c" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
deps = [ ":libload_policy" ]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
install_images = [
"system",
"updater",
]
}
ohos_executable("restorecon") {
install_enable = true
sources = [ "interfaces/tools/restorecon/restorecon.c" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
deps = [ ":librestorecon" ]
external_deps = [
"bounds_checking_function:libsec_shared",
"selinux:libselinux",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
install_images = [
"system",
"updater",
]
}
ohos_executable("hap_restorecon") {
install_enable = false
sources = [ "interfaces/tools/hap_restorecon/test.cpp" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
deps = [
":libhap_restorecon",
":libselinux_error_static",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
external_deps = [ "selinux:libselinux" ]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_executable("param_check") {
install_enable = false
sources = [ "interfaces/tools/param_check/test.cpp" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
deps = [
":libparaperm_checker",
":libselinux_error_static",
":libselinux_parameter_static",
]
external_deps = [
"pcre2:libpcre2",
"selinux:libselinux",
]
if (startup_init_with_param_base) {
deps += [ ":libselinux_parameter_static" ]
}
cflags = [
"-D_GNU_SOURCE",
"-DTIME_DISPLAY",
"-Wall",
"-Werror",
]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_executable("service_check") {
install_enable = false
sources = [ "interfaces/tools/service_check/test.cpp" ]
include_dirs = [ "interfaces/policycoreutils/include" ]
deps = [
":libselinux_error_static",
":libservice_checker",
]
cflags = [
"-D_GNU_SOURCE",
"-Wall",
"-Werror",
]
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
}
debug_version = "disable"
updater_version = "disable"
action("build_policy") {
if (build_variant == "user") {
debug_version = "disable"
} else if (build_variant == "root") {
debug_version = "enable"
} else {
debug_version = "enable"
}
updater_version = "disable"
inputs = exec_script("//build/scripts/find.py",
[ rebase_path("sepolicy") ],
"list lines")
if (selinux_build_path != "default") {
foreach(src, string_split(selinux_build_path, ":")) {
src = "//" + src
inputs += exec_script("//build/scripts/find.py",
[ rebase_path(src) ],
"list lines")
}
if (special_build_selinux_gni_exist &&
selinux_build_path_ext != "default") {
selinux_build_path = selinux_build_path + ":" + selinux_build_path_ext
}
}
if (special_build_policy_script != "default") {
script = special_build_policy_script
} else {
script = "scripts/build_policy.py"
}
args = [
"--dst-file",
rebase_path(target_out_dir + "/policy.31"),
"--tool-path",
rebase_path(root_build_dir + "/clang_x64/thirdparty/selinux/"),
"--source-root-dir",
rebase_path("//"),
"--policy_dir_list",
selinux_build_path,
"--debug-version",
debug_version,
"--updater-version",
updater_version,
"--components",
components,
]
if (components != "default") {
args += [
"--vendor-policy-version",
"$vendor_policy_version",
]
}
if (extra_args != "default") {
foreach(arg, string_split(extra_args, " ")) {
args += [ arg ]
}
}
deps = [
"$THIRD_PARTY_DIR/selinux:checkpolicy($host_toolchain)",
"$THIRD_PARTY_DIR/selinux:secilc($host_toolchain)",
]
outputs = [
target_out_dir + "/policy.31",
target_out_dir + "/user_policy",
target_out_dir + "/vendor.cil",
target_out_dir + "/prebuild_sepolicy.system.cil.sha256",
target_out_dir + "/system.cil",
target_out_dir + "/system.cil.sha256",
target_out_dir + "/compatible/$vendor_policy_version.cil",
target_out_dir + "/compatible",
target_out_dir + "/version",
target_out_dir + "/public.cil",
]
outputs += [
target_out_dir + "/developer/prebuild_sepolicy.system.cil.sha256",
target_out_dir + "/developer/system.cil.sha256",
target_out_dir + "/developer/compatible/$vendor_policy_version.cil",
target_out_dir + "/developer/compatible",
target_out_dir + "/developer/developer_policy",
target_out_dir + "/developer/policy.31",
target_out_dir + "/developer/vendor.cil",
target_out_dir + "/developer/system.cil",
target_out_dir + "/developer/public.cil",
]
if (components != "default") {
outputs += [
target_out_dir + "/system_common.cil",
target_out_dir + "/vendor_common.cil",
target_out_dir + "/public_common.cil",
]
}
}
action("build_update_policy") {
if (build_variant == "user") {
debug_version = "disable"
} else if (build_variant == "root") {
debug_version = "enable"
} else {
debug_version = "enable"
}
updater_version = "enable"
components = "default"
inputs = exec_script("//build/scripts/find.py",
[ rebase_path("sepolicy") ],
"list lines")
if (selinux_build_path != "default") {
foreach(src, string_split(selinux_build_path, ":")) {
src = "//" + src
inputs += exec_script("//build/scripts/find.py",
[ rebase_path(src) ],
"list lines")
}
if (special_build_selinux_gni_exist &&
selinux_build_path_ext_updater != "default") {
selinux_build_path =
selinux_build_path + ":" + selinux_build_path_ext_updater
}
}
if (special_build_policy_script != "default") {
script = special_build_policy_script
} else {
script = "scripts/build_policy.py"
}
args = [
"--dst-file",
rebase_path(target_out_dir + "/updater/policy.31"),
"--tool-path",
rebase_path(root_build_dir + "/clang_x64/thirdparty/selinux/"),
"--source-root-dir",
rebase_path("//"),
"--policy_dir_list",
selinux_build_path,
"--debug-version",
debug_version,
"--updater-version",
updater_version,
"--components",
components,
]
if (extra_args != "default") {
foreach(arg, string_split(extra_args, " ")) {
args += [ arg ]
}
}
deps = [
"$THIRD_PARTY_DIR/selinux:checkpolicy($host_toolchain)",
"$THIRD_PARTY_DIR/selinux:secilc($host_toolchain)",
]
outputs = [ target_out_dir + "/updater/policy.31" ]
}
action("build_contexts") {
inputs = exec_script("//build/scripts/find.py",
[ rebase_path("sepolicy") ],
"list lines")
if (selinux_build_path != "default") {
foreach(src, string_split(selinux_build_path, ":")) {
src = "//" + src
inputs += exec_script("//build/scripts/find.py",
[ rebase_path(src) ],
"list lines")
}
if (special_build_selinux_gni_exist &&
selinux_build_path_ext != "default") {
selinux_build_path = selinux_build_path + ":" + selinux_build_path_ext
}
}
if (special_build_contexts_script != "default") {
script = special_build_contexts_script
} else {
script = "scripts/build_contexts.py"
}
args = [
"--dst-dir",
rebase_path(target_out_dir + "/"),
"--tool-path",
rebase_path(root_build_dir + "/clang_x64/thirdparty/selinux/"),
"--policy-file",
rebase_path(target_out_dir + "/policy.31"),
"--source-root-dir",
rebase_path("//"),
"--policy_dir_list",
selinux_build_path,
"--components",
components,
]
if (contexts_extra_args != "default") {
foreach(arg, string_split(contexts_extra_args, " ")) {
args += [ arg ]
}
}
deps = [
":build_policy",
"$THIRD_PARTY_DIR/selinux:sefcontext_compile($host_toolchain)",
]
outputs = [
target_out_dir + "/file_contexts.bin",
target_out_dir + "/file_contexts",
target_out_dir + "/sehap_contexts",
target_out_dir + "/service_contexts",
target_out_dir + "/hdf_service_contexts",
target_out_dir + "/parameter_contexts",
]
}
action("build_updater_contexts") {
inputs = exec_script("//build/scripts/find.py",
[ rebase_path("sepolicy") ],
"list lines")
if (selinux_build_path != "default") {
foreach(src, string_split(selinux_build_path, ":")) {
src = "//" + src
inputs += exec_script("//build/scripts/find.py",
[ rebase_path(src) ],
"list lines")
}
if (special_build_selinux_gni_exist &&
selinux_build_path_ext_updater != "default") {
selinux_build_path =
selinux_build_path + ":" + selinux_build_path_ext_updater
}
}
if (special_build_contexts_script != "default") {
script = special_build_contexts_script
} else {
script = "scripts/build_contexts.py"
}
args = [
"--dst-dir",
rebase_path(target_out_dir + "/updater"),
"--tool-path",
rebase_path(root_build_dir + "/clang_x64/thirdparty/selinux/"),
"--policy-file",
rebase_path(target_out_dir + "/updater/policy.31"),
"--source-root-dir",
rebase_path("//"),
"--policy_dir_list",
selinux_build_path,
"--components",
components,
]
if (contexts_extra_args != "default") {
foreach(arg, string_split(contexts_extra_args, " ")) {
args += [ arg ]
}
}
deps = [
":build_update_policy",
"$THIRD_PARTY_DIR/selinux:sefcontext_compile($host_toolchain)",
]
outputs = [
target_out_dir + "/updater/file_contexts.bin",
target_out_dir + "/updater/file_contexts",
target_out_dir + "/updater/sehap_contexts",
target_out_dir + "/updater/service_contexts",
target_out_dir + "/updater/hdf_service_contexts",
target_out_dir + "/updater/parameter_contexts",
]
}
action("selinux_check") {
script = "scripts/selinux_check/selinux_check_main.py"
args = [
"--output-path",
rebase_path(target_out_dir),
"--source-root-dir",
rebase_path("//"),
"--user-policy",
rebase_path(target_out_dir + "/user_policy"),
"--developer-policy",
rebase_path(target_out_dir + "/developer/developer_policy"),
"--tool-path",
rebase_path(root_build_dir + "/clang_x64/thirdparty/selinux/"),
"--policy-dir-list",
selinux_build_path,
]
if (special_selinux_check_config != "default") {
args += [
"--selinux-check-config",
special_selinux_check_config,
]
} else {
args += [
"--selinux-check-config",
"base/security/selinux_adapter/scripts/selinux_check/config/selinux_check.json",
]
}
outputs = [ "$target_out_dir" ]
deps = [
":build_contexts",
":build_policy",
]
}
copy("selinux_config") {
if (selinux_enforce) {
sources = [ "config/config.enforce" ]
} else {
sources = [ "config/config.permissive" ]
}
outputs = [ "$target_out_dir/config" ]
}
copy("updater_selinux_config") {
sources = [ "config/config.enforce" ]
outputs = [ "$target_out_dir/updater/config" ]
}
ohos_prebuilt_etc("build_sepolicy") {
deps = [ ":build_policy" ]
source = target_out_dir + "/policy.31"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
if (components == "vendor") {
relative_install_dir = "selinux/prebuild_sepolicy/"
install_images = [ "vendor" ]
} else if (components == "default") {
if (!support_developer_mode) {
source = target_out_dir + "/developer/policy.31"
}
relative_install_dir = "selinux/targeted/policy/"
install_images = [ "system" ]
}
}
ohos_prebuilt_etc("build_updater_sepolicy") {
deps = [ ":build_update_policy" ]
source = target_out_dir + "/updater/policy.31"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/policy/"
install_images = [ "updater" ]
}
ohos_prebuilt_etc("selinux_version") {
deps = [ ":build_policy" ]
source = target_out_dir + "/version"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
ohos_prebuilt_etc("config") {
deps = [ ":selinux_config" ]
source = target_out_dir + "/config"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "system" ]
}
ohos_prebuilt_etc("updater_config") {
deps = [ ":updater_selinux_config" ]
source = target_out_dir + "/updater/config"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "updater" ]
}
ohos_prebuilt_etc("sehap_contexts") {
deps = [ ":build_contexts" ]
source = target_out_dir + "/sehap_contexts"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/contexts/"
}
ohos_prebuilt_etc("parameter_contexts") {
deps = [ ":build_contexts" ]
source = target_out_dir + "/parameter_contexts"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/contexts/"
if (components == "vendor") {
install_images = [ "vendor" ]
} else {
install_images = [
"system",
"updater",
]
}
}
ohos_prebuilt_etc("service_contexts") {
deps = [ ":build_contexts" ]
source = target_out_dir + "/service_contexts"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/contexts/"
if (components == "vendor") {
install_images = [ "vendor" ]
} else {
install_images = [ "system" ]
}
}
ohos_prebuilt_etc("hdf_service_contexts") {
deps = [ ":build_contexts" ]
source = target_out_dir + "/hdf_service_contexts"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/contexts/"
if (components == "vendor") {
install_images = [ "vendor" ]
} else {
install_images = [ "system" ]
}
}
ohos_prebuilt_etc("file_contexts") {
deps = [ ":build_contexts" ]
source = target_out_dir + "/file_contexts"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/contexts/"
if (components == "vendor") {
install_images = [ "vendor" ]
} else {
install_images = [ "system" ]
}
}
ohos_prebuilt_etc("file_contexts_updater") {
deps = [ ":build_updater_contexts" ]
source = target_out_dir + "/updater/file_contexts"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/targeted/contexts/"
if (components == "vendor") {
install_images = [ "updater_vendor" ]
} else {
install_images = [ "updater" ]
}
}
ohos_prebuilt_etc("vendor_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/vendor.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
if (components == "vendor") {
ohos_prebuilt_etc("vendor_common_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/vendor_common.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
}
ohos_prebuilt_etc("public_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/public.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
if (components == "vendor") {
ohos_prebuilt_etc("public_common_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/public_common.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
}
ohos_prebuilt_etc("version_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/compatible/$vendor_policy_version.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/compatible/"
install_images = [ "system" ]
}
ohos_prebuilt_etc("prebuild_sepolicy_system_cil_sha256") {
deps = [ ":build_policy" ]
source = target_out_dir + "/prebuild_sepolicy.system.cil.sha256"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
ohos_prebuilt_etc("system_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/system.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "system" ]
}
if (components == "system") {
ohos_prebuilt_etc("system_common_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/system_common.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "system" ]
}
}
ohos_prebuilt_etc("system_cil_sha256") {
deps = [ ":build_policy" ]
source = target_out_dir + "/system.cil.sha256"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "system" ]
}
if (support_developer_mode) {
ohos_prebuilt_etc("system_developer_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/system.cil"
output = "system_developer.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "system" ]
}
ohos_prebuilt_etc("vendor_developer_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/vendor.cil"
output = "vendor_developer.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
ohos_prebuilt_etc("public_developer_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/public.cil"
output = "public_developer.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
ohos_prebuilt_etc("version_developer_cil") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/compatible/$vendor_policy_version.cil"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/compatible_developer/"
install_images = [ "system" ]
}
ohos_prebuilt_etc("developer_policy") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/policy.31"
output = "developer_policy"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
if (components == "vendor") {
relative_install_dir = "selinux/prebuild_sepolicy/"
install_images = [ "vendor" ]
} else if (components == "default") {
relative_install_dir = "selinux/targeted/policy/"
install_images = [ "system" ]
}
}
ohos_prebuilt_etc("prebuild_sepolicy_system_developer_cil_sha256") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/prebuild_sepolicy.system.cil.sha256"
output = "prebuild_sepolicy.system_developer.cil.sha256"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "vendor" ]
}
ohos_prebuilt_etc("system_developer_cil_sha256") {
deps = [ ":build_policy" ]
source = target_out_dir + "/developer/system.cil.sha256"
output = "system_developer.cil.sha256"
license_file = "LICENSE"
part_name = "selinux_adapter"
subsystem_name = "security"
relative_install_dir = "selinux/"
install_images = [ "system" ]
}
}
if (build_selinux) {
ohos_copy("libselinux_toolchain") {
deps = [ "$THIRD_PARTY_DIR/selinux:libselinux($host_toolchain)" ]
sources = [ "$root_build_dir/clang_x64/thirdparty/selinux/libselinux.so" ]
outputs = [ "$root_build_dir/clang_x64/security/selinux/libselinux.so" ]
part_name = "selinux_adapter"
subsystem_name = "security"
}
ohos_copy("libpcre2_toolchain") {
deps = [ "$THIRD_PARTY_DIR/pcre2:libpcre2($host_toolchain)" ]
sources = [ "$root_build_dir/clang_x64/thirdparty/pcre2/libpcre2.so" ]
outputs = [ "$root_build_dir/clang_x64/security/selinux/libpcre2.so" ]
part_name = "selinux_adapter"
subsystem_name = "security"
}
}
ohos_copy("filecontexts_toolchain") {
deps = [ ":build_contexts" ]
sources = [ "$target_out_dir/file_contexts.bin" ]
outputs = [ "$target_out_dir/../security/selinux/file_contexts.bin" ]
part_name = "selinux_adapter"
subsystem_name = "security"
}
if (components != "default") {
copy("eng_system_compatible") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/compatible" ]
outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/compatible" ]
}
copy("eng_system_compatible_developer") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/developer/compatible" ]
outputs = [
"$root_out_dir/$eng_system_base_dir/etc/selinux/compatible_developer",
]
}
copy("eng_system_system_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/system.cil" ]
outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system.cil" ]
}
copy("eng_system_system_cil_sha256") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/system.cil.sha256" ]
outputs =
[ "$root_out_dir/$eng_system_base_dir/etc/selinux/system.cil.sha256" ]
}
copy("eng_system_system_common_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/system_common.cil" ]
outputs =
[ "$root_out_dir/$eng_system_base_dir/etc/selinux/system_common.cil" ]
}
copy("eng_system_system_developer_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/developer/system.cil" ]
outputs = [
"$root_out_dir/$eng_system_base_dir/etc/selinux/system_developer.cil",
]
}
copy("eng_system_system_developer_cil_sha256") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/developer/system.cil.sha256" ]
outputs = [ "$root_out_dir/$eng_system_base_dir/etc/selinux/system_developer.cil.sha256" ]
}
copy("eng_chipset_developer_policy") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/developer/policy.31" ]
outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy/developer_policy" ]
}
copy("eng_chipset_policy") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/policy.31" ]
outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy/policy.31" ]
}
copy("eng_chipset_system_cil_sha256") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/prebuild_sepolicy.system.cil.sha256" ]
outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy.system.cil.sha256" ]
}
copy("eng_chipset_system_developer_cil_sha256") {
deps = [ ":build_policy" ]
sources =
[ "$target_out_dir/developer/prebuild_sepolicy.system.cil.sha256" ]
outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/prebuild_sepolicy.system_developer.cil.sha256" ]
}
copy("eng_chipset_public_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/public.cil" ]
outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public.cil" ]
}
copy("eng_chipset_public_common_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/public_common.cil" ]
outputs =
[ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/public_common.cil" ]
}
copy("eng_chipset_public_developer_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/developer/public.cil" ]
outputs = [
"$root_out_dir/$eng_chipset_base_dir/etc/selinux/public_developer.cil",
]
}
copy("eng_chipset_vendor_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/vendor.cil" ]
outputs = [ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor.cil" ]
}
copy("eng_chipset_vendor_common_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/vendor_common.cil" ]
outputs =
[ "$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor_common.cil" ]
}
copy("eng_chipset_vendor_developer_cil") {
deps = [ ":build_policy" ]
sources = [ "$target_out_dir/developer/vendor.cil" ]
outputs = [
"$root_out_dir/$eng_chipset_base_dir/etc/selinux/vendor_developer.cil",
]
}
group("eng_system_selinux_group") {
deps = [
":eng_system_compatible",
":eng_system_compatible_developer",
":eng_system_system_cil",
":eng_system_system_cil_sha256",
":eng_system_system_common_cil",
":eng_system_system_developer_cil",
":eng_system_system_developer_cil_sha256",
":filecontexts_toolchain",
]
}
group("eng_chipset_selinux_group") {
deps = [
":eng_chipset_developer_policy",
":eng_chipset_policy",
":eng_chipset_public_cil",
":eng_chipset_public_common_cil",
":eng_chipset_public_developer_cil",
":eng_chipset_system_cil_sha256",
":eng_chipset_system_developer_cil_sha256",
":eng_chipset_vendor_cil",
":eng_chipset_vendor_common_cil",
":eng_chipset_vendor_developer_cil",
":filecontexts_toolchain",
]
}
}
group("selinux_group") {
if (build_selinux) {
deps = [
":build_updater_sepolicy",
":config",
":file_contexts",
":file_contexts_updater",
":filecontexts_toolchain",
":hap_restorecon",
":hdf_service_contexts",
":libpcre2_toolchain",
":libselinux_toolchain",
":load_policy",
":param_check",
":parameter_contexts",
":restorecon",
":sehap_contexts",
":selinux_check",
":service_check",
":service_contexts",
":updater_config",
"$THIRD_PARTY_DIR/selinux:checkpolicy($host_toolchain)",
"$THIRD_PARTY_DIR/selinux:chkcon",
"$THIRD_PARTY_DIR/selinux:getenforce",
"$THIRD_PARTY_DIR/selinux:getfilecon",
"$THIRD_PARTY_DIR/selinux:getpidcon",
"$THIRD_PARTY_DIR/selinux:secilc",
"$THIRD_PARTY_DIR/selinux:secilc($host_toolchain)",
"$THIRD_PARTY_DIR/selinux:sefcontext_compile($host_toolchain)",
"$THIRD_PARTY_DIR/selinux:selinux_check_access",
"$THIRD_PARTY_DIR/selinux:selinuxexeccon",
"$THIRD_PARTY_DIR/selinux:setenforce",
"$THIRD_PARTY_DIR/selinux:setfilecon",
]
if (components == "system") {
deps += [
":system_cil",
":system_cil_sha256",
":system_common_cil",
":version_cil",
]
if (support_developer_mode) {
deps += [
":system_developer_cil",
":system_developer_cil_sha256",
":version_developer_cil",
]
}
} else if (components == "vendor") {
deps += [
":build_sepolicy",
":prebuild_sepolicy_system_cil_sha256",
":public_cil",
":public_common_cil",
":selinux_version",
":vendor_cil",
":vendor_common_cil",
]
if (support_developer_mode) {
deps += [
":developer_policy",
":prebuild_sepolicy_system_developer_cil_sha256",
":public_developer_cil",
":vendor_developer_cil",
]
}
} else {
deps += [ ":build_sepolicy" ]
if (support_developer_mode) {
deps += [ ":developer_policy" ]
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yuzhenze9446/security_selinux_adapter_1.git
git@gitee.com:yuzhenze9446/security_selinux_adapter_1.git
yuzhenze9446
security_selinux_adapter_1
security_selinux_adapter_1
master

搜索帮助