1// Copyright 2019 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 default_applicable_licenses: ["Android-Apache-2.0"], 17} 18 19prebuilt_etc { 20 name: "init.boringssl.zygote64_32.rc", 21 src: "init.boringssl.zygote64_32.rc", 22 sub_dir: "init/hw", 23 symlinks: [ 24 "init.boringssl.zygote32.rc", 25 "init.boringssl.no_zygote.rc", 26 ], 27} 28 29prebuilt_etc { 30 name: "init.boringssl.zygote64.rc", 31 src: "init.boringssl.zygote64.rc", 32 sub_dir: "init/hw", 33} 34 35prebuilt_etc { 36 name: "init.rc", 37 src: "init.rc", 38 sub_dir: "init/hw", 39 required: [ 40 "platform-bootclasspath", 41 "init.boringssl.zygote64.rc", 42 "init.boringssl.zygote64_32.rc", 43 ], 44} 45 46prebuilt_etc { 47 name: "ueventd.rc", 48 src: "ueventd.rc", 49} 50 51prebuilt_etc { 52 name: "ueventd.rc.recovery", 53 src: "ueventd.rc", 54 recovery: true, 55 filename: "ueventd.rc", 56} 57 58filegroup { 59 name: "system_linker_config_json_file", 60 srcs: ["etc/linker.config.json"], 61} 62 63// TODO(b/185211376) Scope the native APIs that microdroid will provide to the app payload 64prebuilt_etc { 65 name: "public.libraries.android.txt", 66 src: "etc/public.libraries.android.txt", 67 filename: "public.libraries.txt", 68 no_full_install: true, 69} 70 71// adb_debug.prop in debug ramdisk 72prebuilt_root { 73 name: "adb_debug.prop", 74 src: "adb_debug.prop", 75 debug_ramdisk: true, 76} 77 78prebuilt_etc { 79 name: "init.zygote64.rc", 80 src: "init.zygote64.rc", 81 sub_dir: "init/hw", 82} 83 84prebuilt_etc { 85 name: "init.zygote32.rc", 86 src: "init.zygote32.rc", 87 sub_dir: "init/hw", 88} 89 90prebuilt_etc { 91 name: "init.zygote64_32.rc", 92 src: "init.zygote64_32.rc", 93 sub_dir: "init/hw", 94} 95 96prebuilt_etc { 97 name: "init.usb.rc", 98 src: "init.usb.rc", 99 sub_dir: "init/hw", 100} 101 102prebuilt_etc { 103 name: "init.usb.configfs.rc", 104 src: "init.usb.configfs.rc", 105 sub_dir: "init/hw", 106} 107 108prebuilt_etc { 109 name: "etc_hosts", 110 src: "etc/hosts", 111 filename: "hosts", 112} 113 114prebuilt_etc { 115 name: "init-debug.rc", 116 src: "init-debug.rc", 117 sub_dir: "init", 118} 119 120prebuilt_etc { 121 name: "init-mmd-prop.rc", 122 src: "init-mmd-prop.rc", 123 sub_dir: "init", 124} 125 126prebuilt_etc { 127 name: "asan.options", 128 src: "asan.options", 129} 130 131sh_binary { 132 name: "asan_extract", 133 src: "asan_extract.sh", 134 init_rc: ["asan_extract.rc"], 135 // We need bzip2 on device for extraction. 136 required: ["bzip2"], 137} 138 139llndk_libraries_txt { 140 name: "llndk.libraries.txt", 141} 142 143sanitizer_libraries_txt { 144 name: "sanitizer.libraries.txt", 145} 146 147EXPORT_GLOBAL_ASAN_OPTIONS = select(soong_config_variable("ANDROID", "ASAN_ENABLED"), { 148 true: "export ASAN_OPTIONS include=/system/asan.options", 149 default: "", 150}) 151 152EXPORT_GLOBAL_HWASAN_OPTIONS = select(soong_config_variable("ANDROID", "HWASAN_ENABLED"), { 153 true: "export HWASAN_OPTIONS heap_history_size=1023,stack_history_size=512,export_memory_stats=0,max_malloc_fill_size=131072,malloc_fill_byte=0", 154 default: "", 155}) 156 157EXPORT_GLOBAL_GCOV_OPTIONS = select(soong_config_variable("ANDROID", "GCOV_COVERAGE"), { 158 true: "export GCOV_PREFIX /data/misc/trace", 159 default: "", 160}) 161 162EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS = select((soong_config_variable("ANDROID", "CLANG_COVERAGE"), soong_config_variable("ANDROID", "CLANG_COVERAGE_CONTINUOUS_MODE")), { 163 (true, true): "export LLVM_PROFILE_FILE /data/misc/trace/clang%c-%20m.profraw", 164 (true, default): "export LLVM_PROFILE_FILE /data/misc/trace/clang-%20m.profraw", 165 (default, default): "", 166}) 167 168EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE = select(soong_config_variable("ANDROID", "SCUDO_ALLOCATION_RING_BUFFER_SIZE"), { 169 "": "", 170 any @ size: "export SCUDO_ALLOCATION_RING_BUFFER_SIZE " + size, 171 default: "", 172}) 173 174genrule { 175 name: "init.environ.rc.gen", 176 srcs: ["init.environ.rc.in"], 177 out: ["init.environ.rc"], 178 cmd: "cp -f $(in) $(out) && " + 179 "echo ' " + EXPORT_GLOBAL_ASAN_OPTIONS + "' >> $(out) && " + 180 "echo ' " + EXPORT_GLOBAL_GCOV_OPTIONS + "' >> $(out) && " + 181 "echo ' " + EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS + "' >> $(out) && " + 182 "echo ' " + EXPORT_GLOBAL_HWASAN_OPTIONS + "' >> $(out) && " + 183 "echo ' " + EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE + "' >> $(out)", 184} 185 186prebuilt_root { 187 name: "init.environ.rc-soong", 188 src: ":init.environ.rc.gen", 189 filename: "init.environ.rc", 190 install_in_root: true, 191 no_full_install: true, 192 required: select((soong_config_variable("ANDROID", "ASAN_ENABLED"), soong_config_variable("ANDROID", "SANITIZE_TARGET_SYSTEM_ENABLED")), { 193 (true, true): [ 194 "asan.options", 195 "asan_extract", 196 ], 197 (true, default): ["asan.options"], 198 (default, default): [], 199 }), 200} 201 202filegroup { 203 name: "ramdisk_node_list", 204 srcs: ["ramdisk_node_list"], 205 export_to_make_var: "RAMDISK_NODE_LIST", 206} 207