A file updating method, device, equipment and storage medium

By downloading and virtually merging the directory of the update data package and the file package to be updated in the smart terminal device, the problem of system unavailability caused by the failure of the firmware OTA upgrade is solved, file updates are realized without introducing additional storage space, and the system stability is improved. and disk utilization.

CN112463191BActive Publication Date: 2024-10-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202011351980.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-26
Publication Date
2024-10-22
Estimated Expiration
2040-11-26

AI Technical Summary

Technical Problem

Existing technology can easily lead to system unavailability in the OTA upgrade of smart terminal device firmware when it fails, and common solutions need to introduce additional storage space overhead, especially the active/standby switchover solution that requires tens or hundreds of megabytes to be reserved. Additional system partition space.

Method used

By downloading the update data package to the target disk partition where the file package to be updated is located, the file package to be updated and the directory of the update data package are virtually merged to form a temporary file package, and after the temporary file package is successfully verified, the update data package is merged into the file package to be updated. Update the file package directory to implement file updates without the need for additional disk partitions.

Benefits of technology

While ensuring the robustness of updates, it avoids the introduction of additional storage space overhead, improves system disk utilization, and simplifies the OTA upgrade process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112463191B_ABST
    Figure CN112463191B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a file update method, the method comprising: downloading an update data packet to a target disk partition where the file package to be updated is located; the update data packet is used to update the file package to be updated; virtually merging the directory of the file package to be updated and the directory of the update data packet to obtain a temporary file package; if the temporary file package is successfully verified, merging the update data packet into the directory of the file package to be updated. In addition, the embodiment of the present application also discloses a file update device, equipment and storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and relate to but are not limited to a file updating method and apparatus, device, and storage medium. Background Art

[0002] Smart terminal devices (such as smartphones, smart speakers, etc.) often need to upgrade their software systems during their life cycle, on the one hand to fix defects in old versions, and on the other hand to upgrade new feature versions to improve user experience. The mainstream online upgrade method is Over The Air (OTA), that is, the device downloads the upgrade package through mobile data or WIFI network and completes the upgrade. After the upgrade package is downloaded, depending on the upgrade goals and solutions, it is sometimes necessary to restart the device.

[0003] OTA can be divided into software OTA (SOTA) and firmware OTA (FOTA) according to the upgrade object. SOTA is aimed at application software / APP upgrades, while FOTA upgrades system firmware such as bootloader, kernel, and root directory (rootfs).

[0004] A key to OTA upgrades is robustness, that is, when an OTA upgrade fails, the system can still be rolled back to the old version without causing the system or software to become unusable or even bricked. This is especially important for FOTA upgrades. Directly updating the operating system firmware such as kernel or rootfs will most likely cause the system to be unable to boot and use if it fails.

[0005] There are two common solutions in the industry to solve the above problems: one is active-standby switching, and the other is to deploy "recovery mode". However, both solutions require additional storage space overhead. In particular, the active-standby switching solution requires an additional set of complete system partition space, which usually requires tens or hundreds of megabytes (MB), or even more. Summary of the invention

[0006] In view of this, the embodiments of the present application provide a file update method and apparatus, device, and storage medium to solve at least one problem existing in the related art, which can complete the file update without introducing additional storage space overhead.

[0007] The technical solution of the embodiment of the present application is implemented as follows:

[0008] In a first aspect, an embodiment of the present application provides a file updating method, the method comprising:

[0009] Downloading an update data packet to the target disk partition where the file package to be updated is located; the update data packet is used to update the file package to be updated;

[0010] Virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package;

[0011] When the temporary file package is successfully verified, the update data package is merged into the directory of the file package to be updated.

[0012] In a second aspect, an embodiment of the present application provides a file updating device, the device comprising:

[0013] A downloading unit, used for downloading an update data packet to a target disk partition where the file package to be updated is located; the update data packet is used for updating the file package to be updated;

[0014] A stacking unit, used for virtually merging the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package;

[0015] The writing unit is used to merge the update data package into the directory of the file package to be updated when the temporary file package is successfully verified.

[0016] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned file updating method when executing the computer program.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above-mentioned file updating method when executed by a processor.

[0018] In an embodiment of the present application, a file updating method, apparatus, device and storage medium are provided, which download an update data packet to a target disk partition where a file packet to be updated is located; the update data packet is used to update the file packet to be updated; the directory of the file packet to be updated and the directory of the update data packet are virtually merged to obtain a temporary file packet; if the temporary file packet is successfully verified, the update data packet is merged into the directory of the file packet to be updated; thereby, the update data packet for updating the file to be updated is downloaded to the disk space where the file packet to be updated is located, without providing an additional disk partition for the update data packet, and by virtually merging the directory of the file packet to be updated and the directory of the update data packet, the file packet to be updated and the update data packet are stacked to obtain a temporary file packet, and after the temporary file packet is verified, the update data packet is merged into the directory of the file packet to be updated to complete the update of the file packet to be updated by the update data packet, thereby ensuring the robustness of the update without introducing additional disk overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a schematic diagram of the network architecture of an embodiment of the present application;

[0020] Figure 2 An optional flowchart of a file updating method provided in an embodiment of the present application;

[0021] Figure 3 An optional flowchart of a file updating method provided in an embodiment of the present application;

[0022] Figure 4 An optional schematic diagram of a virtual merged file provided in an embodiment of the present application;

[0023] Figure 5 An optional flowchart of a file updating method provided in an embodiment of the present application;

[0024] Figure 6 It is an optional flowchart of a file updating method in the related art;

[0025] Figure 7 It is an optional flowchart of a file updating method in the related art;

[0026] Figure 8 An optional flowchart of a file updating method provided in an embodiment of the present application;

