InsaneCoder
InsaneCoder

Reputation: 8268

How "adb reboot bootloader" works internally?

I am seeing an issue with my android images where the command adb reboot bootloader simply reboots back the android, instead of going to bootloader mode.

In order to fix the issue, I did some study and find that there are acually two things, adb and adbd and the host and target devices communicate using the TCP protocol over sockets.

So, the interesting thing is commands like adb shell and adb devices are working but not the reboot bootloader. I want to understand what the adbd on receiving the reboot bootloader. Does it change the boor order, sets some flag, changes EFI vars....?

Can you please point to some good links or understanding you can share?

PS : I am working on embedded device environ, similar to raspberry pi...

Upvotes: 7

Views: 7311

Answers (1)

Alex P.
Alex P.

Reputation: 31676

This is how adb reboot bootloader works on a standard Android device connected via USB (the only transport supported by the standard Android bootloader in the fastboot mode):

  1. adb client sends the reboot bootloader command to the adb server (over TCP)
  2. adb server forwards the reboot bootloader command to the adbd on the device (over USB)
  3. adbd sets the sys.powerctl property to reboot,bootloader
  4. sys.powerctl change triggers the init.rc rule which runs powerctl init's built-in
  5. which does _NR_reboot syscall
  6. which sets the reboot to bootloader flag and reboots the device

On the next power up the bootloader would see the flag and go to the fastboot mode. But only if USB is connected.

Upvotes: 12

Related Questions