Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 999
Naveen Avatar asked Feb 10 '17 06:02

Naveen


People also ask

What does adb reboot do?

This command reboots your device in normal mode. You'll typically run this command after you've flashed something to your device and need to reboot. This command can also be useful if you're encountering issues with your Android device – for example, if your smartphone suddenly becomes unresponsive.

What adb reboots the reboot and device?

Type adb reboot and press Enter. It will soon restart the phone.

What is adb reboot recovery?

It's a mode just like recovery mode but allows you to flash custom files using ADB and fastboot. Reboot to recovery – it reboots your device into the recovery mode.

Does rebooting bootloader delete everything?

If you unlocked the bootloader, you are then allowed to install a custom OS. If done correctly, you can customize your phone to a greater extent. But you need to note that it may also cause your phone and downloaded apps to stop working properly. And, unlocking the bootloader will delete all data on your phone.


1 Answers

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.

like image 179
Alex P. Avatar answered Sep 30 '22 06:09

Alex P.