blob: 5a9badb0d0cc3f5aaee598f7e721a5b2580d617c [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Debugfs initialization script"
author "chromium-os-dev@chromium.org"
# Initialize tracefs after it's mounted in the startup job (the chromeos_startup
# script). Labeling tracefs is compute intensive and is moved out of the
# critical path of boot.
start on stopped startup
# Other jobs that depend on this job need to wait unitl this job completes.
task
# Disable OOM killer as we must never fail.
oom score never
script
# Restore SELinux context for tracefs files.
if [ -f /sys/fs/selinux/enforce ]; then
# Launch a background job for the default instance.
restorecon -R /sys/kernel/debug/tracing \
-e /sys/kernel/debug/tracing/instances &
# /sys/kernel/debug/tracing/instances contains non-default instances of
# tracefs (currently only drm).
# Launch a background job for each instance.
for dir in /sys/kernel/debug/tracing/instances/* ; do
if [ -e "${dir}" ]; then
restorecon -R "${dir}" &
fi
done
wait
fi
end script