Merge "Let init mount/unmount debugfs for non-user builds" am: 8376d87e2d am: 2bd8b0a33a am: 54be11cf54

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1542228

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iad2c594e104d94f792ec1cbb34627397be42cff9
This commit is contained in:
Treehugger Robot 2021-01-13 05:52:23 +00:00 committed by Automerger Merge Worker
commit c7a6f9d544
2 changed files with 22 additions and 0 deletions

View file

@ -878,6 +878,21 @@ int SecondStageMain(int argc, char** argv) {
auto is_installed = android::gsi::IsGsiInstalled() ? "1" : "0";
SetProperty(gsi::kGsiInstalledProp, is_installed);
/*
* For debug builds of S launching devices, init mounts debugfs for
* enabling vendor debug data collection setup at boot time. Init will unmount it on
* boot-complete after vendor code has performed the required initializations
* during boot. Dumpstate will then mount debugfs in order to read data
* from the same using the dumpstate HAL during bugreport creation.
* Dumpstate will also unmount debugfs after bugreport creation.
* first_api_level comparison is done here instead
* of init.rc since init.rc parser does not support >/< operators.
*/
auto api_level = android::base::GetIntProperty("ro.product.first_api_level", 0);
bool is_debuggable = android::base::GetBoolProperty("ro.debuggable", false);
auto mount_debugfs = (is_debuggable && (api_level >= 31)) ? "1" : "0";
SetProperty("init.mount_debugfs", mount_debugfs);
am.QueueBuiltinAction(SetupCgroupsAction, "SetupCgroups");
am.QueueBuiltinAction(SetKptrRestrictAction, "SetKptrRestrict");
am.QueueBuiltinAction(TestPerfEventSelinuxAction, "TestPerfEventSelinux");

View file

@ -934,6 +934,9 @@ on boot && property:ro.config.low_ram=true
write /proc/sys/vm/dirty_expire_centisecs 200
write /proc/sys/vm/dirty_background_ratio 5
on property:sys.boot_completed=1 && property:init.mount_debugfs=1
umount /sys/kernel/debug
on boot
# basic network init
ifup lo
@ -1202,6 +1205,10 @@ on userspace-reboot-resume
on property:sys.boot_completed=1 && property:sys.init.userspace_reboot.in_progress=1
setprop sys.init.userspace_reboot.in_progress ""
on early-init && property:init.mount_debugfs=1
mount debugfs debugfs /sys/kernel/debug
chmod 0755 /sys/kernel/debug
# Migrate tasks again in case kernel threads are created during boot
on property:sys.boot_completed=1
copy_per_line /dev/cpuctl/tasks /dev/cpuctl/system/tasks