A method and device for generating an original OTA package

By extracting block mapping information from the old version of the flash image file to restore the original OTA packet, the problem of not being able to upgrade after the OTA packet is lost is solved, and fast and accurate OTA packet generation and reduction of error probability is achieved.

CN113821222BActive Publication Date: 2025-07-04FIBOCOM AUTO INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110852664.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-27
Publication Date
2025-07-04
Estimated Expiration
2041-07-27

AI Technical Summary

Technical Problem

After the old version of OTA packet is lost, the OTA differential upgrade package cannot be made, resulting in the inability to upgrade the system software version through the OTA differential upgrade technology.

Method used

By extracting block mapping information from the old version of the flash image file, the original OTA package is restored, including file identification, start address information and end address information, and the original OTA package is generated.

Benefits of technology

After the original OTA packet is lost, the original OTA packet can be generated accurately and quickly, avoid execution errors, reduce program error probability, and reduce performance losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113821222B_ABST
    Figure CN113821222B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for generating an original Over-the-Air (OTA) package, which is characterized in that the method includes: obtaining a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent the system software information of the first version; extracting block mapping information according to the flashing image file, where the block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file, and the first file is the file obtained after the flashing image file is mounted; generating the original OTA package according to the file identifier of the first file, the start address information and the end address information. Thus, the lost original OTA package can be accurately and quickly generated, avoiding the problem of execution errors when executing programs due to the loss of the original OTA package.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a method and device for generating an original OTA package. Background Art

[0002] Over-the-air (OTA) technology is a technology for data downloading via a wireless network, and is usually applied to the upgrade of system software versions of terminal devices such as mobile phones and tablet computers.

[0003] Currently, users can independently upgrade the system version through OTA technology, and there are mainly two methods: OTA full upgrade package upgrade and OTA differential upgrade package upgrade. Among them, OTA full upgrade package upgrade is to perform an overwriting upgrade by copying the complete new version data through file copying, while OTA differential upgrade package upgrade is to upgrade the differential data between two old and new version firmware by patching. Generally, for the same version system upgrade (for example, upgrading from Android 7.0 to Android 7.1), OTA differential upgrade package upgrade is adopted. The production of OTA differential upgrade packages depends on the old version OTA package and the new version OTA package, and the old version OTA package and the new version OTA package contain some file information, version configuration information, etc. required for system upgrade.

[0004] However, if the old version OTA package is lost due to subjective or objective reasons (such as hard disk damage, system poisoning, human misoperation, etc.), an OTA differential upgrade package cannot be produced, and thus OTA differential upgrade cannot be achieved through the OTA differential upgrade package. Therefore, how to provide a method for generating an old version OTA package has become an important research topic in the technical field. Summary of the Invention

[0005] Embodiments of the present application provide a method and device for generating an original OTA package, so that after the original OTA package of the system software of the first version is lost, the original OTA package can be restored according to the image file of the system software of the first version.

[0006] In a first aspect, the present application provides a method for generating an original over-the-air technology OTA package, characterized in that the method includes: obtaining a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent the system software information of the first version; extracting block mapping information according to the flashing image file, where the block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file, and the first file is the file obtained after the flashing image file is mounted; generating the original OTA package according to the file identifier of the first file, the start address information and the end address information.

[0007] In the embodiment of the present application, the software system information of the first version is the system software information of the system version that has lost the original OTA package. It can be understood that the above-mentioned start address information and end address information recorded in the block mapping information can be used to find the address information and corresponding data content of all data blocks storing the first file on the disk.

[0008] By using the method for generating the original OTA provided in the embodiment of the present application, the block mapping information is extracted from the old version of the flashing image file, and the original OTA package is restored according to the block mapping information. For an electronic device that has lost the original OTA package, when the original OTA package is needed, the original OTA package can be accurately and quickly generated, avoiding the problem of execution errors when executing programs due to the loss of the original OTA package, reducing the probability of program errors, and reducing unnecessary performance losses.

[0009] In a possible implementation manner, the extracting the block mapping information according to the flashing image file includes: mounting the flashing image file to obtain the file identifier of the first file and the file data in the first file; inputting the file identifier of the first file, the file data of the first file, and the first path into a target script; extracting the block mapping information through the target script, and outputting the block mapping information to a file corresponding to the first path through the target script.

[0010] In a possible implementation manner, the generating the original OTA package according to the file identifier of the first file, the start address information, and the end address information includes: obtaining target configuration information according to a target OTA package, where the target OTA package is used to represent the system software information of the second version, and the target configuration information includes file signature path information and first permission configuration information; generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information.

[0011] Generally, the permission configuration information, signature information, etc. of the mirror image file stored in the OTA packages of the system software of the new and old versions will not be modified with the version update. Therefore, in the case where the original OTA package is lost and needs to be restored, the configuration information and signature path information in the target OTA package can be used as the configuration information and signature path information in the original OTA package.

[0012] In the embodiment of the present application, the above-mentioned target configuration information can be obtained by copying the target configuration information in the target OTA package. Or the entire target OTA package can also be copied, and then the information other than the target configuration information in the target OTA package is deleted.

[0013] In the embodiment of the present application, only the target configuration information in the target OTA package is added to the original OTA package, rather than adding the entire target OTA package to the original OTA package, thereby saving unnecessary storage overhead and improving the utilization rate of storage space.

[0014] In a possible implementation manner, the first permission configuration information includes the file identifier of the second file and the permission configuration information of the second file; before generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information, the method further includes: deleting the file information of the target file in the first permission configuration information to obtain the second permission configuration information, where the file identifier of the target file is included in the file identifier of the second file and not included in the file identifier of the first file; or, adding the file information of the target file to the first permission configuration information to obtain the second permission configuration information, where the file identifier of the target file is included in the file identifier of the first file and not included in the file identifier of the second file; the generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information includes: generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the second permission configuration information.

[0015] It can be understood that when the file information included in the above first permission configuration information in the target OTA package is inconsistent with the file information of the above first file in the flashing image file, it is necessary to delete the file information that is not included in the file identifier of the first file and is included in the file identifier of the second file recorded in the first permission configuration information, and re-add the file information that is included in the file identifier of the first file and not included in the file identifier of the second file recorded in the first permission configuration information to the first permission configuration information.

[0016] In a possible implementation manner, the flashing image file includes the image file of the file system partition, and the mounting the flashing image file to obtain the file identifier of the first file and the file data of the first file includes: when the file format of the image file of the file system partition is a non-file system format, converting the file format of the image file of the file system partition to a file system format; mounting the image file of the file system partition in the file system format to obtain the files in the image file of the file system partition, and using the files in the image file of the file system partition as the first file.

[0017] In a possible implementation, the flashing image file includes the image file of the file system partition. Mounting the flashing image file to obtain the file identifier of the first file and the file data of the first file includes: when the file format of the image file of the file system partition is a non-file system format, converting the file format of the image file of the file system partition into a file system format; mounting the image file of the file system partition in the file system format to obtain the files in the image file of the file system partition, and using the files in the image file of the file system partition as the first file.

