Program upgrading method and device, equipment and storage medium

During the terminal's file system upgrade process, data feature information comparison and parallel update technology are used to download inconsistent data blocks to the free memory area file cache partition, which solves the problem of time-consuming and high hardware cost of upgrading the terminal file system, and achieves efficient system upgrade and cost reduction.

CN120371370APending Publication Date: 2025-07-25NINGBO FOTILE KITCHEN WARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510259555.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-06
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In the prior art, a larger upgrade package is required to be downloaded when upgrading a terminal file system, which results in a long time and increases the hardware cost of the device.

Method used

By obtaining the characteristic information of the target data block and local data block corresponding to the upgrade instruction, comparing and downloading inconsistent data blocks to be updated to the free memory area file cache partition of the operating system, performing parallel updates to reduce upgrade time and reduce hardware costs.

Benefits of technology

Improve system upgrade efficiency, reduce upgrade time, and reduce equipment hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371370A_ABST
    Figure CN120371370A_ABST
Patent Text Reader

Abstract

The invention discloses a program upgrading method and device, equipment and a storage medium, and the method comprises the steps: obtaining respective first data feature information of a plurality of target data blocks and respective second data feature information corresponding to a plurality of local data blocks in response to an upgrading instruction for a first file system partition; comparing the first data feature information with the second data feature information to obtain a comparison result of each target data block; downloading the to-be-updated data blocks indicating that the first data feature information and the second data feature information are inconsistent in the comparison result to a file cache partition, wherein the available storage space of the file cache partition is smaller than the available storage space of the free memory area; and in response to the update trigger of the second file system partition, performing backup update on the second file system partition based on each target data block downloaded in the file cache partition, and by utilizing the scheme of the application, the program upgrade efficiency can be improved, and the equipment hardware cost can be effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of program upgrade, and particularly relates to a program upgrade method, device, equipment and storage medium. Background Art

[0002] In the prior art, when upgrading the file system of a terminal, it is necessary to download the upgrade program package to the data storage partition, and then rewrite the file system partition based on the upgrade package in the data storage partition. In the case of a large upgrade package, downloading the upgrade package and rewriting the file system partition will be time-consuming, and a large data storage space is required to store the upgrade package, increasing the hardware cost of the device. Summary of the Invention

[0003] This application provides a program upgrade method, device, equipment and storage medium, which can reduce the system upgrade time, improve the system upgrade efficiency, and effectively reduce the hardware cost of the device.

[0004] The technical solution of this application is as follows:

[0005] On the one hand, this application provides a system upgrade method, which is applied to a terminal including a first file system partition and a second file system partition, and the second file system partition is a backup of the first file system partition. The method includes:

[0006] In response to an upgrade instruction for the first file system partition, obtain the first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and the second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by splitting the upgrade program package corresponding to the upgrade instruction, the multiple local data blocks are obtained by splitting the original program package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence;

[0007] Compare the first data feature information of each target data block with the second data feature information of the local data block corresponding to the target data block to obtain a comparison result for each target data block;

[0008] Download the to-be-updated data blocks, for which the comparison result indicates that the first data feature information and the second data feature information are inconsistent, among the multiple target data blocks to a file cache partition, where the file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area;

[0009] Update the multiple local data blocks based on each of the target data blocks downloaded in the file cache partition to obtain a first update result;

[0010] If the first update result indicates successful update, in response to the update trigger of the second file system partition, perform a backup update on the second file system partition based on each of the target data blocks downloaded in the file cache partition.

[0011] On the other hand, the present application provides a program upgrade device, which is applied to a terminal including a first file system partition and a second file system partition, and the second file system partition is a backup of the first file system partition. The device includes:

[0012] A data feature information acquisition module, configured to, in response to an upgrade instruction for the first file system partition, acquire first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by splitting the upgrade program package corresponding to the upgrade instruction, the multiple local data blocks are obtained by splitting the original program package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence;

[0013] A comparison result determination module, configured to compare the first data feature information of each target data block with the second data feature information of the local data block corresponding to the target data block to obtain a comparison result for each target data block;

[0014] A first processing module, configured to download, to the file cache partition, the data blocks to be updated for which the comparison result indicates that the first data feature information and the second data feature information are inconsistent among the multiple target data blocks, where the file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area;

[0015] A first update result acquisition module, configured to update the multiple local data blocks based on each of the target data blocks downloaded in the file cache partition to obtain a first update result;

[0016] A second file system partition update module, configured to, if the first update result indicates successful update, in response to the update trigger of the second file system partition, perform a backup update on the second file system partition based on each of the target data blocks downloaded in the file cache partition.

[0017] On the other hand, a system upgrade device is provided. The device includes a processor and a memory. At least one instruction or at least one program segment is stored in the memory. The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the program upgrade method as described above.

