Commit graph

237 commits

Author SHA1 Message Date
Hridya Valsaraju
b39ec7084a Add a build flag to turn on debugfs restrictions
Starting with Android R launched devices, debugfs cannot be mounted in
production builds. In order to avoid accidental debugfs dependencies
from creeping in during development with userdebug/eng builds, this
patch introduces a build flag that can be set by vendors to enforce
additional debugfs restrictions for userdebug/eng builds. The same flag
will be used to enable sepolicy neverallow statements to prevent new
permissions added for debugfs access.

Bug: 184381659
Test: make with/without PRODUCT_SET_DEBUGFS_RESTRICTIONS
Change-Id: I9aff974da7ddce9bf1a7ec54153b161527b12062
2021-04-07 16:47:59 -07:00
Yi-Yo Chiang
875442fde4 Remove obsolete var PRODUCT_CHECK_ELF_FILES
After aosp/1184262 is submitted, PRODUCT_CHECK_ELF_FILES is deprecated
and nobody is using this variable anymore.

Bug: 149715904
Test: Presubmit; Should be noop
Change-Id: Iaf4a6ae1fe4062684a9699b7ef999030ff483e16
2021-03-29 18:35:51 +08:00
Treehugger Robot
9ae28a750a Merge "Add filter to some boolean variables" 2021-03-24 23:20:53 +00:00
Inseob Kim
ce0671f057 Merge "Add WithDexpreopt soong variable" 2021-03-24 06:20:03 +00:00
Inseob Kim
3dfb8b8d7a Add filter to some boolean variables
add_json_bool converts non-empty string to true, and empty string to
false. But some of boolean variables are meant to be set either "true"
or "false". In that case "false" may lead to a mismatch. This adds
filter to boolean variables which are directly compared to "true", like

    ifeq ($(VAR),true)

Bug: 183483152
Test: build
Change-Id: I0dc4a05293a3233ae4958335781a19e6445a3799
2021-03-24 14:20:33 +09:00
Inseob Kim
84a8be3c52 Add WithDexpreopt soong variable
Test: m selinux_policy on sc-arc
Change-Id: Ieae24f65d74179d0604040a95f8aff4b027a2949
2021-03-23 23:21:24 +00:00
Inseob Kim
35f63019c9 Fix SepolicySplit soong variable
It should be "filtered" by "true" because all non-empty values become
true when using add_json_bool.

Test: m selinux_policy on sc-arc
Change-Id: I35d5881d83746230793cf8ced76885607e82334a
2021-03-23 20:47:39 +09:00
Inseob Kim
232f6ac676 Add PlatformSepolicyVersion to soong_config
PlatformSepolicyVersion and BoardSepolicyVers haven't assigned correctly
so far. Below is the reason why it hasn't been discovered yet.

DeviceConfig.PlatformSepolicyVersion() was added to support mixed
sepolicy build (setting BOARD_SEPOLICY_VERS and building vendor sepolicy
with old plat policy files). Soong compares PlatformSepolicyVersion()
and BoardSepolicyVers(), and used old vendor sources if both are
different. Back then, the only place where such logic played a role was
selinux contexts. Test codes were running as intended: after setting
BOARD_SEPOLICY_VERS the context files were built against old policies.

But there were two mistakes:

1) PlatformSepolicyVersion() was not added to soong_config.mk, so it was
always empty.
2) BOARD_SEPOLICY_VERS was set to default in system/sepolicy/Android.mk,
which was processed after soong_config. So if BOARD_SEPOLICY_VERS was
not set in BoardConfig.mk, BoardSepolicyVers() was empty, not
PLATFORM_SEPOLICY_VERSION.

And there were no issues as Soong only checked equality.

To fix the issue correctly, this commit adds the variable
PlatformSepolicyVersion, and then handles BoardSepolicyVers correctly by
returning PlatformSepolicyVersion if it's empty.