[0018] In a possible implementation, generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information includes: packaging the file identifier of the first file, the start address information, the end address information, the target OTA package, and the flashing image file to generate the original OTA package; wherein, the file identifier of the first file, the start address information, the end address information, and the flashing image file are in the same folder.

[0019] In the embodiments of the present application, on the one hand, adding the entire target OTA package to the original OTA package. For the image file of the new version of the target OTA package included in the original OTA package, it can be selected not to be processed when generating the OTA differential package, that is, adding the entire target OTA package to the original OTA package will not affect the use of the original OTA package. On the other hand, adding the entire target OTA package to the original OTA package, then there is no need to perform operations such as deletion on the files in the target OTA package other than the above-mentioned target configuration information, saving performance loss, reducing the workload of developers, and lowering the technical requirements for developers.

[0020] In a possible implementation, the method further includes: storing the block mapping information into the source code of the system software of the first version.

[0021] In a possible implementation, the method further includes: storing the target configuration information into the source code of the system software of the first version.

[0022] In the embodiments of the present application, the block mapping information and the target configuration information are stored in the source code. If it is necessary to synthesize the original OTA package again next time, the target configuration information and the block mapping information stored in the system software of the first version are directly obtained, and then the original OTA package is generated according to the block mapping information, the flashing image file, and the target configuration information. It is not necessary to run the above-mentioned target script again to generate the block mapping information, reducing the device performance overhead. It is also not necessary to copy the target OTA package or perform data operations such as modifying or deleting the target OTA package, reducing the time cost of project development.

[0023] In a second aspect, an apparatus for generating an original OTA package provided by an embodiment of the present application includes:

[0024] An acquisition unit, configured to acquire a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent the system software information of the first version;

[0025] An extraction unit, configured to extract block mapping information according to the flashing image file, where the block mapping information includes a file identifier of a first file, start address information and end address information of a data block for storing the first file, and the first file is a file obtained after the flashing image file is mounted;

[0026] A generation unit, configured to generate the original OTA package according to the file identifier of the first file, the start address information, and the end address information.

[0027] In a third aspect, an embodiment of the present invention provides an apparatus for generating an original OTA package. The apparatus for generating the original OTA package includes a processor, a memory, and a communication interface. The processor, the memory, and the communication interface are connected to each other. Among them, the communication interface is used to receive and send data, the memory is used to store program codes, and the processor is used to call the program codes to execute the method described in the first aspect.

[0028] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, and the computer program is executed by a processor to implement the method described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.

[0030] Figure 1 It is a schematic flowchart of a method for generating an original OTA package provided by an embodiment of the present application;

[0031] Figure 2ASchematic diagram of another method for generating the original OTA package provided by the embodiments of the present application;

[0032] Figures 2B - 2C Schematic diagram of the file structure of the target OTA package provided by the embodiments of the present application;

[0033] Figure 2D Schematic diagram of the file structure of a minimum original package provided by the embodiments of the present application;

[0034] Figure 2E Schematic diagram of the file structure of another minimum original package provided by the embodiments of the present application;

[0035] Figure 3 Schematic diagram of another process for generating the original OTA package provided by the embodiments of the present application;

[0036] Figure 4A Schematic diagram of the structure of a device for generating the original OTA package provided by the embodiments of the present invention;

[0037] Figure 4B Schematic diagram of the structure of another device for generating the original OTA package provided by the embodiments of the present invention;

[0038] Figure 5 Schematic diagram of the structure of another device for generating the original OTA package provided by the embodiments of the present invention. Detailed implementation manners

[0039] The following details the terms involved in the present application.

[0040] (1) Block mapping information:

[0041] In the present application, the block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file, and the first file is the file obtained after mounting the flashing image file.

[0042] It can be understood that mounting the flashing image file means mounting the flashing image file to an existing directory that does not store files, so that the file data in the flashing image file can be stored in the disk corresponding to the directory. Thus, the file data in the flashing image file can be accessed by accessing this directory. The block mapping information can also be understood as the information of the first file and the data blocks (i.e., the data blocks in the disk) occupied by the file data of the first file, and the first file is part or all of the files in this directory.

[0043] Exemplarily, the flashing image file includes File A (it can be understood that the flashing image file includes File A, which is only an example. The flashing image file may also include other files, such as File B and File C, which are not limited in this article). Then, mount the flashing image file to the above directory, and the directory can include File A. If the file size of File A is 4M and the capacity size of the data block of the file system is 4k (1M = 1024k), then File A includes 1024 4k data and needs to occupy 1024 data blocks of the file system to store the 1024 4k data. Correspondingly, the block mapping information includes the identifier of File A, the address information (starting address information) of the first data block among the 1024 data blocks storing File A, and the address information (ending address information) of the last data block. It can be understood that according to the starting address information and the ending address information recorded in the block mapping information, the address information of all data blocks storing File A and the corresponding data content on the disk can be found. Thus, the difference content between the image files of the old and new versions of the system software can be found according to the block mapping information of the old and new versions of the system software.

[0044] (2) Flashing image file:

[0045] Generally, a series of files related to the function data of the system software of the first version are used to make a flashing image file in a certain format for users to download and use. It can be understood that the flashing image file can be stored in the source code of the terminal configured with the system software of the first version, or can be stored in the factory flashing package.

[0046] In the embodiments of the present application, the flashing image file includes the image file of the non - file - system partition and the image file of the file - system partition.

[0047] Exemplarily, if the flashing image file is the flashing image file stored in a terminal configured with the system software of the first version, then the flashing image file can be the image file corresponding to the target partition in the file system of the terminal. The target partition can be a file system partition such as a system partition, a product partition, a vendor partition, etc., or the target partition can also be a disk partition corresponding to one or more non-file system partitions such as a boot partition. For example, the target partition includes a system partition, a product partition, a boot partition, and a vendor partition. Correspondingly, the image files of the file system partitions in the flashing image file include: a system image file (system.img), a product image file (product.img), and a vendor image file (vendor.img), and the image files of the non-file system partitions in the flashing image file include: a boot image file (boot.img). For example, the target partition is the disk partition corresponding to the system partition. Then correspondingly, the image file of the file system partition in the flashing image file includes system.img, and the flashing image file does not include the image file of the non-file system partition. Exemplarily, the flashing image file can also be the image file of the file system partition and / or the image file of the non-file system partition stored in the factory flashing package. It can be understood that the flashing image file only includes the file data related to the system functions or application program functions of the first version of the system software, and does not include the user data image file.

[0048] It can be understood that the file format of the image file of the file system partition included in the flashing image file can be a non-file system format or a file system format. Exemplarily, the file format of the image file of the file system partition can be the sparse format (non-file system format), or the third-generation extended file system format (ext3 format) or the fourth-generation extended file system format (ext4 format).

