diff --git a/BUILD.gn b/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..79c156f163c6637dadd34f2f3944bd661e2d9440 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,100 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. +import("//build/config/sysroot.gni") +import("//build/ohos.gni") + +config("mtd_utils_config") { + visibility = [ ":*" ] + + include_dirs = [ + ".", + "include", + "lib", + + # "//third_party/mtd-utils", + # "//third_party/mtd-utils/include", + # "//third_party/mtd-utils/lib", + ] + + deps = [] + if (use_musl) { + deps += [ + "//third_party/musl:musl_headers", + "//third_party/musl:musl_libs", + ] + include_dirs += [ "//third_party/musl/include" ] + } + + cflags = [ + "-Wall", + "-Wextra", + "-Wunused", + "-Wmissing-prototypes", + "-Wmissing-declarations", + "-Wwrite-strings", + "-Wuninitialized", + "-Winit-self", + "-Wunused-parameter", + "-Wunused-result", + "-Wunused-variable", + "-Wnull-dereference", + "-Wno-shadow", + "-Wno-sign-compare", + "-std=gnu99", + ] + if (target_cpu == "riscv64") { + cflags += [ + "-DTARGET=RISCV64", + "-march=rv64g", + ] + } + + # cflags_cc = [ + # "-std=c++11" + # ] + + ldflags = [] + + # defined at ares_config.h generated by cmake + # TODO: need check on other cpu_arch + defines = [ + "HAVE_CONFIG_H=1", + "_GNU_SOURCE", + ] +} + +ohos_source_set("mtd_utils_misc_headers") { + sources = [ + "misc-utils/lsmtd.h", + "misc-utils/mcast_image.h", + ] +} + +ohos_source_set("mtd_utils_jffs_headers") { + sources = [ + "jffsX-utils/compr.h", + "jffsX-utils/rbtree.h", + "jffsX-utils/summary.h", + ] +} + +group("mtd_utils") { + deps = [ + # "ubifs-utils:mtd_utils_ubifs", + "jffsX-utils:mtd_utils_jffs", + "misc-utils:mtd_utils_misc", + "nand-utils:mtd_utils_nand", + "nor-utils:mtd_utils_nor", + "ubi-utils:mtd_utils_ubi", + ] +} + +group("mtd_utils_tests") { + deps = [ + "tests/fs-tests:fs_tests", + "tests/jittertest:jitter_test", + "tests/mtd-tests:mtd_tests", + "tests/ubi-tests:ubi_tests", + + # "tests/unittests:unit_tests", + ] +} diff --git a/jffsX-utils/BUILD.gn b/jffsX-utils/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..8a7748a320e3d7a52570ca5ef09aae7d1ff1ead2 --- /dev/null +++ b/jffsX-utils/BUILD.gn @@ -0,0 +1,65 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("mkfs.jffs2") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/zlib:libz", + + # FIXME: missing lzo library!!!! + ] + include_dirs = [ "." ] + sources = [ + "compr.c", + "compr.h", + "compr_lzo.c", + "compr_rtime.c", + "compr_zlib.c", + "mkfs.jffs2.c", + "rbtree.c", + "rbtree.h", + ] +} + +ohos_executable("jffs2dump") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/zlib:libz", + + # FIXME: missing lzo library!!!! + ] + include_dirs = [ "." ] + sources = [ "jffs2dump.c" ] +} + +ohos_executable("jffs2reader") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/zlib:libz", + + # FIXME: missing lzo library!!!! + ] + include_dirs = [ "." ] + sources = [ "jffs2reader.c" ] +} + +ohos_executable("sumtool") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "sumtool.c" ] +} + +group("mtd_utils_jffs") { + deps = [ + # FIXME: missing lzo library!!!! + # ":mkfs.jffs2", + # ":jffs2dump", + # ":jffs2reader", + ":sumtool", + ] +} diff --git a/lib/BUILD.gn b/lib/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..b412833faee517ebd74ed418f3c21164a50bb63f --- /dev/null +++ b/lib/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_static_library("ubi") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ "libubi.c" ] +} + +ohos_static_library("missing") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ "execinfo.c" ] +} + +ohos_static_library("mtd") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ + "common.c", + "libcrc32.c", + "libfec.c", + "libmtd.c", + "libmtd_legacy.c", + ] +} + +ohos_static_library("ubigen") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ "libubigen.c" ] +} + +ohos_static_library("iniparser") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ + "dictionary.c", + "libiniparser.c", + ] +} + +ohos_static_library("scan") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ "libscan.c" ] +} diff --git a/misc-utils/BUILD.gn b/misc-utils/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..8b50a34b467c50c25ce575af7eacc3a391e7ffd4 --- /dev/null +++ b/misc-utils/BUILD.gn @@ -0,0 +1,137 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("ftl_format") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "ftl_format.c" ] +} + +ohos_executable("doc_loadbios") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "doc_loadbios.c" ] +} + +ohos_executable("ftl_check") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "ftl_check.c" ] +} + +ohos_executable("mtd_debug") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "mtd_debug.c" ] +} + +ohos_executable("docfdisk") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "docfdisk.c" ] +} + +ohos_executable("serve_image") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "serve_image.c" ] +} + +ohos_executable("recv_image") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "recv_image.c" ] +} + +ohos_executable("flash_erase") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "flash_erase.c" ] +} + +ohos_executable("flash_lock") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flash_lock.c" ] +} + +ohos_executable("flash_unlock") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flash_unlock.c" ] +} + +ohos_executable("flash_otp_info") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flash_otp_info.c" ] +} + +ohos_executable("flash_otp_dump") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flash_otp_dump.c" ] +} + +ohos_executable("flash_otp_lock") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flash_otp_lock.c" ] +} + +ohos_executable("flash_otp_write") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flash_otp_write.c" ] +} + +ohos_executable("flashcp") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "flashcp.c" ] +} + +ohos_executable("mtdpart") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "mtdpart.c" ] +} + +ohos_executable("lsmtd") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + include_dirs = [ "." ] + sources = [ + "lsmtd.c", + "lsmtd_scan.c", + ] +} + +group("mtd_utils_misc") { + deps = [ + ":doc_loadbios", + ":docfdisk", + ":flash_erase", + ":flash_lock", + ":flash_otp_dump", + ":flash_otp_info", + ":flash_otp_lock", + ":flash_otp_write", + ":flash_unlock", + ":flashcp", + ":ftl_check", + ":ftl_format", + ":lsmtd", + ":mtd_debug", + ":mtdpart", + ":recv_image", + ":serve_image", + ] +} diff --git a/nand-utils/BUILD.gn b/nand-utils/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..cbf9e551e4b89deb076f3fcd0b945a29db6ea0dd --- /dev/null +++ b/nand-utils/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("nanddump") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "nanddump.c" ] +} + +ohos_executable("nandwrite") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "nandwrite.c" ] +} + +ohos_executable("nandtest") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "nandtest.c" ] +} + +ohos_executable("nftldump") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "nftldump.c" ] +} + +ohos_executable("nftl_format") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "nftl_format.c" ] +} + +group("mtd_utils_nand") { + deps = [ + ":nanddump", + ":nandtest", + ":nandwrite", + ":nftl_format", + ":nftldump", + ] +} diff --git a/nor-utils/BUILD.gn b/nor-utils/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..b9757eff2d8f845362855e83677e2d0e6dcd9019 --- /dev/null +++ b/nor-utils/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("rfddump") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "rfddump.c" ] +} + +ohos_executable("rfdformat") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + include_dirs = [ "." ] + sources = [ "rfdformat.c" ] +} + +group("mtd_utils_nor") { + deps = [ + ":rfddump", + ":rfdformat", + ] +} diff --git a/tests/fs-tests/BUILD.gn b/tests/fs-tests/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..0f14f2a12a760e0ccb6eacf4a39ea0b15800dd4a --- /dev/null +++ b/tests/fs-tests/BUILD.gn @@ -0,0 +1,170 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_static_library("fs_tests_library") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "lib" ] + sources = [ "lib/tests.c" ] +} + +# fs-tests/integrity +ohos_executable("mtd_utils_tests_integck") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:missing", + "//third_party/mtd-utils/lib:ubi", + ] + include_dirs = [ "lib" ] + sources = [ "integrity/integck.c" ] +} + +# fs-tests/simple +ohos_executable("mtd_utils_tests_test_1") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "simple/test_1.c" ] +} + +ohos_executable("mtd_utils_tests_test_2") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "simple/test_2.c" ] +} + +ohos_executable("mtd_utils_tests_ftrunc") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "simple/ftrunc.c" ] +} + +ohos_executable("mtd_utils_tests_perf") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "simple/perf.c" ] +} + +ohos_executable("mtd_utils_tests_orph") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "simple/orph.c" ] +} + +# fs-tests/stress +ohos_executable("mtd_utils_tests_stress_1") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/stress_1.c" ] +} + +ohos_executable("mtd_utils_tests_stress_2") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/stress_2.c" ] +} + +ohos_executable("mtd_utils_tests_stress_3") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/stress_3.c" ] +} + +ohos_executable("mtd_utils_tests_pdfrun") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/pdfrun.c" ] +} + +ohos_executable("mtd_utils_tests_gcd_hupper") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/gcd_hupper.c" ] +} + +ohos_executable("mtd_utils_tests_rndwrite00") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/rndwrite00.c" ] +} + +ohos_executable("mtd_utils_tests_fwrite00") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/fwrite00.c" ] +} + +ohos_executable("mtd_utils_tests_rmdir00") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/rmdir00.c" ] +} + +ohos_executable("mtd_utils_tests_rndrm00") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/rndrm00.c" ] +} + +ohos_executable("mtd_utils_tests_rndrm99") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ ":fs_tests_library" ] + include_dirs = [ "lib" ] + sources = [ "stress/atoms/rndrm99.c" ] +} + +# fs-tests/utils +ohos_executable("mtd_utils_tests_fstest_monitor") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "lib" ] + sources = [ "utils/fstest_monitor.c" ] +} + +ohos_executable("mtd_utils_tests_free_space") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "lib" ] + sources = [ "utils/free_space.c" ] +} + +group("fs_tests") { + deps = [ + # fs-tests/integrity + ":mtd_utils_tests_free_space", + + # fs-tests/utils + ":mtd_utils_tests_fstest_monitor", + ":mtd_utils_tests_ftrunc", + ":mtd_utils_tests_fwrite00", + ":mtd_utils_tests_gcd_hupper", + ":mtd_utils_tests_integck", + ":mtd_utils_tests_orph", + ":mtd_utils_tests_pdfrun", + ":mtd_utils_tests_perf", + ":mtd_utils_tests_rmdir00", + ":mtd_utils_tests_rndrm00", + ":mtd_utils_tests_rndrm99", + ":mtd_utils_tests_rndwrite00", + + # fs-tests/stress + ":mtd_utils_tests_stress_1", + ":mtd_utils_tests_stress_2", + ":mtd_utils_tests_stress_3", + + # fs-tests/simple + ":mtd_utils_tests_test_1", + ":mtd_utils_tests_test_2", + ] +} diff --git a/tests/jittertest/BUILD.gn b/tests/jittertest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..f5c3b1b57ff79bd70a8c6369fd820248c087410e --- /dev/null +++ b/tests/jittertest/BUILD.gn @@ -0,0 +1,20 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("mtd_utils_tests_JitterTest") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ "JitterTest.c" ] +} + +ohos_executable("mtd_utils_tests_plotJittervsFill") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + sources = [ "plotJittervsFill.c" ] +} + +group("jitter_test") { + deps = [ + ":mtd_utils_tests_JitterTest", + ":mtd_utils_tests_plotJittervsFill", + ] +} diff --git a/tests/mtd-tests/BUILD.gn b/tests/mtd-tests/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..10c702848d5ec5655d9b1087d2d81ef0fb2d5bac --- /dev/null +++ b/tests/mtd-tests/BUILD.gn @@ -0,0 +1,57 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("mtd_utils_tests_flash_torture") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "flash_torture.c" ] +} + +ohos_executable("mtd_utils_tests_flash_stress") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "flash_stress.c" ] +} + +ohos_executable("mtd_utils_tests_flash_speed") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "flash_speed.c" ] +} + +ohos_executable("mtd_utils_tests_nandbiterrs") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "nandbiterrs.c" ] +} + +ohos_executable("mtd_utils_tests_flash_readtest") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "flash_readtest.c" ] +} + +ohos_executable("mtd_utils_tests_nandpagetest") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "nandpagetest.c" ] +} + +ohos_executable("mtd_utils_tests_nandsubpagetest") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ "//third_party/mtd-utils/lib:mtd" ] + sources = [ "nandsubpagetest.c" ] +} + +group("mtd_tests") { + deps = [ + ":mtd_utils_tests_flash_readtest", + ":mtd_utils_tests_flash_speed", + ":mtd_utils_tests_flash_stress", + ":mtd_utils_tests_flash_torture", + ":mtd_utils_tests_nandbiterrs", + ":mtd_utils_tests_nandpagetest", + ":mtd_utils_tests_nandsubpagetest", + ] +} diff --git a/tests/ubi-tests/BUILD.gn b/tests/ubi-tests/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..fa66a0cc941c7997dc4d03ce0e0cc3b4176461cf --- /dev/null +++ b/tests/ubi-tests/BUILD.gn @@ -0,0 +1,156 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_static_library("ubi_tests_library") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ "." ] + sources = [ "helpers.c" ] +} + +ohos_executable("mtd_utils_tests_io_basic") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "io_basic.c" ] +} + +ohos_executable("mtd_utils_tests_io_update") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "io_update.c" ] +} + +ohos_executable("mtd_utils_tests_io_paral") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + cflags = [ "-pthread" ] + sources = [ "io_paral.c" ] +} + +ohos_executable("mtd_utils_tests_io_read") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "io_read.c" ] +} + +ohos_executable("mtd_utils_tests_volrefcnt") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "volrefcnt.c" ] +} + +ohos_executable("mtd_utils_tests_integ") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "integ.c" ] +} + +ohos_executable("mtd_utils_tests_mkvol_basic") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "mkvol_basic.c" ] +} + +ohos_executable("mtd_utils_tests_mkvol_bad") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "mkvol_bad.c" ] +} + +ohos_executable("mtd_utils_tests_mkvol_paral") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + cflags = [ "-pthread" ] + sources = [ "mkvol_paral.c" ] +} + +ohos_executable("mtd_utils_tests_mkvol_rsvol") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + include_dirs = [ + ".", + "../../ubi-utils", + ] + deps = [ + ":ubi_tests_library", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "rsvol.c" ] +} + +group("ubi_tests") { + deps = [ + ":mtd_utils_tests_integ", + ":mtd_utils_tests_io_basic", + ":mtd_utils_tests_io_paral", + ":mtd_utils_tests_io_read", + ":mtd_utils_tests_io_update", + ":mtd_utils_tests_mkvol_bad", + ":mtd_utils_tests_mkvol_basic", + ":mtd_utils_tests_mkvol_paral", + ":mtd_utils_tests_mkvol_rsvol", + ":mtd_utils_tests_volrefcnt", + ] +} diff --git a/ubi-utils/BUILD.gn b/ubi-utils/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..bb600ae9f9b5dc02c9a8a12bb3a9998b4faa43bc --- /dev/null +++ b/ubi-utils/BUILD.gn @@ -0,0 +1,143 @@ +# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. + +import("//build/ohos.gni") + +ohos_executable("ubiupdatevol") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubiupdatevol.c" ] +} + +ohos_executable("ubimkvol") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubimkvol.c" ] +} + +ohos_executable("ubirmvol") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubirmvol.c" ] +} + +ohos_executable("ubicrc32") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubicrc32.c" ] +} + +ohos_executable("ubinfo") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubinfo.c" ] +} + +ohos_executable("ubiattach") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubiattach.c" ] +} + +ohos_executable("ubidetach") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubidetach.c" ] +} + +ohos_executable("ubinize") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:iniparser", + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + "//third_party/mtd-utils/lib:ubigen", + ] + sources = [ "ubinize.c" ] +} + +ohos_executable("ubiformat") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:scan", + "//third_party/mtd-utils/lib:ubi", + "//third_party/mtd-utils/lib:ubigen", + ] + sources = [ "ubiformat.c" ] +} + +ohos_executable("ubirename") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubirename.c" ] +} + +ohos_executable("mtdinfo") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + "//third_party/mtd-utils/lib:ubigen", + ] + sources = [ "mtdinfo.c" ] +} + +ohos_executable("ubirsvol") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubirsvol.c" ] +} + +ohos_executable("ubiblock") { + configs = [ "//third_party/mtd-utils:mtd_utils_config" ] + deps = [ + "//third_party/mtd-utils/lib:mtd", + "//third_party/mtd-utils/lib:ubi", + ] + sources = [ "ubiblock.c" ] +} + +group("mtd_utils_ubi") { + deps = [ + ":mtdinfo", + ":ubiattach", + ":ubiblock", + ":ubicrc32", + ":ubidetach", + ":ubiformat", + ":ubimkvol", + ":ubinfo", + ":ubinize", + ":ubirename", + ":ubirmvol", + ":ubirsvol", + ":ubiupdatevol", + ] +}