[0018] On the other hand, a computer-readable storage medium is provided. At least one instruction or at least one program segment is stored in the storage medium. The at least one instruction or the at least one program segment is loaded and executed by a processor to implement the program upgrade method as described above.

[0019] The program upgrade method, device, equipment and storage medium provided by this application have the following technical effects:

[0020] Using the technical solution provided by this application, in the application scenario of upgrading the first file system partition of the operating system, first, in response to an upgrade instruction for the first file system partition, obtain the first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and the second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; compare the first data feature information of each target data block with the second data feature information of the local data block corresponding to the target data block to obtain the comparison result of each target data block; among the multiple target data blocks, download the data blocks to be updated whose comparison results indicate that the first data feature information and the second data feature information are inconsistent to the file cache partition. The file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area; then, in response to the update trigger of the second file system partition, perform backup update on the second file system partition based on the target data blocks downloaded in the file cache partition. Since only the target data blocks corresponding to the local data blocks to be updated among the multiple target data blocks need to be downloaded during the entire file system partition upgrade process, and the tasks are scheduled and executed in parallel, the program upgrade time can be reduced, the program upgrade efficiency can be improved, and the storage space of the data storage partition does not need to be occupied, which can effectively reduce the hardware cost of the device. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 is a flowchart of a program upgrade method provided by an embodiment of the present application;

[0023] Figure 2 It is a schematic diagram of the upgrade package data segmentation provided by an embodiment of the present application;

[0024] Figure 3 It is a schematic diagram of an operating system partition architecture provided by an embodiment of the present application;

[0025] Figure 4 It is a schematic diagram of the first file system partition block upgrade provided by an embodiment of the present application;

[0026] Figure 5 It is a schematic diagram of a program upgrade device provided by an embodiment of the present application;

[0027] Figure 6 It is a schematic diagram of the structure of a program upgrade device provided by an embodiment of the present application. Detailed implementation manners

[0028] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0030] The following introduces a system upgrade method provided by an embodiment of the present application, Figure 1 It is a flowchart of a system upgrade method provided by an embodiment of the present application. It should be noted that this specification provides method operation steps such as in the embodiment or flowchart, but based on routine or non-creative labor, it may include more or fewer operation steps. The step order listed in the embodiment is only one way among the execution orders of numerous steps, and does not represent the only execution order. When the actual system or product is executed, it can be executed in the order shown in the embodiment or the drawing or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing). Specifically, asFigure 1 As shown, the method is applied to a terminal including a first file system partition and a second file system partition, and the second file system partition is a backup of the first file system partition. The method may include:

[0031] S101, in response to an upgrade instruction for the first file system partition, obtain the first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and the second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by splitting the upgrade program package corresponding to the upgrade instruction, and the multiple local data blocks are obtained by splitting the original program package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence.

[0032] Specifically, the terminal may include entity devices such as smartphones, desktop computers, tablet computers, laptop computers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, intelligent voice interaction devices, intelligent home appliances, intelligent wearable devices, in-vehicle terminal devices, etc., or may also include software running on the entity devices, such as application programs, etc.

[0033] In the embodiments of this specification, the above operating system may be an operating system installed in a computer device, and the computer device may include, but is not limited to: mobile terminals, computer terminals, servers, or similar computing devices. The computer system may include: Microsoft Windows system, iOS system, Android system, and embedded systems, etc. Among them, the embedded system may include: Linux system, VxWorks system, uCOS system, FreeRTOS system, RTOS system, etc.

[0034] In a specific embodiment, as Figure 2 shown, the above operating system may include: U-boot partition, kernel partition, first file system partition, second file system partition, system private partition, data storage partition, etc. Among them, the U-boot partition is used to store the uboot image, and the uboot program is mainly responsible for starting the system kernel; the kernel partition is used to store the kernel image, including the system's driver programs, system configuration files, and network environment configurations, etc.; the first file system partition and the second file system partition are used to store the file system image, including some programs built into the system, third-party library files, etc.; the system private partition is used to store the variable data of the operating system; the data storage partition is used to store the data saved by the user.

[0035] It can be understood that in the prior art, the upgrade package is often stored in the data storage partition, that is, the available storage space of the data storage partition needs to be greater than the data volume of the upgrade package.

[0036] Specifically, the upgrade instruction can be an instruction for upgrading the first file system. Specifically, the root file system runs in the first file system partition, and the main application for operating interaction with the user is installed in the second file system partition. The user can initiate an upgrade instruction for the first file system partition through the main application.

[0037] In the embodiment of the present specification, the upgrade package is an image file corresponding to the new version of the first file system partition. Schematically, the file format of the upgrade package can be.img.

[0038] In a specific embodiment, before S101, it further includes:

[0039] In response to a data storage space query request sent by the remote server, send the available storage space of the file cache partition to the remote server, so that the remote server determines the preset storage space of each target data block based on the available storage space of the file cache partition, and performs data segmentation on the upgrade package based on the preset storage space of each target data block to obtain multiple target data blocks.