[0049] It is understandable that in an image file in a file system format such as the ext3 format or the ext4 format, there will be many invalid padding areas filled with all zeros. For a complete image file in the file system format, the mount command can be directly used for mounting (in the embodiments of the present application, mounting refers to a process in which an operating system makes computer files and directories on a storage device, such as a hard disk, a CD-ROM, or a shared resource, accessible to users through the computer's file system). However, an image file in the sparse format is obtained by sparsely describing an image file in the file system format. By squeezing out any zero elements, a full matrix is converted into a sparse format, so that there are no invalid padding areas filled with all zeros in the sparse-format image file. It is an incomplete image file and cannot execute the mount command normally. If a matrix contains many zeros, converting the matrix to a sparse storage space can greatly save memory. Therefore, the image file compiled by default in the Android environment is a file in the sparse format.

[0050] (3) Original OTA package:

[0051] In the embodiments of the present application, the original OTA package can be used to represent the system software information of the first version. The system software information of the first version can be understood as the system software information of the system version that has lost the original OTA package. Exemplarily, the original OTA package can be understood as an upgrade package for the old version of the system software. Generally, the upgrade package for the old version of the system software includes an image file corresponding to the old version of the system software, block mapping information corresponding to the image file, file signature path information of the files in the image file, and file permission configuration information.

[0052] In the embodiments of the present application, the target OTA package can be used to represent the system software information of the second version. The system software information of the second version can be understood as the system software information of the new version. Exemplarily, the target OTA package can be understood as an upgrade package for the new version of the system software. Generally, the upgrade package for the new version of the system software includes an image file corresponding to the new version of the system software, block mapping information corresponding to the image file, file signature path information of the files in the image file, and file permission configuration information.

[0053] It is understandable that the above block mapping information is used to generate an OTA differential package by comparing the differences between the block mapping information in the original OTA package and the block mapping information in the target OTA package when generating the OTA differential package in the block difference mode. Specifically, by using the first start address information and the first end address information of the data block storing the first file included in the block mapping information of the original OTA package of the old version, and the second start address information and the second end address information of the data block storing the second file included in the block mapping information of the target OTA package of the new version, the differences in the file data of the first file in the mirror file of the new version and the second file in the mirror file of the old version are found, so as to generate the OTA difference. It is understandable that the first file and the second file are only used to distinguish whether the file belongs to the mirror file of the system software of the new version or the mirror file of the system software of the old version, and the file identifiers of the first file and the second file can be the same.

[0054] Exemplarily, in the block mapping information of the system software of the old version, the file identifier of file A, the first start address information and the first end address information of the data block storing file A are recorded; in the block mapping information of the system software of the new version, the file identifier of file A, the second start address information and the second end address information of the data block storing file A are recorded. Denote the first start address information to the first end address information as the first interval, and denote the address information of the data block of the second start address information and the second end address information as the second interval. Take the intersection of the first interval and the second interval, and perform a diff operation on the data stored in the data block corresponding to the address information in the intersection to generate a patch file. Delete the data stored in the data block outside the intersection that only exists in the old version; pack the data stored in the data block outside the intersection that only exists in the new version to generate a new data file, so as to generate an OTA differential package according to the patch file and the new data file.

[0055] (4) Target script:

[0056] In the embodiment of the present application, the target script can be used to generate a mirror file and block mapping information. Thus, by inputting the first mirror file after mounting the flashing mirror file into the target script, the block mapping information can be obtained.

[0057] Exemplarily, the target script includes the build_image.py script. The target script can be used to generate a mirror file consistent with the above sparse format file system mirror file, and the regenerated mirror file includes the permission group information and selinux configuration information of the file data included in the first mirror file. The target script can be used to generate block mapping information.

[0058] Next, the technical solutions in the embodiments of the present invention will be described in conjunction with the accompanying drawings in the embodiments of the present invention.

[0059] Next, in conjunction with the attached Figure 1 , a method for generating an original OTA package provided by an embodiment of the present invention will be introduced in detail.

[0060] Please refer to Figure 1 , which is a schematic flowchart of a method for generating an original OTA package provided by an embodiment of the present invention. As Figure 1 shown, the method for generating the original OTA package includes:

[0061] 101. Obtain a flashing image file corresponding to the original OTA package.

[0062] Exemplarily, there are several implementation manners for obtaining the flashing image file as follows:

[0063] 1. Read the flashing image file stored in the source code of an electronic device configured with a system software of a first version through a target read command. The terminal can be a mobile phone, a computer, a PC, etc. that can download and configure the system software of the first version through OTA (the description of the terminal in other embodiments of this application is the same as this).

[0064] 2. In the case where the flashing image file stored in an electronic device configured with a system software of a first version is lost, use relevant tools to export the files in the image partition of the terminal, and after export, the flashing image file in the file system format can be obtained.

[0065] Exemplarily, use relevant tools such as the QFIL tool (the QFIL tool is used for flashing Android devices and backing up and restoring the mirror images of each partition in the device), export the image partition, and after export, the above-mentioned flashing image file in the ext3 format or ext4 format of the file system can be obtained.

[0066] 3. Obtain the flashing image file from the factory flashing package corresponding to the system software of the first version.

[0067] Exemplarily, the factory flashing package stores the mirror image file of the system software version with the same version type as the first system version software. By downloading the factory flashing package and decompressing it, the mirror image file can be obtained.

[0068] It can be understood that the above-listed methods for obtaining the flashing image file are only examples, and other methods can also be used to obtain the flashing image file. Specifically, which method is used to obtain the flashing image file is not limited in the embodiments of this application.

[0069] 102. Extract the block mapping information from the flashing image file. The block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file. The first file is the file obtained after mounting the flashing image file.

[0070] In the embodiments of the present application, by mounting the image file of the file system partition in the flashing image file, the file identifier of the first file and the data in the first file are obtained. Exemplarily, when the image file of the file system partition is in the sparse file format, first convert the file format of the image file of the file system partition from the sparse format to the file system format to obtain the first image file; and execute the mount instruction on the first image file to obtain the files contained in the first image file as the first file.

[0071] In the embodiments of the present application, extracting the block mapping information according to the flashing image file includes: extracting the block mapping information according to the first image file after mounting the flashing image file. Exemplarily, extracting the block mapping information according to the first image file may be to input the file identifier of the first file, the file data of the first file, and the first path into the target script. The block mapping information is extracted through the target script, and the block mapping information is output to the file corresponding to the first path through the target script.

[0072] It can be understood that the first image file obtained by mounting has been stored in the data block of the disk corresponding to the mounting directory. Then the first image file contains the file identifier of the first file, the start address information and the end address information of the data block for storing the first file. And the target script can be used to generate the block mapping information. Therefore, by inputting the file identifier of the first file, the file data of the first file, and the first path in the first image file into the target script, the block mapping information can be generated.

[0073] 103. Generate the original OTA package according to the file identifier of the first file, the start address information and the end address information.

[0074] Generally, the OTA differential package is generated by the block difference method. It is mainly to obtain the difference information of the file data of the image files of the system versions of the old and new software by comparing the differences between the block mapping information of the original OTA package of the old version and the file identifier of the file, the start address information and the end address information of the data block for storing the file included in the block mapping information of the target OTA package of the new version, and then generate the OTA differential package according to the difference information.

[0075] Therefore, the file identifier of the first file, the start address information and the end address information of the data block storing the first file can be understood as the main information in the original OTA package. After the original OTA package is lost, the original OTA package can be regenerated based on the file identifier of the first file, the start address information and the end address information.

[0076] Exemplarily, generating the original OTA package may include the following implementation manners:

[0077] 1. Obtain target configuration information according to a target OTA package, where the target OTA package is used to represent system software information of a second version, and the target configuration information includes file signature path information and first permission configuration information; generate the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information.

[0078] It can be understood that the first permission configuration information includes the file identifier of a second file and the permission configuration information of the second file. The permission configuration information of the second file includes the readable, writable, and executable permissions of the second file and the permission of the second file to access other files except itself. The second file refers to the file included in the mirror file of the system software of the second version corresponding to the target OTA package.

[0079] In the embodiments of the present application, when the configuration information (such as the above-mentioned first permission configuration information), signature path information, etc. stored in the original OTA package or the target OTA package and not modified with version updates, when the original OTA package is lost and needs to be restored, the configuration information and signature path information in the target OTA package can be used as the configuration information and signature path information in the original OTA package. Exemplarily, the file signature path information and the first permission configuration information can be copied from the target OTA package. Then, a block mapping file (i.e., block mapping information) is generated by packaging according to the file identifier of the first file, the start address information, and the end address information above, and the block mapping file, the flashing mirror file, the first permission configuration information, and the signature path information are packaged to generate the original OTA package. Among them, the flashing mirror file and the block mapping file are in the same folder. Or, a copy of the target OTA package can be obtained by copying the target OTA package, and other information in the copy of the target OTA package except the above-mentioned first permission configuration information and file signature path information is deleted, so as to obtain a copy of the target OTA package that only contains the above-mentioned first permission configuration information and file signature path information. Then, the original OTA package is generated according to the block mapping file, the flashing mirror file, and the copy of the target OTA package.

[0080] 2. Package the file identifier of the first file, the start address information, and the end address information to generate a block mapping file (i.e., block mapping information), and package the block mapping file, the flashing image file, and a copy of the target OTA package to generate the original OTA package.

[0081] It can be understood that the above first permission configuration information and signature path information are included in the target OTA package. When the first permission configuration information and signature path information are needed, in order not to perform unnecessary deletion operations on the target OTA package, the entire target OTA package can be directly used.

[0082] It can be understood that the copy of the target OTA package is obtained by copying the original of the target OTA package. In addition to the first permission configuration information and signature path information, the target OTA package also contains block mapping information and image files of the new version system software. Therefore, the generated original OTA package also contains block mapping information and image files of the new version system software. Optionally, when generating an OTA differential package using the original OTA package and the target OTA package, only the block mapping information corresponding to the system software of the first version in the original OTA package can be compared with the block mapping information in the target OTA package, and the block mapping information corresponding to the system software of the second version in the original OTA package is not compared with the block mapping information in the target OTA package. Or, since comparing the block mapping information corresponding to the system software of the second version in the original OTA package with the block mapping information in the target OTA package will not generate a differential file, optionally, when generating an OTA differential package using the original OTA package and the target OTA package, the block mapping information corresponding to the system software of the first version in the original OTA package can also be compared with the block mapping information in the target OTA package, and the block mapping information corresponding to the system software of the second version in the original OTA package is also compared with the block mapping information in the target OTA package.

[0083] 3. Package the file identifier of the first file, the start address information, and the end address information to generate a block mapping file (i.e., block mapping information); and replace the image file in the target OTA package with the above flashing image file, and replace the block mapping file in the target OTA package with the block mapping file generated in 102 to obtain an updated target OTA package, and use the updated target OTA package as the original OTA package.

[0084] In an embodiment of the present application, after obtaining the first permission configuration information from the target OTA package, if the file identifier of the second file included in the first permission configuration information and the file permission configuration information of the second file are inconsistent with the file information of the first file in the flashing image file, the file information of the target file in the first permission configuration information is deleted to obtain the second permission configuration information, where the file identifier of the target file is included in the file identifier of the second file and not included in the file identifier of the first file; or, the file information of the target file is added to the first permission configuration information to obtain the second permission configuration information, where the file identifier of the target file is included in the file identifier of the first file and not included in the file identifier of the second file. Specifically, generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information includes: generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the second permission configuration information.

[0085] In an embodiment of the present application, since the storage space occupied by the non-file system is generally relatively small, when making the OTA differential package of the first version of the system software and the second version of the system software, generally no differential processing is performed on the non-file system image file. That is, the target OTA package does not include the block mapping information corresponding to the non-file system image file. When differential processing is required, the diff command can be directly used to compare the file data of the new and old version image files to obtain the difference data. Therefore, for the non-file system image file in the flashing image file, no corresponding block mapping information needs to be generated, and it can be directly added to the original OTA package following the flashing image file.

[0086] In an embodiment of the present application, the block mapping information can also be stored in the source code of the first version of the system software. If the original OTA package of the first version of the system software needs to be synthesized again next time, the stored block mapping information is directly used as the block mapping information in step 102 above.

[0087] Generally, the OTA differential packages below Android 7.0 are made by file differencing. In the file differencing method, neither the original OTA package nor the target OTA package includes block mapping information. The patch file (i.e., the OTA differential package) is directly obtained by executing the diff command on the file data of the first file in the original OTA package and the target OTA package. For versions above Android 7.0, the OTA differential packages are made by block differencing. The block differencing method mainly makes the OTA differential package by comparing the block mapping information in the original OTA package with the block mapping information in the target OTA package. Thus, in the case of making the OTA differential package by block differencing, if the original OTA package is lost and the method of restoring the original OTA package in the file differencing method is still used to generate the original OTA package, the block mapping information will not be included in the OTA package, resulting in the inability to generate the OTA differential package.

[0088] However, by using the method for generating the original OTA provided in the embodiments of the present application, the block mapping information is extracted from the old version of the flashing image file, and then the original OTA package is restored according to the block mapping information. For an electronic device that has lost the original OTA package, when the original OTA package is needed, the original OTA package can be accurately and quickly generated, avoiding the problem of execution errors when executing the program due to the loss of the original OTA package. Exemplarily, when making the OTA differential package according to the original OTA package, the method provided in the embodiments of the present application can avoid the problem of execution errors when executing the program for generating the OTA differential package due to the loss of the original OTA package or the lack of block mapping information in the original OTA package, so as to quickly and accurately generate the OTA differential package, reduce the probability of program errors, and reduce unnecessary performance losses.

[0089] For further understanding Figure 1 of the method shown below, the method provided in the embodiments of the present application will be illustrated by the following example.

[0090] Please refer to Figures 2A - 2E , which is a schematic flowchart of a method for generating an original OTA package provided by an embodiment of the present invention. As Figure 2A shown, the method for generating the original OTA package includes:

[0091] 201, Obtain the flashing image file of the system software of the first version.

[0092] Regarding how to obtain the flashing image file, please refer to the relevant detailed descriptions of other embodiments of the present application (such as step 101 shown in Figure 1 ), which will not be elaborated here.

[0093] 202. For the image file of the file system partition in the flashing image file, when the format of the image file of the file system partition is the sparse file format, convert the file format of the image file of the file system partition from the sparse format to the file system format; and execute the mount instruction on the image file of the file system partition in the file system format to obtain the file data in the image file of the file system partition, denoted as the first image file.

[0094] It can be understood that to enable the image file of the file system partition to be normally mounted after executing the mount instruction and the file data in the mounted image file of the file system partition can be accessed, it is necessary to convert the image file of the file system partition in the sparse format to the image file of the file system partition in the file system format. Exemplarily, convert the image file of the file system partition from the sparse format to the ext4 format to obtain the first image file in the ext4 format.

[0095] Exemplarily, the file format conversion tool provided in the Android source code can be used to convert the image file of the file system partition in the sparse format to the image file of the file system partition in the file system format to obtain the first image file. For example, the file format conversion tool is located in the directory: system / core / libsparse / simg2img.c. Thus, by executing the command simg2img system.img system.raw, the file format of system.img can be converted from the sparse format to the file system format to obtain system.img in the file system format.

[0096] It can be understood that the method for converting the format of the image file of the file system partition from the sparse format to the file system format in the embodiments of the present application is only an example, and other methods can also be used to convert the format of the image file of the file system partition from the sparse format to the file system format. The embodiments of the present application do not limit this.

[0097] 203. Pass the first parameter path, the second parameter path, the third parameter path, and the above-mentioned first image file to the target script in the form of passing parameters, so that a block map file corresponding to the first image file is generated when the target script is run.

[0098] In an embodiment of the present application, the second parameter path is the file path of the file storing the permission group information of all the files included in the first mirror file. Exemplarily, the file pointed to by the second parameter path is filesystem_config.txt, and the filesystem_config.txt file is used to store the permission group information of all the files included in the above-mentioned first mirror file. The single-line format of the data in the filesystem_config.txt file is file name - file owner - group - access permission. It can be understood that the file owner refers to the creator of the file (such as root), the group refers to which user groups (a user group refers to a collection of users) the file can be accessed by, and the access permission refers to the permissions of read, write, and execute. Exemplarily, in the first_info.txt file storing information such as the permission configuration information and signature information of the first mirror file in the system software of the first version, the second parameter path config_fs (which can also be understood as filesystem_config.txt) is written into the first_info.txt file through the statement config_fs = filesystem_config.txt.

[0099] In an embodiment of the present application, the third parameter path is the file path of the file storing the selinux configuration information of the files included in the first mirror file. Specifically, the file pointed to by the third parameter path is file_context.bin, and the file_context.bin file is used to store the selinux configuration information of all the files included in the first mirror file. The single-line format of the file_context.bin file is file name - file path - file selinux configuration information. Through the selinux configuration information, the permissions of other files that each file (each file in the files included in the first mirror file) can use and access can be defined, a separate permission list can be defined for each file, and the permissions for the file to execute and access other files can be defined. Exemplarily, in the first_info.txt file in the system software of the first version, the third parameter path selinux_fc (which can also be understood as file_context.bin) is written into the _info.txt file through the statement selinux_fc = file_context.bin.

[0100] It can be understood that the above-mentioned permission group information and selinux configuration information can also be understood as the first permission configuration information described in other embodiments.

[0101] In an embodiment of the present application, the first parameter path is used to define the file path of the output location of the block map file and the file name of the block map file. Exemplarily, in the first _info.txt file, add the statement block_list = / xxx / system.map, and write the first parameter path block_list into the first _info.txt file. It can be understood that if the first parameter path is passed in the build_image.py script, it means that when running the target script, according to the file name and file path defined by the first parameter path, the block map file is output to the file path, and the block map file is named the file name. If the first parameter path does not exist in the target script, the block map file is not output when running the target script.

[0102] In an embodiment of the present application, after writing the above first parameter path, second parameter path, and third parameter path into the first _info.txt, the electronic device executing the method of the embodiment of the present application then passes the first _info.txt file and the above first image file into the build_image.py script in the form of parameters, so that the build_image.py script is executed to generate the block map file. Exemplarily, add the statement copy_prop(“block_list”, “block_list”) in the build_image.py script, so that when the first _info.txt file and the first image file are used as inputs and the build_image.py script is run, copy_prop makes a copy and preparation of the first parameter path, second parameter path, and third parameter path, and passes the first parameter path into the build_image.py script to indicate that according to the first image file, the first parameter path, second parameter path, and third parameter path are used to regenerate the image file, and the blockmap file is output to the file corresponding to the first parameter path.

[0103] In the embodiment of the present application, by running the target script, the files included in the first image file obtained after mounting are accessed, and the block map file is generated according to the data blocks occupied by each file. Exemplarily, according to the data in each file and the address information of the data blocks storing the data, and following the root directory first, then files, and then folders / files (for example, if the files included in the first image file are file A and file C under folder B, then first record the file information of file A, and then record the file information of file C under folder B), and the first letter of the file name ranges from a to z, the information of the files included in the first image file is filled in line by line in the single-line format of "file path - address information of the starting data block of the inode record corresponding to the file - address information of the last data block storing the data of the inode record".

[0104] It can be understood that the above first _info.txt file can be an _info.txt file corresponding one by one to each image file included in the first image file, or an _info.txt file including all the image files in the first image file. Exemplarily, when the first image file includes system.img, product.img, and vendor.img, the first _info.txt file can be the system.image_info.txt file corresponding to system.img, the product.image_info.txt file corresponding to product.img, and the vendor.image_info.txt file corresponding to vendor.img. Or, the first _info.txt can also be the misc_info.txt file including all the image files of system.img, product.img, and vendor.img.

[0105] Generally, the data content included in the _info.txt file such as the permission configuration information and signature information of the image files stored in the OTA packages of the old and new system software versions is mostly exactly the same, and generally there will be no major changes. Thus, in the case where the original OTA package of the first version of the system software is lost, the first _info.txt file can be obtained from the source code of the first version of the system software. Or, the first _info.txt file can also be obtained from the target OTA package of the second system software version (for example, copy the second _info.txt file in the META directory of the target OTA package as the first _info.txt file of the first version of the system software).

[0106] Exemplarily, Figures 2B - 2CIt is a schematic diagram of the file structure of a target OTA package provided by an embodiment of the present application. In addition to the image file ( Figure 2B shown as the IMAGES file), the permission configuration information, signature information, etc. stored in other folders will not change with the version update. As Figure 2C shown, the second _info.txt file in the target OTA package is stored in the META folder. It can be understood that Figures 2B - 2C the file structure of the target OTA package shown in is only an example, and the target OTA package may also include other folders. For example, in order to adapt to the upgrade method of file comparison, the target OTA package may also include folders for storing file data of the system (system) partition, folders for storing product file data, folders for storing boot file data, etc.

[0107] It is understandable that the permission group information and selinux configuration information of the first mirror file stored in the first _info.txt file are the same as those of the mirror file in the target OTA package stored in the second _info.txt file and will not be modified with version updates. However, compared with the first mirror file, the file system mirror file in the target OTA package may have new folders added or deleted, which may cause the content of the filesystem_config.txt file and file_context.bin file pointed to by the first parameter path in the first _info.txt file to be different from the content of the filesystem_config.txt file and file_context.bin file pointed to by the first parameter path in the second _info.txt file, resulting in inaccurate new mirror files generated by running the build_image.py script, such as the presence of extra files or missing files. In this case, before using the second _info.txt file as the first _info.txt file, it is necessary to first copy the filesystem_config.txt file and file_context.bin file in the second info.txt file. Also, since the filesystem_config.txt file and file_context.bin file have a fixed single-line format, for example, the single-line format of the file_context.bin file is file name - file path - file selinux configuration information, and the single-line format of the filesystem_config.txt file is file name - file owner - group - access permission, the difference content can be found by manually screening or by creating a script with comparison functions based on the filesystem_config.txt file, file_context.bin file, and the first mirror file.

[0108] For the found differential content, edit and modify the filesystem_config.txt file and the file_context.bin file. Exemplarily, if it is found that the file system image file in the target OTA package (for ease of description, the file system image file in the target OTA package will be referred to as the second image file hereinafter) has a new folder A compared to the first image file, then delete the data regarding the folder A in the copied filesystem_config.txt file and file_context.bin file. Exemplarily, if it is found that the second image file has deleted the folder B compared to the first image file, then delete the data regarding the folder B in the copied filesystem_config.txt file and file_context.bin file. It can be understood that if the file_context.bin file cannot be edited due to the bin file format, a tool (such as sefcontext_compile) needs to be used to convert the file_contexts.bin file into an editable format (such as.txt format), and then convert it back to the bin format of the file_contexts.bin file after editing.

[0109] It can be understood that the embodiments of the present application are applicable to electronic devices that perform differential upgrade of the system software version according to the OTA differential upgrade package in the block upgrade method. In this block upgrade method, for the image file of the file system partition, the OTA differential package is mainly made by comparing the data block information recorded in the block map file under the image file in the old version OTA package and the block map file under the image file in the new version OTA package. Devices equipped with the old version of the system software can download and run the OTA differential package through OTA technology to achieve the differential upgrade of the system software version. It can be understood that the upgrade of the system software version refers to the upgrade of the inherent system functions or application program functions in the system software version (for example, upgrading from andirod7.0 to andirod7.1; for example, in the WeChat application, fixing bugs or adding a new function to the old version of the system function, etc.). During the upgrade process, the upgrade of user data is not involved and user data will not be accessed. It can be understood that the data content in the flashing image file (or the first image file) in devices equipped with the same first version of the system software is exactly the same.

[0110] In the embodiments of the present application, the above flashing image file further includes a non-file system image file. Exemplarily, the non-file system image file includes one or more of the image files of non-file system partitions such as the boot image file boot.img or the baseband image file modem.img.

[0111] It is understandable that there may be a situation where new folders are added or existing folders are deleted in the non - file - system image files in the target OTA package compared to the non - file - system image files in the flashing image file. This is consistent with the relevant processing described above regarding the possible addition or deletion of folders in the file - system image files in the target OTA package compared to the first image file, and will not be elaborated here.

[0112] In the embodiments of the present application, since the storage space occupied by the non - file system is generally relatively small, when making an OTA upgrade package (which can also be understood as the OTA differential package described in other embodiments of this article) for non - file - system image files, differential processing can be performed or not. For example, the original size of boot.img is between 10M - 20M, and the differential file boot.img.p.patch obtained after differential processing is about 5M - 10M. Not performing differential processing on the non - file - system image files of the new and old versions will not have a significant impact on the size of the upgrade package.

[0113] In the embodiments of the present application, since the data content included in the non - file - system image file is relatively small, when generating an OTA differential package using the block upgrade method, the new - version OTA package (which can also be understood as the target OTA package described in other embodiments of this article) does not contain a block map file. When differential processing is required, the diff command can be directly used to compare the new and old versions of the image files to obtain the differential data. Exemplarily, by executing the command diff, the differential content of the non - file - system image files boot.img of the new and old versions is distinguished, and a differential file (such as boot.img.p patch) is generated and stored in the OTA differential package. Therefore, there is no need to generate a corresponding blockmap file for the non - file - system image files in the flashing image file.

[0114] 204. Generate the original OTA package of the system software of the first version according to the block map file, the flashing image file, and the target OTA package.

[0115] Regarding how to specifically generate the original OTA package according to the block map file, the flashing image file, and the target OTA package, please refer to the relevant descriptions in other embodiments of the present application (such as Figure 1 step 103 as shown).

[0116] 205. Store the above - mentioned block mapping file in the source code of the system software of the first version.

[0117] It is understandable that the block mapping file is stored in the source code and can be generated once for multiple uses. Thus, when the original OTA package needs to be synthesized again next time, the complex generation actions do not need to be repeated, reducing performance loss. Exemplarily, by adding the parameter block_list=$(PRODUCT_OUT) / system.map to the build / make / core / Makefile file and adding this block_list to the copy_prop function in ImagePropFromGlobalDict, copy_prop("block_list", "block_list"), the storage path of this block map file is defined, so that this block map file is stored in the out directory. When this block map file needs to be used, accessing the $(PRODUCT_OUT) / system.map directory can obtain this block map file.

[0118] In some other embodiments, other files in the above target OTA package except the image file can also be used as the minimum original package, and this minimum original package is stored in the source code. Exemplarily, the minimum original package includes the permission group configuration information, selinux configuration information, and signature path information in the target OTA package, and this minimum original package is stored in the source code of the system software of the first version.

[0119] It is understandable that storing the above minimum original package and block mapping file in the source code can enable directly obtaining the minimum original package, the original OTA package, and the flashing image file stored in the source code when the original OTA package needs to be generated next time, and generating the original OTA package based on the minimum original package, the original OTA package, and the flashing image file. There is no need to perform complex generation actions for generating the block mapping file anymore, nor do we need to perform operations such as replacement or deletion on the target OTA package, saving project development time and reducing performance loss at the same time.

[0120] Exemplarily, as Figure 2D shown, the minimum original package can only include other folders and folder data in the target OTA package except the image file. Subsequently, when putting the block map file and the flashing image file into this minimum original package, corresponding folders for storing the flashing image file and the block map file are created. Or, as Figure 2EAs shown, the minimum original package may include: other folders and folder data in the target OTA package except for the image files, and the folder IMAGES of the empty image file (the folder of the empty image file does not contain the file data of the image file). Subsequently, when the block map file and the flashing image file are placed in the minimum original package, the empty image file folder is filled with the flashing image file to restore the original OTA package.

[0121] It can be understood that if the original OTA package is generated by adding the block map file and the flashing image file to the parent of the minimum original package, after using the original OTA package (for example, after creating the OTA differential package based on the original OTA package and the target OTA package), the addition of the block map file and the flashing image file in the parent needs to be deleted. If the original OTA package is obtained by adding the block map file and the flashing image file to the copy of the minimum original package, after using it (for example, after creating the OTA differential package based on the original OTA package and the target OTA package), the original OTA package can be deleted. Thus, storage space is saved.

[0122] In the embodiment of the present application, for the non-file system image file in the flashing image file, the image file corresponding to the non-file system image file in the target OTA package is used to replace the non-file system image file. It can be understood that after making restorative modifications for the newly added or deleted folders, for the non-file system image file, only the non-file system image file has differences between the OTA packages of the old and new system software versions. Therefore, when the original OTA package of the system software of the first version is lost and the original OTA package is restored through the target OTA package, for the non-file system image file in the target OTA package, the image file corresponding to the non-file system image file in the target OTA package can be replaced with the non-file system image file in the flashing image file.

[0123] It can be understood that the operations that need to be performed on the target OTA package in the embodiment of the present application (such as making corresponding restorative modifications to the found above differences and adding the block map file and the flashing image file to the target OTA package, etc.) are processed in the copied target OTA package (copy target OTA package), rather than on the parent of the target OTA package, to ensure the integrity of the parent target OTA package.

[0124] 205. Create an OTA differential package according to the original OTA package and the target OTA package.

[0125] It is understandable that the differential package can be generated by calling the command for generating the differential package. Exemplarily, if the original OTA package is target_files1.zip and the target OTA package is target_files2.zip, then by running the statement. / build / tools / releasetools / OTA_from_target_files -k and the statement build / target / product / security / testkey -i OTA_target_files1.zip OTA_target_files2.zip update.zip, the obtained update.zip is the generated differential package after running.

[0126] It is understandable that for the upgrade package of non - file - system image files in the original OTA package, differential processing can be selected or non - differential processing can be selected. If differential processing is required for the OTA packages of the non - file - system image files of the old and new system software versions, the diff command is used to create the difference file and store it in the upgrade package. If differential processing is not required, the differential script needs to be modified to make the non - file - system image file non - differential, so that the new version of the non - file - system image file is directly put into the upgrade package without differential processing. Exemplarily, the parameter indicating whether to create the difference file by differential in the differential script OTA_from_target_files.py for creating the difference file of boot.img is modified to non - differential. Exemplarily, the parameter indicating whether to create the difference file by differential in the differential script releasetools.py for creating the difference file of modem.img is modified to non - differential.

[0127] Figure 3 This is a method for generating an original OTA package provided by an embodiment of the present application. As Figure 3 shown, the method for generating the original OTA package includes:

[0128] 301, obtain the flashing image file.

[0129] For the specific description of obtaining the flashing image file, reference can be made to the relevant detailed description of other embodiments of the present application (for example, step 101 as Figure 1 shown), which will not be elaborated here.

[0130] 302, mount the image file of the file system partition in the above - mentioned flashing image file to obtain the first image file.

[0131] For the specific description of mounting the image file of the file system partition, reference can be made to the relevant detailed description of other embodiments of the present application (for example, step 202 as Figure 2A shown), which will not be elaborated here.

[0132] 303. Generate a block map file according to the above first mirror file.

[0133] For the specific description of generating the block map file, reference can be made to the relevant detailed descriptions of other embodiments of this application (for example, step 203 as Figure 2A shown), which will not be elaborated here.

[0134] In the embodiments of this application, before generating the original OTA package according to the block map file, it further includes: copying an OTA upgrade package of the new version of the system software (which can also be understood as the target OTA package described in other embodiments of this application), denoted as the backup OTA package.

[0135] 304. For the mirror file of the file system partition in the flashing mirror file, add the mirror file of the above file system partition and the block map file to the backup OTA package.

[0136] For the specific implementation method of adding the above flashing mirror file and block map file to the backup OTA package, it is the same as the specific implementation method of how to add the flashing mirror file and block map file to the target OTA package above, and reference can be made to the relevant detailed description above (for example, step 103 as Figure 1 shown), which will not be elaborated here.

[0137] 305. For the mirror file of the non - file system partition in the flashing mirror file, directly add the mirror file of the non - file system partition to the target OTA package.

[0138] For the detailed description of adding the above flashing mirror file and block map file to the target OTA package, reference can be made to other embodiments of this application (for example, step 103 as Figure 1 shown), which will not be elaborated here.

[0139] 306. Synthesize the original OTA package corresponding to the above flashing mirror file.

[0140] It can be understood that adding the mirror file of the above file system partition, the block map file, and the mirror file of the non - file system partition to the target OTA package to obtain the updated target OTA package can also be understood as adding the above flashing mirror file and block map file to the target OTA package, obtaining the updated target OTA package, and using this updated target OTA package as the original OTA package.

[0141] The following will introduce the device for generating the original OTA package provided by the embodiments of the present invention.

[0142] Please refer to Figures 4A - 4B , which is a schematic structural diagram of a device for generating an original OTA package provided by an embodiment of the present invention. As Figure 4A shown, the device for generating an original OTA package according to an embodiment of the present invention may include:

[0143] An acquisition unit 401, configured to acquire a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent system software information of a first version;

[0144] An extraction unit 402, configured to extract block mapping information according to the flashing image file, where the block mapping information includes a file identifier of a first file, start address information and end address information of a data block for storing the first file, and the first file is a file obtained after the flashing image file is mounted;

[0145] A generation unit 403, configured to generate an original OTA package according to the file identifier of the first file, the start address information and the end address information.

[0146] As Figure 4B shown, in a possible implementation manner, the extraction unit 402 includes:

[0147] A mounting subunit 4021, configured to mount the flashing image file to obtain the file identifier of the first file and the data in the first file; an input subunit 4022, configured to input the file identifier of the first file, the file data of the first file, and a first path into a target script; an extraction subunit 4023, configured to extract block mapping information through the target script, and an output subunit 4024, configured to output the block mapping information to a file corresponding to the first path through the target script.

[0148] In a possible implementation manner, the mounting subunit 4021 is specifically configured to convert the file format of the image file of the file system partition to the file system format when the file format of the image file of the file system partition is a non-file system format; and mount the image file of the file system partition in the file system format to obtain the file in the image file of the file system partition, and use the file of the image file of the file system partition as the first file.

[0149] In a possible implementation manner, the generation unit 403 includes:

[0150] An obtaining subunit 4031 is configured to obtain target configuration information according to a target OTA package, where the target OTA package is used to represent system software information of a second version, and the target configuration information includes file signature path information and first permission configuration information; a first generating subunit 4032 is configured to generate an original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the first permission configuration information.

[0151] In a possible implementation manner, the generating unit 403 includes:

[0152] A second generating subunit 4033 is configured to package the file identifier of the first file, the start address information, the end address information, the target OTA package, and the flashing image file to generate an original OTA package; where the file identifier of the first file, the start address information, the end address information, and the flashing image file are in the same folder.

[0153] In a possible implementation manner, the first permission configuration information includes the file identifier of a second file and the permission configuration information of the second file; the apparatus for generating the original OTA package further includes:

[0154] A deleting unit 404 is configured to delete the file information of a target file in the first permission configuration information to obtain second permission configuration information, where the file identifier of the target file is included in the file identifier of the second file and does not include the file identifier of the first file; or,

[0155] An adding unit 405 is configured to add the file information of the target file to the first permission configuration information to obtain second permission configuration information, where the file identifier of the target file is included in the file identifier of the first file and is not included in the file identifier of the second file;

[0156] The first generating subunit 4032 is specifically configured to generate an original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the second permission configuration information.

[0157] A storage unit 406 is configured to store the block mapping information into the source code of the system software of the first version.

[0158] In the embodiments of the present invention, the descriptions of the original OTA package, the block mapping information, the system software of the first version, the flashing image file, the first permission configuration information, the file signature path information, etc. may refer to the method embodiments shown above, and will not be elaborated here.

[0159] It can be understood that the specific descriptions of the apparatus shown in the embodiments of the present application may also refer to the method embodiments shown above, such asFigures 1 to 3 The related descriptions shown above will not be elaborated here.

[0160] It can be understood that Figure 4B The units included in the embodiments of the present application shown are only examples and not limitations. The embodiments of the present application may include more or fewer units than those shown Figure 4B The embodiments of the present application do not make any limitations in this regard.

[0161] Please refer to Figure 5 , which is a schematic structural diagram of another device for generating the original OTA package provided by the embodiment of the present invention. As shown Figure 5 , the device 500 for generating the original OTA package may include: at least one processor 501, such as a CPU, at least one communication interface 503, a memory 504, and at least one communication bus 502. Among them, the communication bus 502 is used to realize the connection and communication between these components. The communication interface 503 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface or a Bluetooth interface, etc.). The memory 504 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 504 may optionally also be at least one storage device located far from the aforementioned processor 501. As shown Figure 5 , the memory 504, as a computer storage medium, may include an operating system, a network communication module, and program instructions. The memory 504 may also be used to store the block mapping information and / or the minimum original package described above.

[0162] In Figure 5 the device 500 for generating the original OTA package shown, the processor 501 may be used to load the program instructions stored in the memory 504 and specifically perform the following operations:

[0163] Obtain a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent the system software information of the first version;

[0164] Extract block mapping information according to the flashing image file, where the block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file, and the first file is the file obtained after the flashing image file is mounted;

[0165] Generate the original OTA package according to the file identifier of the first file, the start address information and the end address information.

[0166] It should be noted that for the specific execution process, reference may be made to the specific descriptions of the method embodiments shown in Figure 1 or Figure 3 , and details will not be elaborated here.

[0167] It can be understood that for the specific description of the device shown in the embodiments of the present application, reference can also be made to the method embodiments shown above, such as Figures 1 to 3 the relevant descriptions shown, which will not be elaborated here.

[0168] The embodiments of the present invention also provide a computer storage medium, which can store multiple instructions. The instructions are suitable for being loaded and executed by a processor to perform the method steps of the embodiments as described above Figure 1 or Figure 3 shown. For the specific execution process, reference can be made to Figure 1 or Figure 3 the specific descriptions of the embodiments shown, which will not be elaborated here.

[0169] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it includes the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.

[0170] As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating an Over-the-Air (OTA) package, characterized in that, The method includes: Obtaining a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent the system software information of the first version; Extracting block mapping information according to the flashing image file, where the block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file, and the first file is the file obtained after the flashing image file is mounted; Obtaining target configuration information according to the target OTA package, where the target OTA package is used to represent the system software information of the second version, and the target configuration information includes file signature path information and first permission configuration information, and the first permission configuration information includes the file identifier of the second file and the permission configuration information of the second file; Deleting the file information of the target file in the first permission configuration information to obtain second permission configuration information, where the file identifier of the target file is included in the file identifier of the second file and not included in the file identifier of the first file; or Adding the file information of the target file to the first permission configuration information to obtain second permission configuration information, where the file identifier of the target file is included in the file identifier of the first file and not included in the file identifier of the second file; Generating the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information and the second permission configuration information.

