Simple process and notes for updating Android recovery

Source: Internet
Author: User
Tags png text symlink imx6

Simple process and notes for updating Android recovery
Summary of recovery updates:
1. General recovery upgrade process:
① Compile: Execute make otapackage
②. In the main systemformat, rename the upgrade package as update.zip and download it to the/cache directory.
③. Create a file/cache/recovery/command and write it to the command: -- update_package =/cache/update.zip
④ The terminal executes the reboot recovery to enter the recovery mode. You can also call the android_reboot function through the android upper layer and set the code to enter the recovery mode.
⑤. The system restarts, enters the recovery mode, and starts the recovery process. This process detects/cache/recovery/commands and then upgrades update.zip.
2. command file/cache/recovery/command: stores the command line from Mainsystem to Recovery. Each line is a command and supports several combinations.

-- Send_intent = anystring // write the text out to recovery/intent at the end of the Recovery, the intent string defined in the finish_recovery function is passed as a parameter, and write it to/cache/recovery/intent.

-- Update_package = root: path // verify install an OTA package file Main packages.

-- Wipe_data // erase user data (and cache), then reboot. Erase user data. The cache partition must be erased when the data partition is erased.

-- Wipe_cache // wipecache (but not user data), then reboot. Erase the cache partition.


3. The rediscovery time zone must be consistent with the partition number in the system main mode.
Location: bootable/bootloader/uboot-imx/include/autoconf. mk

CONFIG_ANDROID_CACHE_PARTITION_MMC = 12

CONFIG_ANDROID_RECOVERY_PARTITION_MMC = 6
CONFIG_ANDROID_SYSTEM_PARTITION_MMC = 5

Config_android_recovery_pai_file = "/recovery/command"
4. Modify bootable/recovery. c.

# LOCAL_MODULE_TAGS: = eng

If this line is opened, only the copy to/system/bin action will be available in the eng software.

5. build/core/Makefile Modification

$ (INTERNAL_OTA_PACKAGE_TARGET): $ (BUILT_TARGET_FILES_PACKAGE) $ (DISTTOOLS)

@ Echo "Package OTA: $ @"

$ (Hide)./build/tools/releasetools/ota_from_target_files-v \

-P $ (HOST_OUT )\

-K $ (KEY_CERT_PAIR )\

-N \

-W \

-N: whether the timestamp is not checked during the upgrade. By default, the timestamp must be checked. That is, the upgrade can only be performed based on the old version.

-W: whether to clear the userdata Partition
Note: If the following error occurs in/cache/recovery/last_log, the upgrade package is older and the execution is terminated. You can add the-n items mentioned above.

Assert failed :! Less_than_int (1397801920, getprop ("ro. build. date. utc "))

6. Store the recovery log file in/cache/recovery/
Last_install
Last_locale: the language used for the last recovery, such as the prompt language displayed on the interface during the update.
Last_log: log
7. Check whether the command file/cache/recovery/command function is int check_recovery_assist_file (void) defined in the following file:

