• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
2# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without modification,
5# are permitted provided that the following conditions are met:
6#
7# 1. Redistributions of source code must retain the above copyright notice, this list of
8#    conditions and the following disclaimer.
9#
10# 2. Redistributions in binary form must reproduce the above copyright notice, this list
11#    of conditions and the following disclaimer in the documentation and/or other materials
12#    provided with the distribution.
13#
14# 3. Neither the name of the copyright holder nor the names of its contributors may be used
15#    to endorse or promote products derived from this software without specific prior written
16#    permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30import("//kernel/liteos_a/liteos.gni")
31
32module_switch = defined(LOSCFG_FS_JFFS)
33module_name = get_path_info(rebase_path("."), "name")
34linux_path = rebase_path("$KERNEL_LINUX_DIR")
35out_path = rebase_path(target_out_dir)
36
37kernel_module(module_name) {
38  patch_path = rebase_path(".")
39  cmd = "if [ -d ${out_path}/jffs2_build ]; then rm -r ${out_path}/jffs2_build; fi && mkdir -p ${out_path}/jffs2_build/fs"
40  cmd += " && cp ${linux_path}/fs/jffs2 ${out_path}/jffs2_build/fs/. -r"
41  cmd += " && pushd ${out_path}/jffs2_build/"
42  cmd += " && patch -p1 < ${patch_path}/jffs2.patch && popd"
43  exec_script("//build/lite/run_shell_cmd.py", [ cmd ])
44
45  sources = [
46    "src/jffs2_hash.c",
47    "src/vfs_jffs2.c",
48  ]
49
50  sources += [
51    "${out_path}/jffs2_build/fs/jffs2/background.c",
52    "${out_path}/jffs2_build/fs/jffs2/build.c",
53    "${out_path}/jffs2_build/fs/jffs2/compr.c",
54    "${out_path}/jffs2_build/fs/jffs2/compr_rtime.c",
55    "${out_path}/jffs2_build/fs/jffs2/compr_rubin.c",
56    "${out_path}/jffs2_build/fs/jffs2/compr_zlib.c",
57    "${out_path}/jffs2_build/fs/jffs2/debug.c",
58    "${out_path}/jffs2_build/fs/jffs2/dir.c",
59    "${out_path}/jffs2_build/fs/jffs2/erase.c",
60    "${out_path}/jffs2_build/fs/jffs2/file.c",
61    "${out_path}/jffs2_build/fs/jffs2/fs.c",
62    "${out_path}/jffs2_build/fs/jffs2/gc.c",
63    "${out_path}/jffs2_build/fs/jffs2/malloc.c",
64    "${out_path}/jffs2_build/fs/jffs2/nodelist.c",
65    "${out_path}/jffs2_build/fs/jffs2/nodemgmt.c",
66    "${out_path}/jffs2_build/fs/jffs2/read.c",
67    "${out_path}/jffs2_build/fs/jffs2/readinode.c",
68    "${out_path}/jffs2_build/fs/jffs2/scan.c",
69    "${out_path}/jffs2_build/fs/jffs2/summary.c",
70    "${out_path}/jffs2_build/fs/jffs2/super.c",
71    "${out_path}/jffs2_build/fs/jffs2/write.c",
72    "${out_path}/jffs2_build/fs/jffs2/writev.c",
73  ]
74
75  include_dirs = [
76    "${out_path}/jffs2_build/fs",
77    "${out_path}/jffs2_build/fs/jffs2",
78  ]
79
80  public_configs = [ ":public" ]
81
82  deps = [ ":cp_jffs2_src" ]
83}
84
85config("public") {
86  include_dirs = [ "include" ]
87}
88
89action("cp_jffs2_src") {
90  script = "//build/lite/run_shell_cmd.py"
91
92  outputs = [
93    "${target_out_dir}/jffs2_build/fs/jffs2/background.c",
94    "${target_out_dir}/jffs2_build/fs/jffs2/build.c",
95    "${target_out_dir}/jffs2_build/fs/jffs2/compr.c",
96    "${target_out_dir}/jffs2_build/fs/jffs2/compr_rtime.c",
97    "${target_out_dir}/jffs2_build/fs/jffs2/compr_rubin.c",
98    "${target_out_dir}/jffs2_build/fs/jffs2/compr_zlib.c",
99    "${target_out_dir}/jffs2_build/fs/jffs2/debug.c",
100    "${target_out_dir}/jffs2_build/fs/jffs2/dir.c",
101    "${target_out_dir}/jffs2_build/fs/jffs2/erase.c",
102    "${target_out_dir}/jffs2_build/fs/jffs2/file.c",
103    "${target_out_dir}/jffs2_build/fs/jffs2/fs.c",
104    "${target_out_dir}/jffs2_build/fs/jffs2/gc.c",
105    "${target_out_dir}/jffs2_build/fs/jffs2/malloc.c",
106    "${target_out_dir}/jffs2_build/fs/jffs2/nodelist.c",
107    "${target_out_dir}/jffs2_build/fs/jffs2/nodemgmt.c",
108    "${target_out_dir}/jffs2_build/fs/jffs2/read.c",
109    "${target_out_dir}/jffs2_build/fs/jffs2/readinode.c",
110    "${target_out_dir}/jffs2_build/fs/jffs2/scan.c",
111    "${target_out_dir}/jffs2_build/fs/jffs2/summary.c",
112    "${target_out_dir}/jffs2_build/fs/jffs2/super.c",
113    "${target_out_dir}/jffs2_build/fs/jffs2/write.c",
114    "${target_out_dir}/jffs2_build/fs/jffs2/writev.c",
115  ]
116}
117