[0040] Specifically, establish a connection with the remote server, create a file cache partition, send a first file upgrade instruction to the remote server, in response to the data storage space query request sent by the remote server, query the available storage space of the file cache partition, and determine the preset storage space of each target data block based on the available storage space of the file cache partition, where the preset storage space of each target data block is less than or equal to the available storage space of the file cache partition. Based on the preset storage space of each target data block, perform data segmentation on the upgrade package according to the preset storage space to obtain multiple target data blocks, where the available storage spaces in the multiple target data blocks are the same. By providing the remote server with the available storage space information of the file cache partition, the remote server can determine the preset storage space of the target data block according to the actual available space, thereby improving the utilization rate of each storage space. Performing data segmentation on the upgrade package based on the preset storage space can improve the efficiency of the upgrade process, reduce the data transmission time, and speed up the upgrade speed, thereby enhancing the user experience.

[0041] Optionally, the preset storage space can take the value of, m can be an integer greater than or equal to 1. Schematically, m can take 2. Preferably, the preset storage space of the target upgrade block can take 1MB.

[0042] Schematically, such as Figure 3As shown, multiple target data blocks can be n target data blocks, respectively labeled as: SR1, SR2, …, SRn. In some embodiments, the available storage space of the target data blocks SR1 to SRn-1 is the preset storage space, SRn-1≥SRn, that is, the remote server starts from the starting position of the upgrade package, and takes the preset storage space as the available size of the data block, and evenly divides the upgrade package to obtain N-1 target data blocks SR1 to SRn-1 and SRn of the same size; In other embodiments, max{SR1, SR2, …, SRn} ≤ the preset storage space, that is, the remote server performs a random segmentation process on the upgrade package to obtain N target data blocks, where the data occupancy space of the largest target data block among the N target data blocks is less than or equal to the preset storage space.

[0043] S102, compare the first data feature information of each target data block with the second data feature information of the local data block corresponding to the target data block to obtain the comparison result of each target data block.

[0044] In one embodiment, the first data feature information and the second data feature information may include: data block identifier, data block size information, data block creation time, data block metadata, and data digest information. The data block identifier is a unique identifier corresponding to each data block, and the data block identifier is used to identify the location and identity of the data block in the operating system; the data block size information represents the storage space size occupied by the data block, the data block creation time is used to record the creation time or the last update time of the data block, the data block metadata includes the metadata information of the data block, such as data type, data format, data structure, and the data digest information is used to verify whether the data has been damaged or tampered with during transmission or storage.

[0045] Specifically, the first data feature information includes a target data block identifier and a target data digest information. The target data block identifier represents the block identifier of the target data block in the upgrade package, and the target data digest information is obtained by performing an encrypted hash operation based on the data content information and data length information of the target data block; the second data feature information includes a local data block identifier and a local data digest information. The local data block identifier represents the block identifier of the local data block in the first file system partition, and the local data digest information is obtained by performing an encrypted hash operation based on the data content information and data length information of the local data block.

[0046] Specifically, the chunk identifier refers to a unique identifier used to identify each block or segment when the upgrade package is split into target data chunks. During data processing, transmission, and storage, splitting the upgrade package into target data chunks can facilitate data management and operation, improving data processing efficiency. The chunk identifier can be a combination of numbers, letters, or symbols used to distinguish different data chunks. The target data chunk identifier and the local data chunk identifier represent the specific locations of the data in the upgrade package. By comparing the identifier information, corresponding data chunks can be quickly identified and matched, and data comparison and replacement operations can be accurately performed. The data digest information obtained through cryptographic hashing operations and the local data digest information ensure the security of the data content, can verify the integrity of the data, effectively guarantee the accuracy of the updated data, and thus improve the upgrade efficiency and accuracy.

[0047] Specifically, the data digest information corresponding to each target data chunk is generated by the remote server after performing data digest processing on each target data chunk based on a first preset encryption algorithm. Optionally, the first preset encryption algorithm here can be a hashing algorithm. Illustratively, the hashing algorithm can include, but is not limited to: HMAC-MD5 algorithm, HMAC-SHA1 algorithm, or HMAC-SHA256 algorithm, etc. The embodiments of the present application do not impose any restrictions on this.

[0048] Specifically, the data digest information corresponding to the local data chunk can represent the data fingerprint of the local data chunk to implement functions such as data signature and data integrity verification. Specifically, the data digest information corresponding to the local data chunk is generated by the computer device (update application) after performing data digest processing on the local data chunk based on a second preset encryption algorithm, where the second preset encryption algorithm is the same encryption algorithm as the above-mentioned first preset encryption algorithm.

[0049] S103, download the data chunks to be updated, for which the comparison result indicates that the first data feature information and the second data feature information are inconsistent, among the multiple target data chunks to the file cache partition. The file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area.

