The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
Anatol Pomazau | 5ae3f93 | 2012-02-28 07:21:08 -0800 | [diff] [blame] | 12 | * the documentation and/or other materials provided with the |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
Anatol Pomazau | 5ae3f93 | 2012-02-28 07:21:08 -0800 | [diff] [blame] | 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 28 | #include "engine.h" |
Anatol Pomazau | c8ba536 | 2011-12-15 17:50:18 -0800 | [diff] [blame] | 29 | |
Colin Cross | 81c632e | 2013-01-23 19:13:43 -0800 | [diff] [blame] | 30 | #include <errno.h> |
Elliott Hughes | 3ab8b85 | 2015-08-25 19:34:13 -0700 | [diff] [blame] | 31 | #include <stdarg.h> |
Mark Salyzyn | 5957c1f | 2014-04-30 14:05:28 -0700 | [diff] [blame] | 32 | #include <stdio.h> |
| 33 | #include <stdlib.h> |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 34 | #include <string.h> |
Anatol Pomazau | c8ba536 | 2011-12-15 17:50:18 -0800 | [diff] [blame] | 35 | #include <sys/stat.h> |
Anatol Pomazau | c8ba536 | 2011-12-15 17:50:18 -0800 | [diff] [blame] | 36 | #include <sys/types.h> |
| 37 | #include <unistd.h> |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 38 | |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 39 | #include <memory> |
| 40 | #include <vector> |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 41 | |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 42 | #include <android-base/stringprintf.h> |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 43 | |
Jerry Zhang | 769a9c1 | 2018-05-15 17:02:50 -0700 | [diff] [blame] | 44 | #include "constants.h" |
Elliott Hughes | 11ff345 | 2018-04-09 13:58:41 -0700 | [diff] [blame] | 45 | #include "transport.h" |
| 46 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 47 | using android::base::StringPrintf; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 48 | |
Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 49 | static fastboot::FastBootDriver* fb = nullptr; |
Anatol Pomazau | c8ba536 | 2011-12-15 17:50:18 -0800 | [diff] [blame] | 50 | |
Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 51 | void fb_init(fastboot::FastBootDriver& fbi) { |
| 52 | fb = &fbi; |
| 53 | auto cb = [](std::string& info) { fprintf(stderr, "(bootloader) %s\n", info.c_str()); }; |
| 54 | fb->SetInfoCallback(cb); |
| 55 | } |
Colin Cross | 80f2d03 | 2012-05-24 18:24:53 -0700 | [diff] [blame] | 56 | |
David Anderson | 1d88743 | 2018-08-27 16:47:32 -0700 | [diff] [blame] | 57 | void fb_reinit(Transport* transport) { |
David Anderson | 03de645 | 2018-09-04 14:32:54 -0700 | [diff] [blame] | 58 | if (Transport* old_transport = fb->set_transport(transport)) { |
| 59 | delete old_transport; |
| 60 | } |
David Anderson | 1d88743 | 2018-08-27 16:47:32 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Aaron Wisner | db51120 | 2018-06-26 15:38:35 -0500 | [diff] [blame] | 63 | const std::string fb_get_error() { |
| 64 | return fb->Error(); |
| 65 | } |
| 66 | |
| 67 | bool fb_getvar(const std::string& key, std::string* value) { |
| 68 | return !fb->GetVar(key, value); |
Colin Cross | 80f2d03 | 2012-05-24 18:24:53 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 71 | static void HandleResult(double start, int status) { |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 72 | if (status) { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 73 | fprintf(stderr, "FAILED (%s)\n", fb->Error().c_str()); |
| 74 | die("Command failed"); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 75 | } else { |
Daniel Sandler | cb6e22b | 2010-02-25 14:05:33 -0500 | [diff] [blame] | 76 | double split = now(); |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 77 | fprintf(stderr, "OKAY [%7.3fs]\n", (split - start)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 78 | } |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 79 | } |
| 80 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 81 | #define RUN_COMMAND(command) \ |
| 82 | { \ |
| 83 | double start = now(); \ |
| 84 | auto status = (command); \ |
| 85 | HandleResult(start, status); \ |
| 86 | } |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 87 | |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 88 | void fb_set_active(const std::string& slot) { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 89 | Status("Setting current slot to '" + slot + "'"); |
| 90 | RUN_COMMAND(fb->SetActive(slot)); |
Daniel Rosenberg | b7bd4ae | 2015-09-14 21:05:41 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 93 | void fb_erase(const std::string& partition) { |
| 94 | Status("Erasing '" + partition + "'"); |
| 95 | RUN_COMMAND(fb->Erase(partition)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 96 | } |
| 97 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 98 | void fb_flash_fd(const std::string& partition, int fd, uint32_t sz) { |
| 99 | Status(StringPrintf("Sending '%s' (%u KB)", partition.c_str(), sz / 1024)); |
| 100 | RUN_COMMAND(fb->Download(fd, sz)); |
Chris Fries | 0ea946c | 2017-04-12 10:25:57 -0500 | [diff] [blame] | 101 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 102 | Status("Writing '" + partition + "'"); |
| 103 | RUN_COMMAND(fb->Flash(partition)); |
Chris Fries | 0ea946c | 2017-04-12 10:25:57 -0500 | [diff] [blame] | 104 | } |
| 105 | |
Tom Cherry | dfd85df | 2018-09-20 14:45:05 -0700 | [diff] [blame^] | 106 | void fb_flash(const std::string& partition, const std::vector<char>& data) { |
| 107 | Status(StringPrintf("Sending '%s' (%zu KB)", partition.c_str(), data.size() / 1024)); |
| 108 | RUN_COMMAND(fb->Download(data)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 109 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 110 | Status("Writing '" + partition + "'"); |
| 111 | RUN_COMMAND(fb->Flash(partition)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 112 | } |
| 113 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 114 | void fb_flash_sparse(const std::string& partition, struct sparse_file* s, uint32_t sz, |
| 115 | size_t current, size_t total) { |
| 116 | Status(StringPrintf("Sending sparse '%s' %zu/%zu (%u KB)", partition.c_str(), current, total, |
| 117 | sz / 1024)); |
| 118 | RUN_COMMAND(fb->Download(s)); |
Colin Cross | f838788 | 2012-05-24 17:18:41 -0700 | [diff] [blame] | 119 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 120 | Status(StringPrintf("Writing sparse '%s' %zu/%zu", partition.c_str(), current, total)); |
| 121 | RUN_COMMAND(fb->Flash(partition)); |
Colin Cross | f838788 | 2012-05-24 17:18:41 -0700 | [diff] [blame] | 122 | } |
| 123 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 124 | void fb_create_partition(const std::string& partition, const std::string& size) { |
| 125 | Status("Creating '" + partition + "'"); |
| 126 | RUN_COMMAND(fb->RawCommand(FB_CMD_CREATE_PARTITION ":" + partition + ":" + size)); |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 129 | void fb_delete_partition(const std::string& partition) { |
| 130 | Status("Deleting '" + partition + "'"); |
| 131 | RUN_COMMAND(fb->RawCommand(FB_CMD_DELETE_PARTITION ":" + partition)); |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 132 | } |
| 133 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 134 | void fb_resize_partition(const std::string& partition, const std::string& size) { |
| 135 | Status("Resizing '" + partition + "'"); |
| 136 | RUN_COMMAND(fb->RawCommand(FB_CMD_RESIZE_PARTITION ":" + partition + ":" + size)); |
David Anderson | 0d4277d | 2018-07-31 13:27:37 -0700 | [diff] [blame] | 137 | } |
| 138 | |
Elliott Hughes | b3748de | 2015-06-23 20:27:58 -0700 | [diff] [blame] | 139 | static int match(const char* str, const char** value, unsigned count) { |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 140 | unsigned n; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 141 | |
| 142 | for (n = 0; n < count; n++) { |
| 143 | const char *val = value[n]; |
| 144 | int len = strlen(val); |
| 145 | int match; |
| 146 | |
| 147 | if ((len > 1) && (val[len-1] == '*')) { |
| 148 | len--; |
| 149 | match = !strncmp(val, str, len); |
| 150 | } else { |
| 151 | match = !strcmp(val, str); |
| 152 | } |
| 153 | |
| 154 | if (match) return 1; |
| 155 | } |
| 156 | |
| 157 | return 0; |
| 158 | } |
| 159 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 160 | void fb_require(const std::string& product, const std::string& var, bool invert, size_t count, |
| 161 | const char** values) { |
| 162 | Status("Checking '" + var + "'"); |
| 163 | |
| 164 | double start = now(); |
| 165 | |
| 166 | std::string var_value; |
| 167 | auto status = fb->GetVar(var, &var_value); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 168 | |
| 169 | if (status) { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 170 | fprintf(stderr, "getvar:%s FAILED (%s)\n", var.c_str(), fb->Error().c_str()); |
| 171 | die("requirements not met!"); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 172 | } |
| 173 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 174 | if (!product.empty()) { |
| 175 | if (product != cur_product) { |
Wink Saville | b98762f | 2011-04-04 17:54:59 -0700 | [diff] [blame] | 176 | double split = now(); |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 177 | fprintf(stderr, "IGNORE, product is %s required only for %s [%7.3fs]\n", cur_product, |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 178 | product.c_str(), (split - start)); |
| 179 | return; |
Wink Saville | b98762f | 2011-04-04 17:54:59 -0700 | [diff] [blame] | 180 | } |
| 181 | } |
| 182 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 183 | int yes = match(var_value.c_str(), values, count); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 184 | if (invert) yes = !yes; |
| 185 | |
| 186 | if (yes) { |
Daniel Sandler | cb6e22b | 2010-02-25 14:05:33 -0500 | [diff] [blame] | 187 | double split = now(); |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 188 | fprintf(stderr, "OKAY [%7.3fs]\n", (split - start)); |
| 189 | return; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 190 | } |
| 191 | |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 192 | fprintf(stderr, "FAILED\n\n"); |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 193 | fprintf(stderr, "Device %s is '%s'.\n", var.c_str(), var_value.c_str()); |
| 194 | fprintf(stderr, "Update %s '%s'", invert ? "rejects" : "requires", values[0]); |
| 195 | for (size_t n = 1; n < count; n++) { |
| 196 | fprintf(stderr, " or '%s'", values[n]); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 197 | } |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 198 | fprintf(stderr, ".\n\n"); |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 199 | die("requirements not met!"); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 200 | } |
| 201 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 202 | void fb_display(const std::string& label, const std::string& var) { |
| 203 | std::string value; |
| 204 | auto status = fb->GetVar(var, &value); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 205 | |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 206 | if (status) { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 207 | fprintf(stderr, "getvar:%s FAILED (%s)\n", var.c_str(), fb->Error().c_str()); |
| 208 | return; |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 209 | } |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 210 | fprintf(stderr, "%s: %s\n", label.c_str(), value.c_str()); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 211 | } |
| 212 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 213 | void fb_query_save(const std::string& var, char* dest, uint32_t dest_size) { |
| 214 | std::string value; |
| 215 | auto status = fb->GetVar(var, &value); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 216 | |
Wink Saville | b98762f | 2011-04-04 17:54:59 -0700 | [diff] [blame] | 217 | if (status) { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 218 | fprintf(stderr, "getvar:%s FAILED (%s)\n", var.c_str(), fb->Error().c_str()); |
| 219 | return; |
Wink Saville | b98762f | 2011-04-04 17:54:59 -0700 | [diff] [blame] | 220 | } |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 221 | |
| 222 | strncpy(dest, value.c_str(), dest_size); |
Wink Saville | b98762f | 2011-04-04 17:54:59 -0700 | [diff] [blame] | 223 | } |
| 224 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 225 | void fb_reboot() { |
| 226 | fprintf(stderr, "Rebooting"); |
| 227 | fb->Reboot(); |
Elliott Hughes | 5620d22 | 2018-03-28 08:20:00 -0700 | [diff] [blame] | 228 | fprintf(stderr, "\n"); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 229 | } |
| 230 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 231 | void fb_command(const std::string& cmd, const std::string& msg) { |
| 232 | Status(msg); |
| 233 | RUN_COMMAND(fb->RawCommand(cmd)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 234 | } |
| 235 | |
Tom Cherry | dfd85df | 2018-09-20 14:45:05 -0700 | [diff] [blame^] | 236 | void fb_download(const std::string& name, const std::vector<char>& data) { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 237 | Status("Downloading '" + name + "'"); |
Tom Cherry | dfd85df | 2018-09-20 14:45:05 -0700 | [diff] [blame^] | 238 | RUN_COMMAND(fb->Download(data)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 239 | } |
| 240 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 241 | void fb_download_fd(const std::string& name, int fd, uint32_t sz) { |
| 242 | Status(StringPrintf("Sending '%s' (%u KB)", name.c_str(), sz / 1024)); |
| 243 | RUN_COMMAND(fb->Download(fd, sz)); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 244 | } |
| 245 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 246 | void fb_upload(const std::string& outfile) { |
| 247 | Status("Uploading '" + outfile + "'"); |
| 248 | RUN_COMMAND(fb->Upload(outfile)); |
Jocelyn Bohr | 98cc283 | 2017-01-26 19:20:53 -0800 | [diff] [blame] | 249 | } |
| 250 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 251 | void fb_notice(const std::string& notice) { |
| 252 | Status(notice); |
| 253 | fprintf(stderr, "\n"); |
Jocelyn Bohr | 91fefad | 2017-01-27 14:17:56 -0800 | [diff] [blame] | 254 | } |
| 255 | |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 256 | void fb_wait_for_disconnect() { |
| 257 | fb->WaitForDisconnect(); |
The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 258 | } |
David Anderson | 1d88743 | 2018-08-27 16:47:32 -0700 | [diff] [blame] | 259 | |
| 260 | bool fb_reboot_to_userspace() { |
Tom Cherry | 11f1209 | 2018-08-29 21:36:28 -0700 | [diff] [blame] | 261 | Status("Rebooting to userspace fastboot"); |
David Anderson | 1d88743 | 2018-08-27 16:47:32 -0700 | [diff] [blame] | 262 | verbose("\n"); |
| 263 | |
| 264 | if (fb->RebootTo("fastboot") != fastboot::RetCode::SUCCESS) { |
| 265 | fprintf(stderr, "FAILED (%s)\n", fb->Error().c_str()); |
| 266 | return false; |
| 267 | } |
| 268 | fprintf(stderr, "OKAY\n"); |
| 269 | |
David Anderson | 03de645 | 2018-09-04 14:32:54 -0700 | [diff] [blame] | 270 | fb_reinit(nullptr); |
David Anderson | 1d88743 | 2018-08-27 16:47:32 -0700 | [diff] [blame] | 271 | return true; |
| 272 | } |