Before we start to build recovery for our x86vbox device, we will analyze the code flow of recovery to understand how it works. There are two ways to enter recovery mode from the end user perspective. When users want to perform a factory reset or an OTA update is available, the main system can write a recovery command to the bootloader control block (BCB) and cache partition before resetting the system.
The second way to enter recovery mode is to use a key combination manually. After turning off the phone, press a key combination at the same time to enter the recovery mode manually. The key combination is defined by the device manufacturing, for example, it can be a combination of volume down and power buttons.
In both cases, entering the recovery mode is closely related to the implementation of bootloader. The Android system, recovery, and bootloader communicate with each other using two interfaces...