Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 50.01 KB | None | 0 0
  1. techmik@michaels-laptop:~$ diff -wrp ~/android/system/bootable/recovery/ ~/cm-main/android_bootable_recovery
  2. diff -wrp /home/techmik/android/system/bootable/recovery//Android.mk /home/techmik/cm-main/android_bootable_recovery/Android.mk
  3. *** /home/techmik/android/system/bootable/recovery//Android.mk  2011-04-01 04:16:02.000000000 -0400
  4. --- /home/techmik/cm-main/android_bootable_recovery/Android.mk  2011-04-22 19:44:57.000000000 -0400
  5. *************** LOCAL_MODULE := recovery
  6. *** 26,37 ****
  7.  
  8.   LOCAL_FORCE_STATIC_EXECUTABLE := true
  9.  
  10. ! RECOVERY_VERSION := ClockworkMod Recovery v3.0.0.5
  11.   LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
  12.   RECOVERY_API_VERSION := 2
  13.   LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
  14.  
  15. ! BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_MTD_CACHE BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_RECOVERY_IGNORE_BOOTABLES
  16.  
  17.   $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
  18.     $(if $($(board_define)), \
  19. --- 26,37 ----
  20.  
  21.   LOCAL_FORCE_STATIC_EXECUTABLE := true
  22.  
  23. ! RECOVERY_VERSION := ClockworkMod Recovery v3.0.2.4
  24.   LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
  25.   RECOVERY_API_VERSION := 2
  26.   LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
  27.  
  28. ! BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY BOARD_UMS_LUNFILE
  29.  
  30.   $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
  31.     $(if $($(board_define)), \
  32. *************** LOCAL_STATIC_LIBRARIES += libext4_utils
  33. *** 57,63 ****
  34.   LOCAL_STATIC_LIBRARIES += libminzip libunz libmincrypt
  35.  
  36.   LOCAL_STATIC_LIBRARIES += libedify libbusybox libclearsilverregex libmkyaffs2image libunyaffs liberase_image libdump_image libflash_image
  37. ! LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils libbml_over_mtd
  38.  
  39.   LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
  40.   LOCAL_STATIC_LIBRARIES += libstdc++ libc
  41. --- 57,63 ----
  42.   LOCAL_STATIC_LIBRARIES += libminzip libunz libmincrypt
  43.  
  44.   LOCAL_STATIC_LIBRARIES += libedify libbusybox libclearsilverregex libmkyaffs2image libunyaffs liberase_image libdump_image libflash_image
  45. ! LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils
  46.  
  47.   LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
  48.   LOCAL_STATIC_LIBRARIES += libstdc++ libc
  49. *************** LOCAL_C_INCLUDES += system/extras/ext4_u
  50. *** 66,72 ****
  51.  
  52.   include $(BUILD_EXECUTABLE)
  53.  
  54. ! RECOVERY_LINKS := edify busybox flash_image dump_image mkyaffs2image unyaffs erase_image nandroid reboot volume bml_over_mtd
  55.  
  56.   # nc is provided by external/netcat
  57.   RECOVERY_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(RECOVERY_LINKS))
  58. --- 66,72 ----
  59.  
  60.   include $(BUILD_EXECUTABLE)
  61.  
  62. ! RECOVERY_LINKS := edify busybox flash_image dump_image mkyaffs2image unyaffs erase_image nandroid reboot volume
  63.  
  64.   # nc is provided by external/netcat
  65.   RECOVERY_SYMLINKS := $(addprefix $(TARGET_RECOVERY_ROOT_OUT)/sbin/,$(RECOVERY_LINKS))
  66. diff -wrp /home/techmik/android/system/bootable/recovery//common.h /home/techmik/cm-main/android_bootable_recovery/common.h
  67. *** /home/techmik/android/system/bootable/recovery//common.h    2011-04-01 04:16:02.000000000 -0400
  68. --- /home/techmik/cm-main/android_bootable_recovery/common.h    2011-04-22 19:44:57.000000000 -0400
  69. *************** typedef struct {
  70. *** 112,118 ****
  71.       const char* device2;      // alternative device to try if fs_type
  72.                                 // == "ext4" or "vfat" and mounting
  73.                                 // 'device' fails
  74. !     const char* fallback_fs_type;
  75.   } Volume;
  76.  
  77.   #endif  // RECOVERY_COMMON_H
  78. --- 112,122 ----
  79.       const char* device2;      // alternative device to try if fs_type
  80.                                 // == "ext4" or "vfat" and mounting
  81.                                 // 'device' fails
  82. !     const char* fs_type2;
  83. !
  84. !     const char* fs_options;
  85. !
  86. !     const char* fs_options2;
  87.   } Volume;
  88.  
  89.   #endif  // RECOVERY_COMMON_H
  90. diff -wrp /home/techmik/android/system/bootable/recovery//default_recovery_ui.c /home/techmik/cm-main/android_bootable_recovery/default_recovery_ui.c
  91. *** /home/techmik/android/system/bootable/recovery//default_recovery_ui.c   2011-04-01 04:16:02.000000000 -0400
  92. --- /home/techmik/cm-main/android_bootable_recovery/default_recovery_ui.c   2011-04-22 19:44:57.000000000 -0400
  93. *************** char* MENU_ITEMS[] = { "reboot system no
  94. *** 30,35 ****
  95. --- 30,36 ----
  96.                          "backup and restore",
  97.                          "mounts and storage",
  98.                          "advanced",
  99. +                        "power off",
  100.                          NULL };
  101.  
  102.   int device_recovery_start() {
  103. *************** int device_toggle_display(volatile char*
  104. *** 42,48 ****
  105.           return 1;
  106.       // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
  107.       if (ui_get_showing_back_button()) {
  108. !         return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
  109.       }
  110.       return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
  111.   }
  112. --- 43,50 ----
  113.           return 1;
  114.       // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
  115.       if (ui_get_showing_back_button()) {
  116. !         return 0;
  117. !         //return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_END);
  118.       }
  119.       return get_allow_toggle_display() && (key_code == KEY_HOME || key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
  120.   }
  121. *************** int device_handle_key(int key_code, int
  122. *** 57,67 ****
  123. --- 59,71 ----
  124.               case KEY_CAPSLOCK:
  125.               case KEY_DOWN:
  126.               case KEY_VOLUMEDOWN:
  127. +             case KEY_MENU:
  128.                   return HIGHLIGHT_DOWN;
  129.  
  130.               case KEY_LEFTSHIFT:
  131.               case KEY_UP:
  132.               case KEY_VOLUMEUP:
  133. +             case KEY_HOME:
  134.                   return HIGHLIGHT_UP;
  135.  
  136.               case KEY_POWER:
  137. *************** int device_handle_key(int key_code, int
  138. *** 82,90 ****
  139.              
  140.               case KEY_END:
  141.               case KEY_BACKSPACE:
  142. !             case KEY_BACK:
  143.                   if (!get_allow_toggle_display())
  144.                       return GO_BACK;
  145.           }
  146.       }
  147.  
  148. --- 86,99 ----
  149.              
  150.               case KEY_END:
  151.               case KEY_BACKSPACE:
  152. !             case KEY_SEARCH:
  153. !                 if (ui_get_showing_back_button()) {
  154. !                     return SELECT_ITEM;
  155. !                 }
  156.                   if (!get_allow_toggle_display())
  157.                       return GO_BACK;
  158. +             case KEY_BACK:
  159. +                 return GO_BACK;
  160.           }
  161.       }
  162.  
  163. diff -wrp /home/techmik/android/system/bootable/recovery//edifyscripting.c /home/techmik/cm-main/android_bootable_recovery/edifyscripting.c
  164. *** /home/techmik/android/system/bootable/recovery//edifyscripting.c    2011-04-01 04:16:02.000000000 -0400
  165. --- /home/techmik/cm-main/android_bootable_recovery/edifyscripting.c    2011-04-22 19:44:57.000000000 -0400
  166. *************** Value* FormatFn(const char* name, State*
  167. *** 135,140 ****
  168. --- 135,148 ----
  169.           return StringValue(strdup(""));
  170.       }
  171.      
  172. +     if (strcmp(path, "/data") == 0 && has_datadata()) {
  173. +         ui_print("Formatting /datadata...\n", path);
  174. +         if (0 != format_volume("/datadata")) {
  175. +             free(path);
  176. +             return StringValue(strdup(""));
  177. +         }
  178. +     }
  179. +
  180.   done:
  181.       return StringValue(strdup(path));
  182.   }
  183. Only in /home/techmik/cm-main/android_bootable_recovery/etc: init.htc.rc
  184. diff -wrp /home/techmik/android/system/bootable/recovery//extendedcommands.c /home/techmik/cm-main/android_bootable_recovery/extendedcommands.c
  185. *** /home/techmik/android/system/bootable/recovery//extendedcommands.c  2011-04-01 04:16:02.000000000 -0400
  186. --- /home/techmik/cm-main/android_bootable_recovery/extendedcommands.c  2011-04-22 19:44:57.000000000 -0400
  187. *************** void show_nandroid_restore_menu()
  188. *** 340,351 ****
  189.           nandroid_restore(file, 1, 1, 1, 1, 1, 0);
  190.   }
  191.  
  192.   void show_mount_usb_storage_menu()
  193.   {
  194.       int fd;
  195.       Volume *vol = volume_for_path("/sdcard");
  196. !     if ((fd = open("/sys/devices/platform/usb_mass_storage/lun0/file",
  197. !                    O_WRONLY)) < 0) {
  198.           LOGE("Unable to open ums lunfile (%s)", strerror(errno));
  199.           return -1;
  200.       }
  201. --- 340,354 ----
  202.           nandroid_restore(file, 1, 1, 1, 1, 1, 0);
  203.   }
  204.  
  205. + #ifndef BOARD_UMS_LUNFILE
  206. + #define BOARD_UMS_LUNFILE "/sys/devices/platform/usb_mass_storage/lun0/file"
  207. + #endif
  208. +
  209.   void show_mount_usb_storage_menu()
  210.   {
  211.       int fd;
  212.       Volume *vol = volume_for_path("/sdcard");
  213. !     if ((fd = open(BOARD_UMS_LUNFILE, O_WRONLY)) < 0) {
  214.           LOGE("Unable to open ums lunfile (%s)", strerror(errno));
  215.           return -1;
  216.       }
  217. *************** void show_mount_usb_storage_menu()
  218. *** 371,377 ****
  219.               break;
  220.       }
  221.  
  222. !     if ((fd = open("/sys/devices/platform/usb_mass_storage/lun0/file", O_WRONLY)) < 0) {
  223.           LOGE("Unable to open ums lunfile (%s)", strerror(errno));
  224.           return -1;
  225.       }
  226. --- 374,380 ----
  227.               break;
  228.       }
  229.  
  230. !     if ((fd = open(BOARD_UMS_LUNFILE, O_WRONLY)) < 0) {
  231.           LOGE("Unable to open ums lunfile (%s)", strerror(errno));
  232.           return -1;
  233.       }
  234. *************** typedef struct {
  235. *** 484,489 ****
  236. --- 487,498 ----
  237.       Volume* v;
  238.   } FormatMenuEntry;
  239.  
  240. + int is_safe_to_format(char* name)
  241. + {
  242. +     return !(strcmp(name, "/misc") == 0 || strcmp(name, "/radio") == 0
  243. +             || strcmp(name, "/bootloader") == 0 || strcmp(name, "/recovery") == 0);
  244. + }
  245. +
  246.   void show_partition_menu()
  247.   {
  248.       static char* headers[] = {  "Mounts and Storage Menu",
  249. *************** void show_partition_menu()
  250. *** 516,532 ****
  251.  
  252.         for (i = 0; i < num_volumes; ++i) {
  253.             Volume* v = &device_volumes[i];
  254. !           if(strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) != 0)
  255.             {
  256.                 sprintf(&mount_menue[mountable_volumes].mount, "mount %s", v->mount_point);
  257.                 sprintf(&mount_menue[mountable_volumes].unmount, "unmount %s", v->mount_point);
  258.                 mount_menue[mountable_volumes].v = &device_volumes[i];
  259.                 ++mountable_volumes;
  260.                 sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point);
  261.                 format_menue[formatable_volumes].v = &device_volumes[i];
  262.                 ++formatable_volumes;
  263.             }
  264. !           else if (strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) == 0)
  265.             {
  266.                 sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point);
  267.                 format_menue[formatable_volumes].v = &device_volumes[i];
  268. --- 525,543 ----
  269.  
  270.         for (i = 0; i < num_volumes; ++i) {
  271.             Volume* v = &device_volumes[i];
  272. !           if(strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) != 0 && strcmp("emmc", v->fs_type) != 0 && strcmp("bml", v->fs_type) != 0)
  273.             {
  274.                 sprintf(&mount_menue[mountable_volumes].mount, "mount %s", v->mount_point);
  275.                 sprintf(&mount_menue[mountable_volumes].unmount, "unmount %s", v->mount_point);
  276.                 mount_menue[mountable_volumes].v = &device_volumes[i];
  277.                 ++mountable_volumes;
  278. +               if (is_safe_to_format(v->mount_point)) {
  279.                     sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point);
  280.                     format_menue[formatable_volumes].v = &device_volumes[i];
  281.                     ++formatable_volumes;
  282.                 }
  283. !           }
  284. !           else if (strcmp("ramdisk", v->fs_type) != 0 && strcmp("mtd", v->fs_type) == 0 && is_safe_to_format(v->mount_point))
  285.             {
  286.                 sprintf(&format_menue[formatable_volumes].txt, "format %s", v->mount_point);
  287.                 format_menue[formatable_volumes].v = &device_volumes[i];
  288. *************** void write_fstab_root(char *path, FILE *
  289. *** 1016,1022 ****
  290.  
  291.       fprintf(file, "%s ", device);
  292.       fprintf(file, "%s ", path);
  293. !     fprintf(file, "%s rw\n", vol->fs_type);
  294.   }
  295.  
  296.   void create_fstab()
  297. --- 1027,1034 ----
  298.  
  299.       fprintf(file, "%s ", device);
  300.       fprintf(file, "%s ", path);
  301. !     // special case rfs cause auto will mount it as vfat on samsung.
  302. !     fprintf(file, "%s rw\n", vol->fs_type2 != NULL && strcmp(vol->fs_type, "rfs") != 0 ? "auto" : vol->fs_type);
  303.   }
  304.  
  305.   void create_fstab()
  306. *************** void create_fstab()
  307. *** 1029,1035 ****
  308.           return;
  309.       }
  310.       Volume *vol = volume_for_path("/boot");
  311. !     if (NULL != vol && strcmp(vol->fs_type, "mtd") != 0)
  312.            write_fstab_root("/boot", file);
  313.       write_fstab_root("/cache", file);
  314.       write_fstab_root("/data", file);
  315. --- 1041,1047 ----
  316.           return;
  317.       }
  318.       Volume *vol = volume_for_path("/boot");
  319. !     if (NULL != vol && strcmp(vol->fs_type, "mtd") != 0 && strcmp(vol->fs_type, "emmc") != 0 && strcmp(vol->fs_type, "bml") != 0)
  320.            write_fstab_root("/boot", file);
  321.       write_fstab_root("/cache", file);
  322.       write_fstab_root("/data", file);
  323. *************** int bml_check_volume(const char *path) {
  324. *** 1068,1073 ****
  325. --- 1080,1088 ----
  326.   void process_volumes() {
  327.       create_fstab();
  328.      
  329. +     return;
  330. +
  331. +     // dead code.
  332.       if (device_flash_type() != BML)
  333.           return;
  334.  
  335. *************** int volume_main(int argc, char **argv) {
  336. *** 1150,1172 ****
  337.       load_volume_table();
  338.       return 0;
  339.   }
  340. -
  341. - void handle_chargemode() {
  342. -     const char* filename = "/proc/cmdline";
  343. -     struct stat file_info;
  344. -     if (0 != stat(filename, &file_info))
  345. -         return;
  346. -
  347. -     int file_len = file_info.st_size;
  348. -     char* file_data = (char*)malloc(file_len + 1);
  349. -     FILE *file = fopen(filename, "rb");
  350. -     if (file == NULL)
  351. -         return;
  352. -     fread(file_data, file_len, 1, file);
  353. -     // supposedly not necessary, but let's be safe.
  354. -     file_data[file_len] = '\0';
  355. -     fclose(file);
  356. -    
  357. -     if (strstr(file_data, "androidboot.mode=offmode_charging") != NULL)
  358. -         reboot(RB_POWER_OFF);
  359. -  }
  360. --- 1165,1167 ----
  361. diff -wrp /home/techmik/android/system/bootable/recovery//flashutils/Android.mk /home/techmik/cm-main/android_bootable_recovery/flashutils/Android.mk
  362. *** /home/techmik/android/system/bootable/recovery//flashutils/Android.mk   2011-04-01 04:16:02.000000000 -0400
  363. --- /home/techmik/cm-main/android_bootable_recovery/flashutils/Android.mk   2011-04-22 19:44:57.000000000 -0400
  364. *************** LOCAL_MODULE_TAGS := eng
  365. *** 57,70 ****
  366.   LOCAL_CFLAGS += -Dmain=erase_image_main
  367.   include $(BUILD_STATIC_LIBRARY)
  368.  
  369. - include $(CLEAR_VARS)
  370. - LOCAL_SRC_FILES := bml_over_mtd.c
  371. - LOCAL_C_INCLUDES += bootable/recovery/mtdutils
  372. - LOCAL_MODULE := libbml_over_mtd
  373. - LOCAL_MODULE_TAGS := eng
  374. - LOCAL_CFLAGS += -Dmain=bml_over_mtd_main
  375. - include $(BUILD_STATIC_LIBRARY)
  376. -
  377.  
  378.   include $(CLEAR_VARS)
  379.   LOCAL_SRC_FILES := dump_image.c
  380. --- 57,62 ----
  381. *************** LOCAL_STATIC_LIBRARIES := libflashutils
  382. *** 102,119 ****
  383.   LOCAL_FORCE_STATIC_EXECUTABLE := true
  384.   include $(BUILD_EXECUTABLE)
  385.  
  386. - include $(CLEAR_VARS)
  387. - LOCAL_SRC_FILES := bml_over_mtd.c
  388. - LOCAL_MODULE := bml_over_mtd
  389. - LOCAL_MODULE_TAGS := eng
  390. - LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES
  391. - LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities
  392. - LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities
  393. - LOCAL_MODULE_STEM := bml_over_mtd
  394. - LOCAL_C_INCLUDES += bootable/recovery/mtdutils
  395. - LOCAL_STATIC_LIBRARIES := libmtdutils libcutils libc
  396. - LOCAL_FORCE_STATIC_EXECUTABLE := true
  397. - include $(BUILD_EXECUTABLE)
  398. -
  399.   endif # TARGET_ARCH == arm
  400.   endif # !TARGET_SIMULATOR
  401. --- 94,98 ----
  402. Only in /home/techmik/android/system/bootable/recovery//flashutils: bml_over_mtd.c
  403. diff -wrp /home/techmik/android/system/bootable/recovery//flashutils/flashutils.c /home/techmik/cm-main/android_bootable_recovery/flashutils/flashutils.c
  404. *** /home/techmik/android/system/bootable/recovery//flashutils/flashutils.c 2011-04-01 04:16:02.000000000 -0400
  405. --- /home/techmik/cm-main/android_bootable_recovery/flashutils/flashutils.c 2011-04-22 19:44:57.000000000 -0400
  406. *************** __system(const char *command)
  407. *** 69,77 ****
  408.       return (pid == -1 ? -1 : pstat);
  409.   }
  410.  
  411. ! int restore_raw_partition(const char *partition, const char *filename)
  412.   {
  413.       int type = device_flash_type();
  414.       switch (type) {
  415.           case MTD:
  416.               return cmd_mtd_restore_raw_partition(partition, filename);
  417. --- 69,89 ----
  418.       return (pid == -1 ? -1 : pstat);
  419.   }
  420.  
  421. ! static int detect_partition(const char *partition)
  422.   {
  423.       int type = device_flash_type();
  424. +     if (strstr(partition, "/dev/block/mtd") != NULL)
  425. +         type = MTD;
  426. +     else if (strstr(partition, "/dev/block/mmc") != NULL)
  427. +         type = MMC;
  428. +     else if (strstr(partition, "/dev/block/bml") != NULL)
  429. +         type = BML;
  430. +        
  431. +     return type;
  432. + }
  433. + int restore_raw_partition(const char *partition, const char *filename)
  434. + {
  435. +     int type = detect_partition(partition);
  436.       switch (type) {
  437.           case MTD:
  438.               return cmd_mtd_restore_raw_partition(partition, filename);
  439. *************** int restore_raw_partition(const char *pa
  440. *** 86,92 ****
  441.  
  442.   int backup_raw_partition(const char *partition, const char *filename)
  443.   {
  444. !     int type = device_flash_type();
  445.       switch (type) {
  446.           case MTD:
  447.               return cmd_mtd_backup_raw_partition(partition, filename);
  448. --- 98,104 ----
  449.  
  450.   int backup_raw_partition(const char *partition, const char *filename)
  451.   {
  452. !     int type = detect_partition(partition);
  453.       switch (type) {
  454.           case MTD:
  455.               return cmd_mtd_backup_raw_partition(partition, filename);
  456. *************** int backup_raw_partition(const char *par
  457. *** 101,107 ****
  458.  
  459.   int erase_raw_partition(const char *partition)
  460.   {
  461. !     int type = device_flash_type();
  462.       switch (type) {
  463.           case MTD:
  464.               return cmd_mtd_erase_raw_partition(partition);
  465. --- 113,119 ----
  466.  
  467.   int erase_raw_partition(const char *partition)
  468.   {
  469. !     int type = detect_partition(partition);
  470.       switch (type) {
  471.           case MTD:
  472.               return cmd_mtd_erase_raw_partition(partition);
  473. *************** int erase_raw_partition(const char *part
  474. *** 116,122 ****
  475.  
  476.   int erase_partition(const char *partition, const char *filesystem)
  477.   {
  478. !     int type = device_flash_type();
  479.       switch (type) {
  480.           case MTD:
  481.               return cmd_mtd_erase_partition(partition, filesystem);
  482. --- 128,134 ----
  483.  
  484.   int erase_partition(const char *partition, const char *filesystem)
  485.   {
  486. !     int type = detect_partition(partition);
  487.       switch (type) {
  488.           case MTD:
  489.               return cmd_mtd_erase_partition(partition, filesystem);
  490. *************** int erase_partition(const char *partitio
  491. *** 131,137 ****
  492.  
  493.   int mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only)
  494.   {
  495. !     int type = device_flash_type();
  496.       switch (type) {
  497.           case MTD:
  498.               return cmd_mtd_mount_partition(partition, mount_point, filesystem, read_only);
  499. --- 143,149 ----
  500.  
  501.   int mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only)
  502.   {
  503. !     int type = detect_partition(partition);
  504.       switch (type) {
  505.           case MTD:
  506.               return cmd_mtd_mount_partition(partition, mount_point, filesystem, read_only);
  507. Only in /home/techmik/cm-main/android_bootable_recovery/.git: branches
  508. diff -wrp /home/techmik/android/system/bootable/recovery//.git/config /home/techmik/cm-main/android_bootable_recovery/.git/config
  509. *** /home/techmik/android/system/bootable/recovery//.git/config 2011-04-08 23:15:45.000000000 -0400
  510. --- /home/techmik/cm-main/android_bootable_recovery/.git/config 2011-04-22 19:44:57.000000000 -0400
  511. ***************
  512. *** 1,13 ****
  513.   [core]
  514.     repositoryformatversion = 0
  515.     filemode = true
  516. ! [user]
  517. !   email = techmik67@gmail.com
  518. ! [remote "github"]
  519. !   url = git://github.com/teamhacksung/android_bootable_recovery.git
  520. !   review = review.cyanogenmod.com
  521. !   projectname = teamhacksung/android_bootable_recovery
  522. !   fetch = +refs/heads/*:refs/remotes/github/*
  523.   [branch "gingerbread"]
  524. !   remote = github
  525. !   merge = gingerbread
  526. --- 1,11 ----
  527.   [core]
  528.     repositoryformatversion = 0
  529.     filemode = true
  530. !   bare = false
  531. !   logallrefupdates = true
  532. ! [remote "origin"]
  533. !   fetch = +refs/heads/*:refs/remotes/origin/*
  534. !   url = git://github.com/CyanogenMod/android_bootable_recovery.git
  535.   [branch "gingerbread"]
  536. !   remote = origin
  537. !   merge = refs/heads/gingerbread
  538. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: applypatch-msg.sample
  539. Only in /home/techmik/android/system/bootable/recovery//.git/hooks: commit-msg
  540. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: commit-msg.sample
  541. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: post-commit.sample
  542. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: post-receive.sample
  543. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: post-update.sample
  544. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: pre-applypatch.sample
  545. Only in /home/techmik/android/system/bootable/recovery//.git/hooks: pre-auto-gc
  546. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: pre-commit.sample
  547. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: prepare-commit-msg.sample
  548. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: pre-rebase.sample
  549. Only in /home/techmik/cm-main/android_bootable_recovery/.git/hooks: update.sample
  550. Binary files /home/techmik/android/system/bootable/recovery//.git/index and /home/techmik/cm-main/android_bootable_recovery/.git/index differ
  551. diff -wrp /home/techmik/android/system/bootable/recovery//.git/logs/HEAD /home/techmik/cm-main/android_bootable_recovery/.git/logs/HEAD
  552. *** /home/techmik/android/system/bootable/recovery//.git/logs/HEAD  2011-04-08 23:15:45.000000000 -0400
  553. --- /home/techmik/cm-main/android_bootable_recovery/.git/logs/HEAD  2011-04-22 19:44:57.000000000 -0400
  554. ***************
  555. *** 1,4 ****
  556. ! e63320aa120f2262dce36e8bfcdd72a13649e859 e63320aa120f2262dce36e8bfcdd72a13649e859 Michael <techmik67@gmail.com> 1302313448 -0400  checkout: moving from e63320aa120f2262dce36e8bfcdd72a13649e859 to gingerbread
  557. ! e63320aa120f2262dce36e8bfcdd72a13649e859 e63320aa120f2262dce36e8bfcdd72a13649e859 Michael <techmik67@gmail.com> 1302313518 -0400  checkout: moving from gingerbread to usb
  558. ! e63320aa120f2262dce36e8bfcdd72a13649e859 e63320aa120f2262dce36e8bfcdd72a13649e859 Michael <techmik67@gmail.com> 1302318668 -0400  checkout: moving from usb to gingerbread
  559. ! e63320aa120f2262dce36e8bfcdd72a13649e859 413156f46a8a1a9ea14ce5785fb09f5df6629798 Michael <techmik67@gmail.com> 1302318945 -0400  merge 413156f46a8a1a9ea14ce5785fb09f5df6629798: Fast-forward
  560. --- 1 ----
  561. ! 0000000000000000000000000000000000000000 f1bde365724b63b0f2b97304167fe60da9fd44cd techmik <techmik67@gmail.com> 1303515897 -0400  clone: from git://github.com/CyanogenMod/android_bootable_recovery.git
  562. diff -wrp /home/techmik/android/system/bootable/recovery//.git/logs/refs/heads/gingerbread /home/techmik/cm-main/android_bootable_recovery/.git/logs/refs/heads/gingerbread
  563. *** /home/techmik/android/system/bootable/recovery//.git/logs/refs/heads/gingerbread    2011-04-08 23:15:45.000000000 -0400
  564. --- /home/techmik/cm-main/android_bootable_recovery/.git/logs/refs/heads/gingerbread    2011-04-22 19:44:57.000000000 -0400
  565. ***************
  566. *** 1,2 ****
  567. ! 0000000000000000000000000000000000000000 e63320aa120f2262dce36e8bfcdd72a13649e859 Michael <techmik67@gmail.com> 1302313434 -0400  branch: Created from github/gingerbread
  568. ! e63320aa120f2262dce36e8bfcdd72a13649e859 413156f46a8a1a9ea14ce5785fb09f5df6629798 Michael <techmik67@gmail.com> 1302318945 -0400  merge 413156f46a8a1a9ea14ce5785fb09f5df6629798: Fast-forward
  569. --- 1 ----
  570. ! 0000000000000000000000000000000000000000 f1bde365724b63b0f2b97304167fe60da9fd44cd techmik <techmik67@gmail.com> 1303515897 -0400  clone: from git://github.com/CyanogenMod/android_bootable_recovery.git
  571. Only in /home/techmik/android/system/bootable/recovery//.git/logs/refs: remotes
  572. Only in /home/techmik/android/system/bootable/recovery//.git/objects: 41
  573. Only in /home/techmik/android/system/bootable/recovery//.git/objects: 4c
  574. Only in /home/techmik/android/system/bootable/recovery//.git/objects: d4
  575. Only in /home/techmik/cm-main/android_bootable_recovery/.git/objects/pack: pack-d333eb5c1f4fbcdce971d9e00ea7ee95c55ea70c.idx
  576. Only in /home/techmik/cm-main/android_bootable_recovery/.git/objects/pack: pack-d333eb5c1f4fbcdce971d9e00ea7ee95c55ea70c.pack
  577. Only in /home/techmik/android/system/bootable/recovery//.git/objects/pack: pack-f8b3bd47c78e25c2140880b60c6a669a6e00bd0d.idx
  578. Only in /home/techmik/android/system/bootable/recovery//.git/objects/pack: pack-f8b3bd47c78e25c2140880b60c6a669a6e00bd0d.pack
  579. Only in /home/techmik/android/system/bootable/recovery//.git: ORIG_HEAD
  580. diff -wrp /home/techmik/android/system/bootable/recovery//.git/packed-refs /home/techmik/cm-main/android_bootable_recovery/.git/packed-refs
  581. *** /home/techmik/android/system/bootable/recovery//.git/packed-refs    2011-04-01 03:01:19.000000000 -0400
  582. --- /home/techmik/cm-main/android_bootable_recovery/.git/packed-refs    2011-04-22 19:44:57.000000000 -0400
  583. ***************
  584. *** 1,7 ****
  585.   # pack-refs with: peeled
  586. ! d105f8f84f25db7861775e07a808855334207d95 refs/remotes/github/cupcake
  587. ! adf906d034480fdffbfca51f56176d0e0d603437 refs/remotes/github/eclair
  588. ! 0b7bbf29d5864fc2939ab9b954c0e1d18a24bffd refs/remotes/github/froyo
  589. ! 8df69c0660927cd1c10a11b40f0c28641405adc2 refs/remotes/github/froyo-stable
  590. ! e63320aa120f2262dce36e8bfcdd72a13649e859 refs/remotes/github/gingerbread
  591. ! 789d4d969027c745837f437298ab42957b5576ac refs/remotes/github/streak
  592. --- 1,7 ----
  593.   # pack-refs with: peeled
  594. ! 789d4d969027c745837f437298ab42957b5576ac refs/remotes/origin/streak
  595. ! f1bde365724b63b0f2b97304167fe60da9fd44cd refs/remotes/origin/gingerbread
  596. ! 8df69c0660927cd1c10a11b40f0c28641405adc2 refs/remotes/origin/froyo-stable
  597. ! 3d6a2111e40a30424117b6e7d4623d71ee0df96a refs/remotes/origin/froyo
  598. ! adf906d034480fdffbfca51f56176d0e0d603437 refs/remotes/origin/eclair
  599. ! d105f8f84f25db7861775e07a808855334207d95 refs/remotes/origin/cupcake
  600. diff -wrp /home/techmik/android/system/bootable/recovery//.git/refs/heads/gingerbread /home/techmik/cm-main/android_bootable_recovery/.git/refs/heads/gingerbread
  601. *** /home/techmik/android/system/bootable/recovery//.git/refs/heads/gingerbread2011-04-08 23:15:45.000000000 -0400
  602. --- /home/techmik/cm-main/android_bootable_recovery/.git/refs/heads/gingerbread2011-04-22 19:44:57.000000000 -0400
  603. ***************
  604. *** 1 ****
  605. ! 413156f46a8a1a9ea14ce5785fb09f5df6629798
  606. --- 1 ----
  607. ! f1bde365724b63b0f2b97304167fe60da9fd44cd
  608. Only in /home/techmik/android/system/bootable/recovery//.git/refs/remotes: github
  609. Only in /home/techmik/android/system/bootable/recovery//.git/refs/remotes: m
  610. Only in /home/techmik/cm-main/android_bootable_recovery/.git/refs/remotes: origin
  611. Only in /home/techmik/android/system/bootable/recovery//.git: rr-cache
  612. Only in /home/techmik/android/system/bootable/recovery//.git: svn
  613. Only in /home/techmik/cm-main/android_bootable_recovery: htc
  614. diff -wrp /home/techmik/android/system/bootable/recovery//mmcutils/Android.mk /home/techmik/cm-main/android_bootable_recovery/mmcutils/Android.mk
  615. *** /home/techmik/android/system/bootable/recovery//mmcutils/Android.mk 2011-04-01 04:16:02.000000000 -0400
  616. --- /home/techmik/cm-main/android_bootable_recovery/mmcutils/Android.mk 2011-04-22 19:44:57.000000000 -0400
  617. *************** ifeq ($(TARGET_ARCH),arm)
  618. *** 4,9 ****
  619. --- 4,13 ----
  620.   LOCAL_PATH := $(call my-dir)
  621.   include $(CLEAR_VARS)
  622.  
  623. + ifeq ($(BOARD_HAS_LARGE_FILESYSTEM),true)
  624. + LOCAL_CFLAGS += -DBOARD_HAS_LARGE_FILESYSTEM
  625. + endif
  626. +
  627.   LOCAL_SRC_FILES := \
  628.     mmcutils.c
  629.  
  630. diff -wrp /home/techmik/android/system/bootable/recovery//mmcutils/mmcutils.c /home/techmik/cm-main/android_bootable_recovery/mmcutils/mmcutils.c
  631. *** /home/techmik/android/system/bootable/recovery//mmcutils/mmcutils.c 2011-04-01 04:16:02.000000000 -0400
  632. --- /home/techmik/cm-main/android_bootable_recovery/mmcutils/mmcutils.c 2011-04-22 19:44:57.000000000 -0400
  633. *************** run_exec_process ( char **argv) {
  634. *** 340,352 ****
  635.  
  636.   int
  637.   format_ext3_device (const char *device) {
  638. !     // Run mke2fs
  639.       char *const mke2fs[] = {MKE2FS_BIN, "-j", device, NULL};
  640.       if(run_exec_process(mke2fs))
  641.           return -1;
  642.  
  643.       // Run tune2fs
  644. -     char *const tune2fs[] = {TUNE2FS_BIN, "-j", "-C", "1", device, NULL};
  645.       if(run_exec_process(tune2fs))
  646.           return -1;
  647.  
  648. --- 340,357 ----
  649.  
  650.   int
  651.   format_ext3_device (const char *device) {
  652. ! #ifdef BOARD_HAS_LARGE_FILESYSTEM
  653. !     char *const mke2fs[] = {MKE2FS_BIN, "-j", "-q", device, NULL};
  654. !     char *const tune2fs[] = {TUNE2FS_BIN, "-C", "1", device, NULL};
  655. ! #else
  656.       char *const mke2fs[] = {MKE2FS_BIN, "-j", device, NULL};
  657. +     char *const tune2fs[] = {TUNE2FS_BIN, "-j", "-C", "1", device, NULL};
  658. + #endif
  659. +     // Run mke2fs
  660.       if(run_exec_process(mke2fs))
  661.           return -1;
  662.  
  663.       // Run tune2fs
  664.       if(run_exec_process(tune2fs))
  665.           return -1;
  666.  
  667. *************** ERROR3:
  668. *** 464,472 ****
  669.   }
  670.  
  671.  
  672. - // TODO: refactor this to not be a giant copy paste mess
  673.   int
  674. ! mmc_raw_dump (const MmcPartition *partition, char *out_file) {
  675.       int ch;
  676.       FILE *in;
  677.       FILE *out;
  678. --- 469,476 ----
  679.   }
  680.  
  681.  
  682.   int
  683. ! mmc_raw_dump_internal (const char* in_file, const char *out_file) {
  684.       int ch;
  685.       FILE *in;
  686.       FILE *out;
  687. *************** mmc_raw_dump (const MmcPartition *partit
  688. *** 475,481 ****
  689.       unsigned sz = 0;
  690.       unsigned i;
  691.       int ret = -1;
  692. -     char *in_file = partition->device_index;
  693.  
  694.       in  = fopen ( in_file,  "r" );
  695.       if (in == NULL)
  696. --- 479,484 ----
  697. *************** ERROR3:
  698. *** 516,521 ****
  699. --- 519,530 ----
  700.  
  701.   }
  702.  
  703. + // TODO: refactor this to not be a giant copy paste mess
  704. + int
  705. + mmc_raw_dump (const MmcPartition *partition, char *out_file) {
  706. +     return mmc_raw_dump_internal(partition->device_index, out_file);
  707. + }
  708. +
  709.  
  710.   int
  711.   mmc_raw_read (const MmcPartition *partition, char *data, int data_size) {
  712. *************** ERROR3:
  713. *** 575,580 ****
  714. --- 584,590 ----
  715.  
  716.   int cmd_mmc_restore_raw_partition(const char *partition, const char *filename)
  717.   {
  718. +     if (partition[0] != '/') {
  719.           mmc_scan_partitions();
  720.           const MmcPartition *p;
  721.           p = mmc_find_partition_by_name(partition);
  722. *************** int cmd_mmc_restore_raw_partition(const
  723. *** 582,590 ****
  724. --- 592,605 ----
  725.               return -1;
  726.           return mmc_raw_copy(p, filename);
  727.       }
  728. +     else {
  729. +         return mmc_raw_dump_internal(filename, partition);
  730. +     }
  731. + }
  732.  
  733.   int cmd_mmc_backup_raw_partition(const char *partition, const char *filename)
  734.   {
  735. +     if (partition[0] != '/') {
  736.           mmc_scan_partitions();
  737.           const MmcPartition *p;
  738.           p = mmc_find_partition_by_name(partition);
  739. *************** int cmd_mmc_backup_raw_partition(const c
  740. *** 592,607 ****
  741.           return -1;
  742.       return mmc_raw_dump(p, filename);
  743.   }
  744.  
  745.   int cmd_mmc_erase_raw_partition(const char *partition)
  746.   {
  747. -     mmc_scan_partitions();
  748. -     const MmcPartition *p;
  749. -     p = mmc_find_partition_by_name(partition);
  750. -     if (p == NULL)
  751. -         return -1;
  752. -
  753. -     // TODO: implement raw wipe
  754.       return 0;
  755.   }
  756.  
  757. --- 607,619 ----
  758.               return -1;
  759.           return mmc_raw_dump(p, filename);
  760.       }
  761. +     else {
  762. +         return mmc_raw_dump_internal(partition, filename);
  763. +     }
  764. + }
  765.  
  766.   int cmd_mmc_erase_raw_partition(const char *partition)
  767.   {
  768.       return 0;
  769.   }
  770.  
  771. diff -wrp /home/techmik/android/system/bootable/recovery//nandroid.c /home/techmik/cm-main/android_bootable_recovery/nandroid.c
  772. *** /home/techmik/android/system/bootable/recovery//nandroid.c  2011-04-01 04:16:02.000000000 -0400
  773. --- /home/techmik/cm-main/android_bootable_recovery/nandroid.c  2011-04-22 19:44:57.000000000 -0400
  774. *************** int nandroid_backup_partition(const char
  775. *** 110,115 ****
  776. --- 110,116 ----
  777.       char tmp[PATH_MAX];
  778.       int ret;
  779.       if (strcmp(vol->fs_type, "mtd") == 0 ||
  780. +             strcmp(vol->fs_type, "bml") == 0 ||
  781.               strcmp(vol->fs_type, "emmc") == 0) {
  782.           const char* name = basename(root);
  783.           sprintf(tmp, "%s/%s.img", backup_path, name);
  784. *************** int nandroid_backup(const char* backup_p
  785. *** 153,166 ****
  786.       if (0 != (ret = nandroid_backup_partition(backup_path, "/recovery")))
  787.           return ret;
  788.  
  789. !     if (0 == (ret = get_partition_device("wimax", tmp)))
  790.       {
  791.           char serialno[PROPERTY_VALUE_MAX];
  792.           ui_print("Backing up WiMAX...\n");
  793.           serialno[0] = 0;
  794.           property_get("ro.serialno", serialno, "");
  795.           sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);
  796. !         ret = backup_raw_partition("wimax", tmp);
  797.           if (0 != ret)
  798.               return print_and_error("Error while dumping WiMAX image!\n");
  799.       }
  800. --- 154,168 ----
  801.       if (0 != (ret = nandroid_backup_partition(backup_path, "/recovery")))
  802.           return ret;
  803.  
  804. !     Volume *vol = volume_for_path("/wimax");
  805. !     if (vol != NULL && 0 == stat(vol->device, &s))
  806.       {
  807.           char serialno[PROPERTY_VALUE_MAX];
  808.           ui_print("Backing up WiMAX...\n");
  809.           serialno[0] = 0;
  810.           property_get("ro.serialno", serialno, "");
  811.           sprintf(tmp, "%s/wimax.%s.img", backup_path, serialno);
  812. !         ret = backup_raw_partition(vol->device, tmp);
  813.           if (0 != ret)
  814.               return print_and_error("Error while dumping WiMAX image!\n");
  815.       }
  816. *************** int nandroid_backup(const char* backup_p
  817. *** 176,183 ****
  818.               return ret;
  819.       }
  820.  
  821. !     struct stat st;
  822. !     if (0 != stat("/sdcard/.android_secure", &st))
  823.       {
  824.           ui_print("No /sdcard/.android_secure found. Skipping backup of applications on external storage.\n");
  825.       }
  826. --- 178,184 ----
  827.               return ret;
  828.       }
  829.  
  830. !     if (0 != stat("/sdcard/.android_secure", &s))
  831.       {
  832.           ui_print("No /sdcard/.android_secure found. Skipping backup of applications on external storage.\n");
  833.       }
  834. *************** int nandroid_backup(const char* backup_p
  835. *** 190,197 ****
  836.       if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/cache", 0)))
  837.           return ret;
  838.  
  839. !     Volume *vol = volume_for_path("/sd-ext");
  840. !     if (vol == NULL || 0 != stat(vol->device, &st))
  841.       {
  842.           ui_print("No sd-ext found. Skipping backup of sd-ext.\n");
  843.       }
  844. --- 191,198 ----
  845.       if (0 != (ret = nandroid_backup_partition_extended(backup_path, "/cache", 0)))
  846.           return ret;
  847.  
  848. !     vol = volume_for_path("/sd-ext");
  849. !     if (vol == NULL || 0 != stat(vol->device, &s))
  850.       {
  851.           ui_print("No sd-ext found. Skipping backup of sd-ext.\n");
  852.       }
  853. *************** int nandroid_restore_partition(const cha
  854. *** 282,287 ****
  855. --- 283,289 ----
  856.       // see if we need a raw restore (mtd)
  857.       char tmp[PATH_MAX];
  858.       if (strcmp(vol->fs_type, "mtd") == 0 ||
  859. +             strcmp(vol->fs_type, "bml") == 0 ||
  860.               strcmp(vol->fs_type, "emmc") == 0) {
  861.           int ret;
  862.           const char* name = basename(root);
  863. *************** int nandroid_restore(const char* backup_
  864. *** 322,328 ****
  865.       if (restore_boot && NULL != volume_for_path("/boot") && 0 != (ret = nandroid_restore_partition(backup_path, "/boot")))
  866.           return ret;
  867.      
  868. !     if (restore_wimax && 0 == (ret = get_partition_device("wimax", tmp)))
  869.       {
  870.           char serialno[PROPERTY_VALUE_MAX];
  871.          
  872. --- 324,332 ----
  873.       if (restore_boot && NULL != volume_for_path("/boot") && 0 != (ret = nandroid_restore_partition(backup_path, "/boot")))
  874.           return ret;
  875.      
  876. !     struct stat s;
  877. !     Volume *vol = volume_for_path("/wimax");
  878. !     if (restore_wimax && vol != NULL && 0 == stat(vol->device, &s))
  879.       {
  880.           char serialno[PROPERTY_VALUE_MAX];
  881.          
  882. *************** int nandroid_restore(const char* backup_
  883. *** 344,350 ****
  884.               if (0 != (ret = format_volume("/wimax")))
  885.                   return print_and_error("Error while formatting wimax!\n");
  886.               ui_print("Restoring WiMAX image...\n");
  887. !             if (0 != (ret = restore_raw_partition("wimax", tmp)))
  888.                   return ret;
  889.           }
  890.       }
  891. --- 348,354 ----
  892.               if (0 != (ret = format_volume("/wimax")))
  893.                   return print_and_error("Error while formatting wimax!\n");
  894.               ui_print("Restoring WiMAX image...\n");
  895. !             if (0 != (ret = restore_raw_partition(vol->device, tmp)))
  896.                   return ret;
  897.           }
  898.       }
  899. diff -wrp /home/techmik/android/system/bootable/recovery//recovery.c /home/techmik/cm-main/android_bootable_recovery/recovery.c
  900. *** /home/techmik/android/system/bootable/recovery//recovery.c  2011-04-01 04:16:02.000000000 -0400
  901. --- /home/techmik/cm-main/android_bootable_recovery/recovery.c  2011-04-22 19:44:57.000000000 -0400
  902. *************** static const char *LOG_FILE = "/cache/re
  903. *** 61,66 ****
  904. --- 61,67 ----
  905.   static const char *LAST_LOG_FILE = "/cache/recovery/last_log";
  906.   static const char *SDCARD_ROOT = "/sdcard";
  907.   static int allow_display_toggle = 1;
  908. + static int poweroff = 0;
  909.   static const char *SDCARD_PACKAGE_FILE = "/sdcard/update.zip";
  910.   static const char *TEMPORARY_LOG_FILE = "/tmp/recovery.log";
  911.   static const char *SIDELOAD_TEMP_DIR = "/tmp/sideload";
  912. *************** prompt_and_wait() {
  913. *** 707,712 ****
  914. --- 708,714 ----
  915.  
  916.           switch (chosen_item) {
  917.               case ITEM_REBOOT:
  918. +                 poweroff=0;
  919.                   return;
  920.  
  921.               case ITEM_WIPE_DATA:
  922. *************** prompt_and_wait() {
  923. *** 751,756 ****
  924. --- 753,761 ----
  925.               case ITEM_ADVANCED:
  926.                   show_advanced_menu();
  927.                   break;
  928. +             case ITEM_POWEROFF:
  929. +                 poweroff=1;
  930. +                 return;
  931.           }
  932.       }
  933.   }
  934. *************** main(int argc, char **argv) {
  935. *** 782,794 ****
  936.               return nandroid_main(argc, argv);
  937.           if (strstr(argv[0], "reboot"))
  938.               return reboot_main(argc, argv);
  939.           if (strstr(argv[0], "setprop"))
  940.               return setprop_main(argc, argv);
  941. -         if (strstr(argv[0], "bml_over_mtd"))
  942. -             return bml_over_mtd_main(argc, argv);
  943.         return busybox_driver(argc, argv);
  944.     }
  945. -     handle_chargemode();
  946.       __system("/sbin/postrecoveryboot.sh");
  947.      
  948.       int is_user_initiated_recovery = 0;
  949. --- 787,799 ----
  950.               return nandroid_main(argc, argv);
  951.           if (strstr(argv[0], "reboot"))
  952.               return reboot_main(argc, argv);
  953. +         if (strstr(argv[0], "poweroff")){
  954. +             return reboot_main(argc, argv);
  955. +         }
  956.           if (strstr(argv[0], "setprop"))
  957.               return setprop_main(argc, argv);
  958.         return busybox_driver(argc, argv);
  959.     }
  960.       __system("/sbin/postrecoveryboot.sh");
  961.      
  962.       int is_user_initiated_recovery = 0;
  963. *************** main(int argc, char **argv) {
  964. *** 941,949 ****
  965.  
  966.       // Otherwise, get ready to boot the main system...
  967.       finish_recovery(send_intent);
  968.       ui_print("Rebooting...\n");
  969.       sync();
  970. !     reboot(RB_AUTOBOOT);
  971.       return EXIT_SUCCESS;
  972.   }
  973.  
  974. --- 946,957 ----
  975.  
  976.       // Otherwise, get ready to boot the main system...
  977.       finish_recovery(send_intent);
  978. +     if(!poweroff)
  979.           ui_print("Rebooting...\n");
  980. +     else
  981. +         ui_print("Shutting down...\n");
  982.       sync();
  983. !     reboot((!poweroff) ? RB_AUTOBOOT : RB_POWER_OFF);
  984.       return EXIT_SUCCESS;
  985.   }
  986.  
  987. diff -wrp /home/techmik/android/system/bootable/recovery//recovery_ui.h /home/techmik/cm-main/android_bootable_recovery/recovery_ui.h
  988. *** /home/techmik/android/system/bootable/recovery//recovery_ui.h   2011-04-01 04:16:02.000000000 -0400
  989. --- /home/techmik/cm-main/android_bootable_recovery/recovery_ui.h   2011-04-22 19:44:57.000000000 -0400
  990. *************** int device_wipe_data();
  991. *** 74,79 ****
  992. --- 74,80 ----
  993.   #define ITEM_NANDROID        5
  994.   #define ITEM_PARTITION       6
  995.   #define ITEM_ADVANCED        7
  996. + #define ITEM_POWEROFF        8          
  997.  
  998.   // Header text to display above the main menu.
  999.   extern char* MENU_HEADERS[];
  1000. diff -wrp /home/techmik/android/system/bootable/recovery//roots.c /home/techmik/cm-main/android_bootable_recovery/roots.c
  1001. *** /home/techmik/android/system/bootable/recovery//roots.c 2011-04-01 04:16:02.000000000 -0400
  1002. --- /home/techmik/cm-main/android_bootable_recovery/roots.c 2011-04-22 19:44:57.000000000 -0400
  1003. *************** Volume* get_device_volumes() {
  1004. *** 39,44 ****
  1005. --- 39,58 ----
  1006.       return device_volumes;
  1007.   }
  1008.  
  1009. + static int is_null(const char* sz) {
  1010. +     if (sz == NULL)
  1011. +         return 1;
  1012. +     if (strcmp("NULL", sz) == 0)
  1013. +         return 1;
  1014. +     return 0;
  1015. + }
  1016. +
  1017. + static char* dupe_string(const char* sz) {
  1018. +     if (is_null(sz))
  1019. +         return NULL;
  1020. +     return strdup(sz);
  1021. + }
  1022. +
  1023.   void load_volume_table() {
  1024.       int alloc = 2;
  1025.       device_volumes = malloc(alloc * sizeof(Volume));
  1026. *************** void load_volume_table() {
  1027. *** 48,53 ****
  1028. --- 62,69 ----
  1029.       device_volumes[0].fs_type = "ramdisk";
  1030.       device_volumes[0].device = NULL;
  1031.       device_volumes[0].device2 = NULL;
  1032. +     device_volumes[0].fs_options = NULL;
  1033. +     device_volumes[0].fs_options2 = NULL;
  1034.       num_volumes = 1;
  1035.  
  1036.       FILE* fstab = fopen("/etc/recovery.fstab", "r");
  1037. *************** void load_volume_table() {
  1038. *** 70,75 ****
  1039. --- 86,94 ----
  1040.           // lines may optionally have a second device, to use if
  1041.           // mounting the first one fails.
  1042.           char* device2 = strtok(NULL, " \t\n");
  1043. +         char* fs_type2 = strtok(NULL, " \t\n");
  1044. +         char* fs_options = strtok(NULL, " \t\n");
  1045. +         char* fs_options2 = strtok(NULL, " \t\n");
  1046.  
  1047.           if (mount_point && fs_type && device) {
  1048.               while (num_volumes >= alloc) {
  1049. *************** void load_volume_table() {
  1050. *** 77,86 ****
  1051.                   device_volumes = realloc(device_volumes, alloc*sizeof(Volume));
  1052.               }
  1053.               device_volumes[num_volumes].mount_point = strdup(mount_point);
  1054. !             device_volumes[num_volumes].fs_type = strdup(fs_type);
  1055.               device_volumes[num_volumes].device = strdup(device);
  1056.               device_volumes[num_volumes].device2 =
  1057. !                 device2 ? strdup(device2) : NULL;
  1058.               ++num_volumes;
  1059.           } else {
  1060.               LOGE("skipping malformed recovery.fstab line: %s\n", original);
  1061. --- 96,115 ----
  1062.                   device_volumes = realloc(device_volumes, alloc*sizeof(Volume));
  1063.               }
  1064.               device_volumes[num_volumes].mount_point = strdup(mount_point);
  1065. !             device_volumes[num_volumes].fs_type = !is_null(fs_type2) ? strdup(fs_type2) : strdup(fs_type);
  1066.               device_volumes[num_volumes].device = strdup(device);
  1067.               device_volumes[num_volumes].device2 =
  1068. !                 !is_null(device2) ? strdup(device2) : NULL;
  1069. !             device_volumes[num_volumes].fs_type2 = !is_null(fs_type2) ? strdup(fs_type) : NULL;
  1070. !
  1071. !             if (!is_null(fs_type2)) {
  1072. !                 device_volumes[num_volumes].fs_options2 = dupe_string(fs_options);
  1073. !                 device_volumes[num_volumes].fs_options = dupe_string(fs_options2);
  1074. !             }
  1075. !             else {
  1076. !                 device_volumes[num_volumes].fs_options2 = NULL;
  1077. !                 device_volumes[num_volumes].fs_options = dupe_string(fs_options);
  1078. !             }
  1079.               ++num_volumes;
  1080.           } else {
  1081.               LOGE("skipping malformed recovery.fstab line: %s\n", original);
  1082. *************** Volume* volume_for_path(const char* path
  1083. *** 113,118 ****
  1084. --- 142,167 ----
  1085.       return NULL;
  1086.   }
  1087.  
  1088. + int try_mount(const char* device, const char* mount_point, const char* fs_type, const char* fs_options) {
  1089. +     if (device == NULL || mount_point == NULL || fs_type == NULL)
  1090. +         return -1;
  1091. +     int ret = 0;
  1092. +     if (fs_options == NULL) {
  1093. +         ret = mount(device, mount_point, fs_type,
  1094. +                        MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
  1095. +     }
  1096. +     else {
  1097. +         char mount_cmd[PATH_MAX];
  1098. +         sprintf(mount_cmd, "mount -t %s -o%s %s %s", fs_type, fs_options, device, mount_point);
  1099. +         LOGE("%s\n", mount_cmd);
  1100. +         ret = __system(mount_cmd);
  1101. +     }
  1102. +     if (ret == 0)
  1103. +         return 0;
  1104. +     LOGW("failed to mount %s (%s)\n", device, strerror(errno));
  1105. +     return ret;
  1106. + }
  1107. +
  1108.   int ensure_path_mounted(const char* path) {
  1109.       Volume* v = volume_for_path(path);
  1110.       if (v == NULL) {
  1111. *************** int ensure_path_mounted(const char* path
  1112. *** 152,172 ****
  1113.           }
  1114.           return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0);
  1115.       } else if (strcmp(v->fs_type, "ext4") == 0 ||
  1116.                  strcmp(v->fs_type, "vfat") == 0) {
  1117. !         result = mount(v->device, v->mount_point, v->fs_type,
  1118. !                        MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
  1119. !         if (result == 0) return 0;
  1120. !
  1121. !         if (v->device2) {
  1122. !             LOGW("failed to mount %s (%s); trying %s\n",
  1123. !                  v->device, strerror(errno), v->device2);
  1124. !             result = mount(v->device2, v->mount_point, v->fs_type,
  1125. !                            MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
  1126. !             if (result == 0) return 0;
  1127. !         }
  1128. !
  1129. !         LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno));
  1130. !         return -1;
  1131.       } else {
  1132.           // let's try mounting with the mount binary and hope for the best.
  1133.           char mount_cmd[PATH_MAX];
  1134. --- 201,218 ----
  1135.           }
  1136.           return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0);
  1137.       } else if (strcmp(v->fs_type, "ext4") == 0 ||
  1138. +                strcmp(v->fs_type, "ext3") == 0 ||
  1139. +                strcmp(v->fs_type, "rfs") == 0 ||
  1140.                  strcmp(v->fs_type, "vfat") == 0) {
  1141. !         if ((result = try_mount(v->device, v->mount_point, v->fs_type, v->fs_options)) == 0)
  1142. !             return 0;
  1143. !         if ((result = try_mount(v->device2, v->mount_point, v->fs_type, v->fs_options)) == 0)
  1144. !             return 0;
  1145. !         if ((result = try_mount(v->device, v->mount_point, v->fs_type2, v->fs_options2)) == 0)
  1146. !             return 0;
  1147. !         if ((result = try_mount(v->device2, v->mount_point, v->fs_type2, v->fs_options2)) == 0)
  1148. !             return 0;
  1149. !         return result;
  1150.       } else {
  1151.           // let's try mounting with the mount binary and hope for the best.
  1152.           char mount_cmd[PATH_MAX];
  1153. diff -wrp /home/techmik/android/system/bootable/recovery//utilities/Android.mk /home/techmik/cm-main/android_bootable_recovery/utilities/Android.mk
  1154. *** /home/techmik/android/system/bootable/recovery//utilities/Android.mk    2011-04-01 04:16:02.000000000 -0400
  1155. --- /home/techmik/cm-main/android_bootable_recovery/utilities/Android.mk    2011-04-22 19:44:57.000000000 -0400
  1156. *************** LOCAL_MODULE_PATH := $(TARGET_RECOVERY_R
  1157. *** 42,45 ****
  1158. --- 42,89 ----
  1159.   LOCAL_SRC_FILES := $(LOCAL_MODULE)
  1160.   include $(BUILD_PREBUILT)
  1161.  
  1162. + ifeq ($(BOARD_HAS_LARGE_FILESYSTEM),true)
  1163. + include $(CLEAR_VARS)
  1164. + LOCAL_MODULE := mke2fs
  1165. + LOCAL_MODULE_TAGS := eng
  1166. + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
  1167. + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
  1168. + LOCAL_SRC_FILES := $(LOCAL_MODULE)
  1169. + include $(BUILD_PREBUILT)
  1170. + endif
  1171. +
  1172. + ifeq ($(BOARD_USES_RECOVERY_CHARGEMODE),true)
  1173. + include $(CLEAR_VARS)
  1174. + LOCAL_MODULE := choice_fn
  1175. + LOCAL_MODULE_TAGS := eng
  1176. + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
  1177. + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
  1178. + LOCAL_SRC_FILES := $(LOCAL_MODULE)
  1179. + include $(BUILD_PREBUILT)
  1180. +
  1181. + include $(CLEAR_VARS)
  1182. + LOCAL_MODULE := power_test
  1183. + LOCAL_MODULE_TAGS := eng
  1184. + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
  1185. + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
  1186. + LOCAL_SRC_FILES := $(LOCAL_MODULE)
  1187. + include $(BUILD_PREBUILT)
  1188. +
  1189. + include $(CLEAR_VARS)
  1190. + LOCAL_MODULE := offmode_charging
  1191. + LOCAL_MODULE_TAGS := eng
  1192. + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
  1193. + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
  1194. + LOCAL_SRC_FILES := $(LOCAL_MODULE)
  1195. + include $(BUILD_PREBUILT)
  1196. +
  1197. + include $(CLEAR_VARS)
  1198. + LOCAL_MODULE := detect_key
  1199. + LOCAL_MODULE_TAGS := eng
  1200. + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
  1201. + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
  1202. + LOCAL_SRC_FILES := $(LOCAL_MODULE)
  1203. + include $(BUILD_PREBUILT)
  1204. + endif
  1205. +
  1206.   endif
  1207. Only in /home/techmik/cm-main/android_bootable_recovery/utilities: choice_fn
  1208. Only in /home/techmik/cm-main/android_bootable_recovery/utilities: detect_key
  1209. Only in /home/techmik/cm-main/android_bootable_recovery/utilities: mke2fs
  1210. Only in /home/techmik/cm-main/android_bootable_recovery/utilities: offmode_charging
  1211. Only in /home/techmik/cm-main/android_bootable_recovery/utilities: power_test
  1212. diff -wrp /home/techmik/android/system/bootable/recovery//utilities/sdparted /home/techmik/cm-main/android_bootable_recovery/utilities/sdparted
  1213. *** /home/techmik/android/system/bootable/recovery//utilities/sdparted  2011-04-01 04:16:02.000000000 -0400
  1214. --- /home/techmik/cm-main/android_bootable_recovery/utilities/sdparted  2011-04-22 19:44:57.000000000 -0400
  1215. *************** TTISMSDOS=
  1216. *** 546,557 ****
  1217.  
  1218.   SDSIZE=
  1219.   SDSIZEMB=
  1220. ! if [ -z "$SDPATH" ]
  1221.   then
  1222. !     SDPATH="/dev/block/mmcblk0"
  1223.   else
  1224. !     echo Found SDPATH=$SDPATH
  1225.   fi
  1226.  
  1227.   FATSIZE=
  1228.   FATTYPE="fat32"
  1229. --- 546,574 ----
  1230.  
  1231.   SDSIZE=
  1232.   SDSIZEMB=
  1233. ! SDINFO=$(cat /etc/fstab | grep /sdcard | awk '{print $1}')
  1234. ! if [ -L "$SDINFO" ]
  1235.   then
  1236. !   SDPATH=$(ls -l $SDINFO | awk '{print $11}')
  1237.   else
  1238. !   SDPATH=$SDINFO
  1239.   fi
  1240. + # we may now have an SDPATH, let's make sure its on mmcblkX or mmcblkXp1
  1241. + CHECK_SDPATH1=$(echo $SDPATH | grep mmcblk.$)
  1242. + CHECK_SDPATH2=$(echo $SDPATH | grep mmcblk.p1$)
  1243. + if [ -z "$CHECK_SDPATH1" ]
  1244. + then
  1245. +   if [ -z "$CHECK_SDPATH2" ]
  1246. +   then
  1247. +       echo fail1
  1248. +       unset SDPATH
  1249. +   else
  1250. +       LEN=${#SDPATH}
  1251. +       BLKLEN=$(expr $LEN - 2)
  1252. +       SDPATH=${SDPATH:0:$BLKLEN}
  1253. +   fi
  1254. + fi
  1255. +
  1256.  
  1257.   FATSIZE=
  1258.   FATTYPE="fat32"
  1259. techmik@michaels-laptop:~$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement