Merge "Add partition-related variables to soong_config.mk" into main
diff --git a/core/Makefile b/core/Makefile
index 099df47..74c6834 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5949,20 +5949,6 @@
fi
endef
-# This is the same as the non-hermetic version, but also accepts a list of files in the directory
-# to copy. It will only copy those files. This is so that we don't copy extra files that could've
-# been built in the staging directories by prior builds.
-# $(1): Directory to copy
-# $(2): Location to copy it to
-# $(3): A list of files in the $(1) directory, only these files will be copied
-define package_files-copy-root-hermetic
- $(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),
- $(call package_files-copy-root,$(1),$(2)),
- $(foreach f,$(filter $(strip $(1))/%,$(3)), \
- mkdir -p $(strip $(2))/$(dir $(patsubst $(strip $(1))/%,%,$(f)))$(newline) \
- $(ACP) -d $(f) $(strip $(2))/$(patsubst $(strip $(1))/%,%,$(f))$(newline)))
-endef
-
built_ota_tools :=
# We can't build static executables when SANITIZE_TARGET=address
@@ -6312,7 +6298,7 @@
$(BUILT_KERNEL_VERSION_FILE) \
| $(ACP)
@echo "Building target files: $@"
- $(hide) rm -rf $@ $(zip_root)
+ $(hide) rm -rf $@ $@.list $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)
ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT))$(filter true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)))
@# Components of the recovery image
@@ -6439,8 +6425,8 @@
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
ifdef BUILDING_SYSTEM_IMAGE
@# Contents of the system image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM,$(FULL_SYSTEMIMAGE_DEPS))
+ $(hide) $(call package_files-copy-root, \
+ $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
else ifdef INSTALLED_BUILD_PROP_TARGET
@# Copy the system build.prop even if not building a system image
@# because add_img_to_target_files may need it to build other partition
@@ -6450,48 +6436,48 @@
endif
ifdef BUILDING_USERDATA_IMAGE
@# Contents of the data image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_DATA),$(zip_root)/DATA,$(INSTALLED_USERDATAIMAGE_TARGET_DEPS))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_DATA),$(zip_root)/DATA)
endif
ifdef BUILDING_VENDOR_IMAGE
@# Contents of the vendor image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR,$(INTERNAL_VENDORIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
endif
ifdef BUILDING_PRODUCT_IMAGE
@# Contents of the product image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT,$(INTERNAL_PRODUCTIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
endif
ifdef BUILDING_SYSTEM_EXT_IMAGE
@# Contents of the system_ext image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT,$(INTERNAL_SYSTEM_EXTIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT)
endif
ifdef BUILDING_ODM_IMAGE
@# Contents of the odm image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_ODM),$(zip_root)/ODM,$(INTERNAL_ODMIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_ODM),$(zip_root)/ODM)
endif
ifdef BUILDING_VENDOR_DLKM_IMAGE
@# Contents of the vendor_dlkm image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM,$(INTERNAL_VENDOR_DLKMIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM)
endif
ifdef BUILDING_ODM_DLKM_IMAGE
@# Contents of the odm_dlkm image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_ODM_DLKM),$(zip_root)/ODM_DLKM,$(INTERNAL_ODM_DLKMIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_ODM_DLKM),$(zip_root)/ODM_DLKM)
endif
ifdef BUILDING_SYSTEM_DLKM_IMAGE
@# Contents of the system_dlkm image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_SYSTEM_DLKM),$(zip_root)/SYSTEM_DLKM,$(INTERNAL_SYSTEM_DLKMIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_SYSTEM_DLKM),$(zip_root)/SYSTEM_DLKM)
endif
ifdef BUILDING_SYSTEM_OTHER_IMAGE
@# Contents of the system_other image
- $(hide) $(call package_files-copy-root-hermetic, \
- $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER,$(INTERNAL_SYSTEMOTHERIMAGE_FILES))
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
endif
@# Extra contents of the OTA package
$(hide) mkdir -p $(zip_root)/OTA
@@ -6580,8 +6566,7 @@
endif
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
@# If breakpad symbols have been generated, add them to the zip.
- $(call package_files-copy-root, \
- $(TARGET_OUT_BREAKPAD),$(zip_root)/BREAKPAD)
+ $(hide) cp -R $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
endif
ifdef BOARD_PREBUILT_VENDORIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
diff --git a/target/board/emulator_arm64/BoardConfig.mk b/target/board/emulator_arm64/BoardConfig.mk
index 963e558..c16e61b 100644
--- a/target/board/emulator_arm64/BoardConfig.mk
+++ b/target/board/emulator_arm64/BoardConfig.mk
@@ -51,9 +51,6 @@
include build/make/target/board/BoardConfigGsiCommon.mk
include build/make/target/board/BoardConfigEmuCommon.mk
-TARGET_NO_KERNEL := false
-BOARD_USES_RECOVERY_AS_BOOT := true
-
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x02000000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
diff --git a/tools/aconfig/Android.bp b/tools/aconfig/Android.bp
index 28bf8a5..02fc57c 100644
--- a/tools/aconfig/Android.bp
+++ b/tools/aconfig/Android.bp
@@ -34,12 +34,13 @@
// host binary: aconfig
-rust_protobuf_host {
+rust_protobuf {
name: "libaconfig_protos",
protos: ["protos/aconfig.proto"],
crate_name: "aconfig_protos",
source_stem: "aconfig_protos",
use_protobuf3: true,
+ host_supported: true,
}
rust_defaults {
@@ -192,4 +193,4 @@
rustlibs: [
"libaconfig_test_rust_library_with_test_mode",
],
-}
\ No newline at end of file
+}
diff --git a/tools/aconfig/printflags/Android.bp b/tools/aconfig/printflags/Android.bp
new file mode 100644
index 0000000..5d73d96
--- /dev/null
+++ b/tools/aconfig/printflags/Android.bp
@@ -0,0 +1,16 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+rust_binary {
+ name: "printflags",
+ edition: "2021",
+ clippy_lints: "android",
+ lints: "android",
+ srcs: ["src/main.rs"],
+ rustlibs: [
+ "libaconfig_protos",
+ "libanyhow",
+ "libprotobuf",
+ ],
+}
diff --git a/tools/aconfig/printflags/src/main.rs b/tools/aconfig/printflags/src/main.rs
new file mode 100644
index 0000000..a9f7c03
--- /dev/null
+++ b/tools/aconfig/printflags/src/main.rs
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//! `printflags` is a device binary to print feature flags.
+
+use aconfig_protos::aconfig::Parsed_flags as ProtoParsedFlags;
+use anyhow::Result;
+use std::collections::HashMap;
+use std::fs;
+
+fn main() -> Result<()> {
+ let mut flags: HashMap<String, Vec<String>> = HashMap::new();
+ for partition in ["system", "system_ext", "product", "vendor"] {
+ let path = format!("/{}/etc/aconfig_flags.pb", partition);
+ let Ok(bytes) = fs::read(&path) else {
+ eprintln!("warning: failed to read {}", path);
+ continue;
+ };
+ let parsed_flags: ProtoParsedFlags = protobuf::Message::parse_from_bytes(&bytes)?;
+ for flag in parsed_flags.parsed_flag {
+ let key = format!("{}.{}", flag.package(), flag.name());
+ let value = format!("{:?} + {:?} ({})", flag.permission(), flag.state(), partition);
+ flags.entry(key).or_default().push(value);
+ }
+ }
+ for (key, value) in flags {
+ // TODO: if the flag is READ_WRITE (for any partition), call "device_config get" to obtain
+ // the flag's current state, and append value to the output
+ println!("{}: {}", key, value.join(", "));
+ }
+ Ok(())
+}