summaryrefslogtreecommitdiffstats
path: root/recovery_main.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE: Move load & restore logs to logging.cppxunchang2019-04-161-1/+1
| | | | | | | | | | | We perform these steps to perserve the recovery logs when wiping /cache partition. Move them to logging.cpp to keep the actually EraseVolume function concise. Bug: 130166585 Test: unit tests pass, mount cache and check last log after cache Change-Id: Idc52833817a446f3a0148a3dd2112f911c9ef48d (cherry picked from commit 2239b9e4dd08e307ad74dc44b597fd53d2d17de8)
* DO NOT MERGE: Move wipe cache|data to libinstallxunchang2019-04-161-1/+4
| | | | | | | | | | | | | | | | Therefore, libinstall becomes the sole owner to handle the request from minadbd service. The change also includes 1. move logging.cpp out of librecovery 2. drop the dependency on common.h 3. now it's more sensible to move the wipe_cache as part of install_package. move the wipe_cache to the end of the function. Bug: 130166585 Test: wipe data and cache from menu Change-Id: I6f356dccdb38015c50acf756bac246f87c30fc1f (cherry picked from commit 316e9717461890dd319dc370970069fe4532a561)
* DO NOT MERGE: Add socket communication between recovery and minadbdxunchang2019-04-161-11/+0
| | | | | | | | | | | | | | This cl adds a socket pair to support the communication between recovery and minadbd. Therefore, minadbd will be able to issue multiple commands to recovery and get back the status of each command. This cl also switches the adb sideload from the recovery menu to use this protocol; and moves minadbd to a separate binary. Bug: 130166585 Test: sideload a package Change-Id: I80d36d5c4e6fe1ae3ea23640907bc50c0dc0d482 (cherry picked from commit 34690ced91e22f5d9b5dd19c33b11c8e0b4bafa0)
* recovery: Remove SetUsbConfig() out of common.h.Tao Bao2019-03-291-0/+6
| | | | | | | libinstall now has its own copy. Test: mmma -j bootable/recovery Change-Id: Ibbe7084e15baeb7e744f2175d5944477092acc9e
* Move install to separate modulexunchang2019-03-291-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
* Move librecovery_ui to a sub-directoryTianjie Xu2019-03-211-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)
* Use android::base::Pipe.Tao Bao2019-03-011-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
* Add a logo to the fastbootd screen.David Anderson2019-02-121-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
* Merge "logical -> dynamic partitions."Treehugger Robot2018-11-171-2/+2
|\
| * logical -> dynamic partitions.Yifan Hong2018-11-161-2/+2
| | | | | | | | | | | | | | | | | | Reflect a name change. Test: boots Test: boot into recovery Bug: 119286600 Change-Id: I7c323f27574ce033b8fc1750aab00f7300c5cc84
* | recovery: Fix mounting /system with dynamic partitions.David Anderson2018-10-301-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
* Merge "Enter into userspace fastboot only if the device supports it"Treehugger Robot2018-09-241-1/+2
|\
| * Enter into userspace fastboot only if the device supports itHridya Valsaraju2018-09-201-1/+2
| | | | | | | | | | | | | | | | Test: For devices not supporting logical partitions, 'adb reboot fastboot' command reboots into Android. Bug: 78793464 Change-Id: Ie6c6ccdebfee9302a9996ac5bc66069dbd817987
* | Show 'Enter Fastboot' menu item only if device supports fastbootdHridya Valsaraju2018-09-181-0/+4
|/ | | | | | Bug: 112664456 Test: Manual, 'Enter Fastboot' option not visible. Change-Id: I2642391a69a11cd0496c1287130b3b0291c93232
* Fix sideload for user devices by adding a new sideload configHridya Valsaraju2018-09-081-5/+0
| | | | | | | | Bug: 113563995 Test: Tested the 'adb sideload' command on marlin user/userdebug builds and walleye user/userdebug builds Change-Id: I00d565547b85f2db87012e4a08316609e03395ac
* recovery: Add "boot-fastboot" command to BCB.David Anderson2018-08-221-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
* Add fastboot mode to recoveryHridya Valsaraju2018-08-141-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
* Dynamically load device-specific recovery UI lib.Tao Bao2018-08-061-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
* Fix the arguments passed to getopt_long(3).Tao Bao2018-07-171-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
* recovery: Reset optind to 1 after getoptJerry Zhang2018-05-171-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
* recovery: Refactor common setup into main()Jerry Zhang2018-05-161-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
* recovery: Refactor logging code into logging.cppJerry Zhang2018-05-071-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
* recovery: Split main() into recovery_main.cpp.Tao Bao2018-05-011-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