← Back to Blogs

Init RC Files in AOSP

How Android services are declared and started

1 min read

.rc files are read by the init process (PID 1) very early in the Android boot sequence. They define which services to start, which file systems to mount, what properties to set, and what actions to trigger when certain events happen. Understanding .rc files is essential for anyone working on AOSP daemons or boot customization.

Where RC Files Live

RC File Syntax

RC File - Key Sections

  # ── SERVICE DEFINITION ───────────────────────
  service adbd /system/bin/adbd
      class core                 # service class group
      socket adbd stream 660 system system
      disabled                   # don't start automatically
      seclabel u:r:adbd:s0       # SELinux label

  # ── ACTION / TRIGGER ─────────────────────────
  on early-init
      setprop sys.init.early 1

  on property:sys.boot_completed=1
      start myvendordaemon

  # ── IMPORT OTHER RC FILES ────────────────────
  import /vendor/etc/init/myhal.rc

Service Options

Init Triggers (Actions)

Tip: To debug init issues, use 'adb shell dmesg | grep init' or 'adb logcat -s init'. To check whether a service is running: 'adb shell getprop init.svc.<service_name>' - returns 'running', 'stopped', or 'restarting'.