Use /proc/device-tree for reading AVF DT
Although /proc/device-tree is symlink to /sys/firmware/devicetree/base,
/proc/device-tree is the stable API but the absolute path may be
changed in the future.
Bug: 322465386
Test: atest CustomPvmfwHostTestCases
Change-Id: I0d55918b6ec4563135c596649ccfd4bd84284963
diff --git a/microdroid/fstab.microdroid b/microdroid/fstab.microdroid
index 2742757..3209442 100644
--- a/microdroid/fstab.microdroid
+++ b/microdroid/fstab.microdroid
@@ -2,4 +2,4 @@
# This is a temporary solution to unblock other devs that depend on /vendor partition in Microdroid
# The /vendor partition will only be mounted if the kernel cmdline contains
# androidboot.microdroid.mount_vendor=1.
-/dev/block/by-name/microdroid-vendor /vendor ext4 noatime,ro,errors=panic wait,first_stage_mount,avb_hashtree_digest=/sys/firmware/devicetree/base/avf/vendor_hashtree_descriptor_root_digest
+/dev/block/by-name/microdroid-vendor /vendor ext4 noatime,ro,errors=panic wait,first_stage_mount,avb_hashtree_digest=/proc/device-tree/avf/vendor_hashtree_descriptor_root_digest
diff --git a/microdroid/init_debug_policy/src/init_debug_policy.rs b/microdroid/init_debug_policy/src/init_debug_policy.rs
index 6c80926..90d04ac 100644
--- a/microdroid/init_debug_policy/src/init_debug_policy.rs
+++ b/microdroid/init_debug_policy/src/init_debug_policy.rs
@@ -29,11 +29,10 @@
}
fn main() -> Result<(), PropertyWatcherError> {
- // If VM is debuggable or debug policy says so, send logs to outside ot the VM via the serial console.
- // Otherwise logs are internally consumed at /dev/null
+ // If VM is debuggable or debug policy says so, send logs to outside ot the VM via the serial
+ // console. Otherwise logs are internally consumed at /dev/null
let log_path = if system_properties::read_bool("ro.boot.microdroid.debuggable", false)?
- || get_debug_policy_bool("/sys/firmware/devicetree/base/avf/guest/common/log")
- .unwrap_or_default()
+ || get_debug_policy_bool("/proc/device-tree/avf/guest/common/log").unwrap_or_default()
{
"/dev/hvc2"
} else {
@@ -42,8 +41,7 @@
system_properties::write("ro.log.file_logger.path", log_path)?;
let (adbd_enabled, debuggable) = if system_properties::read_bool("ro.boot.adb.enabled", false)?
- || get_debug_policy_bool("/sys/firmware/devicetree/base/avf/guest/microdroid/adb")
- .unwrap_or_default()
+ || get_debug_policy_bool("/proc/device-tree/avf/guest/microdroid/adb").unwrap_or_default()
{
// debuggable is required for adb root and bypassing adb authorization.
("1", "1")