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) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 53 | ctx.RegisterModuleType("prebuilt_root", PrebuiltRootFactory) |
Liz Kammer | e9ecddc | 2022-01-04 17:27:52 -0500 | [diff] [blame] | 54 | ctx.RegisterModuleType("prebuilt_root_host", PrebuiltRootHostFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 55 | ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) |
| 56 | ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) |
yangbill | 63c5e19 | 2024-03-27 09:02:12 +0000 | [diff] [blame] | 57 | ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory) |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 58 | ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) |
| 59 | ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) |
| 60 | ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory) |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 61 | ctx.RegisterModuleType("prebuilt_rfsa", PrebuiltRFSAFactory) |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 62 | ctx.RegisterModuleType("prebuilt_renderscript_bitcode", PrebuiltRenderScriptBitcodeFactory) |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 63 | |
| 64 | ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory) |
Rupert Shuttleworth | 378fc1b | 2021-07-28 08:03:16 -0400 | [diff] [blame] | 65 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 66 | } |
| 67 | |
Paul Duffin | 1172fed | 2021-03-08 11:28:18 +0000 | [diff] [blame] | 68 | var PrepareForTestWithPrebuiltEtc = android.FixtureRegisterWithContext(RegisterPrebuiltEtcBuildComponents) |
| 69 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 70 | type prebuiltEtcProperties struct { |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 71 | // 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] | 72 | // Mutually exclusive with srcs. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 73 | Src *string `android:"path,arch_variant"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 74 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 75 | // Source files of this prebuilt. Can reference a genrule type module with the ":module" syntax. |
| 76 | // Mutually exclusive with src. When used, filename_from_src is set to true. |
| 77 | Srcs []string `android:"path,arch_variant"` |
| 78 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 79 | // 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] | 80 | // name. Only available when using a single source (src). |
Jiyong Park | 139a2e6 | 2018-10-26 21:49:39 +0900 | [diff] [blame] | 81 | Filename *string `android:"arch_variant"` |
| 82 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 83 | // 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] | 84 | // is the same as the file name of the source file. |
| 85 | Filename_from_src *bool `android:"arch_variant"` |
| 86 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 87 | // Make this module available when building for ramdisk. |
Yifan Hong | 39143a9 | 2020-10-26 12:43:12 -0700 | [diff] [blame] | 88 | // On device without a dedicated recovery partition, the module is only |
| 89 | // available after switching root into |
| 90 | // /first_stage_ramdisk. To expose the module before switching root, install |
| 91 | // the recovery variant instead. |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 92 | Ramdisk_available *bool |
| 93 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 94 | // Make this module available when building for vendor ramdisk. |
Yifan Hong | 39143a9 | 2020-10-26 12:43:12 -0700 | [diff] [blame] | 95 | // On device without a dedicated recovery partition, the module is only |
| 96 | // available after switching root into |
| 97 | // /first_stage_ramdisk. To expose the module before switching root, install |
| 98 | // the recovery variant instead. |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 99 | Vendor_ramdisk_available *bool |
| 100 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 101 | // Make this module available when building for debug ramdisk. |
| 102 | Debug_ramdisk_available *bool |
| 103 | |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 104 | // Make this module available when building for recovery. |
| 105 | Recovery_available *bool |
| 106 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 107 | // Whether this module is directly installable to one of the partitions. Default: true. |
| 108 | Installable *bool |
Yo Chiang | 3d64d49 | 2020-05-27 17:56:39 +0800 | [diff] [blame] | 109 | |
| 110 | // Install symlinks to the installed file. |
| 111 | Symlinks []string `android:"arch_variant"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 112 | } |
| 113 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 114 | type prebuiltSubdirProperties struct { |
| 115 | // Optional subdirectory under which this file is installed into, cannot be specified with |
| 116 | // relative_install_path, prefer relative_install_path. |
| 117 | Sub_dir *string `android:"arch_variant"` |
| 118 | |
| 119 | // Optional subdirectory under which this file is installed into, cannot be specified with |
| 120 | // sub_dir. |
| 121 | Relative_install_path *string `android:"arch_variant"` |
| 122 | } |
| 123 | |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 124 | type PrebuiltEtcModule interface { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 125 | android.Module |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 126 | |
| 127 | // Returns the base install directory, such as "etc", "usr/share". |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 128 | BaseDir() string |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 129 | |
| 130 | // Returns the sub install directory relative to BaseDir(). |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 131 | SubDir() string |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 132 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 133 | // Returns an android.OutputPath to the intermediate file, which is the renamed prebuilt source |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 134 | // file. |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 135 | OutputFiles(tag string) (android.Paths, error) |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 136 | } |
| 137 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 138 | type PrebuiltEtc struct { |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 139 | android.ModuleBase |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 140 | android.DefaultableModuleBase |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 141 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 142 | properties prebuiltEtcProperties |
| 143 | subdirProperties prebuiltSubdirProperties |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 144 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 145 | sourceFilePaths android.Paths |
| 146 | outputFilePaths android.OutputPaths |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 147 | // 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] | 148 | installDirBase string |
| 149 | installDirBase64 string |
| 150 | installAvoidMultilibConflict bool |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 151 | // The base install location when soc_specific property is set to true, e.g. "firmware" for |
| 152 | // prebuilt_firmware. |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 153 | socInstallDirBase string |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 154 | installDirPath android.InstallPath |
| 155 | additionalDependencies *android.Paths |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 156 | |
| 157 | makeClass string |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 158 | |
| 159 | // Aconfig files for all transitive deps. Also exposed via TransitiveDeclarationsInfo |
| 160 | mergedAconfigFiles map[string]android.Paths |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 161 | } |
| 162 | |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 163 | type Defaults struct { |
| 164 | android.ModuleBase |
| 165 | android.DefaultsModuleBase |
| 166 | } |
| 167 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 168 | func (p *PrebuiltEtc) inRamdisk() bool { |
| 169 | return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() |
| 170 | } |
| 171 | |
| 172 | func (p *PrebuiltEtc) onlyInRamdisk() bool { |
| 173 | return p.ModuleBase.InstallInRamdisk() |
| 174 | } |
| 175 | |
| 176 | func (p *PrebuiltEtc) InstallInRamdisk() bool { |
| 177 | return p.inRamdisk() |
| 178 | } |
| 179 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 180 | func (p *PrebuiltEtc) inVendorRamdisk() bool { |
| 181 | return p.ModuleBase.InVendorRamdisk() || p.ModuleBase.InstallInVendorRamdisk() |
| 182 | } |
| 183 | |
| 184 | func (p *PrebuiltEtc) onlyInVendorRamdisk() bool { |
| 185 | return p.ModuleBase.InstallInVendorRamdisk() |
| 186 | } |
| 187 | |
| 188 | func (p *PrebuiltEtc) InstallInVendorRamdisk() bool { |
| 189 | return p.inVendorRamdisk() |
| 190 | } |
| 191 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 192 | func (p *PrebuiltEtc) inDebugRamdisk() bool { |
| 193 | return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk() |
| 194 | } |
| 195 | |
| 196 | func (p *PrebuiltEtc) onlyInDebugRamdisk() bool { |
| 197 | return p.ModuleBase.InstallInDebugRamdisk() |
| 198 | } |
| 199 | |
| 200 | func (p *PrebuiltEtc) InstallInDebugRamdisk() bool { |
| 201 | return p.inDebugRamdisk() |
| 202 | } |
| 203 | |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 204 | func (p *PrebuiltEtc) InRecovery() bool { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 205 | return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | func (p *PrebuiltEtc) onlyInRecovery() bool { |
| 209 | return p.ModuleBase.InstallInRecovery() |
| 210 | } |
| 211 | |
| 212 | func (p *PrebuiltEtc) InstallInRecovery() bool { |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 213 | return p.InRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 214 | } |
| 215 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 216 | var _ android.ImageInterface = (*PrebuiltEtc)(nil) |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 217 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 218 | func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {} |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 219 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 220 | func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool { |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 221 | return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() && |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 222 | !p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk() |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 223 | } |
| 224 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 225 | func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 226 | return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 227 | } |
| 228 | |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 229 | func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 230 | return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk() |
| 231 | } |
| 232 | |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 233 | func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 234 | return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk() |
| 235 | } |
| 236 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 237 | func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { |
| 238 | return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 239 | } |
| 240 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 241 | func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 242 | return nil |
| 243 | } |
| 244 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 245 | func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 246 | } |
| 247 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 248 | func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 249 | if len(p.properties.Srcs) > 0 { |
| 250 | panic(fmt.Errorf("SourceFilePath not available on multi-source prebuilt %q", p.Name())) |
| 251 | } |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 252 | return android.PathForModuleSrc(ctx, proptools.String(p.properties.Src)) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 253 | } |
| 254 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 255 | func (p *PrebuiltEtc) InstallDirPath() android.InstallPath { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 256 | return p.installDirPath |
| 257 | } |
| 258 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 259 | // This allows other derivative modules (e.g. prebuilt_etc_xml) to perform |
| 260 | // additional steps (like validating the src) before the file is installed. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 261 | func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) { |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 262 | p.additionalDependencies = &paths |
| 263 | } |
| 264 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 265 | func (p *PrebuiltEtc) OutputFile() android.OutputPath { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 266 | if len(p.properties.Srcs) > 0 { |
| 267 | panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name())) |
| 268 | } |
| 269 | return p.outputFilePaths[0] |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 270 | } |
| 271 | |
Jiyong Park | 76a42f5 | 2021-02-16 06:50:37 +0900 | [diff] [blame] | 272 | var _ android.OutputFileProducer = (*PrebuiltEtc)(nil) |
| 273 | |
| 274 | func (p *PrebuiltEtc) OutputFiles(tag string) (android.Paths, error) { |
| 275 | switch tag { |
| 276 | case "": |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 277 | return p.outputFilePaths.Paths(), nil |
Jiyong Park | 76a42f5 | 2021-02-16 06:50:37 +0900 | [diff] [blame] | 278 | default: |
| 279 | return nil, fmt.Errorf("unsupported module reference tag %q", tag) |
| 280 | } |
| 281 | } |
| 282 | |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 283 | func (p *PrebuiltEtc) SubDir() string { |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 284 | if subDir := proptools.String(p.subdirProperties.Sub_dir); subDir != "" { |
Liz Kammer | 0449a63 | 2020-06-26 10:12:36 -0700 | [diff] [blame] | 285 | return subDir |
| 286 | } |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 287 | return proptools.String(p.subdirProperties.Relative_install_path) |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 288 | } |
| 289 | |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 290 | func (p *PrebuiltEtc) BaseDir() string { |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 291 | return p.installDirBase |
Jooyung Han | 0703fd8 | 2020-08-26 22:11:53 +0900 | [diff] [blame] | 292 | } |
| 293 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 294 | func (p *PrebuiltEtc) Installable() bool { |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 295 | return p.properties.Installable == nil || proptools.Bool(p.properties.Installable) |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 296 | } |
| 297 | |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 298 | func (p *PrebuiltEtc) InVendor() bool { |
| 299 | return p.ModuleBase.InstallInVendor() |
| 300 | } |
| 301 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 302 | func (p *PrebuiltEtc) installBaseDir(ctx android.ModuleContext) string { |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 303 | // If soc install dir was specified and SOC specific is set, set the installDirPath to the |
| 304 | // specified socInstallDirBase. |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 305 | installBaseDir := p.installDirBase |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 306 | if p.Target().Arch.ArchType.Multilib == "lib64" && p.installDirBase64 != "" { |
| 307 | installBaseDir = p.installDirBase64 |
| 308 | } |
Jooyung Han | 8e5685d | 2020-09-21 11:02:57 +0900 | [diff] [blame] | 309 | if p.SocSpecific() && p.socInstallDirBase != "" { |
| 310 | installBaseDir = p.socInstallDirBase |
| 311 | } |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 312 | if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { |
| 313 | installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String()) |
| 314 | } |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 315 | return installBaseDir |
| 316 | } |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 317 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 318 | func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 319 | var installs []installProperties |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 320 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 321 | if p.properties.Src != nil && len(p.properties.Srcs) > 0 { |
| 322 | ctx.PropertyErrorf("src", "src is set. Cannot set srcs") |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 323 | } |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 324 | |
| 325 | // Check that `sub_dir` and `relative_install_path` are not set at the same time. |
| 326 | if p.subdirProperties.Sub_dir != nil && p.subdirProperties.Relative_install_path != nil { |
| 327 | ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir") |
| 328 | } |
| 329 | p.installDirPath = android.PathForModuleInstall(ctx, p.installBaseDir(ctx), p.SubDir()) |
| 330 | |
| 331 | filename := proptools.String(p.properties.Filename) |
| 332 | filenameFromSrc := proptools.Bool(p.properties.Filename_from_src) |
| 333 | if p.properties.Src != nil { |
| 334 | p.sourceFilePaths = android.PathsForModuleSrc(ctx, []string{proptools.String(p.properties.Src)}) |
| 335 | // If the source was not found, set a fake source path to |
| 336 | // support AllowMissingDependencies executions. |
| 337 | if len(p.sourceFilePaths) == 0 { |
| 338 | p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} |
| 339 | } |
| 340 | |
| 341 | // Determine the output file basename. |
| 342 | // If Filename is set, use the name specified by the property. |
| 343 | // If Filename_from_src is set, use the source file name. |
| 344 | // Otherwise use the module name. |
| 345 | if filename != "" { |
| 346 | if filenameFromSrc { |
| 347 | ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") |
| 348 | return |
| 349 | } |
| 350 | } else if filenameFromSrc { |
| 351 | filename = p.sourceFilePaths[0].Base() |
| 352 | } else { |
| 353 | filename = ctx.ModuleName() |
| 354 | } |
| 355 | if strings.Contains(filename, "/") { |
| 356 | ctx.PropertyErrorf("filename", "filename cannot contain separator '/'") |
| 357 | return |
| 358 | } |
| 359 | p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath} |
| 360 | |
| 361 | ip := installProperties{ |
| 362 | filename: filename, |
| 363 | sourceFilePath: p.sourceFilePaths[0], |
| 364 | outputFilePath: p.outputFilePaths[0], |
| 365 | installDirPath: p.installDirPath, |
| 366 | symlinks: p.properties.Symlinks, |
| 367 | } |
| 368 | installs = append(installs, ip) |
| 369 | } else if len(p.properties.Srcs) > 0 { |
| 370 | if filename != "" { |
| 371 | ctx.PropertyErrorf("filename", "filename cannot be set when using srcs") |
| 372 | } |
| 373 | if len(p.properties.Symlinks) > 0 { |
| 374 | ctx.PropertyErrorf("symlinks", "symlinks cannot be set when using srcs") |
| 375 | } |
| 376 | if p.properties.Filename_from_src != nil { |
| 377 | ctx.PropertyErrorf("filename_from_src", "filename_from_src is implicitly set to true when using srcs") |
| 378 | } |
| 379 | p.sourceFilePaths = android.PathsForModuleSrc(ctx, p.properties.Srcs) |
| 380 | for _, src := range p.sourceFilePaths { |
| 381 | filename := src.Base() |
| 382 | output := android.PathForModuleOut(ctx, filename).OutputPath |
| 383 | ip := installProperties{ |
| 384 | filename: filename, |
| 385 | sourceFilePath: src, |
| 386 | outputFilePath: output, |
| 387 | installDirPath: p.installDirPath, |
| 388 | } |
| 389 | p.outputFilePaths = append(p.outputFilePaths, output) |
| 390 | installs = append(installs, ip) |
| 391 | } |
| 392 | } else if ctx.Config().AllowMissingDependencies() { |
| 393 | // If no srcs was set and AllowMissingDependencies is enabled then |
| 394 | // mark the module as missing dependencies and set a fake source path |
| 395 | // and file name. |
| 396 | ctx.AddMissingDependencies([]string{"MISSING_PREBUILT_SRC_FILE"}) |
| 397 | p.sourceFilePaths = android.Paths{android.PathForModuleSrc(ctx)} |
| 398 | if filename == "" { |
| 399 | filename = ctx.ModuleName() |
| 400 | } |
| 401 | p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath} |
| 402 | ip := installProperties{ |
| 403 | filename: filename, |
| 404 | sourceFilePath: p.sourceFilePaths[0], |
| 405 | outputFilePath: p.outputFilePaths[0], |
| 406 | installDirPath: p.installDirPath, |
| 407 | } |
| 408 | installs = append(installs, ip) |
| 409 | } else { |
| 410 | ctx.PropertyErrorf("src", "missing prebuilt source file") |
| 411 | return |
| 412 | } |
| 413 | |
| 414 | // Call InstallFile even when uninstallable to make the module included in the package. |
| 415 | if !p.Installable() { |
| 416 | p.SkipInstall() |
| 417 | } |
| 418 | for _, ip := range installs { |
| 419 | ip.addInstallRules(ctx) |
| 420 | } |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 421 | android.CollectDependencyAconfigFiles(ctx, &p.mergedAconfigFiles) |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 422 | } |
Jiyong Park | f9f6805 | 2020-09-29 20:15:08 +0900 | [diff] [blame] | 423 | |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 424 | type installProperties struct { |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 425 | filename string |
| 426 | sourceFilePath android.Path |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 427 | outputFilePath android.OutputPath |
| 428 | installDirPath android.InstallPath |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 429 | symlinks []string |
| 430 | } |
| 431 | |
| 432 | // utility function to add install rules to the build graph. |
| 433 | // Reduces code duplication between Soong and Mixed build analysis |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 434 | func (ip *installProperties) addInstallRules(ctx android.ModuleContext) { |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 435 | // Copy the file from src to a location in out/ with the correct `filename` |
| 436 | // This ensures that outputFilePath has the correct name for others to |
| 437 | // use, as the source file may have a different name. |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 438 | ctx.Build(pctx, android.BuildParams{ |
| 439 | Rule: android.Cp, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 440 | Output: ip.outputFilePath, |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 441 | Input: ip.sourceFilePath, |
| 442 | }) |
| 443 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 444 | installPath := ctx.InstallFile(ip.installDirPath, ip.filename, ip.outputFilePath) |
Spandan Das | 756d340 | 2023-06-05 22:49:50 +0000 | [diff] [blame] | 445 | for _, sl := range ip.symlinks { |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 446 | ctx.InstallSymlink(ip.installDirPath, sl, installPath) |
Jiyong Park | f9f6805 | 2020-09-29 20:15:08 +0900 | [diff] [blame] | 447 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 448 | } |
| 449 | |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 450 | func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 451 | nameSuffix := "" |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 452 | if p.inRamdisk() && !p.onlyInRamdisk() { |
| 453 | nameSuffix = ".ramdisk" |
| 454 | } |
Yifan Hong | 60e0cfb | 2020-10-21 15:17:56 -0700 | [diff] [blame] | 455 | if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() { |
| 456 | nameSuffix = ".vendor_ramdisk" |
| 457 | } |
Inseob Kim | 08758f0 | 2021-04-08 21:13:22 +0900 | [diff] [blame] | 458 | if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() { |
| 459 | nameSuffix = ".debug_ramdisk" |
| 460 | } |
Kiyoung Kim | ae11c23 | 2021-07-19 11:38:04 +0900 | [diff] [blame] | 461 | if p.InRecovery() && !p.onlyInRecovery() { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 462 | nameSuffix = ".recovery" |
| 463 | } |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 464 | |
| 465 | class := p.makeClass |
| 466 | if class == "" { |
| 467 | class = "ETC" |
| 468 | } |
| 469 | |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 470 | return []android.AndroidMkEntries{{ |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 471 | Class: class, |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 472 | SubName: nameSuffix, |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 473 | OutputFile: android.OptionalPathForPath(p.outputFilePaths[0]), |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 474 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 475 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 476 | entries.SetString("LOCAL_MODULE_TAGS", "optional") |
Colin Cross | c68db4b | 2021-11-11 18:59:15 -0800 | [diff] [blame] | 477 | entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String()) |
Thiébaud Weksteen | 00e8b31 | 2024-03-18 14:06:00 +1100 | [diff] [blame] | 478 | entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePaths[0].Base()) |
Yo Chiang | 3d64d49 | 2020-05-27 17:56:39 +0800 | [diff] [blame] | 479 | if len(p.properties.Symlinks) > 0 { |
| 480 | entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) |
| 481 | } |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 482 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.Installable()) |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 483 | if p.additionalDependencies != nil { |
Yo Chiang | 803c40d | 2020-11-16 20:32:51 +0800 | [diff] [blame] | 484 | entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", p.additionalDependencies.Strings()...) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 485 | } |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 486 | android.SetAconfigFileMkEntries(p.AndroidModuleBase(), entries, p.mergedAconfigFiles) |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 487 | }, |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 488 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 489 | }} |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 490 | } |
| 491 | |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 492 | func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase { |
| 493 | return &p.ModuleBase |
| 494 | } |
| 495 | |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 496 | func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) { |
| 497 | p.installDirBase = dirBase |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 498 | p.AddProperties(&p.properties) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 499 | p.AddProperties(&p.subdirProperties) |
| 500 | } |
| 501 | |
| 502 | func InitPrebuiltRootModule(p *PrebuiltEtc) { |
| 503 | p.installDirBase = "." |
| 504 | p.AddProperties(&p.properties) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 505 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 506 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 507 | // prebuilt_etc is for a prebuilt artifact that is installed in |
| 508 | // <partition>/etc/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 509 | func PrebuiltEtcFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 510 | module := &PrebuiltEtc{} |
| 511 | InitPrebuiltEtcModule(module, "etc") |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 512 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 513 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Inseob Kim | 1e27a14 | 2021-05-06 11:46:11 +0000 | [diff] [blame] | 514 | android.InitDefaultableModule(module) |
| 515 | return module |
| 516 | } |
| 517 | |
| 518 | func defaultsFactory() android.Module { |
| 519 | return DefaultsFactory() |
| 520 | } |
| 521 | |
| 522 | func DefaultsFactory(props ...interface{}) android.Module { |
| 523 | module := &Defaults{} |
| 524 | |
| 525 | module.AddProperties(props...) |
| 526 | module.AddProperties( |
| 527 | &prebuiltEtcProperties{}, |
| 528 | &prebuiltSubdirProperties{}, |
| 529 | ) |
| 530 | |
| 531 | android.InitDefaultsModule(module) |
| 532 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 533 | return module |
| 534 | } |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 535 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 536 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 537 | // $(HOST_OUT)/etc/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 538 | func PrebuiltEtcHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 539 | module := &PrebuiltEtc{} |
| 540 | InitPrebuiltEtcModule(module, "etc") |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 541 | // This module is host-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 542 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 543 | android.InitDefaultableModule(module) |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 544 | return module |
| 545 | } |
| 546 | |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 547 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 548 | // <partition>/etc/<sub_dir> directory. |
| 549 | func PrebuiltEtcCaCertsFactory() android.Module { |
| 550 | module := &PrebuiltEtc{} |
| 551 | InitPrebuiltEtcModule(module, "cacerts") |
| 552 | // This module is device-only |
| 553 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Miguel | 32b0280 | 2022-12-01 18:38:26 +0000 | [diff] [blame] | 554 | return module |
| 555 | } |
| 556 | |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 557 | // prebuilt_root is for a prebuilt artifact that is installed in |
| 558 | // <partition>/ directory. Can't have any sub directories. |
| 559 | func PrebuiltRootFactory() android.Module { |
| 560 | module := &PrebuiltEtc{} |
| 561 | InitPrebuiltRootModule(module) |
| 562 | // This module is device-only |
| 563 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 564 | android.InitDefaultableModule(module) |
Inseob Kim | 27408bf | 2021-04-06 21:00:17 +0900 | [diff] [blame] | 565 | return module |
| 566 | } |
| 567 | |
Liz Kammer | e9ecddc | 2022-01-04 17:27:52 -0500 | [diff] [blame] | 568 | // prebuilt_root_host is for a host prebuilt artifact that is installed in $(HOST_OUT)/<sub_dir> |
| 569 | // directory. |
| 570 | func PrebuiltRootHostFactory() android.Module { |
| 571 | module := &PrebuiltEtc{} |
| 572 | InitPrebuiltEtcModule(module, ".") |
| 573 | // This module is host-only |
| 574 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
| 575 | android.InitDefaultableModule(module) |
| 576 | return module |
| 577 | } |
| 578 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 579 | // prebuilt_usr_share is for a prebuilt artifact that is installed in |
| 580 | // <partition>/usr/share/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 581 | func PrebuiltUserShareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 582 | module := &PrebuiltEtc{} |
| 583 | InitPrebuiltEtcModule(module, "usr/share") |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 584 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 585 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 586 | android.InitDefaultableModule(module) |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 587 | return module |
| 588 | } |
| 589 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 590 | // prebuild_usr_share_host is for a host prebuilt artifact that is installed in |
| 591 | // $(HOST_OUT)/usr/share/<sub_dir> directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 592 | func PrebuiltUserShareHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 593 | module := &PrebuiltEtc{} |
| 594 | InitPrebuiltEtcModule(module, "usr/share") |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 595 | // This module is host-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 596 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 597 | android.InitDefaultableModule(module) |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 598 | return module |
| 599 | } |
| 600 | |
yangbill | 63c5e19 | 2024-03-27 09:02:12 +0000 | [diff] [blame] | 601 | // prebuilt_usr_hyphendata is for a prebuilt artifact that is installed in |
| 602 | // <partition>/usr/hyphen-data/<sub_dir> directory. |
| 603 | func PrebuiltUserHyphenDataFactory() android.Module { |
| 604 | module := &PrebuiltEtc{} |
| 605 | InitPrebuiltEtcModule(module, "usr/hyphen-data") |
| 606 | // This module is device-only |
| 607 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
| 608 | android.InitDefaultableModule(module) |
| 609 | return module |
| 610 | } |
| 611 | |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 612 | // prebuilt_font installs a font in <partition>/fonts directory. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 613 | func PrebuiltFontFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 614 | module := &PrebuiltEtc{} |
| 615 | InitPrebuiltEtcModule(module, "fonts") |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 616 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 617 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 618 | android.InitDefaultableModule(module) |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 619 | return module |
| 620 | } |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 621 | |
Yo Chiang | f0e19fe | 2020-11-18 15:28:42 +0800 | [diff] [blame] | 622 | // prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system |
| 623 | // image. |
| 624 | // If soc_specific property is set to true, the firmware file is installed to the |
| 625 | // vendor <partition>/firmware directory for vendor image. |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 626 | func PrebuiltFirmwareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 627 | module := &PrebuiltEtc{} |
| 628 | module.socInstallDirBase = "firmware" |
| 629 | InitPrebuiltEtcModule(module, "etc/firmware") |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 630 | // This module is device-only |
Jaewoong Jung | 4b79e98 | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 631 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 632 | android.InitDefaultableModule(module) |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 633 | return module |
| 634 | } |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 635 | |
| 636 | // 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] | 637 | // If soc_specific property is set to true, the DSP related file is installed to the |
| 638 | // vendor <partition>/dsp directory for vendor image. |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 639 | func PrebuiltDSPFactory() android.Module { |
| 640 | module := &PrebuiltEtc{} |
| 641 | module.socInstallDirBase = "dsp" |
| 642 | InitPrebuiltEtcModule(module, "etc/dsp") |
| 643 | // This module is device-only |
| 644 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 645 | android.InitDefaultableModule(module) |
Patrice Arruda | 0f68800 | 2020-06-08 21:40:25 +0000 | [diff] [blame] | 646 | return module |
| 647 | } |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 648 | |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 649 | // prebuilt_renderscript_bitcode installs a *.bc file into /system/lib or /system/lib64. |
| 650 | func PrebuiltRenderScriptBitcodeFactory() android.Module { |
| 651 | module := &PrebuiltEtc{} |
| 652 | module.makeClass = "RENDERSCRIPT_BITCODE" |
| 653 | module.installDirBase64 = "lib64" |
Colin Cross | 2f63457 | 2023-11-13 12:12:06 -0800 | [diff] [blame] | 654 | module.installAvoidMultilibConflict = true |
Colin Cross | f17e2b5 | 2023-10-30 15:17:25 -0700 | [diff] [blame] | 655 | InitPrebuiltEtcModule(module, "lib") |
| 656 | // This module is device-only |
| 657 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth) |
| 658 | android.InitDefaultableModule(module) |
| 659 | return module |
| 660 | } |
| 661 | |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 662 | // prebuilt_rfsa installs a firmware file that will be available through Qualcomm's RFSA |
| 663 | // to the <partition>/lib/rfsa directory. |
| 664 | func PrebuiltRFSAFactory() android.Module { |
| 665 | module := &PrebuiltEtc{} |
| 666 | // Ideally these would go in /vendor/dsp, but the /vendor/lib/rfsa paths are hardcoded in too |
| 667 | // many places outside of the application processor. They could be moved to /vendor/dsp once |
| 668 | // that is cleaned up. |
| 669 | InitPrebuiltEtcModule(module, "lib/rfsa") |
| 670 | // This module is device-only |
| 671 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Martin Stjernholm | dc6525e | 2021-10-14 00:42:59 +0100 | [diff] [blame] | 672 | android.InitDefaultableModule(module) |
Colin Cross | 83ebf23 | 2021-04-09 09:41:23 -0700 | [diff] [blame] | 673 | return module |
| 674 | } |