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 | fccad6b | 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 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 17 | import ( |
| 18 | "strconv" |
| 19 | |
| 20 | "github.com/google/blueprint/proptools" |
| 21 | |
| 22 | "android/soong/android" |
| 23 | ) |
| 24 | |
| 25 | var pctx = android.NewPackageContext("android/soong/etc") |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 26 | |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 27 | // 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] | 28 | |
| 29 | func init() { |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 30 | pctx.Import("android/soong/android") |
| 31 | |
| 32 | android.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory) |
| 33 | android.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory) |
| 34 | android.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory) |
| 35 | android.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory) |
| 36 | android.RegisterModuleType("prebuilt_font", PrebuiltFontFactory) |
| 37 | android.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | type prebuiltEtcProperties struct { |
| 41 | // Source file of this prebuilt. |
Colin Cross | 27b922f | 2019-03-04 22:35:41 -0800 | [diff] [blame] | 42 | Src *string `android:"path,arch_variant"` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 43 | |
| 44 | // optional subdirectory under which this file is installed into |
| 45 | Sub_dir *string `android:"arch_variant"` |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 46 | |
Jiyong Park | 139a2e6 | 2018-10-26 21:49:39 +0900 | [diff] [blame] | 47 | // optional name for the installed file. If unspecified, name of the module is used as the file name |
| 48 | Filename *string `android:"arch_variant"` |
| 49 | |
Jiyong Park | 1a7cf08 | 2018-11-13 11:59:12 +0900 | [diff] [blame] | 50 | // when set to true, and filename property is not set, the name for the installed file |
| 51 | // is the same as the file name of the source file. |
| 52 | Filename_from_src *bool `android:"arch_variant"` |
| 53 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 54 | // Make this module available when building for ramdisk. |
| 55 | Ramdisk_available *bool |
| 56 | |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 57 | // Make this module available when building for recovery. |
| 58 | Recovery_available *bool |
| 59 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 60 | // Whether this module is directly installable to one of the partitions. Default: true. |
| 61 | Installable *bool |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 62 | } |
| 63 | |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 64 | type PrebuiltEtcModule interface { |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 65 | android.Module |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 66 | SubDir() string |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 67 | OutputFile() android.OutputPath |
Jooyung Han | 39edb6c | 2019-11-06 16:53:07 +0900 | [diff] [blame] | 68 | } |
| 69 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 70 | type PrebuiltEtc struct { |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 71 | android.ModuleBase |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 72 | |
| 73 | properties prebuiltEtcProperties |
| 74 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 75 | sourceFilePath android.Path |
| 76 | outputFilePath android.OutputPath |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 77 | // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 78 | installDirBase string |
| 79 | // The base install location when soc_specific property is set to true, e.g. "firmware" for prebuilt_firmware. |
| 80 | socInstallDirBase string |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 81 | installDirPath android.InstallPath |
| 82 | additionalDependencies *android.Paths |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 83 | } |
| 84 | |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 85 | func (p *PrebuiltEtc) inRamdisk() bool { |
| 86 | return p.ModuleBase.InRamdisk() || p.ModuleBase.InstallInRamdisk() |
| 87 | } |
| 88 | |
| 89 | func (p *PrebuiltEtc) onlyInRamdisk() bool { |
| 90 | return p.ModuleBase.InstallInRamdisk() |
| 91 | } |
| 92 | |
| 93 | func (p *PrebuiltEtc) InstallInRamdisk() bool { |
| 94 | return p.inRamdisk() |
| 95 | } |
| 96 | |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 97 | func (p *PrebuiltEtc) inRecovery() bool { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 98 | return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery() |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | func (p *PrebuiltEtc) onlyInRecovery() bool { |
| 102 | return p.ModuleBase.InstallInRecovery() |
| 103 | } |
| 104 | |
| 105 | func (p *PrebuiltEtc) InstallInRecovery() bool { |
| 106 | return p.inRecovery() |
| 107 | } |
| 108 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 109 | var _ android.ImageInterface = (*PrebuiltEtc)(nil) |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 110 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 111 | func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {} |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 112 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 113 | func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool { |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 114 | return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() |
| 115 | } |
| 116 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 117 | func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { |
| 118 | return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 119 | } |
| 120 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 121 | func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { |
| 122 | return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery() |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 123 | } |
| 124 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 125 | func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 126 | return nil |
| 127 | } |
| 128 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 129 | func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) { |
Colin Cross | 7228ecd | 2019-11-18 16:00:16 -0800 | [diff] [blame] | 130 | } |
| 131 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 132 | func (p *PrebuiltEtc) DepsMutator(ctx android.BottomUpMutatorContext) { |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 133 | if p.properties.Src == nil { |
| 134 | ctx.PropertyErrorf("src", "missing prebuilt source file") |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 135 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 136 | } |
| 137 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 138 | func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path { |
| 139 | return android.PathForModuleSrc(ctx, android.String(p.properties.Src)) |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 140 | } |
| 141 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 142 | func (p *PrebuiltEtc) InstallDirPath() android.InstallPath { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 143 | return p.installDirPath |
| 144 | } |
| 145 | |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 146 | // This allows other derivative modules (e.g. prebuilt_etc_xml) to perform |
| 147 | // additional steps (like validating the src) before the file is installed. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 148 | func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) { |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 149 | p.additionalDependencies = &paths |
| 150 | } |
| 151 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 152 | func (p *PrebuiltEtc) OutputFile() android.OutputPath { |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 153 | return p.outputFilePath |
| 154 | } |
| 155 | |
| 156 | func (p *PrebuiltEtc) SubDir() string { |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 157 | return android.String(p.properties.Sub_dir) |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 158 | } |
| 159 | |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 160 | func (p *PrebuiltEtc) Installable() bool { |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 161 | return p.properties.Installable == nil || android.Bool(p.properties.Installable) |
Jiyong Park | ad9ce04 | 2018-10-31 22:49:57 +0900 | [diff] [blame] | 162 | } |
| 163 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 164 | func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 165 | p.sourceFilePath = android.PathForModuleSrc(ctx, android.String(p.properties.Src)) |
| 166 | filename := android.String(p.properties.Filename) |
| 167 | filename_from_src := android.Bool(p.properties.Filename_from_src) |
Jiyong Park | 139a2e6 | 2018-10-26 21:49:39 +0900 | [diff] [blame] | 168 | if filename == "" { |
Jiyong Park | 1a7cf08 | 2018-11-13 11:59:12 +0900 | [diff] [blame] | 169 | if filename_from_src { |
| 170 | filename = p.sourceFilePath.Base() |
| 171 | } else { |
| 172 | filename = ctx.ModuleName() |
| 173 | } |
| 174 | } else if filename_from_src { |
| 175 | ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true") |
| 176 | return |
Jiyong Park | 139a2e6 | 2018-10-26 21:49:39 +0900 | [diff] [blame] | 177 | } |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 178 | p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 179 | |
| 180 | // If soc install dir was specified and SOC specific is set, set the installDirPath to the specified |
| 181 | // socInstallDirBase. |
| 182 | installBaseDir := p.installDirBase |
| 183 | if ctx.SocSpecific() && p.socInstallDirBase != "" { |
| 184 | installBaseDir = p.socInstallDirBase |
| 185 | } |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 186 | p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, proptools.String(p.properties.Sub_dir)) |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 187 | |
Dan Willemsen | b055267 | 2019-01-25 16:04:11 -0800 | [diff] [blame] | 188 | // This ensures that outputFilePath has the correct name for others to |
| 189 | // use, as the source file may have a different name. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 190 | ctx.Build(pctx, android.BuildParams{ |
| 191 | Rule: android.Cp, |
Jiyong Park | c43e0ac | 2018-10-04 20:27:15 +0900 | [diff] [blame] | 192 | Output: p.outputFilePath, |
| 193 | Input: p.sourceFilePath, |
| 194 | }) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 195 | } |
| 196 | |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 197 | func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 198 | nameSuffix := "" |
Yifan Hong | 1b3348d | 2020-01-21 15:53:22 -0800 | [diff] [blame] | 199 | if p.inRamdisk() && !p.onlyInRamdisk() { |
| 200 | nameSuffix = ".ramdisk" |
| 201 | } |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 202 | if p.inRecovery() && !p.onlyInRecovery() { |
| 203 | nameSuffix = ".recovery" |
| 204 | } |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 205 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 206 | Class: "ETC", |
| 207 | SubName: nameSuffix, |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 208 | OutputFile: android.OptionalPathForPath(p.outputFilePath), |
| 209 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
| 210 | func(entries *android.AndroidMkEntries) { |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 211 | entries.SetString("LOCAL_MODULE_TAGS", "optional") |
Colin Cross | ff6c33d | 2019-10-02 16:01:35 -0700 | [diff] [blame] | 212 | entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 213 | entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base()) |
| 214 | entries.SetString("LOCAL_UNINSTALLABLE_MODULE", strconv.FormatBool(!p.Installable())) |
| 215 | if p.additionalDependencies != nil { |
| 216 | for _, path := range *p.additionalDependencies { |
| 217 | entries.SetString("LOCAL_ADDITIONAL_DEPENDENCIES", path.String()) |
| 218 | } |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 219 | } |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 220 | }, |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 221 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 222 | }} |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 223 | } |
| 224 | |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 225 | func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) { |
| 226 | p.installDirBase = dirBase |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 227 | p.AddProperties(&p.properties) |
| 228 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 229 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 230 | // prebuilt_etc is for a prebuilt artifact that is installed in |
| 231 | // <partition>/etc/<sub_dir> directory. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 232 | func PrebuiltEtcFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 233 | module := &PrebuiltEtc{} |
| 234 | InitPrebuiltEtcModule(module, "etc") |
Jiyong Park | 5a8d1be | 2018-04-25 22:57:34 +0900 | [diff] [blame] | 235 | // This module is device-only |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 236 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 237 | return module |
| 238 | } |
Tao Bao | 0ba5c94 | 2018-08-14 22:20:22 -0700 | [diff] [blame] | 239 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 240 | // prebuilt_etc_host is for a host prebuilt artifact that is installed in |
| 241 | // $(HOST_OUT)/etc/<sub_dir> directory. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 242 | func PrebuiltEtcHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 243 | module := &PrebuiltEtc{} |
| 244 | InitPrebuiltEtcModule(module, "etc") |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 245 | // This module is host-only |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 246 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Jaewoong Jung | 2478818 | 2019-02-04 14:34:10 -0800 | [diff] [blame] | 247 | return module |
| 248 | } |
| 249 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 250 | // prebuilt_usr_share is for a prebuilt artifact that is installed in |
| 251 | // <partition>/usr/share/<sub_dir> directory. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 252 | func PrebuiltUserShareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 253 | module := &PrebuiltEtc{} |
| 254 | InitPrebuiltEtcModule(module, "usr/share") |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 255 | // This module is device-only |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 256 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Jaewoong Jung | c3fcdb4 | 2019-02-13 05:50:33 -0800 | [diff] [blame] | 257 | return module |
| 258 | } |
| 259 | |
Patrice Arruda | 9e14b96 | 2019-03-11 15:58:50 -0700 | [diff] [blame] | 260 | // prebuild_usr_share_host is for a host prebuilt artifact that is installed in |
| 261 | // $(HOST_OUT)/usr/share/<sub_dir> directory. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 262 | func PrebuiltUserShareHostFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 263 | module := &PrebuiltEtc{} |
| 264 | InitPrebuiltEtcModule(module, "usr/share") |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 265 | // This module is host-only |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 266 | android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) |
Patrice Arruda | 300cef9 | 2019-02-22 15:47:57 -0800 | [diff] [blame] | 267 | return module |
| 268 | } |
| 269 | |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 270 | // prebuilt_font installs a font in <partition>/fonts directory. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 271 | func PrebuiltFontFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 272 | module := &PrebuiltEtc{} |
| 273 | InitPrebuiltEtcModule(module, "fonts") |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 274 | // This module is device-only |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 275 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Patrice Arruda | 61583eb | 2019-05-14 08:20:45 -0700 | [diff] [blame] | 276 | return module |
| 277 | } |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 278 | |
| 279 | // prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system image. |
| 280 | // If soc_specific property is set to true, the firmware file is installed to the vendor <partition>/firmware |
| 281 | // directory for vendor image. |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 282 | func PrebuiltFirmwareFactory() android.Module { |
Jooyung Han | a017182 | 2019-07-22 15:48:36 +0900 | [diff] [blame] | 283 | module := &PrebuiltEtc{} |
| 284 | module.socInstallDirBase = "firmware" |
| 285 | InitPrebuiltEtcModule(module, "etc/firmware") |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 286 | // This module is device-only |
Jaewoong Jung | fccad6b | 2020-06-01 10:45:49 -0700 | [diff] [blame] | 287 | android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) |
Patrice Arruda | 057a8b1 | 2019-06-03 15:29:27 -0700 | [diff] [blame] | 288 | return module |
| 289 | } |