[0050] Specifically, after traversing the multiple target data chunks, determine the data chunks to be updated for which the target data chunks are inconsistent with the local data chunks, and create data processing tasks corresponding to the multiple download information based on the download information corresponding to each of the multiple data chunks to be updated. In an optional embodiment, the download information is a URL address.

[0051] In an optional embodiment, the above method may further include:

[0052] S201. Create data processing tasks corresponding to each data block to be updated. Each data processing task is executed within a data processing partition, and the data processing partition can execute data processing tasks within a preset parallel number.

[0053] Specifically, after determining each data block to be updated, create a data processing partition for processing each data processing task. In a possible implementation, the data processing partition is set on the operating system. In another possible implementation, the data processing partition is set on a remote server. Among them, the data processing partition can execute data processing tasks within a preset parallel number, and the preset parallel number is determined based on the hardware resources of the operating system, data calculation volume, task requirements, etc.

[0054] Schematically, the preset parallel number can be 5. The multiple target data blocks are SR1 to SRn respectively. Correspondingly, the multiple data processing tasks are: task1 corresponding to SR1, task2 corresponding to SR2,..., taskn corresponding to SRn. Take task1 to task5 as 5 target scheduling tasks and execute them in parallel. After any one of the tasks from task1 to task5 is completed, add task6 to the target scheduling tasks to obtain 5 updated target scheduling tasks (the unfinished tasks among task1 to task5 and task6), and continue to execute the 5 updated scheduling tasks in parallel, and so on..., until all n data processing tasks are completed. Among them, the task content of taskx (x = 1, 2,..., n) includes: based on the data identifier of the target data block SRx in the upgrade package, determine the local data block Rx corresponding to the target data block SRx from the first file system partition, read the data digest information of the target data block SR1, calculate the data digest information of the local data block SRx. If the two are equal, it means that the local data block Rx does not need to be updated, end taskx, and continue to execute the data processing task with the highest priority in the current waiting queue; if the two are not equal, it means that the original data block SRx needs to be updated, read the download address information of the target data block SRx and download the target data block SRx to the file cache partition. After the download is completed, flush the target data block SRx in the file cache partition to the original data block Rx in the first file system partition. After the flushing is completed, delete the target data block SRx file.

[0055] Specifically, the priority of the waiting sequence of the data processing tasks is sorted according to the response speed of the tasks, task processing time, task dependencies, task types, etc. to improve the execution speed of the data processing tasks.

[0056] Taking the above factors into comprehensive consideration, the priorities of data processing tasks can be determined and sorted. When scheduling the data processing task with the highest priority in the waiting queue for subsequent execution, the system can use these factors to guide the scheduling and execution order of tasks, ensuring that high-priority tasks are processed in a timely manner and improving the efficiency and performance of the system.

[0057] S203: With the preset parallel number as the upper limit of parallel tasks, schedule and execute each data processing task to download each data block to be updated to the file cache partition.

[0058] Specifically, when the number of data processing tasks is less than or equal to the preset parallel number, all data processing tasks are executed in parallel; when the number of data processing tasks is greater than the preset parallel number, the preset parallel number of data processing tasks are executed in parallel, and the remaining data processing tasks to be updated are stored in the data processing partition until all data processing tasks are completed.

[0059] In this way, the data processing partition has the ability to execute the preset parallel number of data processing tasks, can execute multiple data processing tasks in parallel simultaneously, improve the task execution efficiency, allocate tasks to the data processing partition and limit the number of parallel tasks, which can better manage system resources, ensure system stability and reliability, and improve the system upgrade efficiency.

[0060] Specifically, S203 further includes

[0061] S2031: If the number of each of the data processing tasks is greater than the preset parallel number, determine the preset parallel number of target processing tasks from each of the data processing tasks.

[0062] S2032: Execute each of the target processing tasks in parallel, and add the data processing tasks to be processed except the target processing tasks in each of the data processing tasks to the waiting queue.

[0063] S2033: After any one of the target processing tasks in each of the target processing tasks is completed, determine the data processing task with the highest priority in the waiting queue as the target processing task and schedule its execution, and loop this step until the waiting queue is emptied.

[0064] Schematically, the multiple data processing tasks are p data processing tasks, namely: task1 to taskp. The preset parallel quantity can be 5. Take task1 to task5 as 5 target processing tasks, execute task1 to task5 in parallel, add the tasks other than task1 to task5 to the waiting queue. After any one of the data tasks among task1 to task5 is completed, determine task6 as the target processing task, obtain 5 updated target processing tasks (the unfinished tasks among task1 to task5 and task6), continue to execute the 5 updated target processing tasks in parallel,..., until all p data processing tasks are completed.

