Commit graph

61 commits

Author SHA1 Message Date
mrziwang
555d133433 Use OutputFilesProvider on filesystem module types
Test: CI
Bug: 339477385
Change-Id: I0902726cfef13c716d73c1abc5c9836bdcf3e10f
2024-06-07 11:15:33 -07:00
Cole Faust
d9c6a5b802 Make dirs a configurable property
The microdroid system image customizes dirs using soong config
variables, make it configurable so that selects can be used instead.

Bug: 342006386
Test: Presubmits
Change-Id: I4fbf4dc0a04ad1d1f6539476408606028390cd64
2024-05-21 14:54:00 -07:00
Jiyong Park
3ea9b65990 filesystem modules gathers first target only
With this change, the deps property in filesystem modules gather the
first target of the filesystem module only.

To gather dependencies across both targets, use multilib.both.deps
instead.

Bug: N/A
Test: go test ./...
Change-Id: Ie2ff0c48f08c61c8b219fc2c1540476ff8e4b1fc
2024-05-16 18:23:20 +09:00
Justin Yun
74f3f30ae4 Soong filesystem may install aconfig_flags.pb
By setting aconfig_flags: true, soong filesystem module installs the
aconfig_flags.pb file to its etc directory.

We need to define aconfigFilePaths to ModuleBase to store the list of
aconfig file paths that is generated from the GenerateBuildActions().
The aconfigFilePaths are collected when build the filesystem module
to build the aconfig_flags.pb for the filesystem image.

Bug: 335363964
Test: compare the cache list with those generated from make.
Change-Id: Ia32b566bf43174e94b9e610b9503608c6b583899
2024-05-13 23:14:42 +00:00
Jiyong Park
7c9ab4f5b1 Merge changes from topic "revert-3069323-revert-3066748-duplicate_entry_fs-CIBDJQYRHU-FVLDIVWUZV" into main
* changes:
  Revert^2 "Filesystem modules follow the installation semantic"
  Revert "Revert "Prevent multiple PackagingSpecs having same inst..."
2024-05-04 03:56:55 +00:00
Inseob Kim
b7b8457a60 Add logtags support to filesystem module
If build_logtags is set to true, etc/event-log-tags will be built by
collecting all logtags files from all dependencies.

Note that this is different from Makefile's current behavior that
collects all logtags files, including ones from uninstalled modules. But
the behavior is probably unintended, and ideally each partition image
should have its own logtags, rather than putting all tags to /system.

Bug: 336189540
Test: m aosp_cf_system_x86_64
Change-Id: I72b384cbb65e812af909eacd18799bd86f1dab13
2024-05-02 13:52:43 +09:00
Jiyong Park
7e7d4af6b5 Revert^2 "Filesystem modules follow the installation semantic"
54351867fa

Change-Id: I12010c1013fc9dad19d259ba7b0251ac8e8e0907
2024-05-01 12:36:10 +00:00
Jiyong Park
54351867fa Revert "Filesystem modules follow the installation semantic"
Revert submission 3066748-duplicate_entry_fs

Reason for revert: b/338159248

Reverted changes: /q/submissionid:3066748-duplicate_entry_fs

Change-Id: I8aacdb36efce8343c3713542eee209e71bde660b
2024-05-01 05:25:42 +00:00
Jiyong Park
742f54c4bc Filesystem modules follow the installation semantic
With this change, filesystem modules (android_filesystem,
android_system_image, etc.) follow the installation semantic which means
output from modules which don't produce installable files (i.e. modules
that return false on IsSkipInstall()) are not included in the filesystem
module.

Note that this bug has been there since the beginning but didn't trigger
an error due to another bug (b/335506668) which allowed multiple
packaging specs to contribute to the same path. That bug prevented the
non-installable variant of a module (e.g. stub) from being installed
simply because because it was "luckly" clobbered by the installable
variant of the same module (e.g. impl lib).

Bug: 335506668
Test: go test ./...
Change-Id: I2a42d178701d74bf6ccc5f33ba33918f8c608d40
2024-04-30 19:02:57 +00:00
Jiyong Park
52a08486f3 Merge "android_filesystem_defaults and visibility rule" into main 2024-04-09 23:06:43 +00:00
Jiyong Park
f46b1af969 android_filesystem_defaults and visibility rule
android_systemimage_defaults is deleted and android_filesystem_defaults
is created so that we can have defaults not only for
android_system_image, but also all android_filesystem modules and its
derivatives.

Also, change adds a check which ensures that the partition_type of the
filesystem and its defaults are the same.

Bug: 330665150
Test: m
Change-Id: If635c794534ed89d264eaf7dfc406a8245b8e9f0
2024-04-09 11:26:15 +09:00
Nikita Ioffe
2c8cdc6166 Add support for rollback_index to android_filesystem module
Bug: 287593065
Test: m
Change-Id: I01e986b2d8e3d992533dc7e2c07e4cdbeaca2c00
2024-04-04 13:03:37 +00:00
Inseob Kim
f16c5a0a7d Merge "Add support to generate fsverity metadata" into main 2024-04-02 07:19:32 +00:00
Inseob Kim
5339184e32 Add support to generate fsverity metadata
By setting fsverity.inputs, android_filesystem can now generate
.fsv_meta and BuildManifest.apk. It has been done by Makefile because
Makefile is the only one knowing all installed files. But now
android_filesystem is aware of all artifacts, so we can move fsverity
metadata generation into Soong.

Bug: 330282551
Test: m aosp_cf_system_x86_64 and see output
Change-Id: Iae4dd83eaede960c263bfba537211df4ff4b36bd
2024-04-02 10:04:22 +09:00
Jiyong Park
eaac823f19 Add android_system_image_defaults
Bug: 330665150
Test: go test ./... under filesystem
Change-Id: Id32e6563491a3d129042de4a9517c545543a022d
2024-03-31 21:27:45 +09:00
Cole Faust
9a24d90936 Add more specific partition visibility rules
//visibility:any_system_partition, //visibility:any_vendor_partition,
etc.

Then, if a partition visibility rule is not specificed, but the module
is installed on a non-system partition via the `vendor: true` or other
properties, the visibility rule for that partition will be added by
default.

This is so that "any_partition" doesn't imply that modules could be put
on the vendor partition when they weren't designed for that, and so that
modules that do need to go on the vendor partition don't need to specify
both vendor: true and visibility:any_vendor_partition.

Eventually, the partition properties should be deprecated, and replaced
with just these visibility rules.

Bug: 321000103
Test: go tests
Change-Id: I24dba36bbc20921941f892480bf7c050e93827c6
2024-03-20 10:55:05 -07:00
Cole Faust
4a2a7c98f6 Add include_make_built_files
If `include_make_built_files` is set to the name of a partition, the
make-built files from that partition will be incorperated into this
soong module. This is to ease the transition to soong built filesystems.

If any files are present in both the soong-built file list and the
make-built one, the soong ones will be preferred.

Bug: 329146343
Test: go test
Change-Id: I456b283e1189116e699ed75357cc056f5d217688
2024-03-14 16:40:42 -07:00
Cole Faust
3b806d3b88 Don't use zip files when creating filesystems
The end result is a directory that's passed to build_image, so zipping
and then unzipping image contents will unnecessarily slow things down.

Bug: 329146343
Test: m microdroid --no-skip-soong-tests
Change-Id: I98223c60e8144d6c707832fcc03ba8fe94467e7b
2024-03-14 16:40:30 -07:00
Cole Faust
cec230a0eb Optimize buildPropFile()
Use android.WriteFileRuleVerbatim instead of a custom RuleBuilder
with echo commands.

Test: m nothing --no-skip-soong-tests
Change-Id: I9734305cbb404fd2ae841af2525f0db235622315
2024-03-07 15:51:12 -08:00
Jeongik Cha
54bf875c97 Add GatherPackagingSpecsWithFilter
android_system_image used GatherPackagingSpecs and then filter only
system modules. But some modules were omitted in this logic because
there are modules which has the same relative path, so the later one is
ignored even though its partition info is what we're looking for. So add
filter logic in GatherPackagingSpecs to avoid this problem

Bug: 323793487
Test: build android_system_image, and then check if it contains every
module we want