[0027] Fig. 9 An optional structural diagram of a file updating device provided in an embodiment of the present application;

[0028] Fig.10 A schematic diagram of an optional state transition of a file update method provided in an embodiment of the present application;

[0029] Fig.11 An optional flowchart of a file updating method provided in an embodiment of the present application;

[0030] Fig.12 An optional schematic diagram of a virtual merged file provided in an embodiment of the present application;

[0031] Fig.13 An optional structural diagram of a file updating device provided in an embodiment of the present application;

[0032] Fig.14 An optional structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.

[0034] The embodiments of the present application can provide a file update method and device, equipment and storage medium. In practical applications, the file update method can be implemented by a file update device, and each functional entity in the file update device can be collaboratively implemented by hardware resources of a computer device, such as computing resources such as a processor, and communication resources (such as for supporting various communication methods such as optical cables and cellular).

[0035] The file updating method of the embodiment of the present application can be applied to Figure 1 The information processing system shown in Figure 1 As shown, the information processing system includes a client 10 and a server 20; wherein the client 10 is installed with a file management program capable of downloading update data packets from the network side and updating the file packages to be updated. The server 20 can generate update data packets based on update files and send the update data packets to the client 10, and the client updates the file packages to be updated based on the downloaded data packets. The client 10 and the server 20 interact with each other through a network 30.

[0036] The client 10 can be implemented as a file update device for implementing the file update method. The client 10 downloads an update data packet from the server 20 to the target disk partition where the file package to be updated is located; the update data packet is used to update the file package to be updated; the directory of the file package to be updated and the directory of the update data packet are virtually merged to obtain a temporary file package; if the temporary file package is successfully verified, the update data packet is merged into the directory of the file package to be updated.

[0037] In one example, the server is a cloud server.

[0038] Combination Figure 1 As shown in the schematic diagram of the application scenario, an embodiment of the present application proposes a file update method that can complete the file update without introducing additional storage space overhead.

[0039] Next, combine Figure 1 The schematic diagram of the information processing system shown illustrates various embodiments of the file updating method, apparatus, device and storage medium provided in the embodiments of the present application.

[0040] This embodiment provides a file update method, which is applied to a file update device, which may be a client, wherein the client may be a computer device. The function implemented by the method can be implemented by a processor in the computer device calling a program code, and of course the program code can be stored in a computer storage medium. It can be seen that the computer device at least includes a processor and a storage medium.

[0041] Figure 2 A schematic diagram of the implementation process of a file update method according to an embodiment of the present application is shown in FIG. Figure 2 As shown, the method may include the following steps:

[0042] S201, downloading the update data package to the target disk partition where the file package to be updated is located.

[0043] The update data packet is used to update the file package to be updated.

[0044] Here, the files in the update data package are called update files, and the files in the to-be-updated file package are called to-be-updated files. The update data package includes at least one update file, and the to-be-updated file package includes at least one to-be-updated file.

[0045] The file update device downloads an update data packet from the server in a waiting state. In the embodiment of the present application, the downloaded update data packet is different based on different file update scenarios. In the file upgrade scenario, the downloaded update data packet is an upgrade package, which can be called an OTA upgrade package. In the file rollback scenario, the downloaded update data packet is a rollback package, which can be called an OTA rollback package.

[0046] The application scenarios of the file update method provided in the embodiment of the present application are not limited to file upgrade and file rollback scenarios, and can also be used in other scenarios for updating files in a file update device.

[0047] The update data package and the file package to be updated are file packages of the same application program, and may also be firmware in the same file system.

[0048] Before downloading the update data packet, the file update device determines the target disk partition where the update data packet is located, and downloads the update data packet to the determined target disk partition. In one example, the target disk partition is a root file system rootfs.

[0049] In the embodiment of the present application, the layout of the directory of the update data package is the same as the layout of the directory of the file package to be updated.

[0050] In one example, the directory of the update data package includes: directory 1 and directory 2, wherein directory 1 includes file 1 and file 2, and directory 2 includes file 3; the files to be updated in the file package to be updated include: file 3, file 4, file 5, and file 6, and the directory of the file package to be updated includes sub-directories: directory 1 and directory 2, wherein directory 1 includes file 4 and file 5, and directory 2 includes file 3 and file 6.

[0051] In the embodiment of the present application, for files with the same name, the full path in the update data packet is the same as the full path in the file package to be updated.

[0052] In one example, the directories in the update data package include: directory Dir-A and directory Dir-B, and the files under directory Dir-A include: file File-1, and the files under directory Dir-B include: file File-4. The full paths of files File-1 and File4 in the update data package are: / Dir-A / File-1, / Dir-B / File4 respectively; the directories in the file package to be updated include: directory Dir-A and directory Dir-B, and the files under directory Dir-A include: file File-1 and file File-2, and the files under directory Dir-B include: file File-3. At this time, the full paths of files File-1 to File3 in the file package to be updated are: / Dir-A / File-1, / Dir-A / File-2, / Dir-B / File-3 respectively.

[0053] In the embodiment of the present application, the file update device may enter a download complete state after completing the download of the update data packet, and perform a restart in the download complete state.

[0054] S202: Virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package.

[0055] According to the directory of the file package to be updated and the directory of the update data package, the files to be updated in the file package to be updated and the update files in the update data package are called, and the file package to be updated and the update data package are stacked to obtain a temporary file package.

[0056] During a restart, the file update device stacks the file package to be updated and the update data package according to the directory of the file package to be updated and the directory of the update data package. Here, the file update device virtually merges the directory of the update data package and the directory of the file package to be updated to obtain a new file directory, i.e., the mount directory, and based on the mount directory, calls each update file in the update data package and each to-be-updated file in the file package to be updated to obtain a temporary file package.