Test: set BOARD_SEPOLICY_VERS and see vendor_file_contexts changes
Change-Id: I4e306ec1f5225094a39f0c8d94f5e7683d70d60e
2021-03-22 22:34:40 +09:00
Inseob Kim
a3ae471485 Add sepolicy related variables
Bug: 33691272
Test: build
Change-Id: Ifbcd2c49d6ecf6d7e69d6b95bace168eccd17f13
2021-03-17 18:04:56 +09:00
Justin DeMartino
f15053ee39 Allow extending of the list of directories to be scanned for VSDK
Bug: 180925851
Test: m nothing, manually
Change-Id: I499f084f04e45eb719882be97e3a581ff868cc98
2021-03-12 19:38:14 +00:00
Jeongik Cha
c5da20e886 Deprecate PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS
There is no module relying on PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS

Test: m
Bug: 150820813
Change-Id: I461ab2654513a3b921bec5d46c39d474b6324ca2
2021-02-19 21:49:59 +09:00
Treehugger Robot
32b84909a1 Merge changes from topic "vendor_property_enforce"
* changes:
  Set BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE for goldfish
  Add BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE to BoardConfig
  Add PRODUCT_SHIPPING_API_LEVEL to productVariables
2021-02-17 07:12:30 +00:00
Jose Galmes
7185c6c500 Implement directed recovery snapshot.
Bug: 177451657
Test: m -j nothing
Change-Id: I902afe71e7577c1c41371f1422512170edf6e492
2021-02-09 07:41:40 -08:00
Ioannis Ilkos
8e568c52ab Remove Use_lmkd_stats_log from build
Use_lmkd_stats_log used to control LMKD_LOG_STATS when compiling lmkd.

However, for newer Android releases, we mandate that lmkd informs statsd of process kills (change id I8cb123b9488fbc6e88863c2f0e75f1422bcd282e)
After aosp/1555318 we compile lmkd with statsd by default, so this setting is a noop.

Change-Id: I91bd08198fe2275fb8aca77ae5ea637df360d416
Test: build
Bug: 177985094
2021-02-08 11:17:55 +00:00
Inseob Kim
43f4ef0221 Add BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE to BoardConfig
Bug: 175526482
Test: m vendor_property_contexts after making violations
Change-Id: I81512fefbe952ecaf31fd4b5d276fd32c6253c7f
2021-02-03 18:17:49 +09:00
Inseob Kim
a0884b90ae Add PRODUCT_SHIPPING_API_LEVEL to productVariables
Bug: 175526482
Test: m selinux_policy
Change-Id: I10195730e47398bdb455d554a1cb7d6b7ac28634
2021-02-03 16:23:42 +09:00
Bill Peckham
ddf8f61ce5 Merge "Enable prebuilt hiddenapi CSV files." 2021-01-20 17:43:48 +00:00
Inseob Kim
890f84fe71 Merge "Implement directed vendor snapshot" 2021-01-20 01:17:23 +00:00
Bill Peckham
e3cf60911a Enable prebuilt hiddenapi CSV files.
By enabling these hiddenapi CSV files to be prebuilt, it
becomes possible to create a split build that supports
the hiddenapi encode dex step, but doesn't contain all
of the java sources needed to generate the CSV files.

Bug: 175048716
Test: m nothing
Test: new TestHiddenAPISingletonWithPrebuiltCsvFile
Test: local build without prebuilt hiddenapi
Test: local build with prebuilt hiddenapi
Change-Id: Ia38c5016d2aeba54aa537a5ce601898d46330730
2021-01-16 22:07:40 +00:00
Evgenii Stepanov
10b4d0ad5d Include/exclude paths for memtag sanitizer.
Bug: b/135772972
Test: none
Change-Id: Ib198c359b92b82573cb66fd6d993aece0e9ff7d9
2021-01-11 21:15:21 -08:00
Peter Collingbourne
fcd9ccf4a1 Remove ANDROID_EXPERIMENTAL_MTE.
Now that the feature guarded by this flag has landed in Linux 5.10
we no longer need the flag, so we can remove it.