2. The method according to claim 1, wherein The extracting the block mapping information according to the flashing image file includes: Mounting the flashing image file to obtain the file identifier of the first file and the file data in the first file; Inputting the file identifier of the first file, the file data of the first file and the first path into the target script; Extracting the block mapping information through the target script, and outputting the block mapping information to the file corresponding to the first path through the target script.

3. The method according to claim 2, characterized in that The flashing image file includes the image file of the file system partition, and the mounting the flashing image file to obtain the file identifier of the first file and the file data of the first file includes: In the case where the file format of the image file of the file system partition is a non-file system format, converting the file format of the image file of the file system partition to a file system format; Mounting the image file of the file system partition in the file system format to obtain the files in the image file of the file system partition, and using the file in the image file of the file system partition as the first file.

4. The method according to any one of claims 1 to 3, characterized in that The method further includes: Storing the block mapping information into the source code of the system software of the first version.

5. An apparatus for generating an original OTA package, characterized in that, including: An obtaining unit, configured to obtain a flashing image file corresponding to the original OTA package, where the original OTA package is used to represent the system software information of the first version; An extracting unit, configured to extract block mapping information according to the flashing image file, where the block mapping information includes the file identifier of the first file, the start address information and the end address information of the data block for storing the first file, and the first file is the file obtained after the flashing image file is mounted; A generation unit, configured to obtain target configuration information according to a target OTA package, where the target OTA package is used to represent system software information of a second version, and the target configuration information includes file signature path information and first permission configuration information, and the first permission configuration information includes a file identifier of a second file and permission configuration information of the second file; A deletion unit, configured to delete file information of a target file in the first permission configuration information to obtain second permission configuration information, where the file identifier of the target file is included in the file identifier of the second file and not included in the file identifier of the first file; or, An addition unit, configured to add file information of a target file to the first permission configuration information to obtain second permission configuration information, where the file identifier of the target file is included in the file identifier of the first file and not included in the file identifier of the second file; The generation unit is further configured to generate the original OTA package according to the file identifier of the first file, the start address information, the end address information, the file signature path information, and the second permission configuration information.

6. An apparatus for generating an original OTA package, characterized in that It includes a processor, a memory, and a communication interface, where the processor, the memory, and the communication interface are interconnected. Among them, the communication interface is used to receive and send data, the memory is used to store program codes, and the processor is used to call the program codes to execute the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and device for generating OTA central package

    CN106569843A

  • Method and device for generating upgrade package

    CN109426515A