[0057] In the embodiment of the present application, when calling the update file and the file to be updated, the called files are different based on the update method of the update file, wherein the update method includes: replacement, deletion, addition and retention. For files that exist in both the file package to be updated and the update data package and have the same path, the update method is replacement, that is, the file in the update data package is used to replace / overwrite the file with the same name in the file package to be updated; for the newly added files that are in the update data package but not in the file package to be updated, the update method is addition; for the files not involved in the update data package, the update method is retention without clear identification, that is, the files in the file package to be updated are used; for the files not involved in the update data package and the files that need to be deleted that are clearly identified, the update method is deletion. Here, the mark indicating whether the file is deleted can be configured in the update package configuration parameters. In the embodiment of the present application, the update method of each update file can be configured in the update package configuration parameters.

[0058] During the virtual merge process, when the update mode is replace, the path of the file in the update data package is added to the mount directory; when the update mode is add, the path of the file in the update data package is added to the mount directory; when the update mode is keep, the path of the file in the file package to be updated is added to the mount directory; when the update mode is delete, the path of the file in the file package to be updated is hidden and not added to the mount directory.

[0059] In the embodiment of the present application, when the directory of the update data package and the directory of the file package to be updated are virtually merged, only the paths of the files are merged, and the files themselves are not replaced, deleted, etc.

[0060] In actual application, the file update device can virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package after completing the mounting of the root file system where the file to be updated is located and before changing the root directory to the root file system.

[0061] Here, for the user, the temporary file package that can be seen is the same as the expected target file package, but the files included in the temporary file package are in the underlying file system such as the root file system, and the files in the temporary file package that belong to the update data package are located in the directory where the update data package is located, and the files that belong to the file package to be updated are located in the directory where the file package to be updated is located, that is, the update data package and the file package to be updated are not actually merged.

[0062] After obtaining the temporary file package, the file update device verifies the temporary file package. In the embodiment of the present application, the verification method for verifying the temporary file package may include: executing some functions of the temporary file package such as file reading and writing, service detection, etc., and may also compare the version information of the temporary file package with the version information corresponding to the file package to be updated to determine whether to upgrade. Among them, the verification method for verifying the temporary file package can be set according to actual needs, and the verification method in the embodiment of the present application does not impose any restrictions.

[0063] When the file update device determines that the temporary file package verification succeeds, it enters the verification success state, triggers a secondary restart, and executes S203. When the file update device determines that the temporary file package verification fails, it deletes the update data package.

[0064] Here, after the file update device deletes the update data packet, it performs a second restart, loads the root file system where the file to be updated is located, and completes the system recovery.

[0065] S203: When the temporary file package is successfully verified, merge the update data package into the directory of the file package to be updated.

[0066] When the temporary file package is successfully verified, the file update device performs a secondary restart. During the secondary restart, after the target disk partition is mounted and before the root directory is changed to the root file system, the update data package is written to the directory where the file package to be updated is located, and the update data package is merged with the file package to be updated so that the file package to be updated is updated through the update data package.

[0067] Here, when writing the update data packet, the files to be updated in the update file package are processed according to the update mode corresponding to each update file. When the update mode is replace, the update file with the same file name will overwrite the file to be updated; when the update mode is keep, the file to be updated will not be modified; when the update mode is add, the update file will be added to the file package to be updated; when the update mode is delete, the file to be updated will be deleted.

[0068] The target file package is obtained by updating the file package to be updated through the update data package.

[0069] The file update method provided in the embodiment of the present application supports the update of system files in the following scenarios.

[0070] Scenario 1: Update the system files of the application (APP). The system files may include: basic command bin files, lib library files, etc.

[0071] Scenario 2: System-level update. In this case, the updated file is the version file of the entire rootfs.

[0072] Therefore, the file update method provided in the embodiment of the present application can support both APP and system-level updates.

[0073] The file updating method provided in the embodiment of the present application downloads an update data packet to the target disk partition where the file packet to be updated is located; the update data packet is used to update the file packet to be updated; the directory of the file packet to be updated and the directory of the update data packet are virtually merged to obtain a temporary file package; when the temporary file package is successfully verified, the update data packet is merged into the directory of the file package to be updated; thereby, the update data packet for updating the file to be updated is downloaded to the disk space where the file package to be updated is located, and there is no need to provide an additional disk partition for the update data packet. By virtually merging the directory of the file package to be updated and the directory of the update data packet, the file package to be updated and the update data packet are stacked to obtain a temporary file package. After the temporary file package is verified, the update data packet is merged into the directory of the file package to be updated to complete the update of the file package to be updated by the update data packet, thereby ensuring the robustness of the update without introducing additional disk overhead.

[0074] In some embodiments, the implementation of S201 includes: downloading the update data package to a first space area of ​​the target disk space; and the file package to be updated is located in a second space area of ​​the target disk space.

[0075] Here, the target disk space is the underlying file system rootfs, and both the update data package and the file package to be updated are located in the rootfs and in different space areas so that the directory of the update data package and the directory of the file package to be updated are independent directories.

[0076] In some embodiments, before S202, it is detected that the update data packet has been downloaded, a first upgrade parameter in the boot loader is set to a first value, and a first restart instruction is generated; the first value indicates that the update data packet has been downloaded; based on the first restart instruction, a restart is performed;

[0077] Correspondingly, the implementation of S202 includes: detecting that the first upgrade parameter is the first value, virtually merging the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package.

[0078] When the first upgrade parameter is the first value, the first upgrade parameter indicates that the current file update device is in the update data package download completion state. When the file update device detects that the first upgrade parameter is the first value during the restart process, the directory of the file package to be updated and the directory of the update data package are virtually merged to obtain a temporary file package.