Bug: 135772972
Change-Id: I02fa50848cbd0486c23c8a229bb8f1ab5dd5a56f
2021-01-11 10:55:51 -08:00
Jose "Pepe" Galmes
bee0c588a8 Merge "Support for recovery snapshot." 2021-01-06 21:17:54 +00:00
Inseob Kim
d8cc1352b5 Implement directed vendor snapshot
Vendors can now generate only needed modules by setting the following
Makefile variables:

- DIRECTED_VENDOR_SNAPSHOT: set to true
- VENDOR_SNAPSHOT_MODULES: list of snapshot candidates

e.g.

DIRECTED_VENDOR_SNAPSHOT := true
VENDOR_SNAPSHOT_MODULES := toybox_vendor sh_vendor libbase libcutils ...

Bug: 157967325
Test: m dist vendor-snapshot after setting those in BoardConfig.mk
Change-Id: Iea1ddbe78e143316fb6cb5027de90b9c83252f80
2021-01-06 23:10:41 +09:00
Inseob Kim
5cbfbf4ca7 Merge "Support building mixed versions of sepolicy" 2021-01-06 05:07:05 +00:00
Inseob Kim
fb7c801b67 Support building mixed versions of sepolicy
Now newer system policy and older vendor policy can be built together by
setting following variables:

- BOARD_SEPOLICY_VERS
- BOARD_REQD_MASK_POLICY (copy of older system/sepolicy/reqd_mask)
- BOARD_PLAT_VENDOR_POLICY (copy of older system/sepolicy/vendor)
- BOARD_(SYSTEM_EXT|PRODUCT)_(PUBLIC|PRIVATE)_PREBUILT_DIRS (copy of
  older system_ext and product policies)

Bug: 168159977
Test: try normal build and mixed build
Test: boot and check selinux denials
Change-Id: I4e2890c96cab69e60c83c60f8c396cfe049ec05b
2021-01-06 10:41:45 +09:00
Jiyong Park
cddea9b426 Add TARGET_FORCE_APEX_SYMLINK_OPTIMIZATION
The APEX symlink optimization is a build-time trick to save the
storage/RAM usage of APEX by replacing some files in APEX with symlinks
to the files in the system partition. The optimization however is
automatically turned off for 'updatable: true' APEXes because doing the
optimization for them will hide the sys-health implication until when
the APEXes are built unbundled (i.e. prebuilt) and thus the
optimization is impossible.

TARGET_FORCE_APEX_SYMLINK_OPTIMIZATION forcibly disables the safety net.
When it is set to true, the symlink optimization is done regardless of
the 'updatable' property. This is useful for some of the devices like Go
where most APEXes (even the 'updatable: true' ones) should be
effectively non-updatable.

Bug: 175630508
Test: TARGET_FORCE_APEX_SYMLINK_OPTIMIZATION=true m and check that
updatable APEXes have symlinks to system libs

Change-Id: I261fd4ab2dd8e62ff435306b11168121cbcf662a
2021-01-05 21:03:30 +09:00
Jose Galmes
5cd2547df9 Support for recovery snapshot.
Bug: 171231437
Test: source build/envsetup.sh
Test: ALLOW_MISSING_DEPENDENCIES=true m -j nothing
Change-Id: I6dbcf21ee26c53cd3ac573d118a99d68161aa2c7
2020-12-21 08:32:44 -08:00
Anton Hansson
e47d6e4a8c Merge "Add make support for Aml_abis and Ndk_abis options" 2020-12-16 11:38:49 +00:00
Anton Hansson
5e05b8ef31 Add make support for Aml_abis and Ndk_abis options
Add a new TARGET_ARCH_SUITE which, when set to 'mainline_sdk' or 'ndk',
sets `Aml_abis: true` in soong.variables.

This is required to enable removing the custom soong.variables that
are being maintained for the ndk and mainline sdk builds.

Bug: 174315599
Test: TARGET_ARCH_SUITE=mainline-sdk m nothing; inspect soong.variables
      (ditto for ndk)