[0065] Specifically, when the number of tasks in the multiple data processing tasks is greater than the preset parallel quantity, determine the preset parallel quantity of target scheduling tasks from the multiple data processing tasks, add the data processing tasks other than the preset parallel quantity of data processing tasks to be processed among the multiple data processing tasks to the waiting queue, then execute the preset parallel quantity of data processing tasks in parallel, and after any one of the target processing tasks among the preset parallel quantity of data processing tasks is completed, update the preset parallel quantity of target processing tasks based on the data processing task with the earliest sorting in the waiting queue, obtain the preset parallel quantity of updated target processing tasks, and then execute the preset parallel quantity of target processing tasks in parallel until the number of tasks in the waiting queue is zero. By the way of parallel scheduling and execution of data processing tasks, the program upgrade time can be reduced and the program upgrade efficiency can be improved.

[0066] Schematically, the upgrade package is divided into 10 target data blocks: SR1 to SR10. Correspondingly, the first file system partition is divided into 10 local data blocks: R1 corresponding to SR1, R2 corresponding to SR2, …, R10 corresponding to SR10. Among them, the data digest information of SR1 is inconsistent with that of R1, the data digest information of SR2 is inconsistent with that of R2, the data digest information of SR3 is inconsistent with that of R3, the data digest information of SR5 is inconsistent with that of R5, the data digest information of SR7 is inconsistent with that of R7, the data digest information of SR8 is inconsistent with that of R8, and the data digest information of SR9 is inconsistent with that of R9. Therefore, data update tasks corresponding to the target data blocks SR1, SR2, SR3, SR5, SR7, SR8, and SR9 are created, and these 7 data update tasks are scheduled and executed in parallel. Taking the preset parallel number as 5 as an example, the data update task 1 corresponding to SR1, the data update task 2 corresponding to SR2, the data update task 3 corresponding to SR3, the data update task 4 corresponding to SR4, and the data update task 5 corresponding to SR7 are executed in parallel. After any one of the data update tasks 1 to 5 is completed, the data update task 6 corresponding to SR8 is continued to be executed, and so on …, until all 7 data update tasks are completed. Among them, the task content of each data update task includes: reading the download address information of the corresponding target data block SRi and downloading the target data block SRi to the file cache partition. After the download is completed, the target data block SRi in the file cache partition is flushed to the original data block Ri in the first file system partition. After the flushing is completed, the target data block SRi file is deleted.

[0067] Specifically, the creation method of the file cache partition includes:

[0068] S301, obtaining the available storage space of the free memory area of the operating system.

[0069] Specifically, the memory usage of the operating system is monitored in real time through system monitoring tools such as htop, glances, etc. to obtain the available storage space of the free memory area of the operating system.

[0070] S303, using the available storage space with a preset ratio as the target storage space, and creating a file cache partition in the free memory area.

[0071] Specifically, based on the product of the preset ratio and the available storage space to determine the available storage space capacity of the target storage space, a file cache partition is created in the file free area and mounted on the / tmp directory. Accessing the / tmp directory can access the available storage space of the file cache partition. By creating the file cache partition, the I / O load is reduced, thereby improving the overall performance and response speed of the operating system.

[0072] Specifically, the preset ratio can be 20%, 30%, 50%, etc. In the usage scenarios of different operating systems, the preset ratio of the target storage space in the available storage space is different.

[0073] In an alternative embodiment of the specification, the method further includes:

[0074] S401, monitor the current occupancy rate of the file cache partition.

[0075] Specifically, the current occupancy rate is equal to the ratio value of the data volume of each target data block SRi in the storage space of the file cache partition.

[0076] In an alternative embodiment, based on the average occupancy rate of the data volume of a preset number of target data blocks SRi in the file cache partition, determine the current occupancy rate of the file cache partition.

[0077] S403, if the current occupancy rate is higher than the preset occupancy rate, expand the target storage space of the target cache partition based on the current available storage space in the free memory area.

[0078] Specifically, the preset occupancy rate can be 30%-80%. When the current occupancy rate is higher than the preset occupancy rate, re-obtain the current available storage space in the free memory area, re-define the target storage space of the target cache partition according to the current available storage space, so as to expand the target storage space of the target cache partition; when the current occupancy rate is lower than the preset occupancy rate, re-obtain the current available storage space in the free memory area, re-define the target storage space of the target cache partition according to the current available storage space, so as to reduce the target storage space of the target cache partition. Dynamically adjusting the target storage space of the target cache partition through the current occupancy rate can make greater use of the memory resources of the operating system, avoid performance degradation or program crashes caused by insufficient memory, and can also better balance the utilization of memory and storage space, avoiding resource waste and unnecessary memory occupation.

[0079] S104, update multiple local data blocks based on each downloaded target data block in the file cache partition to obtain a first update result.

[0080] Specifically, the first update result is used to indicate whether the first file system partition is updated successfully. Based on each downloaded target data block SRi in the file cache partition, update the corresponding local data block Ri of the target data block SRi, determine the data processing tasks corresponding to each target data block to be updated, and after all the data processing tasks are completed, determine that the target data block to be updated is written to the first file system partition to obtain the first update result.

