1# Copyright (c) 2024-2024 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
14if (defined(ohos_lite)) {
15  executable("remount") {
16    sources = [ "//base/startup/init/remount/remount.c" ]
17    defines = [ "_GNU_SOURCE" ]
18    if (ohos_kernel_type == "linux") {
19      defines += [ "LINUX_REMOUNT" ]
20    }
21  }
22} else {
23  import("//base/startup/init/begetd.gni")
24  import("//build/ohos.gni")
25  ohos_executable("remount") {
26    sources = [ "remount.c" ]
27
28    defines = [ "_GNU_SOURCE" ]
29    install_enable = true
30    part_name = "init"
31    subsystem_name = "startup"
32
33    if (init_startup_feature_erofs_overlay) {
34      sources += [
35        "//base/startup/init/services/log/init_commlog.c",
36        "remount_overlay.c",
37      ]
38
39      include_dirs = [ "//base/startup/init/remount/include" ]
40
41      deps = [
42        "//base/startup/init/interfaces/innerkits/fs_manager:libfsmanager_static",
43        "//base/startup/init/services/log:init_log",
44      ]
45
46      external_deps = [ "bounds_checking_function:libsec_shared" ]
47      defines += [ "EROFS_OVERLAY" ]
48    }
49  }
50}
51
52group("overlayremount") {
53  if (defined(ohos_lite)) {
54    if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
55      deps = [ ":remount" ]
56    } else {
57      deps = []
58    }
59  } else {
60    deps = [ ":remount" ]
61  }
62}
63