"Bootable/bootloader/uboot-imx/board/freescale/mx6q_sabresd/mx6q_sabresd.c"
8. The recovery upgrade is performed by executing the updater-script. Below are some comments for your reference.

 
 
  1. Assert (getprop ("ro. product. device") = "sabresd_6dq" |
  2. Getprop ("ro. build. product") = "sabresd_6dq ");
  3. // Show_progress (frac, sec): frac indicates the progress completed value, and sec indicates the total number of seconds of the entire process. It mainly uses and displays the progress bar on the UI.
  4. Show_progress (0.500000, 0 );
  5. // Format (fs_type, partition_type, location): fs_type, file system type. The value is generally "yaffs2" or "ext4 ". Partition_type: partition type. Generally, the value is "MTD" or "EMMC ". It is mainly used to format a specified file system.
  6. Format ("ext4", "EMMC", "/dev/block/mmcblk0p5", "0", "/system ");
  7. // Mount a file system/system to the specified mount point mmcblk0p5
  8. Mount ("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system ");
  9. // Package_extract_dir (src_path, destination_path): src_path, the directory to be extracted, and the destination directory of destination_path. Purpose: extract the directory from the update package to the specified location.
  10. Package_extract_dir ("recovery", "/system"); // extract recovery
  11. Package_extract_dir ("system", "/system"); // extract system
  12. // Create a symbolic link
  13. Symlink ("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf ");
  14. Symlink ("Roboto-Regular.ttf", "/system/fonts/DroidSans. ttf ");
  15. Symlink ("mksh", "/system/bin/sh ");
  16. Symlink ("toolbox", "/system/bin/cat", "/system/bin/chmod ",
  17. "/System/bin/chown", "/system/bin/cmp", "/system/bin/cp ",
  18. "/System/bin/date", "/system/bin/dd", "/system/bin/df ",
  19. "/System/bin/dmesg", "/system/bin/du", "/system/bin/getevent ",
  20. "/System/bin/getprop", "/system/bin/grep", "/system/bin/hd ",
  21. "/System/bin/id", "/system/bin/ifconfig", "/system/bin/iftop ",
  22. "/System/bin/insmod", "/system/bin/ioctl", "/system/bin/ionice ",
  23. "/System/bin/kill", "/system/bin/ln", "/system/bin/log ",
  24. "/System/bin/ls", "/system/bin/lsmod", "/system/bin/lsof ",
  25. "/System/bin/md5", "/system/bin/mkdir", "/system/bin/mount ",
  26. "/System/bin/mv", "/system/bin/nandread", "/system/bin/netstat ",
  27. "/System/bin/newfs_msdos", "/system/bin/Y", "/system/bin/printenv ",
  28. "/System/bin/ps", "/system/bin/reboot", "/system/bin/renice ",
  29. "/System/bin/rm", "/system/bin/rmdir", "/system/bin/rmmod ",
  30. "/System/bin/route", "/system/bin/schedtop", "/system/bin/sendevent ",
  31. "/System/bin/setconsole", "/system/bin/setprop", "/system/bin/sleep ",
  32. "/System/bin/smd", "/system/bin/start", "/system/bin/stop ",
  33. "/System/bin/sync", "/system/bin/top", "/system/bin/touch ",
  34. "/System/bin/umount", "/system/bin/uptime", "/system/bin/vmstat ",
  35. "/System/bin/watchprops ",
  36. "/System/bin/wipe ");
  37. // Set file or directory permissions
  38. Set_perm_recursive (0, 0, 0755,064 4, "/system ");
  39. Set_perm_recursive (0, 2000,075 5, 0755, "/system/bin ");
  40. Set_perm (0, 3003,027 50, "/system/bin/netcfg ");
  41. Set_perm (0, 3004,027 55, "/system/bin/ping ");
  42. Set_perm (0, 2000,067 50, "/system/bin/run-");
  43. Set_perm (1002,100 2, 0440, "/system/etc/limits. conf ");
  44. Set_perm (1014,200 0, 0550, "/system/etc/dhcpcd-run-hooks ");
  45. Set_perm (0, 2000,055 0, "/system/etc/init. goldfish. sh ");
  46. Set_perm (0, 0, 0544, "/system/etc/install-recovery.sh ");
  47. Set_perm_recursive (0, 0, 0755,055 5, "/system/etc/ppp ");
  48. Set_perm_recursive (0, 2000,075 5, 0644, "/system/vendor ");
  49. Set_perm (0, 0, 0644, "/system/vendor/etc/audio_effects.conf ");
  50. Set_perm_recursive (0, 2000,075 5, 0755, "/system/xbin ");
  51. Show_progress (0.200000, 0 );
  52. Show_progress (0.200000, 10 );
  53. // Write the boot. imgfile in the upgrade package to/dev/block/mmcblk0p1
  54. Package_extract_file ("boot. img", "/dev/block/mmcblk0p1 ");
  55. Show_progress (0.100000, 0 );
  56. Unmount ("/system ");


9. The updater-script is generated from python script build/tools/releasetools/ota_from_target_files.

10. The updated image is displayed under/android4.2-imx6/bootable/recovery/res/images.
11. In Android recovery mode, the text displayed on the interface is read from png text images. The directory is also in/android4.2-imx6/bootable/recovery/res/images
To display text, you must pass the locale variable from the upper layer. If you do not set it or do not know how to set it (I do not know), you can directly modify the locale definition in the bootable/recovery. cpp file to assign the initial value.
Char * locale = "en_GB"


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.