Change-Id: Iec8ae920736d3d1920eecad71ba0f8f2fe848e6c
2024-02-08 11:14:43 +09:00
Colin Cross
f5f4ad3db6 Convert coverageMutator to a TransitionMutator
Convert coverageMutator to a TransitionMutator as a step towards
variants-on-demand.

Bug: 319288033
Test: coverage_test.go
Test: treehugger coverage builds
Change-Id: Ic50c0040dea8b42c36b5d784221daa00b7b0d379
2024-01-24 10:17:10 -08:00
Inseob Kim
87230e613d Add defaults modules for avb modules
Bug: 302465542
Test: build
Change-Id: I5bb5a0241d40cf142ed8bbefb76bc8a3709c3e34
2023-11-22 18:55:46 +09:00
Seungjae Yoo
a30e450ba0 Add security_patch avb property for android_filesystem
If android_filesystem module is used with use_avb, defined
security_patch for the rollback protection.

Bug: 285855436
Test: m
Test: avbtool info_image --image <IMAGE>
Change-Id: I32c6108bb1aca398ced5e46b615d937685e261a7
2023-11-09 14:55:44 +09:00
Inseob Kim
376d72f791 Add mount_point property to android_filesystem
The motivation is to support vendor images for microdroid, like the real
vendor images having "/vendor" as their mount point. This will help add
vendor_file_contexts easily.

Bug: 306313100
Test: manually build an image with file_contexts
Change-Id: I2e4bbf108eaa1da4f310ebb4099c4d1b42096436
2023-11-01 15:42:14 +09:00
Jooyung Han
e606759ddf Make filesystem aware of coverage
filesystem should have coverage variants with coverage-enabled build.
Otherwise, it would fail to collect dependencies.

Bug: 273238141
Test: m nothing (soong tests)
Test: compare the artifacts
 $ SKIP_ABI_CHECKS=true SOONG_COLLECT_JAVA_DEPS=true EMMA_INSTRUMENT=true\
   EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true\
   NATIVE_COVERAGE_PATHS='*' m microdroid
 $ m microdroid
Change-Id: I792458ace00a63b4b5213898fd3209351a6e00be
2023-03-16 13:11:17 +09:00
Alice Wang
000e3a396c [avb_footer] Add avb_gen_vbmeta_image to generate vbmeta image
This is the reland of the change aosp/2375848. The build of initrd on
linux-x86 that has incorrect format (b/264940248) is disabled in this
cl.

Bug: 260821553
Test: m microdroid_kernel_signed and inspect the output using `avbtool
    info_image --image <output>`
Change-Id: I3ad2419b7132cde4b2fc34ddfa09ec5ba2166819
2023-01-10 15:38:31 +00:00
Treehugger Robot
32a86bd8ec Merge "Fix the description of Avb_hash_algorithm & algorithm" 2023-01-10 08:40:51 +00:00
Jerry Huang
bc675eb9fa Revert "[avb_footer] Add avb_gen_vbmeta_image to generate vbmeta..."
Revert submission 2375848-initrd_avb_footer

Reason for revert: build break

Reverted changes: /q/submissionid:2375848-initrd_avb_footer

Bug: 264940248
Change-Id: Iab44c187183a5d8eeefc952910e6262fc63627de
2023-01-10 02:52:57 +00:00
Alice Wang
fafe064fe1 [avb_footer] Add avb_gen_vbmeta_image to generate vbmeta image
Bug: 260821553
Test: m microdroid_kernel_signed and inspect the output using `avbtool
    info_image --image <output>`
Change-Id: Iacdf34aca15f5480766b6d4f971704f85f6bf44b
2023-01-09 22:04:16 +00:00
Nikita Ioffe
519015f99d Run host_init_verifier when building filesystem
As part of building Android images we run host_init_verifier to ensure
that .rc files are well-formed. Unfortunately that doesn't cover the
Microdroid image. This change addresses the divergence.

Ideally we should have a concept of pluggable linters that we can run on
the generated image. However, introducing such concept will take some
time, so while we are working on it directly integrate
host_init_verifier into the build system.

