Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 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 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 15 | package etc |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 16 | |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 17 | // This file implements module types that install prebuilt artifacts. |
| 18 | // |
| 19 | // There exist two classes of prebuilt modules in the Android tree. The first class are the ones |
| 20 | // based on `android.Prebuilt`, such as `cc_prebuilt_library` and `java_import`. This kind of |
| 21 | // modules may exist both as prebuilts and source at the same time, though only one would be |
| 22 | // installed and the other would be marked disabled. The `prebuilt_postdeps` mutator would select |
| 23 | // the actual modules to be installed. More details in android/prebuilt.go. |
| 24 | // |
| 25 | // The second class is described in this file. Unlike `android.Prebuilt` based module types, |
| 26 | // `prebuilt_etc` exist only as prebuilts and cannot have a same-named source module counterpart. |
| 27 | // This makes the logic of `prebuilt_etc` to be much simpler as they don't need to go through the |
| 28 | // various `prebuilt_*` mutators. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 29 | |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 30 | import ( |
Jiyong Park | 76a42f5 | 2021-02-16 06:50:37 +0900 | [diff] [blame] | 31 | "fmt" |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 32 | "path/filepath" |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 33 | "strings" |
Jiyong Park | 76a42f5 | 2021-02-16 06:50:37 +0900 | [diff] [blame] | 34 | |
Yu Liu | 0a37d42 | 2025-02-13 02:05:00 +0000 | [diff] [blame] | 35 | "github.com/google/blueprint" |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 36 | "github.com/google/blueprint/proptools" |
| 37 | |
| 38 | "android/soong/android" |
| 39 | ) |
| 40 | |
| 41 | var pctx = android.NewPackageContext("android/soong/etc") |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 42 | |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 43 | // TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file. |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 44 | |
| 45 | func init() { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 46 | pctx.Import("android/soong/android") |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 47 | RegisterPrebuiltEtcBuildComponents(android.InitRegistrationContext) |
| 48 | } |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 49 | |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 50 | func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) { |
| 51 | ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory) |
| 52 | ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 53 | ctx.RegisterModuleType("prebuilt_etc_cacerts", PrebuiltEtcCaCertsFactory) |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 54 | ctx.RegisterModuleType("prebuilt_avb", PrebuiltAvbFactory) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 55 | ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory) |
Liz Kammer | e9ecddc | 2022-01-04 17:27:52 -0500 | [diff] [blame] | 56 | ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 57 | ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) |
| 58 | ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) |
yangbill | 63c5e19 | 2024-03-27 09:02:12 +0000 | [diff] [blame] | 59 | ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory) |
yangbill | 85527e6 | 2024-04-30 08:24:50 +0000 | [diff] [blame] | 60 | ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory) |
| 61 | ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory) |
| 62 | ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 63 | ctx.RegisterModuleType("prebuilt_usr_srec", PrebuiltUserSrecFactory) |
Agi Sferro | 243c7d7 | 2025-02-24 15:45:53 -0800 | [diff] [blame] | 64 | ctx.RegisterModuleType("prebuilt_usr_odml", PrebuiltUserOdmlFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 65 | ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) |
Kevin | 93f7cd8 | 2024-05-02 12:37:59 +0200 | [diff] [blame] | 66 | ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 67 | ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) |
Luca Stefani | 04812eb | 2025-03-09 12:41:06 +0100 | [diff] [blame] | 68 | ctx.RegisterModuleType("prebuilt_gpu", PrebuiltGPUFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 69 | ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 70 | ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 71 | ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 72 | ctx.RegisterModuleType("prebuilt_media", PrebuiltMediaFactory) |
Jihoon Kang | ec62d84 | 2024-10-25 20:27:18 +0000 | [diff] [blame] | 73 | ctx.RegisterModuleType("prebuilt_voicepack", PrebuiltVoicepackFactory) |
| 74 | ctx.RegisterModuleType("prebuilt_bin", PrebuiltBinaryFactory) |
| 75 | ctx.RegisterModuleType("prebuilt_wallpaper", PrebuiltWallpaperFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 76 | ctx.RegisterModuleType("prebuilt_priv_app", PrebuiltPrivAppFactory) |
Michael Bestas | 137fab4 | 2025-03-08 20:44:34 +0200 | [diff] [blame] | 77 | ctx.RegisterModuleType("prebuilt_radio", PrebuiltRadioFactory) |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 78 | ctx.RegisterModuleType("prebuilt_rfs", PrebuiltRfsFactory) |
| 79 | ctx.RegisterModuleType("prebuilt_framework", PrebuiltFrameworkFactory) |
| 80 | ctx.RegisterModuleType("prebuilt_res", PrebuiltResFactory) |
| 81 | ctx.RegisterModuleType("prebuilt_wlc_upt", PrebuiltWlcUptFactory) |
| 82 | ctx.RegisterModuleType("prebuilt_odm", PrebuiltOdmFactory) |
Jihoon Kang | 2e2b744 | 2024-11-05 00:26:20 +0000 | [diff] [blame] | 83 | ctx.RegisterModuleType("prebuilt_vendor_dlkm", PrebuiltVendorDlkmFactory) |
| 84 | ctx.RegisterModuleType("prebuilt_bt_firmware", PrebuiltBtFirmwareFactory) |
Jihoon Kang | dca2f2b | 2024-11-06 18:43:19 +0000 | [diff] [blame] | 85 | ctx.RegisterModuleType("prebuilt_tvservice", PrebuiltTvServiceFactory) |
| 86 | ctx.RegisterModuleType("prebuilt_optee", PrebuiltOpteeFactory) |
Jihoon Kang | ecf76dd | 2024-11-12 05:24:46 +0000 | [diff] [blame] | 87 | ctx.RegisterModuleType("prebuilt_tvconfig", PrebuiltTvConfigFactory) |
Jihoon Kang | 3ca07a1 | 2024-12-02 19:14:30 +0000 | [diff] [blame] | 88 | ctx.RegisterModuleType("prebuilt_vendor", PrebuiltVendorFactory) |
Jihoon Kang | 320ca7c | 2024-12-03 18:14:50 +0000 | [diff] [blame] | 89 | ctx.RegisterModuleType("prebuilt_sbin", PrebuiltSbinFactory) |
| 90 | ctx.RegisterModuleType("prebuilt_system", PrebuiltSystemFactory) |
| 91 | ctx.RegisterModuleType("prebuilt_first_stage_ramdisk", PrebuiltFirstStageRamdiskFactory) |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 92 | |
| 93 | ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory) |
Rupert Shuttleworth | 378fc1b | 2021-07-28 08:03:16 -0400 | [diff] [blame] | 94 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 95 | } |
| 96 | |
Yu Liu | 0a37d42 | 2025-02-13 02:05:00 +0000 | [diff] [blame] | 97 | type PrebuiltEtcInfo struct { |
| 98 | // Returns the base install directory, such as "etc", "usr/share". |
| 99 | BaseDir string |
| 100 | // Returns the sub install directory relative to BaseDir(). |
| 101 | SubDir string |
| 102 | } |
| 103 | |
| 104 | var PrebuiltEtcInfoProvider = blueprint.NewProvider[PrebuiltEtcInfo]() |
| 105 | |
Paul Duffin | 1172fed | 2021-03-08 11:28:18 +0000 | [diff] [blame] | 106 | var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents) |
| 107 | |
Jihoon Kang | 69725b3 | 2024-11-12 03:08:49 +0000 | [diff] [blame] | 108 | type PrebuiltEtcProperties struct { |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 109 | // Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax. |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 110 | // Mutually exclusive with srcs. |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 111 | Src proptools.Configurable[string] `android:"path,arch_variant,replace_instead_of_append"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 112 | |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 113 | // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax. |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 114 | // Mutually exclusive with src. When used, filename_from_src is set to true unless dsts is also |
| 115 | // set. May use globs in filenames. |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 116 | Srcs proptools.Configurable[[]string] `android:"path,arch_variant"` |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 117 | |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 118 | // Destination files of this prebuilt. Requires srcs to be used and causes srcs not to implicitly |
| 119 | // set filename_from_src. This can be used to install each source file to a different directory |
| 120 | // and/or change filenames when files are installed. Must be exactly one entry per source file, |
| 121 | // which means care must be taken if srcs has globs. |
| 122 | Dsts proptools.Configurable[[]string] `android:"path,arch_variant"` |
| 123 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 124 | // Optional name for the installed file. If unspecified, name of the module is used as the file |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 125 | // name. Only available when using a single source (src). |
Jiyong Park | 139a2e6 | 2018-10-26 21:49:39 +0900 | [diff] [blame] | 126 | Filename *string `android:"arch_variant"` |
| 127 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 128 | // When set to true, and filename property is not set, the name for the installed file |
Jiyong Park | 1a7cf08 | 2018-11-13 11:59:12 +0900 | [diff] [blame] | 129 | // is the same as the file name of the source file. |
| 130 | Filename_from_src *bool `android:"arch_variant"` |
| 131 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 132 | // Make this module available when building for ramdisk. |
Yifan Hong | 39143a9 | 2020-10-26 12:43:12 -0700 | [diff] [blame] | 133 | // On device without a dedicated recovery partition, the module is only |
| 134 | // available after switching root into |
| 135 | // /first_stage_ramdisk. To expose the module before switching root, install |
| 136 | // the recovery variant instead. |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 137 | Ramdisk_available *bool |
| 138 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 139 | // Make this module available when building for vendor ramdisk. |
Yifan Hong | 39143a9 | 2020-10-26 12:43:12 -0700 | [diff] [blame] | 140 | // On device without a dedicated recovery partition, the module is only |
| 141 | // available after switching root into |
| 142 | // /first_stage_ramdisk. To expose the module before switching root, install |
| 143 | // the recovery variant instead. |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 144 | Vendor_ramdisk_available *bool |
| 145 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 146 | // Make this module available when building for debug ramdisk. |
| 147 | Debug_ramdisk_available *bool |
| 148 | |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 149 | // Make this module available when building for recovery. |
| 150 | Recovery_available *bool |
| 151 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 152 | // Whether this module is directly installable to one of the partitions. Default: true. |
| 153 | Installable *bool |
Yo Chiang | 3d64d49 | 2020-05-27 17:56:39 +0800 | [diff] [blame] | 154 | |
| 155 | // Install symlinks to the installed file. |
| 156 | Symlinks []string `android:"arch_variant"` |
Wei Li | 5958625 | 2024-11-04 09:25:54 -0800 | [diff] [blame] | 157 | |
Wei Li | 5958625 | 2024-11-04 09:25:54 -0800 | [diff] [blame] | 158 | // Install to partition oem when set to true. |
| 159 | Oem_specific *bool `android:"arch_variant"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 160 | } |
| 161 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 162 | type prebuiltSubdirProperties struct { |
| 163 | // Optional subdirectory under which this file is installed into, cannot be specified with |
| 164 | // relative_install_path, prefer relative_install_path. |
| 165 | Sub_dir *string `android:"arch_variant"` |
| 166 | |
| 167 | // Optional subdirectory under which this file is installed into, cannot be specified with |
| 168 | // sub_dir. |
| 169 | Relative_install_path *string `android:"arch_variant"` |
| 170 | } |
| 171 | |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 172 | type prebuiltRootProperties struct { |
| 173 | // Install this module to the root directory, without partition subdirs. When this module is |
| 174 | // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will |
| 175 | // then be copied to the root of system.img. When this module is packaged by other modules like |
| 176 | // android_filesystem, this module will be installed to the root ("/"), unlike normal |
| 177 | // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/"). |
| 178 | Install_in_root *bool |
| 179 | } |
| 180 | |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 181 | type PrebuiltEtcModule interface { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 182 | android.Module |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 183 | |
| 184 | // Returns the base install directory, such as "etc", "usr/share". |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 185 | BaseDir() string |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 186 | |
| 187 | // Returns the sub install directory relative to BaseDir(). |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 188 | SubDir() string |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 189 | } |
| 190 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 191 | type PrebuiltEtc struct { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 192 | android.ModuleBase |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 193 | android.DefaultableModuleBase |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 194 | |
Jihoon Kang | 69725b3 | 2024-11-12 03:08:49 +0000 | [diff] [blame] | 195 | properties PrebuiltEtcProperties |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 196 | |
| 197 | // rootProperties is used to return the value of the InstallInRoot() method. Currently, only |
| 198 | // prebuilt_avb and prebuilt_root modules use this. |
| 199 | rootProperties prebuiltRootProperties |
| 200 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 201 | subdirProperties prebuiltSubdirProperties |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 202 | |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 203 | sourceFilePaths android.Paths |
Cole Faust | 4e9f592 | 2024-11-13 16:09:23 -0800 | [diff] [blame] | 204 | outputFilePaths android.WritablePaths |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 205 | // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 206 | installDirBase string |
| 207 | installDirBase64 string |
| 208 | installAvoidMultilibConflict bool |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 209 | // The base install location when soc_specific property is set to true, e.g. "firmware" for |
| 210 | // prebuilt_firmware. |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 211 | socInstallDirBase string |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 212 | installDirPaths []android.InstallPath |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 213 | additionalDependencies *android.Paths |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 214 | |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 215 | usedSrcsProperty bool |
| 216 | |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 217 | makeClass string |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 218 | } |
| 219 | |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 220 | type Defaults struct { |
| 221 | android.ModuleBase |
| 222 | android.DefaultsModuleBase |
| 223 | } |
| 224 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 225 | func (p *PrebuiltEtc) inRamdisk() bool { |
| 226 | return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() |
| 227 | } |
| 228 | |
| 229 | func (p *PrebuiltEtc) onlyInRamdisk() bool { |
| 230 | return p.ModuleBase.InstallInRamdisk() |
| 231 | } |
| 232 | |
| 233 | func (p *PrebuiltEtc) InstallInRamdisk() bool { |
| 234 | return p.inRamdisk() |
| 235 | } |
| 236 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 237 | func (p *PrebuiltEtc) inVendorRamdisk() bool { |
| 238 | return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk() |
| 239 | } |
| 240 | |
| 241 | func (p *PrebuiltEtc) onlyInVendorRamdisk() bool { |
| 242 | return p.ModuleBase.InstallInVendorRamdisk() |
| 243 | } |
| 244 | |
| 245 | func (p *PrebuiltEtc) InstallInVendorRamdisk() bool { |
| 246 | return p.inVendorRamdisk() |
| 247 | } |
| 248 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 249 | func (p *PrebuiltEtc) inDebugRamdisk() bool { |
| 250 | return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk() |
| 251 | } |
| 252 | |
| 253 | func (p *PrebuiltEtc) onlyInDebugRamdisk() bool { |
| 254 | return p.ModuleBase.InstallInDebugRamdisk() |
| 255 | } |
| 256 | |
| 257 | func (p *PrebuiltEtc) InstallInDebugRamdisk() bool { |
| 258 | return p.inDebugRamdisk() |
| 259 | } |
| 260 | |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 261 | func (p *PrebuiltEtc) InRecovery() bool { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 262 | return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | func (p *PrebuiltEtc) onlyInRecovery() bool { |
| 266 | return p.ModuleBase.InstallInRecovery() |
| 267 | } |
| 268 | |
| 269 | func (p *PrebuiltEtc) InstallInRecovery() bool { |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 270 | return p.InRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 273 | var _ android.ImageInterface = (*PrebuiltEtc)(nil) |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 274 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 275 | func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.ImageInterfaceContext) {} |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 276 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 277 | func (p *PrebuiltEtc) VendorVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jihoon Kang | 47e9184 | 2024-06-19 00:51:16 +0000 | [diff] [blame] | 278 | return false |
| 279 | } |
| 280 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 281 | func (p *PrebuiltEtc) ProductVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jihoon Kang | 47e9184 | 2024-06-19 00:51:16 +0000 | [diff] [blame] | 282 | return false |
| 283 | } |
| 284 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 285 | func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 286 | return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() && |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 287 | !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk() |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 288 | } |
| 289 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 290 | func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 291 | return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 292 | } |
| 293 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 294 | func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 295 | return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk() |
| 296 | } |
| 297 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 298 | func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 299 | return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk() |
| 300 | } |
| 301 | |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 302 | func (p *PrebuiltEtc) InstallInRoot() bool { |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 303 | return proptools.Bool(p.rootProperties.Install_in_root) |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 304 | } |
| 305 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 306 | func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.ImageInterfaceContext) bool { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 307 | return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 308 | } |
| 309 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 310 | func (p *PrebuiltEtc) ExtraImageVariations(ctx android.ImageInterfaceContext) []string { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 311 | return nil |
| 312 | } |
| 313 | |
Cole Faust | fa6e0fd | 2024-10-15 15:22:57 -0700 | [diff] [blame] | 314 | func (p *PrebuiltEtc) SetImageVariation(ctx android.ImageInterfaceContext, variation string) { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 315 | } |
| 316 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 317 | func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path { |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 318 | if len(p.properties.Srcs.GetOrDefault(ctx, nil)) > 0 { |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 319 | panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name())) |
| 320 | } |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 321 | return android.PathForModuleSrc(ctx, p.properties.Src.GetOrDefault(ctx, "")) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 322 | } |
| 323 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 324 | func (p *PrebuiltEtc) InstallDirPath() android.InstallPath { |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 325 | if len(p.installDirPaths) != 1 { |
| 326 | panic(fmt.Errorf("InstallDirPath not available on multi-source prebuilt %q", p.Name())) |
| 327 | } |
| 328 | return p.installDirPaths[0] |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 329 | } |
| 330 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 331 | // This allows other derivative modules (e.g. prebuilt_etc_xml) to perform |
| 332 | // additional steps (like validating the src) before the file is installed. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 333 | func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) { |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 334 | p.additionalDependencies = &paths |
| 335 | } |
| 336 | |
Cole Faust | 4e9f592 | 2024-11-13 16:09:23 -0800 | [diff] [blame] | 337 | func (p *PrebuiltEtc) OutputFile() android.Path { |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 338 | if p.usedSrcsProperty { |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 339 | panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name())) |
| 340 | } |
| 341 | return p.outputFilePaths[0] |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | func (p *PrebuiltEtc) SubDir() string { |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 345 | if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" { |
Liz Kammer | 0449a63 | 2020-06-26 10:12:36 -0700 | [diff] [blame] | 346 | return subDir |
| 347 | } |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 348 | return proptools.String(p.subdirProperties.Relative_install_path) |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 349 | } |
| 350 | |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 351 | func (p *PrebuiltEtc) BaseDir() string { |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 352 | return p.installDirBase |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 353 | } |
| 354 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 355 | func (p *PrebuiltEtc) Installable() bool { |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 356 | return p.properties.Installable == nil || proptools.Bool(p.properties.Installable) |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 357 | } |
| 358 | |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 359 | func (p *PrebuiltEtc) InVendor() bool { |
| 360 | return p.ModuleBase.InstallInVendor() |
| 361 | } |
| 362 | |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 363 | func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string { |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 364 | // If soc install dir was specified and SOC specific is set, set the installDirPath to the |
| 365 | // specified socInstallDirBase. |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 366 | installBaseDir := p.installDirBase |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 367 | if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" { |
| 368 | installBaseDir = p.installDirBase64 |
| 369 | } |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 370 | if p.SocSpecific() && p.socInstallDirBase != "" { |
| 371 | installBaseDir = p.socInstallDirBase |
| 372 | } |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 373 | if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { |
| 374 | installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String()) |
| 375 | } |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 376 | return installBaseDir |
| 377 | } |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 378 | |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 379 | func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 380 | var installs []installProperties |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 381 | |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 382 | srcProperty := p.properties.Src.Get(ctx) |
| 383 | srcsProperty := p.properties.Srcs.GetOrDefault(ctx, nil) |
| 384 | if srcProperty.IsPresent() && len(srcsProperty) > 0 { |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 385 | ctx.PropertyErrorf("src", "src is set. Cannot set srcs") |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 386 | } |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 387 | dstsProperty := p.properties.Dsts.GetOrDefault(ctx, nil) |
| 388 | if len(dstsProperty) > 0 && len(srcsProperty) == 0 { |
| 389 | ctx.PropertyErrorf("dsts", "dsts is set. Must use srcs") |
| 390 | } |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 391 | |
| 392 | // Check that `sub_dir` and `relative_install_path` are not set at the same time. |
| 393 | if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil { |
| 394 | ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir") |
| 395 | } |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 396 | baseInstallDirPath := android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir()) |
Wei Li | 5958625 | 2024-11-04 09:25:54 -0800 | [diff] [blame] | 397 | // TODO(b/377304441) |
Spandan Das | 27ff767 | 2024-11-06 19:23:57 +0000 | [diff] [blame] | 398 | if android.Bool(p.properties.Oem_specific) { |
Wei Li | 5958625 | 2024-11-04 09:25:54 -0800 | [diff] [blame] | 399 | baseInstallDirPath = android.PathForModuleInPartitionInstall(ctx, ctx.DeviceConfig().OemPath(), p.installBaseDir(ctx), p.SubDir()) |
| 400 | } |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 401 | |
| 402 | filename := proptools.String(p.properties.Filename) |
| 403 | filenameFromSrc := proptools.Bool(p.properties.Filename_from_src) |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 404 | if srcProperty.IsPresent() { |
| 405 | p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{srcProperty.Get()}) |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 406 | // If the source was not found, set a fake source path to |
| 407 | // support AllowMissingDependencies executions. |
| 408 | if len(p.sourceFilePaths) == 0 { |
| 409 | p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} |
| 410 | } |
| 411 | |
| 412 | // Determine the output file basename. |
| 413 | // If Filename is set, use the name specified by the property. |
| 414 | // If Filename_from_src is set, use the source file name. |
| 415 | // Otherwise use the module name. |
| 416 | if filename != "" { |
| 417 | if filenameFromSrc { |
| 418 | ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") |
| 419 | return |
| 420 | } |
| 421 | } else if filenameFromSrc { |
| 422 | filename = p.sourceFilePaths[0].Base() |
| 423 | } else { |
| 424 | filename = ctx.ModuleName() |
| 425 | } |
| 426 | if strings.Contains(filename, "/") { |
| 427 | ctx.PropertyErrorf("filename", "filename cannot contain separator '/'") |
| 428 | return |
| 429 | } |
Cole Faust | 4e9f592 | 2024-11-13 16:09:23 -0800 | [diff] [blame] | 430 | p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)} |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 431 | |
| 432 | ip := installProperties{ |
| 433 | filename: filename, |
| 434 | sourceFilePath: p.sourceFilePaths[0], |
| 435 | outputFilePath: p.outputFilePaths[0], |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 436 | installDirPath: baseInstallDirPath, |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 437 | symlinks: p.properties.Symlinks, |
| 438 | } |
| 439 | installs = append(installs, ip) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 440 | p.installDirPaths = append(p.installDirPaths, baseInstallDirPath) |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 441 | } else if len(srcsProperty) > 0 { |
| 442 | p.usedSrcsProperty = true |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 443 | if filename != "" { |
| 444 | ctx.PropertyErrorf("filename", "filename cannot be set when using srcs") |
| 445 | } |
| 446 | if len(p.properties.Symlinks) > 0 { |
| 447 | ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs") |
| 448 | } |
| 449 | if p.properties.Filename_from_src != nil { |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 450 | if len(dstsProperty) > 0 { |
| 451 | ctx.PropertyErrorf("filename_from_src", "dsts is set. Cannot set filename_from_src") |
| 452 | } else { |
| 453 | ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs") |
| 454 | } |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 455 | } |
Cole Faust | fdec872 | 2024-05-22 11:38:29 -0700 | [diff] [blame] | 456 | p.sourceFilePaths = android.PathsForModuleSrc(ctx, srcsProperty) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 457 | if len(dstsProperty) > 0 && len(p.sourceFilePaths) != len(dstsProperty) { |
| 458 | ctx.PropertyErrorf("dsts", "Must have one entry in dsts per source file") |
| 459 | } |
| 460 | for i, src := range p.sourceFilePaths { |
| 461 | var filename string |
| 462 | var installDirPath android.InstallPath |
| 463 | |
| 464 | if len(dstsProperty) > 0 { |
| 465 | var dstdir string |
| 466 | |
| 467 | dstdir, filename = filepath.Split(dstsProperty[i]) |
| 468 | installDirPath = baseInstallDirPath.Join(ctx, dstdir) |
| 469 | } else { |
| 470 | filename = src.Base() |
| 471 | installDirPath = baseInstallDirPath |
| 472 | } |
Cole Faust | 4e9f592 | 2024-11-13 16:09:23 -0800 | [diff] [blame] | 473 | output := android.PathForModuleOut(ctx, filename) |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 474 | ip := installProperties{ |
| 475 | filename: filename, |
| 476 | sourceFilePath: src, |
| 477 | outputFilePath: output, |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 478 | installDirPath: installDirPath, |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 479 | } |
| 480 | p.outputFilePaths = append(p.outputFilePaths, output) |
| 481 | installs = append(installs, ip) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 482 | p.installDirPaths = append(p.installDirPaths, installDirPath) |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 483 | } |
| 484 | } else if ctx.Config().AllowMissingDependencies() { |
| 485 | // If no srcs was set and AllowMissingDependencies is enabled then |
| 486 | // mark the module as missing dependencies and set a fake source path |
| 487 | // and file name. |
| 488 | ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"}) |
| 489 | p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} |
| 490 | if filename == "" { |
| 491 | filename = ctx.ModuleName() |
| 492 | } |
Cole Faust | 4e9f592 | 2024-11-13 16:09:23 -0800 | [diff] [blame] | 493 | p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)} |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 494 | ip := installProperties{ |
| 495 | filename: filename, |
| 496 | sourceFilePath: p.sourceFilePaths[0], |
| 497 | outputFilePath: p.outputFilePaths[0], |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 498 | installDirPath: baseInstallDirPath, |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 499 | } |
| 500 | installs = append(installs, ip) |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 501 | p.installDirPaths = append(p.installDirPaths, baseInstallDirPath) |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 502 | } else { |
| 503 | ctx.PropertyErrorf("src", "missing prebuilt source file") |
| 504 | return |
| 505 | } |
| 506 | |
| 507 | // Call InstallFile even when uninstallable to make the module included in the package. |
| 508 | if !p.Installable() { |
| 509 | p.SkipInstall() |
| 510 | } |
| 511 | for _, ip := range installs { |
| 512 | ip.addInstallRules(ctx) |
| 513 | } |
mrziwang | 8937176 | 2024-06-11 12:42:24 -0700 | [diff] [blame] | 514 | |
mrziwang | a25adf3 | 2025-02-05 23:50:55 +0000 | [diff] [blame] | 515 | p.updateModuleInfoJSON(ctx) |
| 516 | |
mrziwang | 8937176 | 2024-06-11 12:42:24 -0700 | [diff] [blame] | 517 | ctx.SetOutputFiles(p.outputFilePaths.Paths(), "") |
Yu Liu | 0a37d42 | 2025-02-13 02:05:00 +0000 | [diff] [blame] | 518 | |
| 519 | SetCommonPrebuiltEtcInfo(ctx, p) |
| 520 | } |
| 521 | |
| 522 | func SetCommonPrebuiltEtcInfo(ctx android.ModuleContext, p PrebuiltEtcModule) { |
| 523 | android.SetProvider(ctx, PrebuiltEtcInfoProvider, PrebuiltEtcInfo{ |
| 524 | BaseDir: p.BaseDir(), |
| 525 | SubDir: p.SubDir(), |
| 526 | }) |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 527 | } |
Jiyong Park | f9f6805 | 2020-09-29 20:15:08 +0900 | [diff] [blame] | 528 | |
mrziwang | a25adf3 | 2025-02-05 23:50:55 +0000 | [diff] [blame] | 529 | func (p *PrebuiltEtc) updateModuleInfoJSON(ctx android.ModuleContext) { |
| 530 | moduleInfoJSON := ctx.ModuleInfoJSON() |
| 531 | moduleInfoJSON.Class = []string{"ETC"} |
| 532 | if p.makeClass != "" { |
| 533 | moduleInfoJSON.Class = []string{p.makeClass} |
| 534 | } |
| 535 | moduleInfoJSON.SystemSharedLibs = []string{"none"} |
| 536 | moduleInfoJSON.Tags = []string{"optional"} |
| 537 | } |
| 538 | |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 539 | type installProperties struct { |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 540 | filename string |
| 541 | sourceFilePath android.Path |
Cole Faust | 4e9f592 | 2024-11-13 16:09:23 -0800 | [diff] [blame] | 542 | outputFilePath android.WritablePath |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 543 | installDirPath android.InstallPath |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 544 | symlinks []string |
| 545 | } |
| 546 | |
| 547 | // utility function to add install rules to the build graph. |
| 548 | // Reduces code duplication between Soong and Mixed build analysis |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 549 | func (ip *installProperties) addInstallRules(ctx android.ModuleContext) { |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 550 | // Copy the file from src to a location in out/ with the correct `filename` |
| 551 | // This ensures that outputFilePath has the correct name for others to |
| 552 | // use, as the source file may have a different name. |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 553 | ctx.Build(pctx, android.BuildParams{ |
| 554 | Rule: android.Cp, |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 555 | Output: ip.outputFilePath, |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 556 | Input: ip.sourceFilePath, |
| 557 | }) |
| 558 | |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 559 | installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath) |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 560 | for _, sl := range ip.symlinks { |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 561 | ctx.InstallSymlink(ip.installDirPath, sl, installPath) |
Jiyong Park | f9f6805 | 2020-09-29 20:15:08 +0900 | [diff] [blame] | 562 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 563 | } |
| 564 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 565 | func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 566 | nameSuffix := "" |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 567 | if p.inRamdisk() && !p.onlyInRamdisk() { |
| 568 | nameSuffix = ".ramdisk" |
| 569 | } |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 570 | if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() { |
| 571 | nameSuffix = ".vendor_ramdisk" |
| 572 | } |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 573 | if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() { |
| 574 | nameSuffix = ".debug_ramdisk" |
| 575 | } |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 576 | if p.InRecovery() && !p.onlyInRecovery() { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 577 | nameSuffix = ".recovery" |
| 578 | } |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 579 | |
| 580 | class := p.makeClass |
| 581 | if class == "" { |
| 582 | class = "ETC" |
| 583 | } |
| 584 | |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 585 | return []android.AndroidMkEntries{{ |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 586 | Class: class, |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 587 | SubName: nameSuffix, |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 588 | OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]), |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 589 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 590 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 591 | entries.SetString("LOCAL_MODULE_TAGS", "optional") |
Douglas Anderson | 79688ff | 2024-09-27 15:08:33 -0700 | [diff] [blame] | 592 | entries.SetString("LOCAL_MODULE_PATH", p.installDirPaths[0].String()) |
ThiƩbaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 593 | entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base()) |
Yo Chiang | 3d64d49 | 2020-05-27 17:56:39 +0800 | [diff] [blame] | 594 | if len(p.properties.Symlinks) > 0 { |
| 595 | entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) |
| 596 | } |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 597 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable()) |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 598 | if p.additionalDependencies != nil { |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 599 | entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 600 | } |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 601 | }, |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 602 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 603 | }} |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 604 | } |
| 605 | |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 606 | func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase { |
| 607 | return &p.ModuleBase |
| 608 | } |
| 609 | |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 610 | func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) { |
| 611 | p.installDirBase = dirBase |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 612 | p.AddProperties(&p.properties) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 613 | p.AddProperties(&p.subdirProperties) |
Jihoon Kang | 320ca7c | 2024-12-03 18:14:50 +0000 | [diff] [blame] | 614 | p.AddProperties(&p.rootProperties) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | func InitPrebuiltRootModule(p *PrebuiltEtc) { |
| 618 | p.installDirBase = "." |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 619 | p.AddProperties(&p.properties) |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 620 | p.AddProperties(&p.rootProperties) |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | func InitPrebuiltAvbModule(p *PrebuiltEtc) { |
| 624 | p.installDirBase = "avb" |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 625 | p.AddProperties(&p.properties) |
Inseob Kim | be6a66d | 2024-07-11 15:43:44 +0900 | [diff] [blame] | 626 | p.rootProperties.Install_in_root = proptools.BoolPtr(true) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 627 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 628 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 629 | // prebuilt_etc is for a prebuilt artifact that is installed in |
| 630 | // <partition>/etc/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 631 | func PrebuiltEtcFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 632 | module := &PrebuiltEtc{} |
| 633 | InitPrebuiltEtcModule(module, "etc") |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 634 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 635 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 636 | android.InitDefaultableModule(module) |
| 637 | return module |
| 638 | } |
| 639 | |
| 640 | func defaultsFactory() android.Module { |
| 641 | return DefaultsFactory() |
| 642 | } |
| 643 | |
| 644 | func DefaultsFactory(props ...interface{}) android.Module { |
| 645 | module := &Defaults{} |
| 646 | |
| 647 | module.AddProperties(props...) |
| 648 | module.AddProperties( |
Jihoon Kang | 69725b3 | 2024-11-12 03:08:49 +0000 | [diff] [blame] | 649 | &PrebuiltEtcProperties{}, |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 650 | &prebuiltSubdirProperties{}, |
| 651 | ) |
| 652 | |
| 653 | android.InitDefaultsModule(module) |
| 654 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 655 | return module |
| 656 | } |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 657 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 658 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 659 | // $(HOST_OUT)/etc/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 660 | func PrebuiltEtcHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 661 | module := &PrebuiltEtc{} |
| 662 | InitPrebuiltEtcModule(module, "etc") |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 663 | // This module is host-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 664 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 665 | android.InitDefaultableModule(module) |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 666 | return module |
| 667 | } |
| 668 | |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 669 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 670 | // <partition>/etc/<sub_dir> directory. |
| 671 | func PrebuiltEtcCaCertsFactory() android.Module { |
| 672 | module := &PrebuiltEtc{} |
| 673 | InitPrebuiltEtcModule(module, "cacerts") |
| 674 | // This module is device-only |
| 675 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 676 | return module |
| 677 | } |
| 678 | |
Nelson Li | 1fb94b2 | 2024-07-09 17:04:52 +0800 | [diff] [blame] | 679 | // Generally, a <partition> directory will contain a `system` subdirectory, but the <partition> of |
| 680 | // `prebuilt_avb` will not have a `system` subdirectory. |
| 681 | // Ultimately, prebuilt_avb will install the prebuilt artifact to the `avb` subdirectory under the |
| 682 | // root directory of the partition: <partition_root>/avb. |
| 683 | // prebuilt_avb does not allow adding any other subdirectories. |
| 684 | func PrebuiltAvbFactory() android.Module { |
| 685 | module := &PrebuiltEtc{} |
| 686 | InitPrebuiltAvbModule(module) |
| 687 | // This module is device-only |
| 688 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 689 | android.InitDefaultableModule(module) |
| 690 | return module |
| 691 | } |
| 692 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 693 | // prebuilt_root is for a prebuilt artifact that is installed in |
| 694 | // <partition>/ directory. Can't have any sub directories. |
| 695 | func PrebuiltRootFactory() android.Module { |
| 696 | module := &PrebuiltEtc{} |
| 697 | InitPrebuiltRootModule(module) |
| 698 | // This module is device-only |
| 699 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 700 | android.InitDefaultableModule(module) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 701 | return module |
| 702 | } |
| 703 | |
Liz Kammer | e9ecddc | 2022-01-04 17:27:52 -0500 | [diff] [blame] | 704 | // prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir> |
| 705 | // directory. |
| 706 | func PrebuiltRootHostFactory() android.Module { |
| 707 | module := &PrebuiltEtc{} |
| 708 | InitPrebuiltEtcModule(module, ".") |
| 709 | // This module is host-only |
| 710 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
| 711 | android.InitDefaultableModule(module) |
| 712 | return module |
| 713 | } |
| 714 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 715 | // prebuilt_usr_share is for a prebuilt artifact that is installed in |
| 716 | // <partition>/usr/share/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 717 | func PrebuiltUserShareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 718 | module := &PrebuiltEtc{} |
| 719 | InitPrebuiltEtcModule(module, "usr/share") |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 720 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 721 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 722 | android.InitDefaultableModule(module) |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 723 | return module |
| 724 | } |
| 725 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 726 | // prebuild_usr_share_host is for a host prebuilt artifact that is installed in |
| 727 | // $(HOST_OUT)/usr/share/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 728 | func PrebuiltUserShareHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 729 | module := &PrebuiltEtc{} |
| 730 | InitPrebuiltEtcModule(module, "usr/share") |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 731 | // This module is host-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 732 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 733 | android.InitDefaultableModule(module) |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 734 | return module |
| 735 | } |
| 736 | |
yangbill | 63c5e19 | 2024-03-27 09:02:12 +0000 | [diff] [blame] | 737 | // prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in |
| 738 | // <partition>/usr/hyphen-data/<sub_dir> directory. |
| 739 | func PrebuiltUserHyphenDataFactory() android.Module { |
| 740 | module := &PrebuiltEtc{} |
| 741 | InitPrebuiltEtcModule(module, "usr/hyphen-data") |
| 742 | // This module is device-only |
| 743 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 744 | android.InitDefaultableModule(module) |
| 745 | return module |
| 746 | } |
| 747 | |
yangbill | 85527e6 | 2024-04-30 08:24:50 +0000 | [diff] [blame] | 748 | // prebuilt_usr_keylayout is for a prebuilt artifact that is installed in |
| 749 | // <partition>/usr/keylayout/<sub_dir> directory. |
| 750 | func PrebuiltUserKeyLayoutFactory() android.Module { |
| 751 | module := &PrebuiltEtc{} |
| 752 | InitPrebuiltEtcModule(module, "usr/keylayout") |
| 753 | // This module is device-only |
| 754 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 755 | android.InitDefaultableModule(module) |
| 756 | return module |
| 757 | } |
| 758 | |
| 759 | // prebuilt_usr_keychars is for a prebuilt artifact that is installed in |
| 760 | // <partition>/usr/keychars/<sub_dir> directory. |
| 761 | func PrebuiltUserKeyCharsFactory() android.Module { |
| 762 | module := &PrebuiltEtc{} |
| 763 | InitPrebuiltEtcModule(module, "usr/keychars") |
| 764 | // This module is device-only |
| 765 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 766 | android.InitDefaultableModule(module) |
| 767 | return module |
| 768 | } |
| 769 | |
| 770 | // prebuilt_usr_idc is for a prebuilt artifact that is installed in |
| 771 | // <partition>/usr/idc/<sub_dir> directory. |
| 772 | func PrebuiltUserIdcFactory() android.Module { |
| 773 | module := &PrebuiltEtc{} |
| 774 | InitPrebuiltEtcModule(module, "usr/idc") |
| 775 | // This module is device-only |
| 776 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 777 | android.InitDefaultableModule(module) |
| 778 | return module |
| 779 | } |
| 780 | |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 781 | // prebuilt_usr_srec is for a prebuilt artifact that is installed in |
| 782 | // <partition>/usr/srec/<sub_dir> directory. |
| 783 | func PrebuiltUserSrecFactory() android.Module { |
| 784 | module := &PrebuiltEtc{} |
| 785 | InitPrebuiltEtcModule(module, "usr/srec") |
| 786 | // This module is device-only |
| 787 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 788 | android.InitDefaultableModule(module) |
| 789 | return module |
| 790 | } |
| 791 | |
Agi Sferro | 243c7d7 | 2025-02-24 15:45:53 -0800 | [diff] [blame] | 792 | // prebuilt_usr_odml is for a prebuilt artifact that is installed in |
| 793 | // <partition>/usr/odml/<sub_dir> directory. |
| 794 | func PrebuiltUserOdmlFactory() android.Module { |
| 795 | module := &PrebuiltEtc{} |
| 796 | InitPrebuiltEtcModule(module, "usr/odml") |
| 797 | // This module is device-only |
| 798 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 799 | android.InitDefaultableModule(module) |
| 800 | return module |
| 801 | } |
| 802 | |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 803 | // prebuilt_font installs a font in <partition>/fonts directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 804 | func PrebuiltFontFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 805 | module := &PrebuiltEtc{} |
| 806 | InitPrebuiltEtcModule(module, "fonts") |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 807 | // This module is device-only |
Cole Faust | c49443e | 2024-10-29 11:15:34 -0700 | [diff] [blame] | 808 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 809 | android.InitDefaultableModule(module) |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 810 | return module |
| 811 | } |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 812 | |
Kevin | 93f7cd8 | 2024-05-02 12:37:59 +0200 | [diff] [blame] | 813 | // prebuilt_overlay is for a prebuilt artifact in <partition>/overlay directory. |
| 814 | func PrebuiltOverlayFactory() android.Module { |
| 815 | module := &PrebuiltEtc{} |
| 816 | InitPrebuiltEtcModule(module, "overlay") |
| 817 | // This module is device-only |
| 818 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 819 | return module |
| 820 | } |
| 821 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 822 | // prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system |
| 823 | // image. |
| 824 | // If soc_specific property is set to true, the firmware file is installed to the |
| 825 | // vendor <partition>/firmware directory for vendor image. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 826 | func PrebuiltFirmwareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 827 | module := &PrebuiltEtc{} |
| 828 | module.socInstallDirBase = "firmware" |
| 829 | InitPrebuiltEtcModule(module, "etc/firmware") |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 830 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 831 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 832 | android.InitDefaultableModule(module) |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 833 | return module |
| 834 | } |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 835 | |
Luca Stefani | 04812eb | 2025-03-09 12:41:06 +0100 | [diff] [blame] | 836 | // prebuilt_gpu is for a prebuilt artifact in <partition>/gpu directory. |
| 837 | func PrebuiltGPUFactory() android.Module { |
| 838 | module := &PrebuiltEtc{} |
| 839 | InitPrebuiltEtcModule(module, "gpu") |
| 840 | // This module is device-only |
| 841 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 842 | return module |
| 843 | } |
| 844 | |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 845 | // prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image. |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 846 | // If soc_specific property is set to true, the DSP related file is installed to the |
| 847 | // vendor <partition>/dsp directory for vendor image. |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 848 | func PrebuiltDSPFactory() android.Module { |
| 849 | module := &PrebuiltEtc{} |
| 850 | module.socInstallDirBase = "dsp" |
| 851 | InitPrebuiltEtcModule(module, "etc/dsp") |
| 852 | // This module is device-only |
| 853 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 854 | android.InitDefaultableModule(module) |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 855 | return module |
| 856 | } |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 857 | |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 858 | // prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64. |
| 859 | func PrebuiltRenderScriptBitcodeFactory() android.Module { |
| 860 | module := &PrebuiltEtc{} |
| 861 | module.makeClass = "RENDERSCRIPT_BITCODE" |
| 862 | module.installDirBase64 = "lib64" |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 863 | module.installAvoidMultilibConflict = true |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 864 | InitPrebuiltEtcModule(module, "lib") |
| 865 | // This module is device-only |
| 866 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth) |
| 867 | android.InitDefaultableModule(module) |
| 868 | return module |
| 869 | } |
| 870 | |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 871 | // prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA |
| 872 | // to the <partition>/lib/rfsa directory. |
| 873 | func PrebuiltRFSAFactory() android.Module { |
| 874 | module := &PrebuiltEtc{} |
| 875 | // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too |
| 876 | // many places outside of the application processor. They could be moved to /vendor/dsp once |
| 877 | // that is cleaned up. |
| 878 | InitPrebuiltEtcModule(module, "lib/rfsa") |
| 879 | // This module is device-only |
| 880 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 881 | android.InitDefaultableModule(module) |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 882 | return module |
| 883 | } |
Jihoon Kang | 2ecf862 | 2024-10-23 21:20:30 +0000 | [diff] [blame] | 884 | |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 885 | // prebuilt_media installs media files in <partition>/media directory. |
| 886 | func PrebuiltMediaFactory() android.Module { |
Jihoon Kang | 2ecf862 | 2024-10-23 21:20:30 +0000 | [diff] [blame] | 887 | module := &PrebuiltEtc{} |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 888 | InitPrebuiltEtcModule(module, "media") |
Jihoon Kang | 2ecf862 | 2024-10-23 21:20:30 +0000 | [diff] [blame] | 889 | // This module is device-only |
| 890 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 891 | android.InitDefaultableModule(module) |
| 892 | return module |
| 893 | } |
Jihoon Kang | ec62d84 | 2024-10-25 20:27:18 +0000 | [diff] [blame] | 894 | |
| 895 | // prebuilt_voicepack installs voice pack files in <partition>/tts directory. |
| 896 | func PrebuiltVoicepackFactory() android.Module { |
| 897 | module := &PrebuiltEtc{} |
| 898 | InitPrebuiltEtcModule(module, "tts") |
| 899 | // This module is device-only |
| 900 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 901 | android.InitDefaultableModule(module) |
| 902 | return module |
| 903 | } |
| 904 | |
| 905 | // prebuilt_bin installs files in <partition>/bin directory. |
| 906 | func PrebuiltBinaryFactory() android.Module { |
| 907 | module := &PrebuiltEtc{} |
| 908 | InitPrebuiltEtcModule(module, "bin") |
| 909 | // This module is device-only |
| 910 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 911 | android.InitDefaultableModule(module) |
| 912 | return module |
| 913 | } |
| 914 | |
| 915 | // prebuilt_wallpaper installs image files in <partition>/wallpaper directory. |
| 916 | func PrebuiltWallpaperFactory() android.Module { |
| 917 | module := &PrebuiltEtc{} |
| 918 | InitPrebuiltEtcModule(module, "wallpaper") |
| 919 | // This module is device-only |
| 920 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 921 | android.InitDefaultableModule(module) |
| 922 | return module |
| 923 | } |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 924 | |
| 925 | // prebuilt_priv_app installs files in <partition>/priv-app directory. |
| 926 | func PrebuiltPrivAppFactory() android.Module { |
| 927 | module := &PrebuiltEtc{} |
| 928 | InitPrebuiltEtcModule(module, "priv-app") |
| 929 | // This module is device-only |
| 930 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 931 | android.InitDefaultableModule(module) |
| 932 | return module |
| 933 | } |
| 934 | |
Michael Bestas | 137fab4 | 2025-03-08 20:44:34 +0200 | [diff] [blame] | 935 | // prebuilt_radio installs files in <partition>/radio directory. |
| 936 | func PrebuiltRadioFactory() android.Module { |
| 937 | module := &PrebuiltEtc{} |
| 938 | InitPrebuiltEtcModule(module, "radio") |
| 939 | // This module is device-only |
| 940 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 941 | android.InitDefaultableModule(module) |
| 942 | return module |
| 943 | } |
| 944 | |
Jihoon Kang | 0da5ae9 | 2024-10-29 23:24:17 +0000 | [diff] [blame] | 945 | // prebuilt_rfs installs files in <partition>/rfs directory. |
| 946 | func PrebuiltRfsFactory() android.Module { |
| 947 | module := &PrebuiltEtc{} |
| 948 | InitPrebuiltEtcModule(module, "rfs") |
| 949 | // This module is device-only |
| 950 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 951 | android.InitDefaultableModule(module) |
| 952 | return module |
| 953 | } |
| 954 | |
| 955 | // prebuilt_framework installs files in <partition>/framework directory. |
| 956 | func PrebuiltFrameworkFactory() android.Module { |
| 957 | module := &PrebuiltEtc{} |
| 958 | InitPrebuiltEtcModule(module, "framework") |
| 959 | // This module is device-only |
| 960 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 961 | android.InitDefaultableModule(module) |
| 962 | return module |
| 963 | } |
| 964 | |
| 965 | // prebuilt_res installs files in <partition>/res directory. |
| 966 | func PrebuiltResFactory() android.Module { |
| 967 | module := &PrebuiltEtc{} |
| 968 | InitPrebuiltEtcModule(module, "res") |
| 969 | // This module is device-only |
| 970 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 971 | android.InitDefaultableModule(module) |
| 972 | return module |
| 973 | } |
| 974 | |
| 975 | // prebuilt_wlc_upt installs files in <partition>/wlc_upt directory. |
| 976 | func PrebuiltWlcUptFactory() android.Module { |
| 977 | module := &PrebuiltEtc{} |
| 978 | InitPrebuiltEtcModule(module, "wlc_upt") |
| 979 | // This module is device-only |
| 980 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 981 | android.InitDefaultableModule(module) |
| 982 | return module |
| 983 | } |
| 984 | |
| 985 | // prebuilt_odm installs files in <partition>/odm directory. |
| 986 | func PrebuiltOdmFactory() android.Module { |
| 987 | module := &PrebuiltEtc{} |
| 988 | InitPrebuiltEtcModule(module, "odm") |
| 989 | // This module is device-only |
| 990 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 991 | android.InitDefaultableModule(module) |
| 992 | return module |
| 993 | } |
Jihoon Kang | 2e2b744 | 2024-11-05 00:26:20 +0000 | [diff] [blame] | 994 | |
| 995 | // prebuilt_vendor_dlkm installs files in <partition>/vendor_dlkm directory. |
| 996 | func PrebuiltVendorDlkmFactory() android.Module { |
| 997 | module := &PrebuiltEtc{} |
| 998 | InitPrebuiltEtcModule(module, "vendor_dlkm") |
| 999 | // This module is device-only |
| 1000 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1001 | android.InitDefaultableModule(module) |
| 1002 | return module |
| 1003 | } |
| 1004 | |
| 1005 | // prebuilt_bt_firmware installs files in <partition>/bt_firmware directory. |
| 1006 | func PrebuiltBtFirmwareFactory() android.Module { |
| 1007 | module := &PrebuiltEtc{} |
| 1008 | InitPrebuiltEtcModule(module, "bt_firmware") |
| 1009 | // This module is device-only |
| 1010 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1011 | android.InitDefaultableModule(module) |
| 1012 | return module |
| 1013 | } |
Jihoon Kang | dca2f2b | 2024-11-06 18:43:19 +0000 | [diff] [blame] | 1014 | |
| 1015 | // prebuilt_tvservice installs files in <partition>/tvservice directory. |
| 1016 | func PrebuiltTvServiceFactory() android.Module { |
| 1017 | module := &PrebuiltEtc{} |
| 1018 | InitPrebuiltEtcModule(module, "tvservice") |
| 1019 | // This module is device-only |
| 1020 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1021 | android.InitDefaultableModule(module) |
| 1022 | return module |
| 1023 | } |
| 1024 | |
| 1025 | // prebuilt_optee installs files in <partition>/optee directory. |
| 1026 | func PrebuiltOpteeFactory() android.Module { |
| 1027 | module := &PrebuiltEtc{} |
| 1028 | InitPrebuiltEtcModule(module, "optee") |
| 1029 | // This module is device-only |
| 1030 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1031 | android.InitDefaultableModule(module) |
| 1032 | return module |
| 1033 | } |
Jihoon Kang | ecf76dd | 2024-11-12 05:24:46 +0000 | [diff] [blame] | 1034 | |
| 1035 | // prebuilt_tvconfig installs files in <partition>/tvconfig directory. |
| 1036 | func PrebuiltTvConfigFactory() android.Module { |
| 1037 | module := &PrebuiltEtc{} |
| 1038 | InitPrebuiltEtcModule(module, "tvconfig") |
| 1039 | // This module is device-only |
| 1040 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1041 | android.InitDefaultableModule(module) |
| 1042 | return module |
| 1043 | } |
Jihoon Kang | 3ca07a1 | 2024-12-02 19:14:30 +0000 | [diff] [blame] | 1044 | |
| 1045 | // prebuilt_vendor installs files in <partition>/vendor directory. |
| 1046 | func PrebuiltVendorFactory() android.Module { |
| 1047 | module := &PrebuiltEtc{} |
| 1048 | InitPrebuiltEtcModule(module, "vendor") |
| 1049 | // This module is device-only |
| 1050 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1051 | android.InitDefaultableModule(module) |
| 1052 | return module |
| 1053 | } |
Jihoon Kang | 320ca7c | 2024-12-03 18:14:50 +0000 | [diff] [blame] | 1054 | |
| 1055 | // prebuilt_sbin installs files in <partition>/sbin directory. |
| 1056 | func PrebuiltSbinFactory() android.Module { |
| 1057 | module := &PrebuiltEtc{} |
| 1058 | InitPrebuiltEtcModule(module, "sbin") |
| 1059 | // This module is device-only |
| 1060 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1061 | android.InitDefaultableModule(module) |
| 1062 | return module |
| 1063 | } |
| 1064 | |
| 1065 | // prebuilt_system installs files in <partition>/system directory. |
| 1066 | func PrebuiltSystemFactory() android.Module { |
| 1067 | module := &PrebuiltEtc{} |
| 1068 | InitPrebuiltEtcModule(module, "system") |
| 1069 | // This module is device-only |
| 1070 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1071 | android.InitDefaultableModule(module) |
| 1072 | return module |
| 1073 | } |
| 1074 | |
| 1075 | // prebuilt_first_stage_ramdisk installs files in <partition>/first_stage_ramdisk directory. |
| 1076 | func PrebuiltFirstStageRamdiskFactory() android.Module { |
| 1077 | module := &PrebuiltEtc{} |
| 1078 | InitPrebuiltEtcModule(module, "first_stage_ramdisk") |
| 1079 | // This module is device-only |
| 1080 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 1081 | android.InitDefaultableModule(module) |
| 1082 | return module |
| 1083 | } |