summaryrefslogtreecommitdiffstats
path: root/recovery_main.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-03-29recovery: Remove SetUsbConfig() out of common.h.Tao Bao1-0/+6
libinstall now has its own copy. Test: mmma -j bootable/recovery Change-Id: Ibbe7084e15baeb7e744f2175d5944477092acc9e
2019-03-29Move install to separate modulexunchang1-1/+1
Build libinstall as a shared library. Also drop the dependency on the global variables in common.h. Test: unit tests pass, sideload an OTA Change-Id: I30a20047768ce00689fc0e7851c1c5d712a365a0
2019-03-21Move librecovery_ui to a sub-directoryTianjie Xu1-3/+3
This helps to expose librecovery_ui for device specific RecoveryUi. Bug: 76436783 Test: mma, unit tests pass Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be (cherry picked from commit b5108c372c8b92671ea5ebb4eeff00757fcee187)
2019-03-21Move librecovery_ui to a sub-directoryTianjie Xu1-3/+3
This helps to expose librecovery_ui for device specific RecoveryUi. Bug: 76436783 Test: mma, unit tests pass Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
2019-03-01Use android::base::Pipe.Tao Bao1-15/+12
Also clean up the comments regarding updater/recovery protocol. Test: Sideload a package on taimen. Check that /tmp/recovery.log contains the log from update_engine_sideload. Test: Factory reset on taimen. Check that log file has the info from mke2fs. Change-Id: If560269ce7007769fc85a63bd228813bdd75bebd
2019-02-12Add a logo to the fastbootd screen.David Anderson1-0/+2
fastbootd looks too much like recovery, even if you're carefully reading the menu. It's not obvious the device is in a flashing mode, and it's too tempting to reboot or unplug the device in this state. As a first step, this patch adds a big red "fastbootd" logo so it's less obviously in recovery mode. Bug: 120429730 Test: manual test Change-Id: I73359f1fdfdc0b1694993f760fe7f35c5713b24e
2018-11-16logical -> dynamic partitions.Yifan Hong1-2/+2
Reflect a name change. Test: boots Test: boot into recovery Bug: 119286600 Change-Id: I7c323f27574ce033b8fc1750aab00f7300c5cc84
2018-10-30recovery: Fix mounting /system with dynamic partitions.David Anderson1-2/+7
When using dynamic partitions, the blk_device field in fstab_rec must be translated to a /dev/block/dm-N node with fs_mgr_update_logical_partition. However, init will not have created these nodes to begin with since CreateLogicalPartitions is not called in recovery. This patch addresses both issues. Note that flashing system through fastbootd will not work while /system is mounted. Bug: 118634720 Test: manual test Change-Id: I06c83309d09eab6b65245b1ed10c51d05398f23e
2018-09-20Enter into userspace fastboot only if the device supports itHridya Valsaraju1-1/+2
Test: For devices not supporting logical partitions, 'adb reboot fastboot' command reboots into Android. Bug: 78793464 Change-Id: Ie6c6ccdebfee9302a9996ac5bc66069dbd817987
2018-09-18Show 'Enter Fastboot' menu item only if device supports fastbootdHridya Valsaraju1-0/+4
Bug: 112664456 Test: Manual, 'Enter Fastboot' option not visible. Change-Id: I2642391a69a11cd0496c1287130b3b0291c93232
2018-09-08Fix sideload for user devices by adding a new sideload configHridya Valsaraju1-5/+0
Bug: 113563995 Test: Tested the 'adb sideload' command on marlin user/userdebug builds and walleye user/userdebug builds Change-Id: I00d565547b85f2db87012e4a08316609e03395ac
2018-08-22recovery: Add "boot-fastboot" command to BCB.David Anderson1-1/+12
This change adds a new "boot-fastboot" command in order to boot into fastboot without overwriting recovery tasks. This also allows bootloaders to boot directly into userspace fastboot from the bootloader menu, or via bootloader fastboot. Bug: 112277594 Test: adb reboot fastboot Change-Id: Ia0c9a0961a76c6cbe19486590179abaa50d93f58
2018-08-14Add fastboot mode to recoveryHridya Valsaraju1-21/+103
Add a fastboot mode to recovery that can be entered with command line args or with the ui. Add usb property triggers to switch between fastboot and adb configurations. Allow switching between fastboot and adb through usb commands by opening a unix socket. adbd/fastbootd writes to this socket, which interrupts the ui and switches to the new mode. Test: Use fastboot mode Bug: 78793464 Change-Id: I7891bb84427ec734a21a872036629b95ab3fb13c
2018-08-06Dynamically load device-specific recovery UI lib.Tao Bao1-1/+27
We used to statically link the device-specific recovery UI extension (`TARGET_RECOVERY_UI_LIB`) into `recovery`. Such a logic can't be easily migrated to Soong, as modules specified by `TARGET_RECOVERY_UI_LIB` may not be built with Soong. Instead of porting all the device-specific codes over, this CL builds and installs the UI lib as a shared library with Android.mk. `recovery` dlopen(3)'s and dlsym(3)'s `make_device` to invoke the device-specific UI lib on start. Note that in order to make dlopen(3) actually working, we have to switch `recovery` to be dynamically linked (we will make the move later anyway). Bug: 110380063 Test: Build and boot into marlin recovery image. Check that device-specific recovery UI is successfully loaded. Change-Id: Ia9861c7559a95f3f50676534540c0cb87cae4574
2018-07-17Fix the arguments passed to getopt_long(3).Tao Bao1-5/+2
The getopt_long(3) implementation in Android (upstream freebsd) expects a null-terminated array while parsing long options with required args. if (long_options[match].has_arg == required_argument) { optarg = nargv[optind++]; } ... if (long_options[match].has_arg == required_argument && optarg == NULL) { return (BADARG); } This seems to make sense in practice, as getopt(3) takes the first two arguments of argc and argv that are "as passed to the main() function on program invocation", and both of C and C++ spec say "the value of argv[argc] shall be 0". Prior to the CL, we may run into undefined behavior on malformed input command line (e.g. missing arg for an option that requires one). This CL fixes the issue by always appending a nullptr to the argument list (but without counting that into argc). Test: Build and boot into recovery with commands. Change-Id: Ic6c37548f4db2f30aeabd40f387ca916eeca5392
2018-05-17recovery: Reset optind to 1 after getoptJerry Zhang1-0/+1
The getopt library exposes optind which is the next index to be processed. When scanning is restarted, optind has to be reset to 1. Test: Recovery works Bug: 78793464 Change-Id: I1efca3fb985ffbdfe91e43767469733cda6e7d5b
2018-05-16recovery: Refactor common setup into main()Jerry Zhang1-3/+223
Move more common setup into the main function. Main() handles all 1 time setup, such as ui, logging, and secontext. Recovery_main() takes in command line arguments, does any necessary recovery work, and can be called multiple times from main(). Test: Recovery works Bug: 78793464 Change-Id: I2d2595fc342b4ddfa80f4e06b30e44263132acd9 Merged-In: I2d2595fc342b4ddfa80f4e06b30e44263132acd9
2018-05-16recovery: Refactor common setup into main()Jerry Zhang1-3/+223
Move more common setup into the main function. Main() handles all 1 time setup, such as ui, logging, and secontext. Recovery_main() takes in command line arguments, does any necessary recovery work, and can be called multiple times from main(). Test: Recovery works Bug: 78793464 Change-Id: I2d2595fc342b4ddfa80f4e06b30e44263132acd9
2018-05-07recovery: Refactor logging code into logging.cppJerry Zhang1-1/+1
Move common logging related functions to rotate_logs.cpp, and rename that to logging.cpp. Test: Recovery works Bug: 78793464 Merged-In: I00f20a79a296680122b8437d54a87897c5cb2fc7 Change-Id: I00f20a79a296680122b8437d54a87897c5cb2fc7
2018-05-07recovery: Refactor logging code into logging.cppJerry Zhang1-1/+1
Move common logging related functions to rotate_logs.cpp, and rename that to logging.cpp. Test: Recovery works Bug: 78793464 Change-Id: I00f20a79a296680122b8437d54a87897c5cb2fc7 (cherry picked from commit 3c3f211d1e5698da6eea9e83584acb2dee4ca46e)
2018-05-07recovery: Refactor logging code into logging.cppJerry Zhang1-1/+1
Move common logging related functions to rotate_logs.cpp, and rename that to logging.cpp. Test: Recovery works Bug: 78793464 Change-Id: I00f20a79a296680122b8437d54a87897c5cb2fc7
2018-05-01recovery: Split main() into recovery_main.cpp.Tao Bao1-0/+162
This prepares for moving more codes from recovery into librecovery, so that they will become more easily testable. recovery_main.cpp will be the source code for recovery module, with the rest moved into librecovery. recovery_main.cpp mainly does the initializations, such as setting up the logger. Test: mmma -j bootable/recovery Test: recovery_component_test Test: Build and boot into recovery image on marlin. Change-Id: I8e846524546b6f3f0e32ed869e851f62261eef23 Merged-In: I8e846524546b6f3f0e32ed869e851f62261eef23
2018-05-01recovery: Split main() into recovery_main.cpp.Tao Bao1-0/+162
This prepares for moving more codes from recovery into librecovery, so that they will become more easily testable. recovery_main.cpp will be the source code for recovery module, with the rest moved into librecovery. recovery_main.cpp mainly does the initializations, such as setting up the logger. Test: mmma -j bootable/recovery Test: recovery_component_test Test: Build and boot into recovery image on marlin. Change-Id: I8e846524546b6f3f0e32ed869e851f62261eef23 (cherry picked from commit c241cb662440551eb0d2f42345f7ee08cf60a7dd)