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