Lines Matching +full:mode +full:- +full:recovery

8  *      http://www.apache.org/licenses/LICENSE-2.0
64 static const char *COMMAND_FILE = "/userdata/recovery/command";
65 static const char *INTENT_FILE = "/userdata/recovery/intent";
66 static const char *LOG_FILE = "/userdata/recovery/log";
67 static const char *LAST_LOG_FILE = "/userdata/recovery/last_log";
73 static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
82 * The recovery tool communicates with the main system through /cache files.
83 * /cache/recovery/command - INPUT - command line for tool, one arg per line
84 * /cache/recovery/log - OUTPUT - combined log file from recovery run(s)
85 * /cache/recovery/intent - OUTPUT - intent that was passed in
87 * The arguments which may be supplied in the recovery.command file:
88 * --send_intent=anystring - write the text out to recovery.intent
89 * --update_package=path - verify install an OTA package file
90 * --wipe_data - erase user data (and cache), then reboot
91 * --wipe_cache - wipe cache (but not user data), then reboot
92 * --set_encrypted_filesystem=on|off - enables / diasables encrypted fs
94 * After completing, we remove /cache/recovery/command and reboot.
100 * 2. main system writes "--wipe_data" to /cache/recovery/command
101 * 3. main system reboots into recovery
102 * 4. get_args() writes BCB with "boot-recovery" and "--wipe_data"
103 * -- after this, rebooting will restart the erase --
107 * -- after this, rebooting will restart the main system --
111 * 1. main system downloads OTA package to /cache/some-filename.zip
112 * 2. main system writes "--update_package=/cache/some-filename.zip"
113 * 3. main system reboots into recovery
114 * 4. get_args() writes BCB with "boot-recovery" and "--update_package=..."
115 * -- after this, rebooting will attempt to reinstall the update --
119 * -- after this, rebooting will (try to) restart the main system --
125 * 8a. m_i_f_u() writes BCB with "boot-recovery" and "--wipe_cache"
126 * -- after this, rebooting will reformat cache & restart main system --
128 * 8c. m_i_f_u() writes BCB with "update-radio/hboot" and "--wipe_cache"
129 * -- after this, rebooting will attempt to reinstall firmware --
131 * 8e. bootloader writes BCB with "boot-recovery" (keeping "--wipe_cache")
132 * -- after this, rebooting will reformat cache & restart main system --
135 * -- after this, rebooting will (try to) restart the main system --
140 * 2. main system writes "--set_encrypted_filesystems=on|off" to
141 * /cache/recovery/command
142 * 3. main system reboots into recovery
143 * 4. get_args() writes BCB with "boot-recovery" and
144 * "--set_encrypted_filesystems=on|off"
145 * -- after this, rebooting will restart the transition --
155 * -- after this, rebooting will restart the main system --
177 fopen_path(const char *path, const char *mode) in fopen_path() argument
186 if (strchr("wa", mode[0])) dirCreateHierarchy(path, 0777, NULL, 1); in fopen_path()
188 FILE *fp = fopen(path, mode); in fopen_path()
216 // - the actual command line
217 // - the bootloader control block (one per line, after "recovery")
218 // - the contents of COMMAND_FILE (one per line)
234 // --- if arguments weren't supplied, look in the bootloader control block in get_args()
236 boot.recovery[sizeof(boot.recovery) - 1] = '\0'; // Ensure termination in get_args()
237 const char *arg = strtok(boot.recovery, "\n"); in get_args()
238 if (arg != NULL && !strcmp(arg, "recovery")) { in get_args()
246 } else if (boot.recovery[0] != 0 && boot.recovery[0] != 255) { in get_args()
247 LOGE("Bad boot message\n\"%.20s\"\n", boot.recovery); in get_args()
251 // --- if that doesn't work, try the command file in get_args()
270 // --> write the arguments we have back into the bootloader control block in get_args()
271 // always boot into recovery after this (until finish_recovery() is called) in get_args()
272 strlcpy(boot.command, "boot-recovery", sizeof(boot.command)); in get_args()
273 strlcpy(boot.recovery, "recovery\n", sizeof(boot.recovery)); in get_args()
276 strlcat(boot.recovery, (*argv)[i], sizeof(boot.recovery)); in get_args()
277 strlcat(boot.recovery, "\n", sizeof(boot.recovery)); in get_args()
287 strlcpy(boot.command, "boot-recovery", sizeof(boot.command)); in set_sdcard_update_bootloader_message()
288 strlcpy(boot.recovery, "recovery\n", sizeof(boot.recovery)); in set_sdcard_update_bootloader_message()
321 // clear the recovery command and prepare to boot a (hopefully working) system,
346 // Reset to mormal system boot so recovery won't cycle indefinitely. in finish_recovery()
352 // Remove the command file, so recovery won't repeat indefinitely. in finish_recovery()
459 // "adb push" is happy to overwrite read-only files when it's in copy_sideloaded_package()
472 char* title[] = { "Linux system recovery <" in prepend_title()
479 // caller-provided headers. in prepend_title()
504 int chosen_item = -1; in get_menu_selection()
515 --selected; in get_menu_selection()
572 int name_len = strlen(de->d_name); in sdcard_directory()
574 if (de->d_type == DT_DIR) { in sdcard_directory()
576 if (name_len == 1 && de->d_name[0] == '.') continue; in sdcard_directory()
577 if (name_len == 2 && de->d_name[0] == '.' && in sdcard_directory()
578 de->d_name[1] == '.') continue; in sdcard_directory()
585 strcpy(dirs[d_size], de->d_name); in sdcard_directory()
589 } else if (de->d_type == DT_REG && in sdcard_directory()
591 strncasecmp(de->d_name + (name_len - 4), ".zip", 4) == 0) { in sdcard_directory()
596 zips[z_size++] = strdup(de->d_name); in sdcard_directory()
623 result = -1; in sdcard_directory()
625 } else if (item[item_len - 1] == '/') { in sdcard_directory()
631 new_path[strlen(new_path) - 1] = '\0'; // truncate the trailing '/' in sdcard_directory()
642 ui_print("\n-- Install %s ...\n", path); in sdcard_directory()
687 " Yes -- delete all user data", // [7] in wipe_data()
700 ui_print("\n-- Wiping data...\n"); in wipe_data()
746 return -1; in ui_update()
765 // device-specific code may take some action here. It may in prompt_and_wait()
797 // LOGD("%s:%d:-------->>>>> USERDATA update\n",__func__, __LINE__); in prompt_and_wait()
812 // LOGD("%s:%d:-------->>>> UDISK update\n",__func__, __LINE__); in prompt_and_wait()
861 while ((arg = getopt_long(argc, argv, "", OPTIONS, NULL)) != -1) { in main()
915 printf(" ROCKCHIP recovery system \n"); in main()
919 LOGI("Starting recovery on %s\n", ctime(&start)); in main()
926 LOGI("Recovery System have UI defined.\n"); in main()
967 system("echo default-on > /sys/class/leds/work/trigger"); in main()
995 encrypted_fs_data.mode = MODE_ENCRYPTED_FS_ENABLED; in main()
998 encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; in main()
1005 // Recovery strategy: if the data partition is damaged, disable encrypted file systems. in main()
1006 // This preventsthe device recycling endlessly in recovery mode. in main()
1007 if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && in main()
1010 encrypted_fs_data.mode = MODE_ENCRYPTED_FS_DISABLED; in main()
1022 } else if ((encrypted_fs_data.mode == MODE_ENCRYPTED_FS_ENABLED) && in main()
1103 const MtdPartition *part = mtd_find_partition_by_name("rk-nand"); in main()
1105 part = mtd_find_partition_by_name("spi-nand0"); in main()
1110 system("flashcp -v " FACTORY_FIRMWARE_IMAGE " /dev/mtd0"); in main()
1112 LOGE("Error: Can't find rk-nand or spi-nand0.\n"); in main()
1162 const MtdPartition *part = mtd_find_partition_by_name("rk-nand"); in main()
1164 part = mtd_find_partition_by_name("spi-nand0"); in main()
1169 system("flashcp -v " FACTORY_FIRMWARE_IMAGE " /dev/mtd0"); in main()
1171 LOGE("Error: Can't find rk-nand or spi-nand0.\n"); in main()
1206 printf("------------------ pcba test start -------------\n"); in main()
1207 exit(EXIT_SUCCESS); //exit recovery bin directly, not start pcba here, in rkLanuch.sh in main()
1256 * updating is completely, remove U-disk and reboot */ in main()
1271 elapsed_time = (end_time.tv_sec - start_time.tv_sec) * 1000LL + in main()
1272 (end_time.tv_usec - start_time.tv_usec) / 1000LL; in main()
1273 LOGI("recovery usage time:%lld ms\n", elapsed_time); in main()