[0079] Here, the file updating device may detect the value of the first upgrade parameter after completing the mounting of the root file system where the file to be updated is located and before changing the root directory to the root file system.

[0080] In some embodiments, Figure 3 As shown, the implementation of S202 includes:

[0081] S2021. Virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a mount directory;

[0082] S2022. Based on the mount directory, call the file package to be updated and the update data package to obtain the temporary file package.

[0083] In the embodiment of the present application, the directory of the update data package is used as the upper directory, and the directory of the file package to be updated is used as the lower directory. The upper directory and the lower directory are virtually merged through the stacking file system technology, and the folders corresponding to the upper directory and the folders corresponding to the lower directory are merged into the same directory. Among them, the stacking file system technology can be unionfs, aufs, overlayfs, etc. Here, the merged directory is called the mount directory, and the update files in the upper directory and the files to be updated in the lower files in the mount directory are called based on the mount directory.

[0084] In some embodiments, the implementation of S2021 includes:

[0085] Add the path of the first file under the directory of the update data package to the mount directory; the first file and the second file under the directory of the file package to be updated are files with the same name; add the path of the third file under the directory of the update data package to the mount directory, and the third file is a file newly added to the update data package relative to the file package to be updated; add the fourth file under the directory of the file package to be updated to the mount directory; the fourth file is a file maintained under the directory of the file package to be updated.

[0086] Here, the update method involves several situations such as replacement, deletion, addition, and retention. When performing a virtual merge, the files in the update data package are traversed and compared with the files with the same path in the file package to be updated: for files with the same name and the same path that are present in both the file package to be updated and the upgrade data package (the first file in the update data package, the second file in the file package to be updated), that is, the update method is replacement, and the path of the first file is added to the mount directory; for new files that are not in the file package to be updated, that is, the third file, the update method is addition, and the path of the third file is added to the mount directory; for files that are not involved in the update data package and need to be used, that is, the fourth file, the update method is retention, and the path of the fourth file is added to the mount directory; for files that are not involved in the update data package but are marked as files that need to be deleted, that is, the fifth file, that is, the update method is deletion, the path of the fifth file is hidden and will not be added to the mount directory.

[0087] In one example, if Figure 4 As shown, the directory of the update data package is directory 402, and the directory of the file package to be updated is directory 403. Directory 402 and directory 403 are virtually merged into mount directory 401, wherein directory 402 includes: directory Dir-A and directory Dir-B, and the files under directory Dir-A include: file 4011, and the files under directory Dir-B include: file 4014, and directory 403 includes: directory Dir-A and directory Dir-B, and the files under directory Dir-A include: file 4012, and the files under directory Dir-B include: file 4013. Among them, if the update mode corresponding to file 4011 is replace, the path of file 4011 in directory 402 is added to mount directory 401, if the update mode corresponding to file 4012 is keep, the path of file 4012 in directory 403 is added to mount directory 401, if the update mode corresponding to file 4013 is delete, the path of file 4013 is not added to mount directory 401, if the update mode corresponding to file 4014 is add, the path of file 4014 is not added to mount directory 401. At this time, the directories under the mount directory include: Dir-A and Dir-B, the files under Dir-A include file 4011 and file 4012, and the files under Dir-B include file 4014.

[0088] In some embodiments, before S203, the file updating method further includes:

[0089] Detecting that the called file is successfully verified, setting a second upgrade parameter in the boot loader to a second value, and generating a second restart instruction; the second value indicates that the called file is successfully verified;

[0090] Based on the second restart instruction, performing a secondary restart;

[0091] Correspondingly, the implementation of S203 includes: detecting that the second upgrade parameter is the second value, and writing the update data packet into the directory of the file package to be updated.

[0092] When the second upgrade parameter is the second value, the second upgrade parameter indicates that the current file update device is in a verification success state. When the file update device detects that the second upgrade parameter is the second value during the restart process, the update data packet is merged with the file package to be updated to update the file package to be updated through the update data packet.

[0093] Here, the file updating device may detect the value of the second upgrade parameter after completing the mounting of the root file system where the file to be updated is located and before changing the root directory to the root file system.

[0094] In practical applications, the first upgrade parameter and the second upgrade parameter may be the same parameter.

[0095] In some embodiments, Figure 5 As shown, the implementation of S203 includes:

[0096] S2031, overwriting the second file in the file package to be updated with the first file in the update data package;

[0097] The first file has the same name as the second file;

[0098] S2032, writing the third file in the update data package into the directory of the file package to be updated;

[0099] The third file is a file in the update data package except the first file.

[0100] S2033: Delete the fifth file in the file package to be updated.

[0101] The fifth file is a file to be deleted in the file package to be updated.

[0102] Here, the update method involves several situations such as replacement, deletion, addition, and retention. When performing the merge, the files in the update data package are traversed and compared with the files with the same path in the file package to be updated: for the files with the same name and the same path that are present in both the file package to be updated and the upgrade data package (the first file in the update data package, the second file in the file package to be updated), the update method is replacement, and the first file overwrites the second file; for the newly added file that is not in the file package to be updated, that is, the third file, the update method is addition, and the third file is added to the file package to be updated; for the file that is not involved in the update data package and the file that needs to be used, that is, the fourth file, the update method is retention, and the fourth file remains unchanged; for the file that is not involved in the update data package but is marked as the file that needs to be deleted, that is, the fifth file, the update method is deletion, and the fifth file is deleted from the data package to be updated.

