1package { 2 default_applicable_licenses: ["Android-Apache-2.0"], 3} 4 5rust_bindgen { 6 name: "liblibfdt_bindgen", 7 crate_name: "libfdt_bindgen", 8 defaults: ["avf_build_flags_rust"], 9 wrapper_src: "bindgen/fdt.h", 10 source_stem: "bindings", 11 bindgen_flags: [ 12 "--allowlist-type=fdt_.*", 13 "--allowlist-function=fdt_.*", 14 "--allowlist-var=FDT_.*", 15 "--use-core", 16 "--raw-line=#![no_std]", 17 "--ctypes-prefix=core::ffi", 18 ], 19 static_libs: [ 20 "libfdt", 21 ], 22 apex_available: ["com.android.virt"], 23} 24 25rust_library_rlib { 26 name: "liblibfdt", 27 crate_name: "libfdt", 28 defaults: ["avf_build_flags_rust"], 29 srcs: [ 30 "src/lib.rs", 31 ":liblibfdt_bindgen", 32 ], 33 edition: "2021", 34 no_stdlibs: true, 35 prefer_rlib: true, 36 stdlibs: [ 37 "libcore.rust_sysroot", 38 ], 39 rustlibs: [ 40 "libcstr", 41 "liblibfdt_bindgen", 42 "libmemoffset_nostd", 43 "libstatic_assertions", 44 "libzerocopy_nostd", 45 ], 46 whole_static_libs: [ 47 "libfdt", 48 ], 49 apex_available: ["com.android.virt"], 50} 51 52rust_test { 53 name: "liblibfdt.integration_test", 54 crate_name: "libfdt_test", 55 defaults: ["avf_build_flags_rust"], 56 srcs: ["tests/api_test.rs"], 57 test_suites: ["general-tests"], 58 data: [ 59 ":fdt_test_tree_one_memory_range_dtb", 60 ":fdt_test_tree_multiple_memory_ranges_dtb", 61 ":fdt_test_tree_empty_memory_range_dtb", 62 ":fdt_test_tree_no_memory_node_dtb", 63 ":fdt_test_tree_phandle_dtb", 64 ], 65 prefer_rlib: true, 66 rustlibs: [ 67 "libcstr", 68 "liblibfdt", 69 ], 70} 71 72genrule { 73 name: "fdt_test_tree_one_memory_range_dtb", 74 tools: ["dtc"], 75 srcs: [ 76 "tests/data/test_tree_one_memory_range.dts", 77 "tests/data/test_tree_no_memory_node.dts", 78 ], 79 cmd: "$(location dtc) -I dts -O dtb $(location tests/data/test_tree_one_memory_range.dts) -o $(out)", 80 out: ["data/test_tree_one_memory_range.dtb"], 81} 82 83genrule { 84 name: "fdt_test_tree_multiple_memory_ranges_dtb", 85 tools: ["dtc"], 86 srcs: [ 87 "tests/data/test_tree_multiple_memory_ranges.dts", 88 "tests/data/test_tree_no_memory_node.dts", 89 ], 90 cmd: "$(location dtc) -I dts -O dtb $(location tests/data/test_tree_multiple_memory_ranges.dts) -o $(out)", 91 out: ["data/test_tree_multiple_memory_ranges.dtb"], 92} 93 94genrule { 95 name: "fdt_test_tree_empty_memory_range_dtb", 96 tools: ["dtc"], 97 srcs: [ 98 "tests/data/test_tree_empty_memory_range.dts", 99 "tests/data/test_tree_no_memory_node.dts", 100 ], 101 cmd: "$(location dtc) -I dts -O dtb $(location tests/data/test_tree_empty_memory_range.dts) -o $(out)", 102 out: ["data/test_tree_empty_memory_range.dtb"], 103} 104 105genrule { 106 name: "fdt_test_tree_no_memory_node_dtb", 107 defaults: ["dts_to_dtb"], 108 srcs: ["tests/data/test_tree_no_memory_node.dts"], 109 out: ["data/test_tree_no_memory_node.dtb"], 110} 111 112genrule { 113 name: "fdt_test_tree_phandle_dtb", 114 defaults: ["dts_to_dtb"], 115 srcs: ["tests/data/test_tree_phandle.dts"], 116 out: ["data/test_tree_phandle.dtb"], 117} 118