Upgrading processing method and device, electronic equipment and computer readable storage medium
By dividing the upgrade package into multiple upgrade groups whose total data is less than or equal to the preset threshold, and mapping these upgrade groups into the target memory, the problem of OTA upgrade cannot be achieved through memory mapping when the upgrade package exceeds 2GB, and memory mapping processing of upgrade packages for larger data volumes is realized.
Patent Information
- Application Number
- CN202510221528.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-06-20
AI Technical Summary
In the prior art, when the upgrade package exceeds 2GB of user space available in 32-bit systems, OTA upgrade cannot be achieved through memory mapping, affecting the user experience.
By dividing the pending upgrade package into multiple upgrade groups, each upgrade group has a total amount of data less than or equal to a preset threshold (such as 2GB), and mapping these upgrade groups into target memory to achieve the upgrade task.
It overcomes the defect of the traditional solution that the upgrade package cannot be mapped when the data volume is large, and solves the problem that the upgrade package cannot be upgraded through memory mapping when the upgrade package is large, ensuring that the device can still upgrade normally when the upgrade package is large.
Smart Images

Figure CN120179267A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of communication technologies, and in particular, to an upgrade processing method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] Currently, the upgrade of devices is mainly achieved through Over The Air (OTA) technology, that is, the upgrade package is downloaded to the local (such as a disk) through OTA technology, and then transferred to the virtual address space of the memory to implement device upgrade through the upgrade package in the virtual address space of the memory.
[0003] Among them, in order to improve the transmission efficiency and reduce the number of system calls during the transmission process, the memory mapping method is used to map the downloaded data to the memory to improve the efficiency of file I / O operations.
[0004] However, with the continuous increase of new functions, the volume of the upgrade package is also increasing continuously, which poses new requirements for the transmission of the upgrade package. For example, for a device with a 32-bit system, the limit of the virtual address space is 4GB. Among them, usually only 2GB (2^{31}-1) is available for the user space, that is, the maximum virtual address space that each process can use is 2GB. When the upgrade package exceeds 2GB, the upgrade package cannot be mapped to the memory through the process, and thus the OTA upgrade cannot be realized, affecting the user experience. Summary of the Invention
[0005] Embodiments of the present application provide an upgrade processing method, apparatus, electronic device, and computer-readable storage medium, which can implement the memory mapping processing of an upgrade package with a large amount of data and realize device upgrade based on memory mapping.
[0006] In a first aspect, an upgrade processing method is provided according to an embodiment of the present application. The method includes:
[0007] Determine an upgrade package to be processed, where the upgrade package to be processed includes at least one sub-upgrade file;
[0008] Divide the sub-upgrade files into at least one group to obtain at least one upgrade group, where the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold;
[0009] Group and map each sub-upgrade file to a target memory according to the upgrade group to execute an upgrade task through the mapped target memory.
[0010] In a second aspect, an upgrade processing apparatus is further provided according to an embodiment of the present application. The apparatus includes:
[0011] A determination module, configured to determine an upgrade package to be processed, where the upgrade package to be processed includes at least one sub-upgrade file;
[0012] A division module, configured to divide the sub-upgrade files into at least one group to obtain at least one upgrade group, where the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold;
[0013] A mapping module, configured to group and map each of the sub-upgrade files to a target memory according to the upgrade group, so as to execute an upgrade task through the mapped target memory.
[0014] Optionally, in some embodiments of the present application, the dividing the sub-upgrade files into at least one group to obtain at least one upgrade group includes:
[0015] Determining the number of files and the file size of the sub-upgrade files;
[0016] Dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, a preset quantity ratio, and the preset threshold.
[0017] Optionally, in some embodiments of the present application, the dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, a preset quantity ratio, and the preset threshold includes:
[0018] Determining the file offsets of each of the sub-upgrade files;
[0019] Dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, the file offsets, a preset quantity ratio, and the preset threshold.
[0020] Optionally, in some embodiments of the present application, the dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, the file offsets, a preset quantity ratio, and the preset threshold includes:
[0021] Dividing the sub-upgrade files into two upgrade groups according to the number of files, the file offsets, and the preset quantity ratio;
[0022] For each upgrade group, if the total amount of data corresponding to the file sizes of the sub-upgrade files in the upgrade group is greater than the preset threshold, then at least one sub-upgrade file in the upgrade group is continuously split into two upgrade groups according to the preset quantity ratio and the file offsets until the total amount of data corresponding to each upgrade group is less than or equal to the preset threshold, to obtain at least one upgrade group.
[0023] Optionally, in some embodiments of the present application, the upgrade package to be processed includes a target compressed upgrade package, and determining the file offsets of the sub-upgrade files includes:
[0024] Extracting the file offsets of the sub-upgrade files from the target directory of the target compressed upgrade package.
[0025] Optionally, in some embodiments of the present application, the target memory belongs to the device to be upgraded, and extracting the file offsets of the sub-upgrade files from the central directory of the target compressed upgrade package includes:
[0026] Extracting the end flag of the target directory area from the target compressed upgrade package;
[0027] Mapping the end flag of the target directory area to the target memory of the device to be upgraded;
[0028] Receiving the directory offset and directory size of the target directory returned by the device to be upgraded, where the directory offset and the directory size are determined by the device to be upgraded according to the end flag of the target directory area;
[0029] Mapping the target directory to the target memory according to the directory offset and the directory size;
[0030] Obtaining the file offsets returned by the device to be upgraded, where the file offsets are parsed by the device to be upgraded according to the file header information of the sub-upgrade files in the target directory.
[0031] Optionally, in some embodiments of the present application, mapping the sub-upgrade files to the target memory in groups according to the upgrade groups includes:
[0032] Creating target processes for each of the upgrade groups;
[0033] Mapping the sub-upgrade files of each upgrade group to the target memory according to the respective target processes.
[0034] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps in the above-mentioned upgrade processing method are implemented.
[0035] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned upgrade processing method are implemented.
[0036] Fifth aspect, embodiments of the present application further provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various alternative implementation manners described in the embodiments of the present application.
[0037] Embodiments of the present application determine an upgrade package to be processed. The upgrade package to be processed includes at least one sub-upgrade file. The sub-upgrade file is divided into at least one group to obtain at least one upgrade group. The total amount of data corresponding to each upgrade group is less than or equal to a preset threshold. Each sub-upgrade file is grouped and mapped to a target memory according to the upgrade group, so as to execute an upgrade task through the mapped target memory.
[0038] Among them, by dividing to obtain upgrade groups with a total data amount less than a preset threshold and grouping and mapping each upgrade group to the memory, the defect that the upgrade package cannot be mapped in the traditional solution due to a large amount of data is overcome, and the problem that the upgrade cannot be realized through memory mapping when the upgrade package is large is solved.
[0039] Among them, by grouping in the form of files, the integrity of the sub-upgrade files is avoided from being damaged, which is convenient for accessing each sub-upgrade file after mapping. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
[0041] Figure 1 is a schematic diagram of a scenario where a terminal device provided by an embodiment of the present application executes the upgrade processing method;
[0042] Figure 2 is a schematic flowchart of the upgrade processing method provided by an embodiment of the present application;
[0043] Figure 3 is a schematic diagram of the memory mapping process of a target compressed upgrade package provided by an embodiment of the present application;
[0044] Figure 4 is a schematic structural diagram of an upgrade processing device provided by an embodiment of the present application;
[0045] Figure 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] The technical solutions in the present application will be clearly and completely described below with reference to the accompanying drawings in the present application. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
[0047] The embodiments of the present application provide an upgrade processing method, device, electronic device, and computer-readable storage medium. Specifically, the embodiments of the present application provide an upgrade processing device applicable to an electronic device, which is used to implement memory mapping of an upgrade package with a large total amount of data, and further achieve the purpose of device upgrade based on memory mapping when the data volume of the upgrade package is large. Specifically, the electronic device includes a terminal device or a server. The terminal device includes, but is not limited to, devices such as mobile phones, TVs, air conditioners, refrigerators, and cars. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN, Content Delivery Network), and big data and artificial intelligence platforms. The server can be directly or indirectly connected through wired or wireless communication methods.
[0048] Please refer to Figure 1 , Figure 1 which is a schematic diagram of the scenario where the terminal device provided by the embodiments of the present application executes the upgrade processing method. Among them, the specific execution process of the terminal device executing the upgrade processing method is as follows:
[0049] The terminal device 10 determines an upgrade package to be processed. The upgrade package to be processed includes at least one sub-upgrade file. The terminal device 10 divides the sub-upgrade file into at least one group to obtain at least one upgrade group, where the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold. The terminal device 10 maps each sub-upgrade file to the target memory according to the upgrade group to execute the upgrade task through the mapped target memory.
[0050] For example, the terminal device 10 downloads the upgrade package to be processed from the server or the cloud through the over-the-air (OTA) technology. The data volume of the upgrade package to be processed is large (for example, the data volume is greater than the available user space of 2GB in a 32-bit system). Subsequently, each sub-upgrade file of the upgrade package to be processed is divided into multiple upgrade groups, and memory mapping of each sub-upgrade file is performed in units of upgrade groups.
[0051] In summary, in the embodiments of the present application, upgrade groups with a total data volume less than a preset threshold are obtained through partitioning, and each upgrade group is grouped and mapped to the memory, overcoming the defect in the traditional solution that upgrade package mapping cannot be performed when the data volume is large, and solving the problem that upgrading cannot be achieved through memory mapping when the upgrade package is large.
[0052] Among them, by grouping in the form of files, the integrity of the sub-upgrade files is avoided from being damaged, which is convenient for accessing each sub-upgrade file after mapping.
[0053] The following will be described in detail respectively. It should be noted that the description order of the following embodiments does not limit the priority order of the embodiments. Please refer to Figure 2 , Figure 2 which is a schematic flowchart of the upgrade processing method provided by the embodiments of the present application. Although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown in the flowchart.
[0054] Specifically, the process of the upgrade processing method specifically includes:
[0055] 101. Determine an upgrade package to be processed, where the upgrade package to be processed includes at least one sub-upgrade file.
[0056] Among them, the upgrade package to be processed is the upgrade package required for upgrading, and the upgrade package to be processed can be obtained by copying or downloading from the cloud. For example, the upgrade package to be processed can be downloaded from the server or the cloud through the Over The Air (OTA) technology.
[0057] Among them, the sub-upgrade file is a file that makes up the upgrade package to be processed, and the upgrade package to be processed is usually in the form of a compressed package.
[0058] 102. Divide the sub-upgrade files into at least one group to obtain at least one upgrade group, where the total data volume corresponding to each upgrade group is less than or equal to a preset threshold.
[0059] Among them, the preset threshold is the threshold referred to for grouping in the embodiments of the present application, that is, the goal of the embodiments of the present application is to group to obtain upgrade groups with a total data volume less than or equal to the preset threshold. Among them, the preset threshold is determined based on different systems or different scenarios. For example, for a 32-bit system, the preset threshold includes 2GB.
[0060] It can be understood that in the embodiments of the present application, it mainly aims at the situation where the data volume of the upgrade package to be processed is greater than the preset threshold. When the upgrade package to be processed is greater than the preset threshold, multiple upgrade groups with a total data volume less than or equal to the preset threshold are obtained through grouping, so that the sub-upgrade files of each upgrade group can be processed by memory mapping subsequently.
[0061] 103. Map each of the sub-upgrade files to the target memory according to the upgrade groups, so as to execute the upgrade task through the mapped target memory.
[0062] Among them, the sub-upgrade files of each upgrade group are grouped and mapped, satisfying the condition that the data volume during memory mapping is less than a preset threshold, which helps to map each sub-upgrade file into the memory. Among them, after the sub-upgrade file is mapped to the target memory, the sub-upgrade file can be accessed based on the target memory, and then the device can be upgraded.
[0063] In summary, in the embodiment of the present application, by dividing to obtain upgrade groups with a total data volume less than a preset threshold and grouping and mapping each upgrade group to the memory, the defect in the traditional solution that the upgrade package cannot be mapped when the data volume is large is overcome, and the problem that the upgrade cannot be achieved through memory mapping when the upgrade package is large is solved.
[0064] Among them, by grouping in the form of files, the integrity of the sub-upgrade files is avoided from being damaged, which is convenient for accessing each sub-upgrade file after mapping.
[0065] Among them, since the size limit of the virtual address space that each process can use for a 32-bit system is 2GB, and each upgrade group is limited within an effective range through a preset threshold, therefore, processes can be created respectively for each upgrade group, and memory mapping of the sub-upgrade files of each upgrade group can be performed through the process. That is, optionally, in some embodiments of the present application, the step of "mapping each of the sub-upgrade files to the target memory according to the upgrade groups" includes:
[0066] Create target processes for each of the upgrade groups;
[0067] Map the sub-upgrade files of each upgrade group to the target memory respectively according to the target processes.
[0068] For example, after each upgrade group is obtained based on the preset threshold condition of 2GB, by creating target processes for each upgrade group, the task of mapping the sub-upgrade files corresponding to the upgrade group to the memory can be executed through the target process. Among them, each process can be executed in parallel.
[0069] Among them, in the embodiment of the present application, the upgrade groups can be obtained by dividing based on the number of files and the file size of the sub-upgrade files. That is, optionally, in some embodiments of the present application, the step of "dividing the sub-upgrade files into at least one group to obtain at least one upgrade group" includes:
[0070] Determine the number of files and the file size of the sub-upgrade files;
[0071] Divide the sub-upgrade files into at least two upgrade groups according to the number of the files, the size of the files, a preset quantity ratio, and the preset threshold.
[0072] For example, after detecting that the data volume of the upgrade package to be processed is greater than the preset threshold, grouping can be performed according to the number of sub-upgrade files and the size of the files. For example, the multiple sub-upgrade files of the upgrade package to be processed are evenly divided into two upgrade groups in the way of equal division by the number of files. At the same time, determine whether the total data volume of each upgrade group exceeds the preset threshold through the size of each sub-upgrade file, so as to determine whether to further group.
[0073] Wherein, in order to facilitate the access to each sub-upgrade file, the file offset of each sub-upgrade file in the upgrade package to be processed can also be obtained, and the grouping of each sub-upgrade file is controlled based on the file offset. That is, optionally, in some embodiments of the present application, the step of "dividing the sub-upgrade files into at least two upgrade groups according to the number of the files, the size of the files, a preset quantity ratio, and the preset threshold" includes:
[0074] Determine the file offset of each sub-upgrade file;
[0075] Divide the sub-upgrade files into at least two upgrade groups according to the number of the files, the size of the files, the file offset, a preset quantity ratio, and the preset threshold.
[0076] Wherein, the file offset is a value used to locate a specific position of a file. For example, according to the file offsets of each sub-upgrade file, the context relationship between each sub-upgrade file can be determined. Grouping based on the file offset helps to obtain sub-upgrade files with continuous storage. For example, sub-upgrade file A, sub-upgrade file B, and sub-upgrade file C are continuously stored in the upgrade package to be processed. When analyzing based on the file offset, it is easier to obtain an upgrade group including sub-upgrade file A and sub-upgrade file B, or sub-upgrade file A, sub-upgrade file B, and sub-upgrade file C, rather than an upgrade group only including sub-upgrade file A and sub-upgrade file C. It helps to facilitate accessing sub-upgrade files based on the target memory after grouping mapping based on the upgrade group.
[0077] Correspondingly, in the process of obtaining the upgrade group by grouping, the division of the sub-upgrade files can be comprehensively considered in terms of the number of sub-upgrade files, the size of the files, the file offset, and the preset threshold. That is, optionally, in some embodiments of the present application, the step of "dividing the sub-upgrade files into at least two upgrade groups according to the number of the files, the size of the files, the file offset, a preset quantity ratio, and the preset threshold" includes:
[0078] Divide the sub-upgrade files into two upgrade groups according to the number of the files, the file offsets, and the preset quantity ratio;
[0079] For each of the upgrade groups, if the total data volume corresponding to the file sizes of the sub-upgrade files in the upgrade group is greater than the preset threshold, continue to split at least one sub-upgrade file in the upgrade group into two upgrade groups according to the preset quantity ratio and the file offsets until the total data volume corresponding to each upgrade group is less than or equal to the preset threshold, obtaining at least one upgrade group.
[0080] For example, assume there are n sub-upgrade files in the upgrade package to be processed, and divide them according to the following logic: first, evenly distribute n / 2 files to each group. If the file size of a certain group still exceeds 2GB, continue to divide this group and evenly distribute it again, and so on, ensuring that the total data size in each group does not exceed 2GB.
[0081] Correspondingly, after obtaining each upgrade group through division, the allocation information of each group can be stored in the mapping information set (mapping_information) so as to obtain the sub-upgrade files according to the mapping information set subsequently.
[0082] Taking the upgrade package to be processed as a compressed file as an example, the file offsets of each sub-upgrade file can be extracted from the central directory of the compressed file. That is, optionally, in some embodiments of the present application, the upgrade package to be processed includes a target compressed upgrade package, and the step of "determining the file offsets of each sub-upgrade file" includes:
[0083] Extract the file offsets of each sub-upgrade file from the target directory of the target compressed upgrade package.
[0084] Among them, the target directory includes the central directory. For example, obtain the central directory of the target compressed upgrade package, parse the file header information in the central directory, and record the file offsets and file sizes of each sub-upgrade file.
[0085] Taking the current device receiving the upgrade package to be processed and memory mapping it to the target memory of the device to be upgraded as an example, the specific process of grouping each sub-upgrade file includes:
[0086] Extract the end flag of the target directory area from the target compressed upgrade package;
[0087] Map the end flag of the target directory area to the target memory of the device to be upgraded;
[0088] Receive the directory offset and directory size for the target directory returned by the device to be upgraded, where the directory offset and the directory size are determined by the device to be upgraded according to the target directory area end flag;
[0089] Map the target directory to the target memory according to the directory offset and the directory size;
[0090] Obtain the file offset returned by the device to be upgraded, where the file offset is parsed by the device to be upgraded according to the file header information of each sub-upgrade file in the target directory.
[0091] Among them, the target directory area end flag includes the central directory area end flag (EOCDR), and the target compressed upgrade package includes a data storage area, a central directory area, and a central directory area end flag. Among them, the data storage area includes each sub-upgrade file (including file header information (local file header), file data (filedata), and data description information (datadescriptor)), please refer to Figure 3 , Figure 3 is a schematic diagram of the memory mapping process of the target compressed upgrade package provided by the embodiment of the present application. Specifically, the memory mapping process of the target compressed upgrade package includes:
[0092] 111. The current device obtains the central directory area end flag in the target compressed upgrade package;
[0093] 112. The current device maps the central directory area end flag to the target memory of the device to be upgraded;
[0094] 113. The device to be upgraded obtains the directory offset and directory size of the central directory according to the central directory area end flag, and returns the directory offset and the directory size to the current device;
[0095] 114. The current device maps the central directory to the target memory of the device to be upgraded according to the directory offset and the directory size;
[0096] 115. The device to be upgraded parses the central directory to obtain the file header information of each sub-upgrade file, records the file offset and file size of each sub-upgrade file from the file header information, and sends the file offset and the file size to the current device;
[0097] 116. The current device divides each sub-upgrade file into at least one upgrade group according to the file offset, file size, number of files, and a preset threshold;
[0098] 117. The current device creates target processes for each upgrade group, and maps each sub-upgrade file of each upgrade group to the target memory of the device to be upgraded through the respective target processes.
[0099] In summary, for the single memory mapping operation in the 32-bit system that does not support more than 2GB, the grouping mapping technology is adopted. Each upgrade group is independently mapped to the target memory, thus breaking through the limitation of the single address space. Through each target process, mapping is performed respectively based on the available address space corresponding to each, making full use of the available memory. At the same time, combined with the multi-process technology, the CPU resources are scheduled maximally, the overall processing capacity of the system is improved, and the mapping time is shortened. This solution can solve the problem that the OTA upgrade package cannot be upgraded when it exceeds 2GB.
[0100] To facilitate better implementation of the upgrade processing method of the present application, the present application also provides an upgrade processing device based on the above upgrade processing method. The meanings of the nouns are the same as those in the above upgrade processing method, and the specific implementation details can refer to the description in the method embodiments.
[0101] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of the upgrade processing device provided by the embodiment of the present application. The upgrade processing device can be specifically as follows:
[0102] A determination module 201, configured to determine an upgrade package to be processed, where the upgrade package to be processed includes at least one sub-upgrade file;
[0103] A division module 202, configured to divide the sub-upgrade files into at least one group to obtain at least one upgrade group, where the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold;
[0104] A mapping module 203, configured to map each sub-upgrade file to the target memory in groups according to the upgrade group, so as to execute an upgrade task through the mapped target memory.
[0105] Optionally, in some embodiments of the present application, the dividing the sub-upgrade files into at least one group to obtain at least one upgrade group includes:
[0106] Determining the number of files and the file size of the sub-upgrade files;
[0107] Dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, a preset quantity ratio, and the preset threshold.
[0108] Optionally, in some embodiments of the present application, the dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, a preset quantity ratio, and the preset threshold includes:
[0109] Determine the file offsets of each of the sub-upgrade files;
[0110] Divide the sub-upgrade files into at least two upgrade groups according to the number of files, the file sizes, the file offsets, the preset quantity ratio, and the preset threshold.
[0111] Optionally, in some embodiments of the present application, the dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file sizes, the file offsets, the preset quantity ratio, and the preset threshold includes:
[0112] Divide the sub-upgrade files into two upgrade groups according to the number of files, the file offsets, and the preset quantity ratio;
[0113] For each of the upgrade groups, if the total amount of data corresponding to the file sizes of the sub-upgrade files in the upgrade group is greater than the preset threshold, then continue to split at least one sub-upgrade file in the upgrade group into two upgrade groups according to the preset quantity ratio and the file offset until the total amount of data corresponding to each upgrade group is less than or equal to the preset threshold, to obtain at least one upgrade group.
[0114] Optionally, in some embodiments of the present application, the upgrade package to be processed includes a target compressed upgrade package, and the determining the file offsets of each of the sub-upgrade files includes:
[0115] Extract the file offsets of each of the sub-upgrade files from the target directory of the target compressed upgrade package.
[0116] Optionally, in some embodiments of the present application, the target memory belongs to the device to be upgraded, and the extracting the file offsets of each of the sub-upgrade files from the central directory of the target compressed upgrade package includes:
[0117] Extract the end flag of the target directory area from the target compressed upgrade package;
[0118] Map the end flag of the target directory area to the target memory of the device to be upgraded;
[0119] Receive the directory offset and directory size of the target directory returned by the device to be upgraded, where the directory offset and the directory size are determined by the device to be upgraded according to the end flag of the target directory area;
[0120] Map the target directory to the target memory according to the directory offset and the directory size;
[0121] Obtain the file offset returned by the device to be upgraded, where the file offset is parsed by the device to be upgraded according to the file header information of each sub-upgrade file in the target directory.
[0122] Optionally, in some embodiments of the present application, the mapping of each sub-upgrade file to the target memory according to the upgrade group includes:
[0123] Create a target process for each upgrade group;
[0124] According to each target process, map the sub-upgrade files of each upgrade group to the target memory respectively.
[0125] In the embodiment of the present application, the determination module 201 determines the upgrade package to be processed, where the upgrade package to be processed includes at least one sub-upgrade file. The division module 202 divides the sub-upgrade files into at least one group to obtain at least one upgrade group, where the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold. The mapping module 203 maps each sub-upgrade file to the target memory according to the upgrade group to execute the upgrade task through the mapped target memory.
[0126] Among them, in the embodiment of the present application, by dividing to obtain upgrade groups with a total amount of data less than the preset threshold and mapping each upgrade group to the memory in groups, it overcomes the defect in the traditional solution that the upgrade package cannot be mapped when the data volume is large, and solves the problem that the upgrade cannot be realized through memory mapping when the upgrade package is large.
[0127] Among them, by grouping in the form of files, the integrity of the sub-upgrade files is avoided from being damaged, which is convenient for accessing each sub-upgrade file after mapping.
[0128] In addition, the present application also provides an electronic device, as Figure 5 shown, which shows the structural schematic diagram of the electronic device involved in the present application. Specifically:
[0129] The electronic device may include a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, a power supply 303, an input unit 304 and other components. Those skilled in the art can understand that Figure 5 the structure of the electronic device shown in does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements. Among them:
[0130] The processor 301 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 302, and by invoking the data stored in the memory 302, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 301 either.
[0131] The memory 302 can be used to store software programs and modules. The processor 301 executes various functional applications and data processing by running the software programs and modules stored in the memory 302. The memory 302 mainly includes a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.); the data storage area can store the data created according to the use of the electronic device. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.
[0132] The electronic device further includes a power supply 303 for supplying power to each component. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 303 may also include any components such as one or more DC or AC power supplies, a recharge system, a power device debugging circuit, a power converter or inverter, and a power status indicator.
[0133] The electronic device may further include an input unit 304, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0134] Although not shown, the electronic device may further include a display unit, etc., which will not be elaborated here. Specifically, in this embodiment, the processor 301 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 302 according to the following instructions, and the processor 301 will run the application programs stored in the memory 302, so as to implement the steps in any one of the upgrade processing methods provided in the embodiments of the present application.
[0135] In an embodiment of the present application, a to-be-processed upgrade package is determined. The to-be-processed upgrade package includes at least one sub-upgrade file. The sub-upgrade file is divided into at least one group to obtain at least one upgrade group. Wherein, the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold. The sub-upgrade files are grouped and mapped to the target memory according to the upgrade group, so as to execute the upgrade task through the mapped target memory.
[0136] Among them, by dividing to obtain an upgrade group with a total amount of data less than the preset threshold and grouping and mapping each upgrade group to the memory, the defect that the upgrade package cannot be mapped when the data volume is large in the traditional solution is overcome, and the problem that the upgrade cannot be realized through memory mapping when the upgrade package is large is solved.
[0137] Among them, by grouping in the form of files, the integrity of the sub-upgrade files is avoided from being damaged, which is convenient for accessing each sub-upgrade file after mapping.
[0138] For the specific implementation of each of the above operations, reference may be made to the previous embodiments and will not be elaborated herein.
[0139] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0140] Therefore, the present application provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. The computer program can be loaded by a processor to execute the steps in any one of the upgrade processing methods provided by the present application.
[0141] For the specific implementation of each of the above operations, reference may be made to the previous embodiments and will not be elaborated herein.
[0142] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), a magnetic disk or an optical disc, etc.
[0143] Since the instructions stored in the computer-readable storage medium can execute the steps in any one of the upgrade processing methods provided by the present application, the beneficial effects that can be achieved by any one of the upgrade processing methods provided by the present application can be realized. For details, reference may be made to the previous embodiments and will not be elaborated herein.
[0144] The above has introduced in detail an upgrade processing method, device, electronic device, and computer-readable storage medium provided by the present application. Specific examples are used in this article to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. An upgrade processing method, characterized in that: The method comprises: Determine an upgrade package to be processed, wherein the upgrade package to be processed includes at least one sub-upgrade file; Dividing the sub-upgrade files into at least one group to obtain at least one upgrade group, wherein the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold; The sub-upgrade files are grouped and mapped to a target memory according to the upgrade group, so as to execute an upgrade task through the mapped target memory.
2. The upgrade processing method according to claim 1, characterized in that: The step of dividing the sub-upgrade files into at least one group to obtain at least one upgrade group includes: Determine the number and size of the sub-upgrade files; The sub-upgrade files are divided into at least two upgrade groups according to the number of files, the file size, a preset quantity ratio and the preset threshold.
3. The upgrade processing method according to claim 2, characterized in that: The dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, the preset number ratio and the preset threshold value includes: Determine the file offset of each sub-upgrade file; The sub-upgrade files are divided into at least two upgrade groups according to the number of files, the file size, the file offset, the preset quantity ratio and the preset threshold.
4. The upgrade processing method according to claim 3, characterized in that: The dividing the sub-upgrade files into at least two upgrade groups according to the number of files, the file size, the file offset, the preset number ratio and the preset threshold value includes: Dividing the sub-upgrade files into two upgrade groups according to the number of files, the file offset and the preset quantity ratio; For each of the upgrade groups, if the total amount of data corresponding to the file size of each sub-upgrade file of the upgrade group is greater than the preset threshold, then at least one sub-upgrade file in the upgrade group is further split into two upgrade groups according to the preset quantity ratio and the file offset, until the total amount of data corresponding to each upgrade group is less than or equal to the preset threshold, thereby obtaining at least one upgrade group.
5. The upgrade processing method according to claim 4, characterized in that: The upgrade package to be processed includes a target compressed upgrade package, and determining the file offset of each sub-upgrade file includes: The file offset of each sub-upgrade file is extracted from the target directory of the target compressed upgrade package.
6. The upgrade processing method according to claim 5, characterized in that: The target memory belongs to the device to be upgraded, and the file offset of each sub-upgrade file is extracted from the central directory of the target compressed upgrade package, including: Extracting the target directory area end mark from the target compressed upgrade package; Mapping the target directory area end identifier to the target memory of the device to be upgraded; Receiving a directory offset and a directory size for a target directory returned by the device to be upgraded, wherein the directory offset and the directory size are determined by the device to be upgraded according to an end mark of the target directory area; Mapping the target directory to the target memory according to the directory offset and the directory size; The file offset returned by the device to be upgraded is obtained, wherein the file offset is obtained by parsing the device to be upgraded according to the file header information of each sub-upgrade file in the target directory.
7. The upgrade processing method according to claim 1, characterized in that: Mapping each of the sub-upgrade files into groups to the target memory according to the upgrade group includes: Creating a target process for each of the upgrade groups; The sub-upgrade files of each upgrade group are mapped to the target memory according to each target process.
8. An upgrade processing device, characterized in that: The device comprises: A determination module, used to determine an upgrade package to be processed, wherein the upgrade package to be processed includes at least one sub-upgrade file; A division module, used to divide the sub-upgrade files into at least one group to obtain at least one upgrade group, wherein the total amount of data corresponding to each upgrade group is less than or equal to a preset threshold; A mapping module is used to map each of the sub-upgrade file groups to a target memory according to the upgrade group, so as to execute the upgrade task through the mapped target memory.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the upgrade processing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the upgrade processing method according to any one of claims 1 to 7 are implemented.