[0081] S105. If the first update result indicates successful update, in response to the update trigger of the second file system partition, perform backup update on the second file system partition based on each target data block downloaded in the file cache partition.

[0082] Specifically, if the first update result indicates that the first file system partition is updated successfully, set an update flag bit in the system private partition. After the operating system restarts, based on the update flag bit, load the updated first file system partition. In response to the update trigger of the second file system partition, perform the update operation of the second file system partition in the first file system partition. If the first update result indicates that the first file system partition update fails, the operating system will not be able to set the update flag bit. After the operating system restarts, detect the situation where the first file system partition update fails according to a specific policy and perform corresponding processing to continue updating the first file system partition.

[0083] In a possible embodiment, roll back the first file system partition to the previous state, retry the update, display an error prompt message, etc., to ensure the integrity of the operating system data and avoid potential problems.

[0084] Specifically, repeat the update operation of the first file system partition to update the second file system partition to obtain a second update result. If the second file update result indicates success, the entire program update is successful.

[0085] As can be seen from the technical solutions provided in the embodiments of this specification above, in the application scenario of upgrading the first file system partition and the second file system partition of a terminal, first, in response to an upgrade instruction for the first file system partition, obtain the first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and the second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by splitting the upgrade program package corresponding to the upgrade instruction, the multiple local data blocks are obtained by splitting the original program package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence; compare the first data feature information of each target data block with the second data feature information of the local data block corresponding to the target data block to obtain the comparison result of each target data block; among the multiple target data blocks, download the data blocks to be updated whose comparison results indicate that the first data feature information and the second data feature information are inconsistent to the file cache partition, the file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area; update the multiple local data blocks based on the target data blocks downloaded in the file cache partition to obtain a first update result; if the first update result indicates successful update, in response to the update trigger of the second file system partition, perform backup update on the second file system partition based on the target data blocks downloaded in the file cache partition. Since only the target data blocks corresponding to the local data blocks to be updated among the multiple target data blocks need to be downloaded during the upgrade of the first file system partition / second file system partition, and the tasks are scheduled and executed in parallel, the upgrade time can be reduced and the upgrade efficiency can be improved. At the same time, since the upgrade program package is downloaded in chunks, there is no need to limit the storage space of the data storage partition, thereby effectively reducing the device hardware cost.

[0086] An embodiment of this application provides a system upgrade device, as Figure 5 shown. The device is applied to a terminal including a first file system partition and a second file system partition, and the second file system partition is a backup of the first file system partition. The device may include:

[0087] A data feature information acquisition module 510, configured to, in response to an upgrade instruction for the first file system partition, obtain the first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and the second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by splitting the upgrade program package corresponding to the upgrade instruction, the multiple local data blocks are obtained by splitting the original program package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence;

[0088] A comparison result determination module 520, configured to compare the first data feature information of each of the target data blocks with the second data feature information of the corresponding local data block of the target data block, to obtain a comparison result for each of the target data blocks;

[0089] A first processing module 530, configured to download, to a file cache partition, the data blocks to be updated among the multiple target data blocks, where the comparison result indicates that the first data feature information and the second data feature information are inconsistent. The file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area;

[0090] A first update result acquisition module 540, configured to update the multiple local data blocks based on the target data blocks downloaded in the file cache partition, to obtain a first update result;

[0091] A second file system partition update module 550, configured to, if the first update result indicates a successful update, in response to an update trigger of the second file system partition, perform a backup update on the second file system partition based on the target data blocks downloaded in the file cache partition.

[0092] In a specific embodiment, the above device may further include:

[0093] A data storage capacity query module, configured to, in response to a data storage capacity query request sent by a remote server, send the storable data volume of the data storage partition to the remote server, so that the remote server determines a first data volume based on the storable data volume, and divides the upgrade package based on the first data volume to obtain multiple target data blocks.

[0094] In a specific embodiment, the above first processing module 530 may include:

[0095] A data processing task creation unit, configured to create data processing tasks corresponding to the data blocks to be updated respectively; each of the data processing tasks is executed in a data processing partition, and the data processing partition can execute the data processing tasks within a preset parallel quantity;

[0096] A scheduling execution unit, configured to use the preset parallel quantity as the upper limit of parallel tasks, schedule and execute the data processing tasks, so as to download the data blocks to be updated to the file cache partition.

[0097] In a specific embodiment, the above scheduling execution unit may include:

[0098] A first determination subunit, configured to schedule and execute each of the data processing tasks with the preset parallel quantity as the upper limit of parallel tasks, so as to download each of the to-be-updated data blocks to the file cache partition;

[0099] A parallel execution subunit, configured to execute each of the target processing tasks in parallel, and add the to-be-processed data processing tasks other than the target processing tasks in each of the data processing tasks to a waiting queue;

