1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/startup/init/begetd.gni")
15import("//build/ohos.gni")
16
17config("exported_header_files") {
18  visibility = [ ":*" ]
19  include_dirs = [ "./include" ]
20}
21
22ohos_static_library("sandbox") {
23  sources = [
24    "sandbox.c",
25    "sandbox_namespace.c",
26  ]
27  public_configs = [ ":exported_header_files" ]
28  include_dirs = [
29    "//base/startup/init/interfaces/innerkits/include",
30    "//base/startup/init/interfaces/innerkits/include",
31  ]
32  if (target_cpu == "arm64" || target_cpu == "x86_64" ||
33      target_cpu == "riscv64") {
34    defines = [ "SUPPORT_64BIT" ]
35  }
36  deps = [
37    ":chipset-sandbox.json",
38    ":system-sandbox.json",
39    "//base/startup/init/services/utils:libinit_utils",
40  ]
41  external_deps = [
42    "bounds_checking_function:libsec_static",
43    "cJSON:cjson",
44    "config_policy:configpolicy_util",
45  ]
46  part_name = "init"
47  subsystem_name = "startup"
48}
49
50ohos_prebuilt_etc("system-sandbox.json") {
51  if (target_cpu == "arm64" || target_cpu == "x86_64" ||
52      target_cpu == "riscv64") {
53    source = "system-sandbox64.json"
54  } else {
55    source = "system-sandbox.json"
56  }
57  output = "//base/startup/init/services/sandbox/system-sandbox.json"
58  part_name = "init"
59  subsystem_name = "startup"
60  module_install_dir = "etc/sandbox"
61  install_enable = true
62  install_images = [
63    "system",
64    "updater",
65  ]
66}
67
68ohos_prebuilt_etc("chipset-sandbox.json") {
69  if (target_cpu == "arm64" || target_cpu == "x86_64" ||
70      target_cpu == "riscv64") {
71    source = "chipset-sandbox64.json"
72  } else {
73    source = "chipset-sandbox.json"
74  }
75  output = "//base/startup/init/services/sandbox/chipset-sandbox.json"
76  part_name = "init"
77  subsystem_name = "startup"
78  module_install_dir = "etc/sandbox"
79  install_enable = true
80  install_images = [
81    "system",
82    "updater",
83  ]
84}
85