Bug: 263486078
Test: m microdroid
Test: add incorrect .rc file and run m microdroid, verify it fails
Change-Id: Id8c9311915e89a10ce3ff7b1f209ebc8cb42211f
2022-12-23 15:46:09 +00:00
Shikha Panwar
01403bb225 Fix the description of Avb_hash_algorithm & algorithm
Avb_hash_algorithm corresponds to --hash_algorithm of avbtool while
avb_algorithm corresponds to signing algorithm.

Bug: 262892300
Test: Builds
Change-Id: Ief4b0f0fd89ebf64b45b29962a3811698bc922d6
2022-12-22 12:34:47 +00:00
Shikha Panwar
e6f3063317 Expose avb_hash_algorithm as a property.
When avb_hash_algorithm is set, for filesystem type build targets,
add_hashtree_footer will be called with the appropriate --hash_algorithm
flag.

Bug: 262892300i
Test: Build succeeds

Change-Id: If2f9c9aa1e98314b3d3e2f8bf25c1bab193f908e
2022-12-21 15:49:15 +00:00
Jiyong Park
bc48548df1 Add props property to add_avb_hash_footer
It is used to provide name:value properties to the footer. Value can be
from a text in *.bp file or a binary file referenced via the `file`
prop. e.g.

```
avb_add_hash_footer {
	...
	props: [
		{
			name: "string_prop",
			value: "string_value",
		},
		{
			name: "binary_prop",
			file: "a_binary_file_name",
		},
	],
}
```

This CL also adds a test for the module type which has been missing.

Bug: 256148237
Test: m nothing
Change-Id: Idf55b308c8ce760387c01a847846b42d1aebe4ea
2022-11-18 12:56:12 +09:00
Jooyung Han
65f402b780 Support deterministic output for bootimg/filesystem
Adding salt to bootimg/filesystem so that avbtool can produce the same
output with same input.

Adding timestamp/uuid to filesystem so that resulting image can be
deterministic.

Bug: 229784558
Test: m com.android.virt
      # remove intermediates and touch some sources
      m com.android.virt
      # compare two built artifacts
Change-Id: I4e4668fd0ac42a35bea5a33ec3ae8c362b6a6bd2
2022-04-21 14:36:40 +09:00
Jooyung Han
0fbbc2b0d4 android_system_image only packages "system" items
android_system_image filers packaging items installed outside "system"
partition.

Some packaging items install related items to different partitions but
putting them altogether to android_system_image doesn't make sense.
(android_system_image is suppposed to be "system" partition)

To be specific, this filters out "apex" partition items.  "apex"
partition is used by APEX installation to install APEX contents to paths
similar to activated paths on device so that symbol lookup works well
with APEX contents.

Bug: 225121718
Test: atest MicrodroidHostTestCases
Test: debugfs <intermediate>/microdroid.img -R 'ls system'
  shows no "com.android.runtime"
Change-Id: Ibc3d85ead2fda99e231132ce8ab9ccf1cc9317b7
2022-03-29 07:56:02 +09:00
Jooyung Han
a883428293 Move GatherPackagingSpecs out of CopyDepsToZip
This gives a PackageModule a chance to filter/customize the contents of
resulting package.

Bug: 225121718
Test: m (no changes)
Change-Id: I45505e8234dff42201dc40d4f038e7b08eea89f0
2022-03-28 14:29:14 +09:00
Colin Cross
c68db4b305 Remove InstallBypassMake and ToMakePath
InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-12-15 15:22:53 -08:00
Jiyong Park
fa616137a2 android_system_image that generates linker.config.pb
android_system_image module type is a specialization of the
android_filesystem module type. Currently, it adds a build rule for
creating linker.config.pb from the information about all the other files
in the filesystem and includes linker.config.pb to the filesystem as
well.

To do so, the filesystem module now provides a function pointer which
subtype modules like android_system_image can implement to pass extra
files that they want to package in the filesystem.

In addition, the linkerconfig package is revised to make it possible to
build linker.config.pb file outside of the package.

Bug: 185391776
Test: m microdroid and inspect etc/linker.config.pb in it.

Change-Id: Id89c40b519213062860d7306029b8413d8d36a2d
2021-04-21 09:11:21 +09:00
Jooyung Han
9706cbc1e9 Add filesystem_test.go
It has only one test function as a starting point.