[0103] In one example, the directory of the update data package is directory 402, and the directory of the file package to be updated is directory 403. Directory 402 and directory 403 are virtually merged into mount directory 401, wherein directory 402 includes: directory Dir-A and directory Dir-B, and the files under directory Dir-A include: file 4011, and the files under directory Dir-B include: file 4014, and directory 403 includes: directory Dir-A and directory Dir-B, and the files under directory Dir-A include: file 4012, and the files under directory Dir-B include: file 4013. Among them, the update method corresponding to file 4011 is replace, and file 4011 in directory 403 is replaced by file 4011 in directory 402. The update method corresponding to file 4012 is keep, and file 4012 is kept unchanged. The update method corresponding to file 4013 is delete, and file 4013 is deleted. The update method corresponding to file 4014 is add, and file 4014 in directory 402 is added to directory 403.

[0104] Below, taking the scenario of file upgrade as file update as an example, the file update method provided in the embodiment of the present application is further explained.

[0105] To ensure the robustness of file upgrades, commonly used OTA solutions include: active-standby switching and deploying "recovery mode".

[0106] The principle of file upgrade using active / standby switchover is as follows: Figure 6As shown, the disk reserves two complete system partitions: active system and passive system. Each complete system partition includes: kernel, temporary root file system (initrd) and root file system (rootfs). When the active system is currently used, the other partition passive system is directly updated after downloading the upgrade package, and the bootloader is notified by setting parameters. After restarting, it switches to the new system partition passive system to complete the upgrade.

[0107] like Figure 6 As shown in the figure, the file upgrade process includes three stages: normal startup stage, upgrade installation stage and restart stage. The file upgrade process includes:

[0108] S601. Boot the active system and download the OTA upgrade package.

[0109] S602: Install the OTA upgrade package to update the passive system.

[0110] S603: Notify the bootloader to perform a master-slave switchover.

[0111] S604. After restarting, boot the new active system, that is, the updated passive system.

[0112] The principle of file upgrade using the deployment "recovery mode" is as follows Figure 7 As shown, the disk reserves a streamlined partition: the recovery system, and the recovery system includes limited functions of the kernel and initrd. After the device downloads the upgrade package, it first restarts to the recovery system, then updates the normal system partition, and after completion triggers a restart to the normal system. If the upgrade fails, it can be restored by entering the recovery mode and re-upgrading the version.

[0113] like Figure 7 As shown in the figure, the file upgrade process includes three stages: normal startup stage, upgrade stage and restart stage. The file upgrade process includes:

[0114] S701. Boot the normal system and download the OTA upgrade package.

[0115] S702: Start the recovery system.

[0116] S703, install the OTA upgrade package and update the normal system.

[0117] S704. After restarting, boot the updated normal system.

[0118] To ensure the robustness of the upgrade process, both of the above two file upgrade solutions introduce additional storage space overhead. In particular, the active-standby switchover solution requires an additional set of complete system partition space, which usually requires tens or hundreds of MB or even more. This problem is not prominent in large-capacity storage devices such as smartphones, but in low-cost IoT smart devices, the additional consumption of storage space has a relatively large impact.

[0119] In order to solve the problems existing in the above-mentioned scheme, an embodiment of the present application provides a file upgrade method, which eliminates the additional reserved disk space while ensuring the robustness of OTA upgrade.

[0120] The file upgrade method provided in the embodiment of the present application is as follows Figure 8 As shown in the figure, the disk space includes the boot program, normal system and user data partitions, and no additional disk space is required. The normal system includes kernel, initrd and rootfs.

[0121] like Figure 8 As shown, the upgrade process of the file upgrade method provided in the embodiment of the present application includes four stages: download stage, one restart stage, rollback stage and two restart stages. The file upgrade process includes:

[0122] S801. Download the OTA upgrade package.

[0123] In the download phase, the OTA upgrade package is downloaded. The downloaded OTA upgrade package is stored in the root file system in the disk partition, where the original file to be upgraded is also stored in the root file system. After the OTA upgrade package is completed, the upgrade parameter in the device boot program is in the download completion state, and a restart is triggered, entering the first restart phase.

[0124] S802: Perform upgrade verification on the OTA upgrade package by virtually merging the file directories.

[0125] During the first restart process, the OTA main module in initrd reads the upgrade parameter as the download completion status, and then uses the stacking file system technology to apply the OTA package (virtual merging, not replacement).

[0126] Here, at the first restart, before the root file system is switched, stack mounting is performed to "virtually merge" the directory of the OTA upgrade package and the directory of the original file package to apply the OTA package, which is a temporary file package.

[0127] If the application of the OTA package fails, the upgrade parameters are set to the verification failure state, a secondary restart is triggered, the failure fallback phase is entered, and S803 is executed.

[0128] If the OTA package is applied successfully, the root directory is changed and the root file system is entered to perform verification of the OTA package. When verification succeeds, the upgrade parameters are set to the verification success state, triggering a secondary restart, entering the failure rollback phase, and executing S803; when verification fails, the upgrade parameters are set to the verification failure state, triggering a secondary restart, entering the secondary restart phase, and executing S804.

[0129] S803: System rollback.

[0130] During the secondary restart process of entering the failure rollback stage, the OTA main module in initrd reads that the upgrade parameters are in the verification failure state, so it deletes the OAT upgrade package, cancels the stack file system call, loads the original root file system, and rolls back to the original system.

[0131] S804. File replacement.

[0132] During the secondary restart process of the secondary restart phase, the OTA main module in initrd reads the upgrade parameters and verifies that they are in a successful verification state, triggering version replacement, reading the OTA upgrade package, and writing the read OTA upgrade package to the directory where the original file is located to replace the original file. After completing the replacement, addition, deletion and other file package merging of the original file, change the root directory to rootfs and load the updated rootfs.

