Merge "trusty: storage: proxy: FS_READY property setting on vendor only" into main
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
deleted file mode 100644
index cde0cb2..0000000
--- a/fastboot/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2007 Google Inc.
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-#
-# Package fastboot-related executables.
-#
-
-my_dist_files := $(HOST_OUT_EXECUTABLES)/mke2fs
-my_dist_files += $(HOST_OUT_EXECUTABLES)/make_f2fs
-my_dist_files += $(HOST_OUT_EXECUTABLES)/make_f2fs_casefold
-$(call dist-for-goals,dist_files sdk,$(my_dist_files))
-my_dist_files :=
diff --git a/init/README.md b/init/README.md
index de57208..560c528 100644
--- a/init/README.md
+++ b/init/README.md
@@ -501,9 +501,10 @@
       reformatted here if it couldn't mount in first-stage init.
    6. `post-fs-data-checkpointed` - Triggered when vold has completed committing a checkpoint
       after an OTA update. Not triggered if checkpointing is not needed or supported.
-   7. `zygote-start` - Start the zygote.
-   8. `early-boot` - After zygote has started.
-   9. `boot` - After `early-boot` actions have completed.
+   7. `bpf-progs-loaded` - Starts things that want to start ASAP but need eBPF (incl. netd)
+   8. `zygote-start` - Start the zygote.
+   9. `early-boot` - After zygote has started.
+  10. `boot` - After `early-boot` actions have completed.
 
 Commands
 --------
diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp
index ece430b..c26b31e 100644
--- a/init/first_stage_mount.cpp
+++ b/init/first_stage_mount.cpp
@@ -156,6 +156,13 @@
     return fstab;
 }
 
+static bool IsRequestingMicrodroidVendorPartition(const std::string& cmdline) {
+    if (virtualization::IsEnableTpuAssignableDeviceFlagEnabled()) {
+        return access("/proc/device-tree/avf/vendor_hashtree_descriptor_root_digest", F_OK) == 0;
+    }
+    return cmdline.find("androidboot.microdroid.mount_vendor=1") != std::string::npos;
+}
+
 // Note: this is a temporary solution to avoid blocking devs that depend on /vendor partition in
 // Microdroid. For the proper solution the /vendor fstab should probably be defined in the DT.
 // TODO(b/285855430): refactor this
@@ -166,7 +173,7 @@
     if (!ReadDefaultFstab(&fstab)) {
         return Error() << "failed to read fstab";
     }
-    if (cmdline.find("androidboot.microdroid.mount_vendor=1") == std::string::npos) {
+    if (!IsRequestingMicrodroidVendorPartition(cmdline)) {
         // We weren't asked to mount /vendor partition, filter it out from the fstab.
         auto predicate = [](const auto& entry) { return entry.mount_point == "/vendor"; };
         fstab.erase(std::remove_if(fstab.begin(), fstab.end(), predicate), fstab.end());
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 4b3ad82..d80416d 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -568,6 +568,7 @@
 
     # Should be before netd, but after apex, properties and logging is available.
     trigger load_bpf_programs
+    trigger bpf-progs-loaded
 
     # Now we can start zygote.
     trigger zygote-start
@@ -1109,6 +1110,9 @@
 on property:vold.checkpoint_committed=1
     trigger post-fs-data-checkpointed
 
+on bpf-progs-loaded
+    start netd
+
 # It is recommended to put unnecessary data/ initialization from post-fs-data
 # to start-zygote in device's init.rc to unblock zygote start.
 on zygote-start
@@ -1116,7 +1120,6 @@
     # A/B update verifier that marks a successful boot.
     exec_start update_verifier
     start statsd
-    start netd
     start zygote
     start zygote_secondary