Bug: n/a
Test: m (soong tests)
Change-Id: I785b096805014a40dfd600f7baaf884f4016c23c
2021-04-16 13:20:02 +09:00
Treehugger Robot
9b6108f8de Merge "Fix PackagingBase.CopyDepsToZip" 2021-03-23 04:21:38 +00:00
Jooyung Han
092ef811a0 Fix PackagingBase.CopyDepsToZip
CopyDepsToZip() zips direct dependencies with tags implementing
PackagingItem interface.

Previously, it relied on InstallNeededDependencyTag which has a
different meaning.
- InstallNeededDependencyTag tells whether a dependency is required to
  be installed together.
- PackagingItem tells whether a dependency (of PackagingBase) is
  required to be packaged.

With the separation of InstallNeededDependencyTag and PackagingItem,
PackagingBase module can distinguish cases which were not available
before.(I = InstallNeededDependencyTag, P = PackagingItem)

   a (PackagingBase module)
   |
   |`--(I)--> b
   |
   |`--(P)--> c --(I)--> d
   |
    `--(I/P)--> e

a's CopyDepsToZip(): [c, d, e]

Test: m nothing (packaging_test)
Change-Id: I71fce29b19b0f00dc394981bcf4240e9c1041c7a
2021-03-17 11:54:53 +09:00
Jiyong Park
972e06c41f Add vbmeta module type
The module type is to create vbmeta image out of other partitions.

Bug: 180676957
Test: m microdroid_vbmeta microdroid_vbmeta_system
Inspect the built image using `avbtool info_image --image <image>`

Change-Id: Iac92e9ab1640dcd488af69842e09850a91262bf1
2021-03-16 11:34:11 +09:00
Jiyong Park
ac4076de9d bootimg signs image using verity_utils
Previously, bootimg signed the image using avbtool. This didn't work
because avbtool always requires that the partition size is given via
'--partition_size' parameter. The partition size is hard to estimate
especially when the image is not for a real physical partition, but for
a logical partition in a composite image.

With this change, the signing of bootimg is done by verity_utils.py
which internally uses avbtool. The python script is capable of
calculating the minimum required partition size when the partition size
is not given.

In addition, this change adds 'partition_name' property to the
`android_filesystem` module type so that we can customize the partition
name field in the vbmeta descriptor.

Bug: 180676957
Test: m microdroid-boot-5.10
Change-Id: I2e4aa626cf06a2177b4a8d90ff9b9006d2927ae4
2021-03-16 00:34:57 +09:00
Treehugger Robot
277303f042 Merge "Add ctx to AndroidMkExtraEntriesFunc" 2021-02-22 22:40:31 +00:00
Colin Cross
aa2555387d Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-19 23:05:40 +00:00
Inseob Kim
14199b07f7 Add dirs and symlinks property to filesystem
Dirs and symlinks will be created under the root of the filesystem.
Basic essential directories like "dev", "proc", "sys" and symlinks like
"bin -> /system/bin", "init -> /system/bin/init" can be created with
these properties.

Bug: 179652970
Test: boot with aosp_cf_x86_64_only_phone, see adb works
Change-Id: Ie06dc5a93635ea8b1e18be517ed8615b6c82fee6
2021-02-17 14:05:12 +09:00
Inseob Kim
2ce1b5dc3a Add base_dir property to filesystem
Deps have been installed to "system/" because of hard-coded mount point
"system". Now they are installed to base_dir, and mount point is set to
root.

Bug: 179652970
Test: see contents of microdroid.img
Change-Id: Ie03b539a1688db7002bb178823b39017a83ce840
2021-02-17 13:07:18 +09:00
Treehugger Robot
b3f9025b6e Merge "Support uncompressed cpio" 2021-02-05 15:57:22 +00:00
Treehugger Robot
364da36115 Merge changes I6a5357e9,I199f070e
* changes:
  Install ko to /lib/modules
  android_filesystem is OutputFileProducer
2021-02-05 03:39:51 +00:00
Jiyong Park
837cdb2212 Support uncompressed cpio
Bug: 178978059
Test: atest VirtualizationHostTestCases
Change-Id: I1f69af40f10d14ec2f3de6111d12b3a9c5d6c75c
2021-02-05 00:29:47 +09:00