[0133] The structure of the information system used by the file updating method provided in the embodiment of the present application is as follows Fig. 9 As shown, it includes: cloud 901 and device 902. Among them, the components of cloud 901 include: upgrade package production component 9011, and the components of device 902 include: OTA download 9021, OTA verification 9022, OTA main module 9023, and OTA parameter storage 9024. Among them,

[0134] Upgrade package production 9011, used to produce OTA upgrade package.

[0135] OTA download 9021, located in stystem / roots, is used to download OTA upgrade packages from the cloud.

[0136] OTA verification 9022, located in stystem / roots, is used to verify the OTA package.

[0137] The OTA main module 9023, located in initrd, is used to control the application, verification and replacement of OTA packages.

[0138] OTA parameter storage 9024, located in the bootloader, is used to store upgrade parameters.

[0139] The state transition diagram of the file updating device in the file updating method provided in the embodiment of the present application is as follows Fig.10 As shown, the states of the file update device include: waiting state 1001, download completion state 1002, upgrade verification state 1003, verification success state 1004 and verification failure state 1005.

[0140] In the waiting state 1001 , the OTA upgrade package is downloaded. If the OTA upgrade package is downloaded successfully, the download completion state 1002 is entered. If the OTA upgrade package is downloaded failed, the waiting state 1001 is maintained.

[0141] In the download completion state 1002 , the upgrade parameters are set, a restart is performed, and the upgrade verification is triggered to enter the upgrade verification state 1003 .

[0142] In the upgrade verification state 1003, the upgrade verification is performed. When the upgrade verification succeeds, the system enters the verification success state 1004. When the upgrade verification fails, the system enters the verification failure state 1005.

[0143] In the verification success state 1004, a second restart is performed to complete the file replacement and load the new system. The files to be updated in the new system have been replaced with new files.

[0144] In the verification failure state 1005, a second restart is performed to cancel the new system and load the original system. The original system contains the files to be updated, that is, the original files.

[0145] The file updating method provided in the embodiment of the present application is as follows Fig.11 As shown, including:

[0146] S1101, wait.

[0147] S1102. Download the OTA upgrade package.

[0148] S1102: Determine whether the OTA upgrade package is downloaded successfully?

[0149] If the download is successful, execute S1103; if the download fails, execute S1101.

[0150] S1103, OTA upgrade verification.

[0151] The file update device virtually merges the OTA upgrade directory and the original file directory through the stacking file system technology to obtain a mount directory, and calls the OTA upgrade package and the original file based on the mount directory to obtain an OTA package, and verifies the OTA package.

[0152] S1104. Was the upgrade verification successful?

[0153] If the verification is successful, execute S1105, and if the verification is successful, execute S1106.

[0154] S1105. Update the system.

[0155] Use the OTA upgrade package to replace the original files in the system, obtain the upgraded files, and perform a second restart to load the new system.

[0156] S1106. Restore the original system.

[0157] Delete the OTA upgrade package, perform a second restart, and load the original system.

[0158] In the embodiment of the present application, stacked file system technology is used in the production and upgrade verification of the OTA upgrade package. The stacked file system technology used can be unionfs, aufs, overlayfs, etc. The technical principle of the stacked file system technology is as follows Fig.12 As shown, lower dirA1203, lower dirB1204 and upper dir1202 are different directories from the underlying file system, which can be specified by the user. They contain the files and directories that the user wants to merge, and merge dir1201 is the mount point. When the file system is mounted, the contents from lower dir A1203, lower dirB1204 and upper dir1202 will be seen under merge dir1201 at the same time. Among them, in merge dir1201, you can see files A and B from upperdir1202, file C from lower dir A1203, and file D from lower dirB1204. And the user cannot (does not need to) perceive which of these files are from the lower dir and which are from the upper dir. The user only sees an ordinary file system root directory, and there can be multiple or only one lower dir.

[0159] The upper dir and lower dir directories are not completely equivalent, but have a hierarchical relationship. When the upper dir and lower dir have files with the same name, the files in the lower dir will be hidden, and users can only see the files from the upper dir. For example, Fig.12 In the example, both lower dirA1203 and upper dir1202 contain file B. The user can only see file B from upper dir1202, and hide file B from lower dirA1203. Each lower dir also has the same hierarchical relationship, and the upper level shields the lower level files with the same name. For example, Fig.12In the example, both lowerdirA1203 and lowerdirB1204 contain file C. The user can only see file C from lowerdirA120, and hide file C from lowerdirB1204. In addition, if there are directories with the same name, continue merging.

[0160] For files that exist in both the upper and lower directories (the full paths of files with the same name are the same), only files under the upperdir directory will be displayed in the directory after the "virtual merge". Files that do not exist in the upperdir can be displayed as files in the lowerdir or marked as deleted and not displayed. For example, when marked as not to be deleted, they are displayed as files in the lowerdir, and when marked as deleted, they are deleted and not displayed. Based on this technical feature, this application treats the directory of the new version file and the directory of the old version file as different directories, such as upperdir and lowerdir, and generates an OTA upgrade package based on the difference between the new and old versions. During OTA testing, the "virtual merge" technology is used for testing and verification.

[0161] The file update method provided in the embodiment of the present application includes:

[0162] S11, OTA software package production;

[0163] The cloud compares the differences between the two version directories and creates an OTA upgrade package based on the stacked file system technology. If necessary, the OTA upgrade package is security-enhanced, such as signing and encryption.

[0164] S12, OTA software package download;

[0165] The device uses the existing secure channel and mechanism to download the OTA upgrade package. If necessary, perform security verification on the OTA upgrade package, such as signature verification and decryption.

[0166] S13, setting the upgrade parameters to the download completion state.

[0167] After the OTA upgrade package is downloaded, the OTA parameter storage module interface (typically such as bootloader env partition / variable setting) is used to update the OTA status indicated by the upgrade parameters to the download completion status, triggering a restart.

