A patch processing method and system of a software package, an electronic device and a storage medium
By identifying patch objects and constructing address indexes within embedded software packages, and then reconstructing the software packages using patch data packets, the problem of low patch processing efficiency in existing technologies is solved, achieving more efficient patch processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ROLLING WIRELESS SARL
- Filing Date
- 2026-03-13
- Publication Date
- 2026-06-12
AI Technical Summary
In the existing technology, the patching process for embedded software packages is inefficient, requiring the entire package to be recompiled, which results in excessive time consumption.
By identifying the patch objects in the software package, constructing address indexes and mapping relationships, and reconstructing the software package using patch data packages, precise patching of the patch objects can be achieved.
It improves the efficiency of patch processing for software packages, reduces the time required to recompile packages, and increases overall processing efficiency.
Smart Images

Figure CN122195486A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and more specifically, to a method, system, electronic device, and storage medium for patching software packages. Background Technology
[0002] Currently, when any object in an embedded software package needs patching, the entire package often needs to be recompiled to obtain a new package. Because recompiling the entire package is time-consuming, it results in inefficient patching processes. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a method, system, electronic device, and storage medium for patching software packages, in order to solve the problem of low efficiency in patching software packages in the prior art.
[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0005] The first aspect illustrates a method for patching a software package, the method comprising:
[0006] Determine the patch objects in the currently input software package based on business requirements;
[0007] Construct a corresponding address index based on the basic information of the patch object;
[0008] Obtain the patch data package corresponding to the patch object, and construct a mapping relationship between the address of the patch data package and the address index of the patch object;
[0009] Based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, the software package is reconstructed to obtain the repaired software package.
[0010] Optionally, the patch objects in the currently input software package can be determined based on business requirements, including:
[0011] The business requirements and the currently input software package are input into a preset processing model. Based on the preset processing model, it is determined whether there are any objects that need to be patched.
[0012] If it exists, the object in the software package that needs to be patched will be used as the patch object.
[0013] Optionally, a corresponding address index is constructed based on the basic information of the patch object, including:
[0014] Obtain the basic information corresponding to the patch object from the software package, the basic information including the object name and object number;
[0015] Based on the object name, the patch object is processed using dot fractions to obtain the initial address index;
[0016] The address index of the patch object is obtained by combining the initial address index and the object number.
[0017] Optionally, the software package is reconstructed based on the address index of the patch object, the mapping relationship between the address of the patch data package and the address index of the patch object, and the patch data package to obtain a repaired software package, including:
[0018] The software package is split into sub-units according to its hierarchical structure;
[0019] The content of the patch object at the corresponding position in the sub-unit is determined based on the address index of the patch object;
[0020] Based on the mapping relationship between the address of the patch data package and the address index of the patch object, the patch data package is invoked to reconstruct the content of the patch object, thereby obtaining the repaired software package.
[0021] Optionally, the software package is reconstructed based on the address index of the patch object, the mapping relationship between the address of the patch data package and the address index of the patch object, and the patch data package to obtain a repaired software package, including:
[0022] The software package is parsed to obtain the current object;
[0023] If the current object is determined to be an object that needs to be patched based on the address index, the patch data package is invoked to reconstruct the content of the patch object based on the mapping relationship between the address of the patch data package and the address index of the patch object, so as to obtain the patched software package.
[0024] Optional, also includes:
[0025] If the address index determines that the current object does not require patching, return to the step of parsing the software package to obtain the current object.
[0026] Optional, also includes:
[0027] If the file format of the patch object is determined to be the first format, the processing operation corresponding to the first format is executed to re-examine the patched software package;
[0028] If the file format of the patch object is determined to be the second format, the processing operation corresponding to the second format is executed to re-sign the patched software package.
[0029] The second aspect illustrates a patch processing system for software packages, the system comprising:
[0030] The determination unit is used to determine the patch objects in the currently input software package based on business requirements;
[0031] The construction unit is used to construct a corresponding address index based on the basic information of the patch object;
[0032] The acquisition unit is used to acquire the patch data package corresponding to the patch object and construct a mapping relationship between the address of the patch data package and the address index of the patch object;
[0033] The patch processing unit is used to reconstruct the software package based on the address index of the patch object, the mapping relationship between the address of the patch data package and the address index of the patch object, and the patch data package, to obtain the patched software package.
[0034] The third aspect discloses an electronic device including a processor and a memory, the memory being used to store program code and data for data generation, and the processor being used to invoke program instructions in the memory to execute a patching method for a software package as described in any of the first aspects.
[0035] The fourth aspect discloses a storage medium including a stored program, wherein, when the program is executed, it controls the device on which the storage medium resides to perform a patching method for a software package as described in any of the first aspects.
[0036] Based on the above embodiments of the present invention, a method, system, electronic device, and storage medium for patching software packages are provided. The method includes: determining whether a currently input software package needs patching based on business requirements; if so, determining the corresponding patch object; then constructing a corresponding address index based on the basic information of the patch object to ensure the uniqueness and understandability of addressing; reconstructing the software package based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet to obtain a patched software package. By establishing the patch object and its corresponding address index, the content of the patch data packet and the patch object is replaced by the address index to reconstruct the software package, thereby improving the patching efficiency of the software package. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0038] Figure 1 This is a schematic diagram of the hierarchical structure of the software package shown in an embodiment of the present invention;
[0039] Figure 2 This is a schematic flowchart illustrating a patching method for a software package according to an embodiment of the present invention;
[0040] Figure 3 This is a schematic diagram illustrating the structure of a software package patching system according to an embodiment of the present invention. Detailed Implementation
[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0043] It should be noted that the descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0044] In this application, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0045] It should be noted that the software package shown in this application is an embedded software package, which includes the following hierarchical structure;
[0046] The first level (level 1) includes software packages;
[0047] The second level, level 2, includes components;
[0048] The third level (level 3) includes the application object, image;
[0049] Level 4 includes the compressed read-only file system object SquashFS image, the unsorted block image object (UBI), the configuration data object CfgData, and the multi-carrier data object MulCarrier;
[0050] Level 5 includes data objects (Non-Volatile, NV), (embbed filesystem, EFS) file objects, carrier objects, and UBI volume objects for split-volume burning.
[0051] Level 6 includes the Carrier NV data object, the Carrier EFS embedded file object, and the squafs subsystem file object.
[0052] It should be noted that the objects are contained sequentially from lowest to highest level. That is, objects in level 1 contain objects in level 2, objects in level 2 contain objects in level 3, objects in level 3 contain objects in level 4, objects in level 4 contain objects in level 5, and objects in level 5 contain objects in level 6, and so on. Figure 1 As shown.
[0053] The package contains multiple components, and the collection of these components includes signature and verification.
[0054] A component contains multiple application objects, and the collection of these objects includes signatures and verifications.
[0055] The application object image contains various data format files and various configuration data files. Each image object contains a signature and verification.
[0056] A compressed read-only file system object, SquashFS image, containing multiple carrier objects and a subdirectory structure.
[0057] Unsorted Block Images (UBI) contain multiple unsorted block image volumes (ubivolume), each of which is an independent compressed read-only file system object (SquashFS image).
[0058] The configuration data object (CfgData) contains multiple NVs and EFSs.
[0059] A multi-carrier data object (MulCarrier) contains multiple carriers.
[0060] The carrier object contains multiple carrier nv and carrier efs.
[0061] Each Ubi volume object is an independent compressed read-only file system object, SquashFS image, which can be expanded into a directory structure.
[0062] In the embodiments of this application, it can be seen from the software package structure shown above that there are different levels of structure, that is, objects that can implement patch objects.
[0063] It should be noted that unpatched objects, such as file header identifiers, are not in the list and do not need to be patched.
[0064] It should be noted that objects at different levels can all be patch objects;
[0065] As shown in Table (1), the patch objects are named in a dotted-fractional manner by object number or object name respectively:
[0066]
[0067] As shown in Table (1), using object names is very direct and easy for users to understand, but it is not easy to distinguish when there are objects with the same name. Compared with using object numbers, it is very easy to ensure unique addressing, but it is not easy to understand. Therefore, in practical applications, the object number and object name are combined. That is to say, the naming method of patch objects in this application is to add a number to the patch object name, such as: APPL1.SYST.UBI.rootfs.file1.
[0068] Based on the software package shown above, the specific process of implementing the software package patching method is as follows: Figure 2 As shown, the method includes:
[0069] Step S201: Determine the patch objects in the currently input software package based on business requirements.
[0070] It should be noted that the specific implementation of step S201 includes the following steps.
[0071] Step S11: Input the business requirements and the currently input software package into the preset processing model. Based on the preset processing model, determine whether there are any objects that need to be patched. If there are, proceed to step S12; otherwise, output a prompt.
[0072] Step S12: Select the objects in the software package that need to be patched as patch objects.
[0073] In the specific implementation of steps S11 and S12, the user selects or uploads the original software package and the corresponding business requirements through their own client.
[0074] Next, the processor receives the business requirements and software packages sent by the client, and inputs the business requirements and software packages into a preset processing model to determine whether the software packages can meet the corresponding business requirements. If the business requirements are not met, the structure that does not meet the business requirements, i.e., the object, is identified and used as a patch object.
[0075] It should be noted that the patch object can be a component in the input software package, an application object, an application object volume, an application object subfile, a user configuration nv, a user configuration efs, an application configuration nv, an application configuration efs, a carrier set nv, and a carrier set efs, etc.
[0076] Component patches, where a component is used as a patch object, can contain one or more application objects and their signatures, and are released by a specific business group. They can be patched individually.
[0077] Application object patches, or patch objects for application objects, are file-level objects that can be files in formats such as UBI, SQUASHFS, ANDRIOD, CONF, MCFG, and ELF, along with their signatures. They can be patched individually. For UBI, SQUASHFS, ANDRIOD, etc., they can be further broken down into directory-structured file systems for lower-level patching.
[0078] UBI volume object patching refers to using a UBI volume as the patch object: UBI contains multiple volumes, each of which is an independent SQUASHFS file and signature. Patches can be applied individually or to subfiles of the SQUASHFS file system.
[0079] SQUASHFS file system subfile patches (belonging to the application object) are SQUASHFS file system subfiles used as patch objects. They contain CARRIER or other ELF format files and signatures, and can be patched individually or extracted to the NV and EFS level for patching.
[0080] User configuration and application configuration patches (belonging to application objects): are CONF format files, unsigned, with only verification. They can be patched individually or extracted to NV and EFS level patches.
[0081] NV and EFS patches: These are read-only contents at a specific address in a file. When patching, the NV or EFS address (similar to a function address) needs to be calculated. They can be patched separately.
[0082] Step S202: Construct the corresponding address index based on the basic information of the patch object.
[0083] It should be noted that the specific implementation of step S202 includes the following steps.
[0084] Step S21: Obtain the basic information corresponding to the patch object from the software package.
[0085] It should be noted that the basic information includes the object name, object number, and original address, etc.
[0086] Optionally, although the package itself does not contain a number, for the convenience of patching, after the package is generated, a new set of numbers or addresses is recalculated based on the position and sequence number of each object in the package, and this is used as the object number. In other words, the object number of each object in the package is fixed.
[0087] It should be noted that the process of recalculating a set of numbers or addresses based on the position and sequence number of each object in the software package is as follows: call the preset model to process the position and sequence number of the object to generate the corresponding number or address.
[0088] The preset model is trained in advance based on the location of different objects, their sequential number in the software package, and preset numbers or addresses.
[0089] Step S22: Perform dot fraction processing on the patch object based on the object name to obtain the initial address index;
[0090] In the specific implementation step S22, the object name is obtained, and a dot is used as a separator to divide the different hierarchical structure of the object name to obtain the initial address index.
[0091] For example, if the object name of a component is packageQcomponent1, then after step S12, the initial address index obtained is packageQ.component1;
[0092] Step S23: Based on the initial address index and the object number, obtain the address index of the patch object;
[0093] In the specific implementation step S23, the corresponding object number is added to the initial address index to obtain the address index of the patch object;
[0094] For example: if the initial address index is APPL.SYST.UBI.rootfs.file1, add the corresponding object number to the initial address index to get APPL1.SYST.UBI.rootfs.file1.
[0095] Step S203: Obtain the patch data package corresponding to the patch object, and construct a mapping relationship between the address of the patch data package and the address index of the patch object;
[0096] In the specific implementation of step S203, the user needs to upload the patch data package through the client; then, the processor obtains the storage size of different storage areas in the database, stores the patch data package in the storage area with the smallest storage, and obtains the address corresponding to the patch data package; then, it constructs a mapping relationship between the address of the patch data package and the address index of the patch object;
[0097] For example: the patch object is a carrier set nv, and the corresponding patch data packet can be a new carrier set; its corresponding address is nv: new_nv1.bin, and the address index BOOT of the patch object is constructed to be equal to the address of the patch data packet new_boot.cwe.
[0098] Optionally, a signing private key for the package can also be set.
[0099] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be a component, that is, when the component is patched, the corresponding patch data package is the new component package new_boot.cwe, and the correspondence between the address index BOOT of the patch object and the address of the patch data package new_boot.cwe is constructed, as shown in Table (2).
[0100] Table (2):
[0101]
[0102] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be an application object, that is, when the application object is patched, the corresponding patch data package is the new application object package new_BootLoader.cwe, and the correspondence between the address index of the patch object BOOT.BootLoader and the address of the patch data package new_BootLoader.cwe is constructed, as shown in Table (3).
[0103] Table (3):
[0104]
[0105] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be an application object volume, that is, when the application object volume is patched, the corresponding patch data package is the new application object package new_volume1.img, and the correspondence between the address index APPL.SYST.UBI.Volume1 of the patch object and the address of the patch data package new_volume1.img is constructed, as shown in Table (4).
[0106] Table (4):
[0107]
[0108] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be an application object subfile, that is, when the application object subfile is patched, the corresponding patch data package is the new application object package new_file1.tsk, and the correspondence between the address index APPL.SYST.UBI.Volume1.file1 of the patch object and the address of the patch data package new_file1.tsk is constructed, as shown in Table (5).
[0109] Table (5):
[0110]
[0111] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be the user-configured efs, that is, when the user-configured efs patch is applied, the corresponding patch data package is the new user-configured efs: new_efs1.bin, and the correspondence between the address index CONF.CusCfg.CfgData.EFS1 of the patch object and the address of the patch data package new_efs1.bin is constructed, as shown in Table (6).
[0112] Table (6):
[0113]
[0114] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be application configuration nv, that is, when the application configuration nv is patched, the corresponding patch data package is the new application configuration nv: new_nv1.bin, and the correspondence between the address index CONF.AppCfg.CfgData.NV1 of the patch object and the address of the patch data package new_efs1.bin is constructed, as shown in Table (7).
[0115] Table (7):
[0116]
[0117] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be application configuration nv, that is, when the application configuration nv is patched, the corresponding patch data package is the new application configuration efs: new_efs1.bin, and the correspondence between the address index CONF.AppCfg.CfgData.NV1 of the patch object and the address of the patch data package new_nv1.bin is constructed, as shown in Table (8).
[0118] Table (8):
[0119]
[0120] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be carrier set nv, that is, when the carrier set nv is patched, the corresponding patch data packet is the new carrier set nv: new_nv1.bin, and the correspondence between the address index CONF.CarrierCfg.MulCarrier.CMCC.NV1 of the patch object and the address of the patch data packet new_nv1.bin is constructed, as shown in Table (9).
[0121] Table (9):
[0122]
[0123] For example, based on the process from step S201 to step S203, if the input original package is Original_package.spk, and if the patch object is determined to be the carrier set efs, that is, when the carrier set efs is patched, the corresponding patch data packet is the new carrier set efs: new_efs1.bin, and the correspondence between the address index CONF.CarrierCfg.MulCarrier.CMCC.EFS1 of the patch object and the address of the patch data packet new_efs1.bin is constructed, as shown in Table (10).
[0124] Table (10):
[0125]
[0126] Step S204: Based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, the software package is reconstructed to obtain the repaired software package.
[0127] It should be noted that there are multiple ways to implement step S204.
[0128] One implementation method includes the following steps.
[0129] Step S31: Decompose the software package into sub-units according to the hierarchical structure of the software package.
[0130] It should be noted that a sub-unit is the smallest patch granularity in each hierarchical structure, i.e., the smallest unit.
[0131] For example, the smallest unit of the first level is the software package, the smallest unit of the second level is the component, the smallest unit of the third level is the application object, the smallest unit of the fourth level is the application object volume, application object subfile, configuration data object, and multi-carrier data object, and the smallest unit of the fifth level is the data object, file object, and carrier object.
[0132] In the specific implementation step S31, the software package is split into layers according to the hierarchical structure from smallest to largest. Specifically, the first-level software package is parsed first to determine the components contained in the software package. Then, each second-level component is parsed to determine the user object under each component. The third-level user object is parsed to determine the object of the next level, and so on, until each level of the software package is determined and parsed to obtain the smallest patch granularity, i.e., the sub-unit.
[0133] Step S32: Determine the content of the patch object at the corresponding position in the sub-unit based on the address index of the patch object;
[0134] In the specific implementation step S32, each sub-unit is traversed according to the address index of the patch object to determine the sub-unit corresponding to the address. The content of the sub-unit can be called the content of the patch object.
[0135] Step S33: Based on the mapping relationship between the address of the patch data package and the address index of the patch object, the patch data package is invoked to reconstruct the content of the patch object, thereby obtaining the repaired software package.
[0136] In the specific implementation step S33, the patch data package is called to replace the content of the patch object at the corresponding position in the software package based on the mapping relationship between the address of the patch data package and the address index of the patch object. At the same time, other objects that have not been changed need to retain their original attributes. Then the software package is reorganized to reconstruct the software package and obtain the repaired software package.
[0137] Optionally, after replacing the content of the patch object at the corresponding location in the software package by calling the patch data package based on the mapping relationship between the address of the patch data package and the address index of the patch object, the method further includes:
[0138] Use the private key constructed above to sign the patched content.
[0139] Optionally, the new storage space in the software package needs to be recalculated.
[0140] Specifically, if the file format of the patch object that has not been patched is ELF, it needs to be patched in 1KB units. After patching, it is then signed. The size of the package file after signing is the final storage size, i.e., the new storage space.
[0141] If the file format of the patch object that is not yet complete is CWE format, no completion is required. In this case, the patch can be signed directly, and the final storage size of the signed package file can be obtained, which is the new storage space.
[0142] In this embodiment of the invention, the software package is directly split into the smallest patch granularity according to all hierarchical structures, and then the corresponding patch data package is used to perform patching and reorganization to reconstruct the software package and obtain the repaired software package; the software package is parsed by splitting it completely.
[0143] Another implementation method includes the following steps.
[0144] Step S41: Parse the software package to obtain the current object.
[0145] In the specific implementation of step S41, multi-level parsing is performed according to the number of hierarchical structures. If it is the first parsing, the components in the software package are parsed and step S42 is executed. If it is the second parsing, the application objects in each component are parsed and step S42 is executed. If it is the third parsing, the application objects in each component are parsed and step S42 is executed. If it is the fourth parsing, the UBI volume object, Unsorted Block Images (UBI), compressed read-only file system object SquashFS image, configuration data object CfgData, or multi-carrier data object MulCarrier in the application object are parsed and step S42 is executed. If it is the fifth parsing, the data object (Non-Volatile, NV), (embbed filesystem, EFS) file object, carrier object, and / or multi-volume burning UBI volume object are parsed and step S42 is executed.
[0146] Step S42: Determine whether the current object is an object that needs to be patched based on the address index. If yes, proceed to step S43; otherwise, return to step S41 to continue parsing the software package.
[0147] In the specific implementation of step S42, if it is the first time parsing, the parsed object, i.e. the current object, can only be a component. At this time, it is determined whether the address index is consistent with the address of the component. If they are consistent, it means that the component contains a patch, i.e. the component needs a patch, and step S43 is executed. Otherwise, step S41 is executed.
[0148] If it is the second parsing, then the parsed object, i.e. the current object, can only be the application object image. At this time, it is determined whether the address index is consistent with the address of the application object. If they are consistent, it means that the application object contains a patch, i.e. the application object needs a patch, and step S43 is executed. Otherwise, step S41 is executed.
[0149] If this is the third parsing, the parsed object, i.e., the current object, can be a compressed read-only file system object (SquashFS image), an unsorted block image object (UBI), a configuration data object (CfgData), and / or a multi-carrier data object (MulCarrier). Next, it is determined whether the address index matches the address of the unsorted block image object (UBI). If they match, it indicates that the unsorted block image object (UBI) contains a patch, meaning it needs a patch, and step S43 is executed. Otherwise, it is determined whether the address index matches the address of the compressed read-only file system object (SquashFS image). If they match, it indicates that the compressed read-only file system object (SquashFS image) contains a patch, meaning it needs a patch. If the image needs a patch, proceed to step S43; otherwise, determine whether the address index is consistent with the address of the configuration data object CfgData. If they are consistent, it means that the configuration data object CfgData contains a patch, i.e., the configuration data object CfgData needs a patch, and proceed to step S43; otherwise, proceed to step S41.
[0150] If this is the fourth parsing, then the parsed object, i.e., the current object, can be a data object (Non-Volatile, NV), an (embbed filesystem, EFS) file object, a carrier object, and / or a multi-volume UBI program. Next, it is determined whether the address index is consistent with the address of the data object NV. If they are consistent, it means that the data object NV contains a patch, i.e., the data object NV needs a patch, and step S43 is executed. Otherwise, it is determined whether the address index is consistent with the address of the data object NV. If they are consistent, it means that the data object NV contains a patch, i.e., the data object NV needs a patch, and step S43 is executed. Otherwise, it is determined whether the address index is consistent with the address of the EFS file object. If they are consistent, it means that the EFS file object contains a patch, i.e., the EFS file object needs a patch, and step S43 is executed. Otherwise, it is determined whether the address index is consistent with the address of the carrier object. If they are consistent, it means that the carrier object contains a patch, i.e., the carrier object needs a patch, and step S43 is executed. Otherwise, step S41 is executed.
[0151] If this is the fifth parsing, the parsed object, i.e., the current object, can be a Carrier NV data object, a Carrier EFS file object, a carrier object, and / or a squafs subsystem file object. Next, it is determined whether the address index matches the address of the Carrier NV data object. If they match, it indicates that the Carrier NV data object contains a patch, meaning the Carrier NV data object needs a patch, and step S43 is executed. Otherwise, it is determined whether the address index matches the address of the carrier object. If they match, it indicates that the carrier object contains a patch, meaning the carrier object needs a patch, and step S43 is executed. Otherwise, it is determined whether the address index matches the address of the squafs subsystem file object. If they match, it indicates that the squafs subsystem file object contains a patch, meaning the squafs subsystem file object needs a patch, and step S43 is executed. Otherwise, step S41 is executed.
[0152] Step S43: Based on the mapping relationship between the address of the patch data package and the address index of the patch object, the patch data package is invoked to reconstruct the content of the patch object, thereby obtaining the repaired software package.
[0153] It should be noted that the specific implementation process of step S43 is the same as that of step S33 described above, and they can be referred to each other.
[0154] Optionally, after executing steps S33 and S43, the original verification and signature become invalid in the patched software package and need to be re-verified and re-signed, specifically including:
[0155] If the file format of the patch object is determined to be the first format, the processing operation corresponding to the first format is executed to re-examine the patched software package.
[0156] If the file format of the patch object is determined to be the second format, the processing operation corresponding to the second format is executed to re-sign the patched software package.
[0157] It should be noted that the first format can be a CONF file or a CWE file, and the second format is an ELF file.
[0158] Specifically, if the file format of the patch object is determined to be the first format, the corresponding processing operation is performed to verify the integrity of the patched software package; if the file format of the patch object is determined to be the second format, the processing operation corresponding to the second format is performed to call the preset private key signature to re-sign the patched software package.
[0159] In this embodiment of the application, only software packages that have been re-verified or re-signed can be downloaded and used normally; otherwise, the software package is considered an illegal software package.
[0160] In this embodiment of the invention, it is determined whether the currently input software package needs patching based on business requirements. If so, the corresponding patch object is identified. Then, a corresponding address index is constructed based on the basic information of the patch object to ensure the uniqueness and understandability of addressing. Based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, the software package is reconstructed to obtain the patched software package. By establishing the patch object and its corresponding address index, the content of the patch data packet and the patch object is replaced using the address index to reconstruct the software package, thereby achieving the patching of the software package.
[0161] Based on the software package patching method shown in the above embodiments of the present invention, correspondingly, the present invention also shows a software package patching system, such as... Figure 3 As shown, the system includes:
[0162] The determining unit 301 is used to determine the patch objects in the currently input software package according to business requirements;
[0163] Construction unit 302 is used to construct a corresponding address index based on the basic information of the patch object;
[0164] The acquisition unit 303 is used to acquire the patch data package corresponding to the patch object and construct a mapping relationship between the address of the patch data package and the address index of the patch object;
[0165] The patch processing unit 304 is used to reconstruct the software package based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, to obtain the patched software package.
[0166] Optionally, based on the patching system for the software package shown in the above embodiments of the present invention, the determining unit 301 is specifically used for:
[0167] The business requirements and the currently input software package are input into a preset processing model. Based on the preset processing model, it is determined whether there are any objects that need to be patched.
[0168] If it exists, the object in the software package that needs to be patched will be used as the patch object.
[0169] Optionally, based on the patching system for the software package shown in the above embodiments of the present invention, the construction unit 302 is specifically used for:
[0170] Obtain the basic information corresponding to the patch object from the software package;
[0171] Based on the object name, the patch object is processed using dot fractions to obtain the initial address index;
[0172] The address index of the patch object is obtained by combining the initial address index and the object number.
[0173] Optionally, based on the patching system for the software package shown in the above embodiments of the present invention, the patch processing unit 304 is specifically used for:
[0174] The software package is split into sub-units according to its hierarchical structure;
[0175] The content of the patch object at the corresponding position in the sub-unit is determined based on the address index of the patch object;
[0176] Based on the mapping relationship between the address of the patch data package and the address index of the patch object, the patch data package is invoked to reconstruct the content of the patch object, thereby obtaining the repaired software package.
[0177] Optionally, based on the patching system for the software package shown in the above embodiments of the present invention, the patch processing unit 304 is specifically used for:
[0178] The software package is parsed to obtain the current object;
[0179] If the current object is determined to be an object that needs to be patched based on the address index, the patch data package is invoked to reconstruct the content of the patch object based on the mapping relationship between the address of the patch data package and the address index of the patch object, so as to obtain the patched software package.
[0180] Optionally, based on the patching system for the software package shown in the above embodiments of the present invention, the patch processing unit 304 is further configured to:
[0181] If the file format of the patch object is determined to be the first format, the processing operation corresponding to the first format is executed to re-examine the patched software package;
[0182] If the file format of the patch object is determined to be the second format, the processing operation corresponding to the second format is executed to re-sign the patched software package.
[0183] This application provides an electronic device, which includes a processor and a memory. The memory is used to store patch code and data for a software package, and the processor is used to call program instructions in the memory to execute steps as shown in the software package patching method in the above embodiments.
[0184] This invention provides a storage medium, namely a computer-readable storage medium, which includes the electronic device provided in the above-described embodiments of this application. The electronic device is used to execute the patching method for the software package disclosed in the embodiments of this application.
[0185] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0186] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0187] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for patching software packages, characterized in that, The method includes: Determine the patch objects in the currently input software package based on business requirements; Construct a corresponding address index based on the basic information of the patch object; Obtain the patch data package corresponding to the patch object, and construct a mapping relationship between the address of the patch data package and the address index of the patch object; Based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, the software package is reconstructed to obtain the repaired software package.
2. The method according to claim 1, characterized in that, Based on business requirements, determine the patch objects in the currently input software package, including: The business requirements and the currently input software package are input into a preset processing model. Based on the preset processing model, it is determined whether there are any objects that need to be patched. If it exists, the object in the software package that needs to be patched will be used as the patch object.
3. The method according to claim 1, characterized in that, Based on the basic information of the patch object, a corresponding address index is constructed, including: Obtain the basic information corresponding to the patch object from the software package, the basic information including the object name and object number; Based on the object name, the patch object is processed using dot fractions to obtain the initial address index; The address index of the patch object is obtained by combining the initial address index and the object number.
4. The method according to claim 1, characterized in that, Based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, the software package is reconstructed to obtain a repaired software package, including: The software package is split into sub-units according to its hierarchical structure; The content of the patch object at the corresponding position in the sub-unit is determined based on the address index of the patch object; Based on the mapping relationship between the address of the patch data package and the address index of the patch object, the patch data package is invoked to reconstruct the content of the patch object, thereby obtaining the repaired software package.
5. The method according to claim 1, characterized in that, Based on the address index of the patch object, the mapping relationship between the address of the patch data packet and the address index of the patch object, and the patch data packet, the software package is reconstructed to obtain a repaired software package, including: The software package is parsed to obtain the current object; If the current object is determined to be an object that needs to be patched based on the address index, the patch data package is invoked to reconstruct the content of the patch object based on the mapping relationship between the address of the patch data package and the address index of the patch object, so as to obtain the patched software package.
6. The method according to claim 5, characterized in that, Also includes: If the address index determines that the current object does not require patching, return to the step of parsing the software package to obtain the current object.
7. The method according to claim 1, characterized in that, Also includes: If the file format of the patch object is determined to be the first format, the processing operation corresponding to the first format is executed to re-examine the patched software package; If the file format of the patch object is determined to be the second format, the processing operation corresponding to the second format is executed to re-sign the patched software package.
8. A patch processing system for software packages, characterized in that, The system includes: The determination unit is used to determine the patch objects in the currently input software package based on business requirements; The construction unit is used to construct a corresponding address index based on the basic information of the patch object; The acquisition unit is used to acquire the patch data package corresponding to the patch object and construct a mapping relationship between the address of the patch data package and the address index of the patch object; The patch processing unit is used to reconstruct the software package based on the address index of the patch object, the mapping relationship between the address of the patch data package and the address index of the patch object, and the patch data package, to obtain the patched software package.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory being used to store program code and data for data generation, and the processor being used to call program instructions in the memory to execute the patching method of the software package as described in any one of claims 1-7.
10. A storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to perform the patching method for the software package as described in any one of claims 1-7.