How to solve the problem of update.zipupgrade Process Analysis (2-update.zip differential package

Source: Internet
Author: User

How to solve the problem of using the update.zipupgrade Process Analysis ()---update.zip differential package

The problem that occurred when generating the differential packet mentioned at the end of the previous Article has been solved. Due to the recent busy schedule, the time between the differential packets is also relatively long. Therefore, a single article will be given to you. This problem is actually a problem in the source code. You may have already created it. However, my problem is indeed a problem in the source code. I don't know if it is a bug. I will analyze it in detail below!

I,Solution to Ota incremental package generation failure

When I use ota_from_target_filesscript at the end of the article to create an update.zip incremental package, I will post the error.

 

An error occurs when you read Radio/bootloader. IMG from input_zip at the end of the script. It indicates that the devicespecifiparams object does not have the input_zip attribute.

First, we can start searching for the call function with an error in the script. The call where an error occurs is indicated by device_specific.incrementalota_installend () in the writeincrementalotapackage (row 443), which is located at the end of writeincrementalotapackage. Further tracking of the source code shows that this is a callback function. Its specific execution method is located in the incrementalota_installend () function in the/device/telechips/common/releasetools. py script in the source code. The following describes the functions of the function.

Releasetools. the two functions fullota_installend () and incrementalota_installend () in The py script read the bootloader under radio/from the input package. the imgfile is written to the output package and the bootloader is generated and installed. the part of the script that is executed in IMG. Only one is to directly put the bootloader in the input package. the IMG image is written to the output package. First, compare the bootloader in target_zip and source_zip. whether the IMG is different (when you use option-I to generate a differential package), and then write the new image to the output package. Next, we will first paste the specific implementation of this function (in/device/telechips/common/releasetools. py:

The actual situation is that the package generated by the command make otapackage does not contain the bootloader. IMG image file in the radio directory (because this part of the update has been blocked ). However, in this function, if the bootloader. imgfile is not read from the package, an error is returned. Therefore, we need to find the cause of the problem from the actual error.

The real error is:

Target_bootloader = info. input_zip.read ("Radio/bootloader. IMG ").

The cause of the error is: attributeerror: 'devicespecificparams 'object has no attribute 'input _ zip'. The system prompts that the devicespecificparams object does not have the input_zip attribute.

Option-I is used when you use the ota_from_target_files script to create a differential package. In this case, there are only three parameters: target_zip, source_zip, and out_zip. The error is indicated by target_bootloader = info. input_zip_read ("Radio/bootloader.img?), the use of input_zip, and we want to suspect that this is not an error, but the use of info.tar get_zip.read (). Below we can confirm our speculation.

From the writefullotapackage () and writeincrementalotapackage functions in the ota_from_target_files script (respectively used to generate the full-inclusive and differential packages), we can find that device_specific is assigned at the beginning of the script. The writefullotapackage () corresponds to input_zip and out_zip, while writeincrementalotapackage corresponds to target_zip, source_zip, and out_zip. Let's take a look at the specific implementation of this Part in the functions:

It can be found that when the writeincrementalotapackage function initializes the devicespecificparams object, it does use target_zip instead of input_zip. In the releasetools. py script, info. input_zip.read () is used. Therefore, the devicespecificparams object does not have the input_zip attribute. So we found the problem (is this a bug in the source code ?).

Set target_bootloader = info. input_zip in the releasetools. py script incrementalota_installend (Info) function.

Read ("Radio/bootloader. IMG"): target_bootloader=info.tar get_zip.read ("Radio/bootloader. IMG"), and then re-execute the differential package creation command mentioned above. The difference package update.zip is generated.

Ii. Test the update of the differential packet update.zip

In the above differential package script command, the principle of generating a differential package is to refer to the first parameter (target_zip) and convert the second parameter (source_zip) output different parts to the third parameter (output_zip. The order of target_zip and source_zip is different, and the generated differential package is also different.

In our testing process, we need to delete a previous application (added when using update.zip all-inclusive upgrade), other parts such as the kernel are not changed, so the generated differential package is very simple, only META-INF this folder. The main differences are reflected in the Updater-Script script. The part after # ---- start make changes here ---- is the change part. The main script command is: delete ("/system/APP/checkupdateall.apk"
, "/System/recovery.img?##;will Delete the checkupdateall.apk application when the app is updated.

For your reference, paste the upgrade script of the differential package. The corresponding full upgrade script has been posted in article 9:

mount("yaffs2", "MTD", "system", "/system");assert(file_getprop("/system/build.prop", "ro.build.fingerprint") == "telechips/full_tcc8800_evm/tcc8800:2.3.5/GRJ90/eng.mumu.20120309.100232:eng/test-keys" ||       file_getprop("/system/build.prop", "ro.build.fingerprint") == "telechips/full_tcc8800_evm/tcc8800:2.3.5/GRJ90/eng.mumu.20120309.100232:eng/test-keys");assert(getprop("ro.product.device") == "tcc8800" ||       getprop("ro.build.product") == "tcc8800");ui_print("Verifying current system...");show_progress(0.100000, 0);# ---- start making changes here ----ui_print("Removing unneeded files...");delete("/system/app/CheckUpdateAll.apk",       "/system/recovery.img");show_progress(0.800000, 0);ui_print("Patching system files...");show_progress(0.100000, 10);ui_print("Symlinks and permissions...");set_perm_recursive(0, 0, 0755, 0644, "/system");set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");set_perm(0, 3003, 02750, "/system/bin/netcfg");set_perm(0, 3004, 02755, "/system/bin/ping");set_perm(0, 2000, 06750, "/system/bin/run-as");set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");set_perm(0, 0, 0755, "/system/etc/bluetooth");set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");set_perm(0, 0, 06755, "/system/xbin/librank");set_perm(0, 0, 06755, "/system/xbin/procmem");set_perm(0, 0, 06755, "/system/xbin/procrank");set_perm(0, 0, 06755, "/system/xbin/su");set_perm(0, 0, 06755, "/system/xbin/tcpdump");unmount("/system");

During the update test, we need to use the target_zip system as the basis, that is, the development board system before the update is the system after the target_zip package is used. Otherwise, the update will fail, because the update will read the device, timestamp, and other information from the corresponding system directory (the beginning of the Updater-Script script ), after matching the correct information, perform the next installation.

After all the preparations are completed, place the differential package we created into the SD card and execute the update in Settings> about phone> system update> installed from sdcard. After the last update is completed, we will find that the previous checkupdateall.apk has been deleted successfully!

Finally, the update.zip package has been successfully created for the corresponding difference package. The following article starts with the process of update.zip package produced by analyticdb in actual updates!


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.