[0168] S14, apply OTA package;

[0169] After a restart, the OTA main module in initrd is executed. The upgrade parameters read by the OTA main module are in the download completion state, triggering the OTA upgrade test verification.

[0170] Here, after mounting the root file system (mount system / rootfs) and before changing to the root file system (chroot system / rootfs), the device uses the stacked file system to mount the root file system (system / rootfs) for the second time, and the directory of the OTA upgrade package has been "virtually merged" with the directory of the old version file. If the second mount fails, set the upgrade parameters to the verification failure state, triggering a second restart.

[0171] If the second mount is successful, the device continues to execute chroot system / rootfs, and after completing the necessary initialization, the OTA verification service is started. The verification service performs basic and user-customized verification processes (such as file reading and writing, service detection, version comparison, etc.). When the verification is successful, the upgrade parameters are set to the verification success state. When the verification is successful, the upgrade parameters are set to the verification failure state. Triggering the second restart.

[0172] In the embodiment of the present application, initrd is a temporary file system, and its main purpose is to perform system initialization. Finally, it switches to the root file system through the operations of mount and chroot. The switching process is generally two steps: the first step is to mount the root file system (the disk partition where it is located), and the second step is to chroot and switch the root directory to the node just mounted. A mount is a necessary operation, which is to mount the disk partition where the root file system is located. Only after mounting can the system recognize the content in the root file system. In the embodiment of the present application, a second mount is performed after a mount and before chroot to obtain a temporary file package.

[0173] S15. Replace the file.

[0174] After the device restarts for the second time, it executes the OTA main module of initrd again. If the OTA main module reads the upgrade parameters and the verification is successful, it triggers the system update / version replacement.

[0175] Here, after mounting system / rootfs and before chrooting system / rootfs, the device uses the OTA upgrade package directory file to replace, add, or delete the files in the system / rootf directory, that is, the original system files. Delete the OTA upgrade package, free up disk space, and get a new system. Update the upgrade parameters to the waiting state. Execute chroot, switch to the new system, and complete the file upgrade.

[0176] S16. Restore the original system.

[0177] After the device is restarted for the second time, the OTA main module of initrd is executed again. If the OTA main module reads the upgrade parameters and the verification fails, it triggers the recovery system service.

[0178] Here, the device records relevant error information, deletes the OTA upgrade package directory, directly mounts system / rootfs, sets the update status to "waiting", executes chroot, and restores to the original system.

[0179] The file update method provided in the embodiment of the present application has the following characteristics:

[0180] 1. No need to reserve additional disk partitions for OTA upgrades, improving system disk utilization.

[0181] 2. The OTA upgrade package production and application method based on the stacked file system technology ensures the robustness of the update process. Through "virtual merging", upgrade verification can be performed, and the old system can be restored when the mount fails or the verification fails. This is a technical effect that cannot be achieved by direct replacement.

[0182] Fig.13 A schematic diagram of the implementation process of a file updating device according to an embodiment of the present application is shown in FIG. Fig.13 As shown, the apparatus 1300 includes:

[0183] The downloading unit 1301 is used to download an update data packet to a target disk partition where the file package to be updated is located; the update data packet is used to update the file package to be updated;

[0184] The stacking unit 1302 is used to virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package;

[0185] The writing unit 1303 is used to merge the update data package into the directory of the file package to be updated when the temporary file package is successfully verified.

[0186] In some embodiments, the downloading unit 1301 is further configured to:

[0187] The update data package is downloaded to the first space area of ​​the target disk space; the file package to be updated is located in the second space area of ​​the target disk space.

[0188] In some embodiments, the apparatus 1300 further includes:

[0189] The first restart unit is used for:

[0190] Before virtually merging the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package, detecting that the update data package has been downloaded, setting a first upgrade parameter in the boot loader to a first value, and generating a first restart instruction; the first value indicates that the update data package has been downloaded; and executing a restart based on the first restart instruction;

[0191] Correspondingly, the stacking unit is further configured to detect that the first upgrade parameter is the first value, and virtually merge the directory of the to-be-updated file package with the directory of the update data package to obtain a temporary file package.

[0192] In some embodiments, the stacking unit 1302 is further configured to:

[0193] Virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a mount directory;

[0194] Based on the mount directory, the file package to be updated and the update data package are called to obtain the temporary file package.

[0195] In some embodiments, the stacking unit 1302 is further configured to:

[0196] Add the path of the first file in the directory of the update data package to the mount directory; the first file and the second file in the directory of the file package to be updated are files with the same name;

[0197] Adding the path of the third file in the directory of the update data package to the mount directory, wherein the third file is a file newly added to the update data package relative to the file package to be updated;

[0198] Add a fourth file in the directory of the file package to be updated to the mounting directory; the fourth file is a file stored in the directory of the file package to be updated.

[0199] In some embodiments, the apparatus 1300 further includes: a second restarting unit, configured to:

[0200] Before merging the update data packet into the directory of the file package to be updated, detecting that the temporary file package is successfully verified, setting a second upgrade parameter in the boot loader to a second value, and generating a second restart instruction; the second value indicates that the temporary file package is successfully verified;

[0201] Based on the second restart instruction, performing a secondary restart;

[0202] Correspondingly, the writing unit 1303 is further configured to detect that the second upgrade parameter is the second value, and merge the update data packet into the directory of the file package to be updated.

[0203] In some embodiments, the writing unit 1303 is further used to:

[0204] Overwriting the second file in the directory of the file package to be updated with the first file in the update data package; the first file has the same name as the second file;

[0205] Writing a third file in the update data packet into the directory of the file package to be updated; the third file is a file in the update data packet other than the first file;