Change-Id: Ib651a637457310270840d721cdccf50bede3ee58
2020-12-15 12:46:46 +00:00
Treehugger Robot
dec924e081 Merge "Revert^2 "Always turn on compatible property"" 2020-12-15 12:00:10 +00:00
Mohammad Islam
0a246e5e31 Merge "Add a product flag that will enable compressed APEX on device" 2020-12-09 14:34:42 +00:00
Mohammad Samiul Islam
c87781a020 Add a product flag that will enable compressed APEX on device
The product flag is only defined in this CL. No device has been
configured to use this flag yet.

The flag is overridable using environment variable. This way, developers
can enable APEX compression on various targets.

Bug: 137802149
Test: build/soong/soong_ui.bash --dumpvar-mode PRODUCT_COMPRESSED_APEX #false
Test: export OVERRIDE_PRODUCT_COMPRESSED_APEX \
  build/soong/soong_ui.bash --dumpvar-mode PRODUCT_COMPRESSED_APEX #true
Change-Id: I10e4909258cee9b4670bc3f10ff3a0ad5013c864
2020-12-03 14:58:47 +00:00
JaeMan Park
38e3f08248 Merge "Add java sdk library enforcement flag" 2020-12-02 04:39:08 +00:00
Jingwen Chen
341928ecc5 Remove SOONG, SOONG_BUILD_NINJA, SOONG_IN_MAKE and SOONG_BOOTSTRAP.
These variables appear to be unused since Nougat, when Soong was
invoked through Make. This is no longer the case, since soong_build is
now invoked through soong_ui.

https://cs.android.com/android/platform/superproject/+/android-7.1.2_r36:build/core/soong.mk

Test: TH presubmit
Change-Id: I1cfe63144d559fa0da0e54474ed1e36fb3fa0555
2020-11-23 02:06:57 -05:00
Inseob Kim
2e88158571 Revert^2 "Always turn on compatible property"
This reverts commit facfb54ee4.

Reason for revert: Fixed broken targets

Change-Id: Ia713b08cf15fd356494984964a1e61eaa9991266
2020-11-19 09:48:49 +00:00
Inseob Kim
facfb54ee4 Revert "Always turn on compatible property"
This reverts commit 9994e96c7d.

Reason for revert: broken targets on the internal branch

Change-Id: Ic440fb1ca6ae5774a1d51e8fe1f3724426511841
2020-11-18 11:04:17 +00:00
Inseob Kim
9994e96c7d Always turn on compatible property
It's mandatory for devices launching with Android P or later.
Some makefiles still depend on PRODUCT_COMPATIBLE_PROPERTY, so rather
than aggressively removing all codes, this forces
PRODUCT_COMPATIBLE_PROPERTY to be true.

Bug: 170082975
Test: m
Change-Id: I49dab8d573c21781e6295a8581a5ad2944e165d7
2020-11-17 10:00:40 +00:00
JaeMan Park
afdd39fd10 Add java sdk library enforcement flag
Add java sdk library enforcement for inter-partition library
dependency, for ensuring backward-compatible libraries for
inter-partition dependencies.

Test: m nothing
Bug: 168180538
Change-Id: I6bfac54c3499b03003a3bc6c2bb62b165b4ce5f9
2020-11-06 01:34:39 +00:00
Paul Duffin
bbd4fae4d7 Move boot jars package check to Soong
Passes the SKIP_BOOT_JARS_CHECK property through to Soong and removes
the boot jars check. Moves the check_boot_jars directory containing the
script and data file into build/soong/scripts.

Test: m check-boot-jars - for failing and passing cases
      verified manually that apart from path differences the same
      files (same check sum) were checked in both old make checks and
      the new Soong ones
Bug: 171479578
Change-Id: I61c128806065befce239bbdd5491567827e1b2f5
2020-10-29 11:07:55 +00:00
Yifan Hong
21f97e27be Export BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT to Soong
Test: pass
Bug: 156098440
Change-Id: I84f26f7f12c53c0cc120c8122e75f68571794ac7
2020-10-21 15:44:03 -07:00
Steven Moreland
1162536936 Merge "Reflect MALLOC_ZERO_CONTENTS default true." 2020-10-13 16:49:16 +00:00
Steven Moreland
38c8824187 Reflect MALLOC_ZERO_CONTENTS default true.
See corresponding build/soong change. This change sets the android
platform to zero all heap allocations by default. To give some
intuition for why this is no so underperformant, zeroing memory is one
way of priming caches.