[0100] A first processing subunit, configured to, after any one of the target processing tasks in each of the target processing tasks is executed, determine the to-be-processed data processing task with the earliest order in the waiting queue as a target processing task and schedule its execution, and loop this step until the waiting queue is emptied.

[0101] In an optional embodiment, the above device may further include:

[0102] A preset storage space determination module, configured to, in response to a data storage space query request sent by a remote server, send the available storage space of the file cache partition to the remote server, so that the remote server determines the preset storage space of each target data block based on the available storage space of the file cache partition, and perform data segmentation on the upgrade program package based on the preset storage space of each target data block to obtain the multiple target data blocks.

[0103] In a specific embodiment, the above device may further include:

[0104] An available storage space module, configured to obtain the available storage space of the free memory area of the operating system;

[0105] A file cache partition creation module, configured to create the file cache partition in the free memory area with the available storage space of a preset ratio as the target storage space.

[0106] In an optional embodiment, the above device may further include:

[0107] A current occupancy rate monitoring module, configured to monitor the current occupancy rate of the file cache partition;

[0108] A target storage space expansion module, configured to, if the current occupancy rate is higher than the preset occupancy rate, expand the target storage space of the target cache partition based on the current available storage space of the free memory area.

[0109] It should be noted that, when the device provided in the above embodiments realizes its functions, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiments and the method embodiments belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.

[0110] An embodiment of the present application provides a computer device, which includes a processor and a memory. At least one instruction or at least one segment of program is stored in the memory, and the at least one instruction or the at least one segment of program is loaded and executed by the processor to implement a program upgrade method as provided in the above method embodiment.

[0111] Figure 6 The figure shows a schematic hardware structure diagram of a device for implementing a program upgrade method provided in an embodiment of the present application. The device may participate in forming or include the device or system provided in the embodiment of the present application. As Figure 6 shown, the device 6 may include one or more processors 602 (602a, 602b,..., 602n are shown in the figure) (the processor 602 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 604 for storing data, and a transmission device 606 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 6 the structure shown is only for illustration and does not limit the structure of the above electronic device. For example, the device 6 may further include more or fewer components than Figure 6 shown in the figure, or have a different configuration from Figure 6 shown in the figure.

[0112] It should be noted that the above one or more processors 602 and / or other data processing circuits are generally referred to as "data processing circuits" in this article. The data processing circuit may be fully or partially embodied as software, hardware, firmware, or any other combination. In addition, the data processing circuit may be a single independent processing module, or fully or partially incorporated into any one of the other elements in the device 6 (or mobile device). As involved in the embodiment of the present application, the data processing circuit is used for processor control (such as the selection of a variable resistance terminal path connected to an interface).

[0113] The memory 604 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method in the embodiments of the present application. The processor 602 executes various functional applications and data processing by running the software programs and modules stored in the memory 604, that is, to implement the above-mentioned method for processing table data. The memory 604 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 604 may further include a memory remotely disposed relative to the processor 602, and these remote memories can be connected to the device 6 through a network. Examples of the above network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and their combinations.

[0114] The transmission device 606 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the device 6. In one instance, the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one instance, the transmission device 606 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0115] The display can be, for example, a touch-screen liquid crystal display (LCD), and the liquid crystal display enables a user to interact with the user interface of the device 6 (or mobile device).

[0116] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium can be disposed in a server to store at least one instruction or at least one segment of a program related to implementing a method for processing table data in the method embodiments. The at least one instruction or the at least one segment of the program is loaded and executed by the processor to implement a program upgrade method provided by the above method embodiments.

[0117] Optionally, in this embodiment, the above storage medium can be located in at least one of multiple network servers of a computer network. Optionally, in this embodiment, the above storage medium may include but is not limited to: USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs and other media that can store program codes.

[0118] An embodiment of the present invention also provides 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 a program upgrade method provided in the above various alternative embodiments.

[0119] It should be noted that: the above sequence of embodiments of the present application is only for description and does not represent the advantages or disadvantages of the embodiments. And the above specific embodiments of the present application have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in a different order than in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0120] Each embodiment in the present application is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the apparatus, device, and storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.

[0121] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by hardware, or can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disk, etc.

[0122] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A program upgrade method, characterized in that, The method is applied to a terminal including a first file system partition and a second file system partition, where the second file system partition is a backup of the first file system partition. The method includes: In response to an upgrade instruction for the first file system partition, obtaining first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by splitting the upgrade program package corresponding to the upgrade instruction, the multiple local data blocks are obtained by splitting the original program package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence; Comparing the first data feature information of each target data block with the second data feature information of the local data block corresponding to the target data block to obtain a comparison result for each target data block; Downloading the to-be-updated data blocks in the multiple target data blocks, for which the comparison result indicates that the first data feature information and the second data feature information are inconsistent, to a file cache partition, where the file cache partition is located in the free memory area of the operating system in the terminal, and the available storage space of the file cache partition is smaller than the available storage space of the free memory area; Updating the multiple local data blocks based on each of the target data blocks downloaded in the file cache partition to obtain a first update result; If the first update result indicates successful update, in response to an update trigger for the second file system partition, performing backup update on the second file system partition based on each of the target data blocks downloaded in the file cache partition.

