0

I am currently reading /proc/cmdline to determine a device's boot reason. Currently, I am using Android's Canonical Boot Reason from the bootloader to determine why the device booted. I just read the values for androidboot.bootreason, eg

androidboot.bootreason=reboot
androidboot.bootreason=bootloader
androidboot.bootreason=PMIC_cold_reboot

Is there a Linux Kernel API to do something similar?

Bret Joseph
  • 401
  • 3
  • 13
  • 1
    "*Is there a Linux Kernel API to do something similar?*" -- AFAIK, no. The file **/proc/cmdline** does not contain any "*device's boot reason*". Depending on the kernel's build configuration, the command line could be hardcoded and the same text for every boot. Some SoCs have a *Reset Controller*, which can be interrogated through its driver as to the cause/reason for the startup (e.g. power-on, watchdog reset, software reset, etc.). Also note the kernel typically doesn't know (nor care) which device(s) was/were the boot medium/media. – sawdust Aug 06 '23 at 22:20

0 Answers0