[0206] The fifth file in the file package to be updated is deleted, where the fifth file is the file to be deleted in the file package to be updated.

[0207] In some embodiments, the apparatus 1300 further includes:

[0208] The fallback unit is used to delete the update data packet when the temporary file packet verification fails.

[0209] It should be noted that the file updating device provided in the embodiment of the present application includes the various units included, which can be implemented by a processor in an electronic device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Micro Processor Unit), a digital signal processor (DSP, Digital Signal Processor) or a field programmable gate array (FPGA, Field-Programmable Gate Array), etc.

[0210] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0211] It should be noted that in the embodiment of the present application, if the above-mentioned file update method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.

[0212] Correspondingly, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the file update method provided in the above embodiment is implemented. The electronic device can be a client or a server.

[0213] Correspondingly, an embodiment of the present application provides a storage medium, that is, 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 file updating method provided in the above embodiment are implemented.

[0214] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0215] It should be noted that Fig.14 A hardware entity diagram of an electronic device according to an embodiment of the present application is shown in FIG. Fig.14 As shown, the electronic device 1400 includes: a processor 1401, at least one communication bus 1402, at least one external communication interface 1404 and a memory 1405. The communication bus 1402 is configured to achieve connection and communication between these components. In an example, the electronic device 1400 also includes: a user interface 1403, wherein the user interface 1403 may include a display screen, and the external communication interface 1404 may include a standard wired interface and a wireless interface.

[0216] The memory 1405 is configured to store instructions and applications executable by the processor 1401, and can also cache data to be processed or processed by the processor 1401 and various modules in the electronic device (for example, image data, audio data, voice communication data, and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).

[0217] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.

[0218] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0219] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0220] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0221] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0222] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.

[0223] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0224] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A file updating method, characterized in that: The method comprises: Downloading an update data packet to the target disk partition where the file package to be updated is located; the update data packet is used to update the file package to be updated; Virtually merge the directory of the file package to be updated and the directory of the update data package to obtain a mount directory; Based on the mount directory, calling the file package to be updated and the update data package to obtain a temporary file package; If the temporary file package is successfully verified, merging the update data package into the directory of the file package to be updated; Wherein, the directory of the file package to be updated and the directory of the update data package are virtually merged to obtain a mount directory, including: Add the path of the first file in the directory of the update data package to the mount directory; the first file and the second file in the directory of the file package to be updated are files with the same name; Adding the path of the third file in the directory of the update data package to the mount directory, wherein the third file is a file newly added to the update data package relative to the file package to be updated; Add a fourth file in the directory of the file package to be updated to the mounting directory; the fourth file is a file stored in the directory of the file package to be updated.

2. The method according to claim 1, characterized in that The downloading of the update data package to the target disk partition where the file package to be updated is located includes: The update data package is downloaded to the first space area of ​​the target disk space; the file package to be updated is located in the second space area of ​​the target disk space.

3. The method according to claim 1, characterized in that Before virtually merging the directory of the file package to be updated and the directory of the update data package to obtain a temporary file package, the method further includes: detecting that the download of the update data packet is complete, setting a first upgrade parameter in the boot loader to a first value, and generating a first restart instruction; the first value indicates that the download of the update data packet is complete; Based on the first restart instruction, performing a restart; Correspondingly, it is detected that the first upgrade parameter is the first value, and the directory of the file package to be updated and the directory of the update data package are virtually merged to obtain a temporary file package.

4. The method according to claim 1, characterized in that: Before merging the update data package into the directory of the file package to be updated, the method further includes: Detecting that the temporary file package is successfully verified, setting a second upgrade parameter in the boot loader to a second value, and generating a second restart instruction; the second value indicates that the temporary file package is successfully verified; Based on the second restart instruction, performing a secondary restart; Correspondingly, it is detected that the second upgrade parameter is the second value, and the update data packet is merged into the directory of the file package to be updated.

5. The method according to claim 1, characterized in that The step of merging the update data package into the directory of the file package to be updated includes: Overwriting the second file in the file package to be updated with the first file in the update data package; the first file and the second file have the same name; Writing a third file in the update data packet into the directory of the file package to be updated; the third file is a file in the update data packet other than the first file; The fifth file in the file package to be updated is deleted; the fifth file is the file to be deleted in the file package to be updated.

6. The method according to claim 1, characterized in that The method further comprises: In the case where the temporary file package fails to be verified, the update data package is deleted.

7. A file updating device, characterized in that: The device comprises: A downloading unit, used for downloading an update data packet to a target disk partition where the file package to be updated is located; the update data packet is used for updating the file package to be updated; A stacking unit, used for virtually merging the directory of the file package to be updated and the directory of the update data package to obtain a mounting directory; The stacking unit is further used to add the path of the first file in the directory of the update data package to the mount directory; the first file and the second file in the directory of the file package to be updated are files with the same name; add the path of the third file in the directory of the update data package to the mount directory, the third file is a file newly added by the update data package relative to the file package to be updated; add the fourth file in the directory of the file package to be updated to the mount directory; the fourth file is a file maintained in the directory of the file package to be updated; The stacking unit is further used to call the file package to be updated and the update data package based on the mounting directory to obtain a temporary file package; The writing unit is used to merge the update data package into the directory of the file package to be updated when the temporary file package is successfully verified.

8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps in the file updating method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the file updating method described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Virtual deletion in merged file system directories

    CN101535968A

  • Playback apparatus for performing application-synchronized playback

    CN101916578A

  • Method, system and equipment for updating equipment firmware

    CN101957765A

  • Virtual machine mirror image updating method, server and desktop cloud system

    CN103218248A

  • File updating method and device

    CN106021373A