2. The method according to claim 1, characterized in that, The downloading the target data blocks in the multiple target data blocks, for which the comparison result indicates that the first data feature information and the second data feature information are inconsistent, to the file cache partition includes: Creating data processing tasks corresponding to each of the to-be-updated data blocks; each of the data processing tasks is executed in a data processing partition, and the data processing partition can execute the data processing tasks within a preset parallel number; Using the preset parallel number as the upper limit of parallel tasks, scheduling and executing each of the data processing tasks to download each of the to-be-updated data blocks to the file cache partition.

3. The method according to claim 2, wherein The using the preset parallel number as the upper limit of parallel tasks and scheduling and executing each of the data processing tasks includes: If the number of each of the data processing tasks is greater than the preset parallel number, determining a preset parallel number of target processing tasks from each of the data processing tasks; Executing each of the target processing tasks in parallel and adding the to-be-processed data processing tasks other than the target processing tasks in each of the data processing tasks to a waiting queue; After any one of the target processing tasks in each of the target processing tasks is executed, determining the data processing task with the earliest order in the waiting queue as a target processing task and scheduling its execution, and repeating this step until the waiting queue is emptied.

4. The method according to any one of claims 1 to 3, characterized in that In response to an upgrade instruction for the first file system partition, obtaining first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition includes: The first data feature information includes a target data block identifier and target data digest information. The target data block identifier represents the block identifier of the target data block in the upgrade package, and the data digest information is obtained by performing an encrypted hash operation based on the data content information and data length information of the target data block; The second data feature information includes a local data block identifier and local data digest information. The local data block identifier represents the block identifier of the local data block in the first file system partition, and the local data digest information is obtained by performing an encrypted hash operation based on the data content information and data length information of the local data block.

5. The method according to any one of claims 1-3, characterized in that, Before, in response to an upgrade instruction for the first file system partition, obtaining first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition, the method further includes: In response to a data storage space query request sent by a remote server, sending the available storage space of the file cache partition to the remote server, so that the remote server determines the preset storage space of each target data block based on the available storage space of the file cache partition, and performs data segmentation on the upgrade package based on the preset storage space of each target data block to obtain the multiple target data blocks.

6. The method according to any one of claims 1-3, characterized in that, The creation method of the file cache partition includes: Obtaining the available storage space of the free memory area of the operating system; Using the available storage space with a preset ratio as the target storage space, and creating the file cache partition in the free memory area.

7. The method according to claim 6, wherein The method further includes: Monitoring the current occupancy rate of the file cache partition; If the current occupancy rate is higher than the preset occupancy rate, expanding the target storage space of the target cache partition based on the current available storage space of the free memory area.

8. A program upgrade device, characterized in that, The device is applied to a terminal including a first file system partition and a second file system partition, and the second file system partition is a backup of the first file system partition. The device includes: A data feature information acquisition module, configured to, in response to an upgrade instruction for the first file system partition, obtain first data feature information of each of the multiple target data blocks corresponding to the upgrade instruction and second data feature information corresponding to each of the multiple local data blocks stored in the first file system partition; the multiple target data blocks are obtained by performing data segmentation on the upgrade package corresponding to the upgrade instruction, the multiple local data blocks are obtained by performing data segmentation on the original package corresponding to the upgrade instruction, and the multiple target data blocks and the multiple local data blocks are set in one-to-one correspondence; A comparison result determination module, configured to compare the first data feature information of each of the target data blocks with the second data feature information of the corresponding local data block of the target data block, to obtain a comparison result for each of the target data blocks; A first processing module, configured to download, to a file cache partition, the data blocks to be updated for which the comparison result indicates that the first data feature information and the second data feature information are inconsistent among a plurality of target data blocks, where the file cache partition is located in an idle memory area of an operating system in the terminal, and an available storage space of the file cache partition is smaller than an available storage space of the idle memory area; A first update result acquisition module, configured to update the plurality of local data blocks based on each of the target data blocks downloaded in the file cache partition, to obtain a first update result; A second file system partition update module, configured to, if the first update result indicates successful update, in response to an update trigger of a second file system partition, perform a backup update on the second file system partition based on each of the target data blocks downloaded in the file cache partition.

9. A system upgrade device, characterized in that, The device includes a processor and a memory, and at least one instruction or at least one program segment is stored in the memory, and the at least one instruction or the at least one program segment is loaded and executed by the processor to implement the program upgrade method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, At least one instruction or at least one program segment is stored in the storage medium, and the at least one instruction or the at least one program segment is loaded and executed by a processor to implement the program upgrade method according to any one of claims 1 to 7.