lijuang | bdb18ea | 2018-02-06 17:21:18 +0800 | [diff] [blame] | 1 | /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
| 12 | * * Neither the name of The Linux Foundation nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #include <debug.h> |
| 30 | #include <reg.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <openssl/evp.h> |
| 33 | #include <dev/fbcon.h> |
| 34 | #include <kernel/thread.h> |
| 35 | #include <display_menu.h> |
| 36 | #include <menu_keys_detect.h> |
| 37 | #include <boot_verifier.h> |
| 38 | #include <string.h> |
| 39 | #include <platform.h> |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 40 | #include <smem.h> |
| 41 | #include <target.h> |
| 42 | #include <sys/types.h> |
| 43 | #include <../../../app/aboot/devinfo.h> |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 44 | #include <../../../app/aboot/recovery.h> |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 45 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 46 | static const char *unlock_menu_common_msg = "By unlocking the bootloader, you will be able to install "\ |
| 47 | "custom operating system on this phone. "\ |
| 48 | "A custom OS is not subject to the same level of testing "\ |
| 49 | "as the original OS, and can cause your phone "\ |
| 50 | "and installed applications to stop working properly.\n\n"\ |
| 51 | "Software integrity cannot be guaranteed with a custom OS, "\ |
| 52 | "so any data stored on the phone while the bootloader "\ |
| 53 | "is unlocked may be at risk.\n\n"\ |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 54 | "To prevent unauthorized access to your personal data, "\ |
| 55 | "unlocking the bootloader will also delete all personal "\ |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 56 | "data on your phone.\n\n"\ |
| 57 | "Press the Volume keys to select whether to unlock the bootloader, "\ |
| 58 | "then the Power Button to continue.\n\n"; |
| 59 | |
| 60 | static const char *lock_menu_common_msg = "If you lock the bootloader, "\ |
| 61 | "you will not be able to install "\ |
| 62 | "custom operating system on this phone.\n\n"\ |
| 63 | "To prevent unauthorized access to your personal data, "\ |
| 64 | "locking the bootloader will also delete all personal "\ |
| 65 | "data on your phone.\n\n"\ |
| 66 | "Press the Volume keys to select whether to "\ |
| 67 | "lock the bootloader, then the power button to continue.\n\n"; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 68 | |
Channagoud Kadabi | 86b0c11 | 2016-03-16 19:23:16 -0700 | [diff] [blame] | 69 | #define YELLOW_WARNING_MSG "Your device has loaded a different operating system\n\n "\ |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 70 | "Visit this link on another device:\n" |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 71 | |
Channagoud Kadabi | 86b0c11 | 2016-03-16 19:23:16 -0700 | [diff] [blame] | 72 | #define ORANGE_WARNING_MSG "Your device software can't be\n checked for corruption. Please lock the bootloader\n\n"\ |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 73 | "Visit this link on another device:\n" |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 74 | |
Channagoud Kadabi | 86b0c11 | 2016-03-16 19:23:16 -0700 | [diff] [blame] | 75 | #define RED_WARNING_MSG "Your device is corrupt. It can't be\ntrusted and will not boot\n\n" \ |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 76 | "Visit this link on another device:\n" |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 77 | |
lijuang | bdd9bb4 | 2016-03-01 18:22:17 +0800 | [diff] [blame] | 78 | #define LOGGING_WARNING_MSG "The dm-verity is not started in enforcing mode and may "\ |
| 79 | "not work properly\n\nTo learn more, visit:\n" |
| 80 | |
Channagoud Kadabi | 86b0c11 | 2016-03-16 19:23:16 -0700 | [diff] [blame] | 81 | #define EIO_WARNING_MSG "Your device is corrupt. It can't be\n trusted and may not work properly.\n\n"\ |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 82 | "Visit this link on another device:\n" |
| 83 | |
| 84 | #define URL_MSG "g.co/ABH\n" |
Channagoud Kadabi | 86b0c11 | 2016-03-16 19:23:16 -0700 | [diff] [blame] | 85 | |
Parth Dixit | 54ac3bb | 2017-03-07 15:52:48 +0530 | [diff] [blame] | 86 | #define DELAY_5SEC 5000 |
| 87 | #define DELAY_30SEC 30000 |
| 88 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 89 | static bool is_thread_start = false; |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 90 | static struct select_msg_info msg_info; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 91 | |
Monika Singh | 5e17036 | 2018-03-14 00:48:36 +0530 | [diff] [blame] | 92 | #if VERIFIED_BOOT || VERIFIED_BOOT_2 |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 93 | struct boot_verify_info { |
| 94 | int msg_type; |
| 95 | const char *warning_msg; |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 96 | const char *url_msg; |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | struct boot_verify_info boot_verify_info[] = { |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 100 | [DISPLAY_MENU_RED] = {FBCON_RED_MSG, RED_WARNING_MSG, URL_MSG}, |
| 101 | [DISPLAY_MENU_YELLOW] = {FBCON_YELLOW_MSG, YELLOW_WARNING_MSG, URL_MSG}, |
| 102 | [DISPLAY_MENU_ORANGE] = {FBCON_ORANGE_MSG, ORANGE_WARNING_MSG, URL_MSG}, |
| 103 | [DISPLAY_MENU_LOGGING] = {FBCON_RED_MSG, LOGGING_WARNING_MSG, NULL}, |
| 104 | [DISPLAY_MENU_EIO] = {FBCON_RED_MSG, EIO_WARNING_MSG, URL_MSG}}; |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 105 | #endif |
| 106 | |
| 107 | static char *verify_option_menu[] = { |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 108 | [POWEROFF] = "Power off\n", |
| 109 | [RESTART] = "Restart\n", |
| 110 | [RECOVER] = "Recovery\n", |
| 111 | [FASTBOOT] = "Fastboot\n", |
| 112 | [BACK] = "Back to previous page\n"}; |
| 113 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 114 | static char *fastboot_option_menu[] = { |
| 115 | [0] = "START\n", |
| 116 | [1] = "Restart bootloader\n", |
| 117 | [2] = "Recovery mode\n", |
lijuang | 42aefaa | 2016-04-14 15:55:17 +0800 | [diff] [blame] | 118 | [3] = "Power off\n", |
| 119 | [4] = "Boot to FFBM\n"}; |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 120 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 121 | static struct unlock_info munlock_info[] = { |
| 122 | [DISPLAY_MENU_LOCK] = {UNLOCK, FALSE}, |
| 123 | [DISPLAY_MENU_UNLOCK] = {UNLOCK, TRUE}, |
| 124 | [DISPLAY_MENU_LOCK_CRITICAL] = {UNLOCK_CRITICAL, FALSE}, |
| 125 | [DISPLAY_MENU_UNLOCK_CRITICAL] = {UNLOCK_CRITICAL, TRUE}, |
| 126 | }; |
| 127 | |
| 128 | struct unlock_option_msg munlock_option_msg[] = { |
| 129 | [TRUE] = {"DO NOT UNLOCK THE BOOTLOADER \n", "UNLOCK THE BOOTLOADER \n"}, |
| 130 | [FALSE] = {"DO NOT LOCK THE BOOTLOADER \n", "LOCK THE BOOTLOADER \n"}, |
| 131 | }; |
| 132 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 133 | static int big_factor = 2; |
| 134 | static int common_factor = 1; |
| 135 | |
lijuang | de34d50 | 2016-02-26 16:04:50 +0800 | [diff] [blame] | 136 | static void wait_for_exit() |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 137 | { |
| 138 | struct select_msg_info *select_msg; |
| 139 | select_msg = &msg_info; |
| 140 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 141 | mutex_acquire(&select_msg->msg_lock); |
lijuang | de34d50 | 2016-02-26 16:04:50 +0800 | [diff] [blame] | 142 | while(!select_msg->info.rel_exit == true) { |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 143 | mutex_release(&select_msg->msg_lock); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 144 | thread_sleep(10); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 145 | mutex_acquire(&select_msg->msg_lock); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 146 | } |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 147 | mutex_release(&select_msg->msg_lock); |
| 148 | |
lijuang | de34d50 | 2016-02-26 16:04:50 +0800 | [diff] [blame] | 149 | is_thread_start = false; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 150 | fbcon_clear(); |
| 151 | display_image_on_screen(); |
| 152 | } |
| 153 | |
lijuang | de34d50 | 2016-02-26 16:04:50 +0800 | [diff] [blame] | 154 | void wait_for_users_action() |
| 155 | { |
Krishna Manikandan | f2c8be9 | 2017-12-05 18:07:56 +0530 | [diff] [blame] | 156 | if (is_display_disabled()) |
| 157 | return; |
lijuang | de34d50 | 2016-02-26 16:04:50 +0800 | [diff] [blame] | 158 | /* Waiting for exit menu keys detection if there is no any usr action |
| 159 | * otherwise it will do the action base on the keys detection thread |
| 160 | */ |
| 161 | wait_for_exit(); |
| 162 | } |
| 163 | |
| 164 | void exit_menu_keys_detection() |
| 165 | { |
| 166 | struct select_msg_info *select_msg; |
| 167 | select_msg = &msg_info; |
| 168 | |
Krishna Manikandan | f2c8be9 | 2017-12-05 18:07:56 +0530 | [diff] [blame] | 169 | if (is_display_disabled()) |
| 170 | return; |
| 171 | |
lijuang | de34d50 | 2016-02-26 16:04:50 +0800 | [diff] [blame] | 172 | mutex_acquire(&select_msg->msg_lock); |
| 173 | select_msg->info.is_exit = true; |
| 174 | mutex_release(&select_msg->msg_lock); |
| 175 | |
| 176 | wait_for_exit(); |
| 177 | } |
| 178 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 179 | static void set_message_factor() |
| 180 | { |
| 181 | uint32_t tmp_factor = 0; |
| 182 | uint32_t max_x_count = 40; |
| 183 | uint32_t max_x = fbcon_get_max_x(); |
| 184 | |
| 185 | max_x = fbcon_get_max_x(); |
| 186 | tmp_factor = max_x/max_x_count; |
| 187 | |
| 188 | if(tmp_factor <= 1) { |
| 189 | big_factor = 2; |
| 190 | common_factor = 1; |
| 191 | } else { |
| 192 | big_factor = tmp_factor*2; |
| 193 | common_factor = tmp_factor; |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | static void display_fbcon_menu_message(char *str, unsigned type, |
| 198 | unsigned scale_factor) |
| 199 | { |
| 200 | while(*str != 0) { |
| 201 | fbcon_putc_factor(*str++, type, scale_factor); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | static char *str_align_right(char *str, int factor) |
| 206 | { |
| 207 | uint32_t max_x = 0; |
| 208 | int diff = 0; |
| 209 | int i = 0; |
| 210 | char *str_target = NULL; |
| 211 | |
| 212 | max_x = fbcon_get_max_x(); |
| 213 | if (!str_target && max_x) { |
| 214 | str_target = malloc(max_x); |
| 215 | } |
| 216 | |
| 217 | if (str_target) { |
| 218 | memset(str_target, 0, max_x); |
| 219 | if ( max_x/factor > strlen(str)) { |
| 220 | if (factor == 1) |
| 221 | diff = max_x/factor - strlen(str) - 1; |
| 222 | else |
| 223 | diff = max_x/factor - strlen(str); |
| 224 | for (i = 0; i < diff; i++) { |
Parth Dixit | 73d3bd0 | 2016-01-07 14:29:41 +0530 | [diff] [blame] | 225 | strlcat(str_target, " ", max_x); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 226 | } |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 227 | } |
lijuang | bdb18ea | 2018-02-06 17:21:18 +0800 | [diff] [blame] | 228 | strlcat(str_target, str, max_x); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 229 | } |
lijuang | bdb18ea | 2018-02-06 17:21:18 +0800 | [diff] [blame] | 230 | return str_target; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 231 | } |
| 232 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 233 | /** |
| 234 | Reset device unlock status |
| 235 | @param[in] Type The type of the unlock. |
| 236 | [DISPLAY_MENU_UNLOCK]: unlock the device |
| 237 | [DISPLAY_MENU_UNLOCK_CRITICAL]: critical unlock the device |
| 238 | [DISPLAY_MENU_LOCK]: lock the device |
| 239 | [DISPLAY_MENU_LOCK_CRITICAL]: critical lock the device |
| 240 | **/ |
| 241 | void reset_device_unlock_status (int type) |
| 242 | { |
| 243 | struct recovery_message msg; |
| 244 | |
| 245 | if (type == DISPLAY_MENU_LOCK || |
| 246 | type == DISPLAY_MENU_UNLOCK || |
| 247 | type == DISPLAY_MENU_LOCK_CRITICAL || |
| 248 | type == DISPLAY_MENU_UNLOCK_CRITICAL) { |
| 249 | set_device_unlock_value (munlock_info[type].unlock_type, |
| 250 | munlock_info[type].unlock_value); |
| 251 | memset(&msg, 0, sizeof(msg)); |
| 252 | snprintf(msg.recovery, sizeof(msg.recovery), "recovery\n--wipe_data"); |
| 253 | write_misc(0, &msg, sizeof(msg)); |
| 254 | } |
| 255 | } |
| 256 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 257 | /* msg_lock need to be holded when call this function. */ |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 258 | static void display_unlock_menu_renew(struct select_msg_info *unlock_msg_info, |
| 259 | int type, bool status) |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 260 | { |
| 261 | fbcon_clear(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 262 | memset(&unlock_msg_info->info, 0, sizeof(struct menu_info)); |
| 263 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 264 | display_fbcon_menu_message("<!>\n\n", |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 265 | FBCON_UNLOCK_TITLE_MSG, big_factor); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 266 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 267 | if (status) { |
| 268 | display_fbcon_menu_message((char*)unlock_menu_common_msg, |
| 269 | FBCON_COMMON_MSG, common_factor); |
| 270 | } else { |
| 271 | display_fbcon_menu_message((char*)lock_menu_common_msg, |
| 272 | FBCON_COMMON_MSG, common_factor); |
| 273 | } |
| 274 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 275 | fbcon_draw_line(FBCON_COMMON_MSG); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 276 | unlock_msg_info->info.option_start[0] = fbcon_get_current_line(); |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 277 | display_fbcon_menu_message((char *)munlock_option_msg[status].ignore_msg, |
| 278 | FBCON_COMMON_MSG, common_factor); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 279 | unlock_msg_info->info.option_bg[0] = fbcon_get_current_bg(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 280 | unlock_msg_info->info.option_end[0] = fbcon_get_current_line(); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 281 | fbcon_draw_line(FBCON_COMMON_MSG); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 282 | unlock_msg_info->info.option_start[1] = fbcon_get_current_line(); |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 283 | display_fbcon_menu_message((char *)munlock_option_msg[status].comfirm_msg, |
| 284 | FBCON_COMMON_MSG, common_factor); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 285 | unlock_msg_info->info.option_bg[1] = fbcon_get_current_bg(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 286 | unlock_msg_info->info.option_end[1] = fbcon_get_current_line(); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 287 | fbcon_draw_line(FBCON_COMMON_MSG); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 288 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 289 | if (type == UNLOCK) { |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 290 | unlock_msg_info->info.msg_type = DISPLAY_MENU_UNLOCK; |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 291 | if (!status) |
| 292 | unlock_msg_info->info.msg_type = DISPLAY_MENU_LOCK; |
| 293 | } else if (type == UNLOCK_CRITICAL) { |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 294 | unlock_msg_info->info.msg_type = DISPLAY_MENU_UNLOCK_CRITICAL; |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 295 | if (!status) |
| 296 | unlock_msg_info->info.msg_type = DISPLAY_MENU_LOCK_CRITICAL; |
| 297 | } |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 298 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 299 | unlock_msg_info->info.option_num = 2; |
| 300 | |
| 301 | /* Initialize the option index */ |
| 302 | unlock_msg_info->info.option_index= 2; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 303 | } |
| 304 | |
Monika Singh | 5e17036 | 2018-03-14 00:48:36 +0530 | [diff] [blame] | 305 | #if VERIFIED_BOOT || VERIFIED_BOOT_2 |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 306 | /* msg_lock need to be holded when call this function. */ |
| 307 | void display_bootverify_menu_renew(struct select_msg_info *msg_info, int type) |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 308 | { |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 309 | unsigned char* fp_buf = NULL; |
| 310 | char fp_str_temp[EVP_MAX_MD_SIZE] = {'\0'}; |
| 311 | char fp_str[EVP_MAX_MD_SIZE*2] = {'\0'}; |
| 312 | char str_temp[8]; |
| 313 | |
| 314 | char str1[]= "Start >"; |
| 315 | char str2[] = "Continue boot"; |
Parth Dixit | 54ac3bb | 2017-03-07 15:52:48 +0530 | [diff] [blame] | 316 | char *str3 = NULL; |
| 317 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 318 | char *str_target = NULL; |
| 319 | uint32 fp_size = 0; |
| 320 | unsigned int i = 0; |
Parth Dixit | 54ac3bb | 2017-03-07 15:52:48 +0530 | [diff] [blame] | 321 | uint32_t timeout = DELAY_5SEC; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 322 | |
| 323 | fbcon_clear(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 324 | memset(&msg_info->info, 0, sizeof(struct menu_info)); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 325 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 326 | /* Align Right */ |
| 327 | str_target = str_align_right(str1, big_factor); |
lijuang | 514c2ce | 2016-05-12 11:37:19 +0800 | [diff] [blame] | 328 | if(str_target != NULL) { |
Sridhar Parasuram | 995a355 | 2015-08-22 08:46:10 -0700 | [diff] [blame] | 329 | display_fbcon_menu_message(str_target, FBCON_TITLE_MSG, big_factor); |
lijuang | 514c2ce | 2016-05-12 11:37:19 +0800 | [diff] [blame] | 330 | free(str_target); |
| 331 | } |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 332 | |
| 333 | str_target = str_align_right(str2, common_factor); |
lijuang | 514c2ce | 2016-05-12 11:37:19 +0800 | [diff] [blame] | 334 | if(str_target != NULL) { |
Sridhar Parasuram | 995a355 | 2015-08-22 08:46:10 -0700 | [diff] [blame] | 335 | display_fbcon_menu_message(str_target, FBCON_TITLE_MSG, common_factor); |
lijuang | 514c2ce | 2016-05-12 11:37:19 +0800 | [diff] [blame] | 336 | free(str_target); |
| 337 | } |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 338 | |
| 339 | display_fbcon_menu_message("\n< More options\n", |
| 340 | FBCON_COMMON_MSG, common_factor); |
| 341 | display_fbcon_menu_message("press VOLUME keys\n\n", |
| 342 | FBCON_SUBTITLE_MSG, common_factor); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 343 | if(boot_verify_info[type].warning_msg != NULL) |
| 344 | display_fbcon_menu_message((char*)boot_verify_info[type].warning_msg, |
| 345 | FBCON_COMMON_MSG, common_factor); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 346 | |
Brahmaji K | 0c2d598 | 2017-09-07 18:44:21 +0530 | [diff] [blame] | 347 | if(boot_verify_info[type].url_msg != NULL) |
| 348 | display_fbcon_menu_message((char*)boot_verify_info[type].url_msg, |
| 349 | boot_verify_info[type].msg_type, common_factor); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 350 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 351 | if (type == DISPLAY_MENU_YELLOW) { |
| 352 | fp_buf = get_boot_fingerprint(&fp_size); |
| 353 | if (fp_buf != NULL) { |
Parth Dixit | 73d3bd0 | 2016-01-07 14:29:41 +0530 | [diff] [blame] | 354 | strlcpy(fp_str_temp, (char const *)fp_buf, fp_size); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 355 | for (i = 0; i < fp_size; i++) { |
| 356 | if(i == fp_size - 1) |
Parth Dixit | 73d3bd0 | 2016-01-07 14:29:41 +0530 | [diff] [blame] | 357 | snprintf(str_temp, sizeof(str_temp), "%02x", fp_str_temp[i]); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 358 | else |
Parth Dixit | 73d3bd0 | 2016-01-07 14:29:41 +0530 | [diff] [blame] | 359 | snprintf(str_temp, sizeof(str_temp), "%02x-", fp_str_temp[i]); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 360 | |
Parth Dixit | 73d3bd0 | 2016-01-07 14:29:41 +0530 | [diff] [blame] | 361 | strlcat(fp_str, str_temp, sizeof(fp_str)); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 362 | } |
| 363 | } |
| 364 | display_fbcon_menu_message("ID:", FBCON_COMMON_MSG, common_factor); |
| 365 | display_fbcon_menu_message(fp_str, FBCON_COMMON_MSG, common_factor); |
| 366 | } |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 367 | |
Parth Dixit | 54ac3bb | 2017-03-07 15:52:48 +0530 | [diff] [blame] | 368 | str3 = "\n\nIf no key pressed:\n"\ |
| 369 | "Your device will boot in 5 seconds\n\n"; |
| 370 | #if ENABLE_VB_ATTEST |
| 371 | if(type == DISPLAY_MENU_EIO) |
| 372 | { |
| 373 | str3 ="\n\nIf power key is not pressed:\n"\ |
| 374 | "Your device will poweroff in 30 seconds\n\n"; |
| 375 | timeout = DELAY_30SEC; |
| 376 | } |
| 377 | #endif |
| 378 | display_fbcon_menu_message(str3, FBCON_COMMON_MSG, common_factor); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 379 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 380 | msg_info->info.msg_type = type; |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 381 | |
| 382 | /* Initialize the time out time */ |
Parth Dixit | 54ac3bb | 2017-03-07 15:52:48 +0530 | [diff] [blame] | 383 | msg_info->info.timeout_time = timeout; //5s |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 384 | } |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 385 | #endif |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 386 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 387 | /* msg_lock need to be holded when call this function. */ |
| 388 | void display_bootverify_option_menu_renew(struct select_msg_info *msg_info) |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 389 | { |
| 390 | int i = 0; |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 391 | int len = 0; |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 392 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 393 | fbcon_clear(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 394 | memset(&msg_info->info, 0, sizeof(struct menu_info)); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 395 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 396 | len = ARRAY_SIZE(verify_option_menu); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 397 | display_fbcon_menu_message("Options menu:\n\n", |
| 398 | FBCON_COMMON_MSG, big_factor); |
| 399 | display_fbcon_menu_message("Press volume key to select, and "\ |
| 400 | "press power key to select\n\n", FBCON_COMMON_MSG, common_factor); |
| 401 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 402 | for (i = 0; i < len; i++) { |
| 403 | fbcon_draw_line(FBCON_COMMON_MSG); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 404 | msg_info->info.option_start[i] = fbcon_get_current_line(); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 405 | display_fbcon_menu_message(verify_option_menu[i], |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 406 | FBCON_COMMON_MSG, common_factor); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 407 | msg_info->info.option_bg[i]= fbcon_get_current_bg(); |
| 408 | msg_info->info.option_end[i]= fbcon_get_current_line(); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 409 | } |
| 410 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 411 | fbcon_draw_line(FBCON_COMMON_MSG); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 412 | msg_info->info.msg_type = DISPLAY_MENU_MORE_OPTION; |
| 413 | msg_info->info.option_num = len; |
| 414 | |
| 415 | /* Initialize the option index */ |
| 416 | msg_info->info.option_index= len; |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 417 | } |
| 418 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 419 | /* msg_lock need to be holded when call this function. */ |
| 420 | void display_fastboot_menu_renew(struct select_msg_info *fastboot_msg_info) |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 421 | { |
| 422 | int len; |
| 423 | int msg_type = FBCON_COMMON_MSG; |
| 424 | char msg_buf[64]; |
| 425 | char msg[128]; |
| 426 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 427 | /* The fastboot menu is switched base on the option index |
| 428 | * So it's need to store the index for the menu switching |
| 429 | */ |
| 430 | uint32_t option_index = fastboot_msg_info->info.option_index; |
| 431 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 432 | fbcon_clear(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 433 | memset(&fastboot_msg_info->info, 0, sizeof(struct menu_info)); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 434 | |
| 435 | len = ARRAY_SIZE(fastboot_option_menu); |
| 436 | switch(option_index) { |
| 437 | case 0: |
| 438 | msg_type = FBCON_GREEN_MSG; |
| 439 | break; |
| 440 | case 1: |
| 441 | case 2: |
| 442 | msg_type = FBCON_RED_MSG; |
| 443 | break; |
| 444 | case 3: |
lijuang | 42aefaa | 2016-04-14 15:55:17 +0800 | [diff] [blame] | 445 | case 4: |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 446 | msg_type = FBCON_COMMON_MSG; |
| 447 | break; |
| 448 | } |
| 449 | fbcon_draw_line(msg_type); |
| 450 | display_fbcon_menu_message(fastboot_option_menu[option_index], |
| 451 | msg_type, big_factor); |
| 452 | fbcon_draw_line(msg_type); |
| 453 | display_fbcon_menu_message("\n\nPress volume key to select, and "\ |
| 454 | "press power key to select\n\n", FBCON_COMMON_MSG, common_factor); |
| 455 | |
| 456 | display_fbcon_menu_message("FASTBOOT MODE\n", FBCON_RED_MSG, common_factor); |
| 457 | |
| 458 | get_product_name((unsigned char *) msg_buf); |
| 459 | snprintf(msg, sizeof(msg), "PRODUCT_NAME - %s\n", msg_buf); |
| 460 | display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor); |
| 461 | |
| 462 | memset(msg_buf, 0, sizeof(msg_buf)); |
| 463 | smem_get_hw_platform_name((unsigned char *) msg_buf, sizeof(msg_buf)); |
| 464 | snprintf(msg, sizeof(msg), "VARIANT - %s %s\n", |
| 465 | msg_buf, target_is_emmc_boot()? "eMMC":"UFS"); |
| 466 | display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor); |
| 467 | |
| 468 | memset(msg_buf, 0, sizeof(msg_buf)); |
| 469 | get_bootloader_version((unsigned char *) msg_buf); |
| 470 | snprintf(msg, sizeof(msg), "BOOTLOADER VERSION - %s\n", |
| 471 | msg_buf); |
| 472 | display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor); |
| 473 | |
| 474 | memset(msg_buf, 0, sizeof(msg_buf)); |
| 475 | get_baseband_version((unsigned char *) msg_buf); |
| 476 | snprintf(msg, sizeof(msg), "BASEBAND VERSION - %s\n", |
| 477 | msg_buf); |
| 478 | display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor); |
| 479 | |
| 480 | memset(msg_buf, 0, sizeof(msg_buf)); |
| 481 | target_serialno((unsigned char *) msg_buf); |
| 482 | snprintf(msg, sizeof(msg), "SERIAL NUMBER - %s\n", msg_buf); |
| 483 | display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor); |
| 484 | |
| 485 | snprintf(msg, sizeof(msg), "SECURE BOOT - %s\n", |
| 486 | is_secure_boot_enable()? "enabled":"disabled"); |
| 487 | display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor); |
| 488 | |
| 489 | snprintf(msg, sizeof(msg), "DEVICE STATE - %s\n", |
| 490 | is_device_locked()? "locked":"unlocked"); |
| 491 | display_fbcon_menu_message(msg, FBCON_RED_MSG, common_factor); |
| 492 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 493 | fastboot_msg_info->info.msg_type = DISPLAY_MENU_FASTBOOT; |
| 494 | fastboot_msg_info->info.option_num = len; |
| 495 | fastboot_msg_info->info.option_index = option_index; |
| 496 | } |
| 497 | |
| 498 | void msg_lock_init() |
| 499 | { |
| 500 | static bool is_msg_lock_init = false; |
| 501 | struct select_msg_info *msg_lock_info; |
| 502 | msg_lock_info = &msg_info; |
| 503 | |
| 504 | if (!is_msg_lock_init) { |
| 505 | mutex_init(&msg_lock_info->msg_lock); |
| 506 | is_msg_lock_init = true; |
| 507 | } |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 508 | } |
| 509 | |
| 510 | static void display_menu_thread_start(struct select_msg_info *msg_info) |
| 511 | { |
| 512 | thread_t *thr; |
| 513 | |
| 514 | if (!is_thread_start) { |
| 515 | thr = thread_create("selectkeydetect", &select_msg_keys_detect, |
| 516 | (void*)msg_info, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE); |
| 517 | if (!thr) { |
| 518 | dprintf(CRITICAL, "ERROR: creat device status detect thread failed!!\n"); |
| 519 | return; |
| 520 | } |
| 521 | thread_resume(thr); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 522 | is_thread_start = true; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 523 | } |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 524 | } |
| 525 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 526 | /* The fuction be called after device in fastboot mode, |
| 527 | * so it's no need to initialize the msg_lock again |
| 528 | */ |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 529 | void display_unlock_menu(int type, bool status) |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 530 | { |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 531 | struct select_msg_info *unlock_menu_msg_info; |
| 532 | unlock_menu_msg_info = &msg_info; |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 533 | |
Krishna Manikandan | f2c8be9 | 2017-12-05 18:07:56 +0530 | [diff] [blame] | 534 | if (is_display_disabled()) |
| 535 | return; |
| 536 | |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 537 | set_message_factor(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 538 | |
| 539 | msg_lock_init(); |
| 540 | mutex_acquire(&unlock_menu_msg_info->msg_lock); |
| 541 | |
| 542 | /* Initialize the last_msg_type */ |
| 543 | unlock_menu_msg_info->last_msg_type = |
| 544 | unlock_menu_msg_info->info.msg_type; |
| 545 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 546 | display_unlock_menu_renew(unlock_menu_msg_info, type, status); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 547 | mutex_release(&unlock_menu_msg_info->msg_lock); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 548 | |
lijuang | f55ad05 | 2018-04-23 18:30:50 +0800 | [diff] [blame^] | 549 | dprintf(INFO, "creating %s keys detect thread\n", |
| 550 | status ? "unlock":"lock"); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 551 | display_menu_thread_start(unlock_menu_msg_info); |
lijuang | 7d235f4 | 2015-07-16 20:19:45 +0800 | [diff] [blame] | 552 | } |
| 553 | |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 554 | void display_fastboot_menu() |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 555 | { |
| 556 | struct select_msg_info *fastboot_menu_msg_info; |
| 557 | fastboot_menu_msg_info = &msg_info; |
| 558 | |
Krishna Manikandan | f2c8be9 | 2017-12-05 18:07:56 +0530 | [diff] [blame] | 559 | if (is_display_disabled()) |
| 560 | return; |
| 561 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 562 | set_message_factor(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 563 | |
| 564 | msg_lock_init(); |
| 565 | mutex_acquire(&fastboot_menu_msg_info->msg_lock); |
| 566 | |
| 567 | /* There are 4 pages for fastboot menu: |
| 568 | * Page: Start/Fastboot/Recovery/Poweroff |
| 569 | * The menu is switched base on the option index |
| 570 | * Initialize the option index and last_msg_type |
| 571 | */ |
| 572 | fastboot_menu_msg_info->info.option_index = 0; |
| 573 | fastboot_menu_msg_info->last_msg_type = |
| 574 | fastboot_menu_msg_info->info.msg_type; |
| 575 | |
| 576 | display_fastboot_menu_renew(fastboot_menu_msg_info); |
| 577 | mutex_release(&fastboot_menu_msg_info->msg_lock); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 578 | |
| 579 | dprintf(INFO, "creating fastboot menu keys detect thread\n"); |
| 580 | display_menu_thread_start(fastboot_menu_msg_info); |
| 581 | } |
| 582 | |
Monika Singh | 5e17036 | 2018-03-14 00:48:36 +0530 | [diff] [blame] | 583 | #if VERIFIED_BOOT || VERIFIED_BOOT_2 |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 584 | void display_bootverify_menu(int type) |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 585 | { |
| 586 | struct select_msg_info *bootverify_menu_msg_info; |
| 587 | bootverify_menu_msg_info = &msg_info; |
| 588 | |
Krishna Manikandan | f2c8be9 | 2017-12-05 18:07:56 +0530 | [diff] [blame] | 589 | if (is_display_disabled()) |
| 590 | return; |
| 591 | |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 592 | set_message_factor(); |
lijuang | 9a7d3b9 | 2015-11-30 14:41:24 +0800 | [diff] [blame] | 593 | |
| 594 | msg_lock_init(); |
| 595 | mutex_acquire(&bootverify_menu_msg_info->msg_lock); |
| 596 | |
| 597 | /* Initialize the last_msg_type */ |
| 598 | bootverify_menu_msg_info->last_msg_type = |
| 599 | bootverify_menu_msg_info->info.msg_type; |
| 600 | |
| 601 | display_bootverify_menu_renew(bootverify_menu_msg_info, type); |
| 602 | mutex_release(&bootverify_menu_msg_info->msg_lock); |
lijuang | 4ece1e7 | 2015-08-14 21:02:36 +0800 | [diff] [blame] | 603 | |
| 604 | dprintf(INFO, "creating boot verify keys detect thread\n"); |
| 605 | display_menu_thread_start(bootverify_menu_msg_info); |
| 606 | } |
| 607 | #endif |