The main goal of this is to prevent accidental reliance on allocations
being zero, which is UB in C++. In some situations, allocations are
almost always guaranteed to be 0, and so resulting flakes can be
extremely rare.

Bug: 131355925
Test: allocated memory successfully getting zerod
Change-Id: I8c27fbc8c06420a15d022eb810595599d1e56aa0
2020-10-12 18:44:05 +00:00
Felix Elsner
d7df770c4a soong_config: Support SYSTEM_EXT* sepolicy vars
The new variable name reflects its actual usage.

Keep compatibility with BOARD_PLAT_* because it has been a
convention for years. Also add warning messages for BOARD_PLAT_*
variables via KATI_deprecated_var.

Test: `make selinux_policy` with
      `SYSTEM_EXT_{PUBLIC,PRIVATE_SEPOLICY_DIRS}` set,
      observe additions in `$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/selinux`

Signed-off-by: Felix Elsner <google@ix5.org>
Change-Id: I58c64839cc513ae082cd3ee3c1e108843ea7439e
2020-10-07 15:56:52 +08:00
Felix Elsner
501ca68fd5 soong_config: Plat->SystemExt*SepolicyDirs
Align with changes in build/soong and system/sepolicy.

Test: build

Signed-off-by: Felix Elsner <google@ix5.org>
Change-Id: I73b773a4fb0bd626a989251d5c61381fcafaa1eb
2020-10-07 15:56:03 +08:00
Jeongik Cha
0d1d98157a Introduce BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES
If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value,
it replaces "current" or "system_current" with the version which
the flag indicates.

Bug: 163009188
Test: BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES=29 m, and then check if every vendor
java module's sdk_version is 29 if its sdk_version was current.

Change-Id: I8c7cf21563b984b8e9ef398192031b1f66d96494
2020-08-24 23:16:19 +09:00
Dan Willemsen
a3f6632de9 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Test: treehugger
Change-Id: Iea6caf3c08252a560155e095135c5ddaad712991
Merged-In: Iea6caf3c08252a560155e095135c5ddaad712991
2020-08-11 01:12:01 +00:00
Jeongik Cha
66853bb381 Merge changes from topic "b/160390776"
* changes:
  Unset ENABLE_PREOPT when DISABLE_PREOPT is set
  Introduce TARGET_BUILD_UNBUNDLED_IMAGE
2020-08-10 00:51:56 +00:00
Yifan Hong
3c1041fb22 Add BOARD_KERNEL_MODULE_INTERFACE_VERSIONS.
This is a list of KMI versions used to filter gki_apex modules. Only
gki_apex modules with kmi_version field that are in the list are created.

Test: build GKI APEXes
Bug: 162888350
Change-Id: I0f582f6ea200d52482fd4065c8f4f8b32efc4dee
2020-08-05 15:45:23 -07:00
Jeongik Cha
d05b57a362 Introduce TARGET_BUILD_UNBUNDLED_IMAGE
- TARGET_BUILD_UNBUNDLED_IMAGE is similar to TARGET_BUILD_APPS, but
its targets are the unbundled partitions instead of apps.
- Rename TARGET_BUILD_APPS_USE_PREBUILT_SDK to TARGET_BUILD_USE_PREBUILT_SDKS
because it is used even without TARGET_BUILD_APPS.
-Instead of TARGET_BUILD_APPS, use TARGET_BUILD_USE_PREBUILT_SDKS
to build java modules with prebuilt sdks, and propagate to Soong.

Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage
Change-Id: Ie096212ccbcca0018baae55e106af693b002c9e5
2020-08-03 15:47:09 +09:00
Yifan Hong
1ba1092e0a Merge "Add BOARD_KERNEL_BINARIES." 2020-07-31 19:13:38 +00:00