Movatterモバイル変換


[0]ホーム

URL:


CN112346771A - Upgrade file generation method and device - Google Patents

Upgrade file generation method and device
Download PDF

Info

Publication number
CN112346771A
CN112346771ACN201910725422.8ACN201910725422ACN112346771ACN 112346771 ACN112346771 ACN 112346771ACN 201910725422 ACN201910725422 ACN 201910725422ACN 112346771 ACN112346771 ACN 112346771A
Authority
CN
China
Prior art keywords
file
read
data block
updated
file system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910725422.8A
Other languages
Chinese (zh)
Other versions
CN112346771B (en
Inventor
朱成党
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Gaohang Technology Transfer Co ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co LtdfiledCriticalHangzhou Hikvision Digital Technology Co Ltd
Priority to CN201910725422.8ApriorityCriticalpatent/CN112346771B/en
Publication of CN112346771ApublicationCriticalpatent/CN112346771A/en
Application grantedgrantedCritical
Publication of CN112346771BpublicationCriticalpatent/CN112346771B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明实施例提出升级文件生成方法及装置。方法包括:当只读文件系统产生新的版本时,则保存新版本中相对旧版本只读文件系统发生更新的数据块、该数据块在新版本只读文件系统中的位置;其中,只读文件系统中每个文件占用的数据块的数目固定,且,每个数据块在只读文件系统中的位置固定;构造升级文件,将发生更新的数据块在新版本只读文件系统中的位置、发生更新的数据块的数据内容、以及发生更新的数据块在升级文件中的位置放入升级文件中。本发明实施例在保证只读文件系统成功升级的前提下,减少了只读文件系统的升级文件的长度。

Figure 201910725422

The embodiments of the present invention provide a method and an apparatus for generating an upgrade file. The method includes: when a read-only file system generates a new version, saving a data block in the new version that is updated relative to the read-only file system of the old version, and the position of the data block in the read-only file system of the new version; wherein, the read-only file system The number of data blocks occupied by each file in the file system is fixed, and the position of each data block in the read-only file system is fixed; when an upgrade file is constructed, the position of the updated data block in the new version of the read-only file system , the data content of the updated data block, and the location of the updated data block in the upgrade file are put into the upgrade file. The embodiment of the present invention reduces the length of the upgrade file of the read-only file system on the premise of ensuring the read-only file system is successfully upgraded.

Figure 201910725422

Description

Upgrade file generation method and device
Technical Field
The invention relates to the technical field of file upgrading, in particular to an upgrading file generation method and device.
Background
In the application of the embedded Linux system, the root file system is loaded after the system is started, various background service programs are started through the root file system, application programs are loaded, and a user operation interface is provided.
At present, programs are stored in Flash (such as Nor Flash, Nand Flash and other nonvolatile Flash memory devices) partitions by a file system. In an actual product, if a file system is damaged, not only system services and application programs cannot be loaded and operated normally, but also serious consequences that the system cannot be started normally are caused.
In some systems requiring high reliability, in order to ensure the stability and reliability of the system, the file systems of the background service programs and the application programs are stored in a certain partition of a storage device (such as a non-volatile Flash device like Nor Flash and Nand Flash) of the system in a read-only manner, and the file systems are set to be read-only and non-modifiable, so that the damage of the file systems caused by accidental operation can be prevented and avoided, the file systems can be normally mounted when the system is started, and the reliability of the system is enhanced. Because the Squashfs and Cramfs have the characteristic of read-only compression, the Squashfs and Cramfs are often used as file systems of programs in the current product development, so that the system reliability can be enhanced, and the hardware cost can be saved.
And when the program needs to be updated, Squashfs and Cramfs need to be upgraded. The current upgrading method comprises the following steps: the whole Squashfs and Cramfs file systems are erased, and then new Squashfs and Cramfs file systems are written for upgrading.
Disclosure of Invention
The embodiment of the invention provides an upgrade file generation method and device, which are used for reducing the length of an upgrade file of a read-only file system on the premise of ensuring the successful upgrade of the read-only file system.
The technical scheme of the embodiment of the invention is realized as follows:
an upgrade file generation method, the method comprising:
when the read-only file system generates a new version, storing a data block which is updated relative to the read-only file system of the old version in the new version and the position of the data block in the read-only file system of the new version; the number of data blocks occupied by each file in the read-only file system is fixed, and the position of each data block in the read-only file system is fixed;
and constructing an upgrade file, and putting the position of the data block where the update occurs in the new version read-only file system, the data content of the data block where the update occurs and the position of the data block where the update occurs in the upgrade file into the upgrade file.
An upgrade file generation apparatus, the apparatus comprising:
the comparison module is used for storing the data block which is updated relative to the read-only file system of the old version in the new version and the position of the data block in the read-only file system of the new version when the read-only file system generates a new version; the number of data blocks occupied by each file in the read-only file system is fixed, and the position of each data block in the read-only file system is fixed;
and the upgrading file constructing module is used for constructing an upgrading file and placing the position of the updated data block in the new version read-only file system, the data content of the updated data block and the position of the updated data block in the upgrading file into the upgrading file.
An upgrade file generation apparatus comprising a processor for carrying out the steps of the method as described above.
A non-transitory computer readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the method as described above.
In the embodiment of the invention, the structure of the read-only file system is set as follows: the number of data blocks occupied by each file is fixed, and the position of each data block in the read-only file system is fixed; when the read-only file system generates a new version, the updated data block in the new version relative to the read-only file system of the old version and the position of the data block in the read-only file system of the new version are stored, and the upgrade file is constructed only according to the updated data block, so that the length of the upgrade file is reduced and the transmission speed of the upgrade file is accelerated on the premise of ensuring the successful upgrade of the read-only file system.
Drawings
Fig. 1 is a flowchart of an upgrade file generation method according to an embodiment of the present invention;
fig. 2 is a flowchart of an upgrade file generation method according to another embodiment of the present invention;
fig. 3 is a schematic structural diagram of Squashfs when the read-only file system in table 1 provided by the embodiment of the present invention is Squashfs;
FIG. 4 is a schematic structural diagram of Cramfs when the read-only file system in Table 1 is Cramfs according to an embodiment of the present invention;
fig. 5 is a diagram illustrating a structure of an upgrade file according to an embodiment of the present invention;
fig. 6 is a diagram illustrating a structure of a file header of an upgrade file according to an embodiment of the present invention;
fig. 7 is an upgrade file generation apparatus according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
The inventor analyzes the existing Squashfs and Cramfs upgrading method and finds that the defects are as follows:
firstly, because the data arrangement of each file in the Squashfs and the cramf must be closely arranged according to bytes, the upgrading of the Squashfs and the cramf must be a complete upgrading mode, so that the flash partitions where the Squashfs and the cramf are located need to be erased during upgrading, new Squashfs and cramf are written, if the equipment uses nor flash to store the Squashfs and the cramf, the whole upgrading process is time-consuming, meanwhile, the instability of the system is also increased, and if the equipment is powered off in the upgrading process, the upgrading process must be executed again after the equipment is restarted;
and secondly, the whole Squashfs and Cramfs are transmitted when the Squashfs and Cramfs are remotely upgraded, and the transmission time consumption of the upgrade package is long for remote mountainous areas with unstable signals.
The inventor analyzes and discovers that the upgrading process of Squashfs and Cramfs comprises the following steps:
when the Squashfs and Cramfs are upgraded, only a certain file in the Squashfs and the Cramfs needs to be updated actually, but the files are limited to be read-only file systems in the Squashfs and the Cramfs, and the file cannot be directly modified in the prior art, so that the prior art still needs to manufacture complete Squashfs and Cramfs.
According to the above analysis, in order to overcome the drawbacks of the prior art, the inventors present the following solutions:
fig. 1 is a flowchart of an upgrade file generation method according to an embodiment of the present invention, which includes the following specific steps:
step 101: when the read-only file system generates a new version, storing a data block which is updated relative to the read-only file system of the old version in the new version and the position of the data block in the read-only file system of the new version; the number of data blocks occupied by each file in the read-only file system is fixed, and the position of each data block in the read-only file system is fixed.
Specifically, when the read-only file system generates a new version, the data block pairs at the same position in the new version and the old version of the read-only file system are sequentially compared, and if the contents of the two data blocks in any data block pair are different, it is determined that the data block in the new version is updated.
Step 102: and constructing an upgrade file, and putting the position of the data block where the update occurs in the new version read-only file system, the data content of the data block where the update occurs and the position of the data block where the update occurs in the upgrade file into the upgrade file.
In the implementation of the invention, the number of the data blocks occupied by each file in the read-only file system is fixed, and the position of each data block in the read-only file system is fixed, so that when the data blocks in the read-only file system are updated, the data blocks in the new version and the old version can be determined by comparing the data block pairs at the same positions, and the updated file is constructed only according to the updated data blocks, so that the length of the updated file is reduced on the premise of ensuring the successful update of the read-only file system, and the transmission speed of the updated file is accelerated.
Specifically, placing the location of the data block where the update occurs in the new version read-only file system, the data content of the data block where the update occurs, and the location of the data block where the update occurs in the upgrade file into the upgrade file may include:
the method comprises the steps of placing the position of an updated data block in a new version read-only file system into a file header or a file tail or a content part of an upgrade file, and preferentially selecting the file header of the upgrade file, wherein when the file tail or the content part of the upgrade file is placed, the position of the file tail or the content part is required to be marked in the file header;
putting the data content of the updated data block into the content part of the upgrade file;
and placing the position of the updated data block in the upgrade file into a file header or a file tail or a content part of the upgrade file, and preferentially selecting the file header into which the upgrade file is placed, wherein when the file tail or the content part of the upgrade file is placed, the position of the file tail or the content part is required to be marked in the file header.
The position of the updated data block in the new version read-only file system can be represented by the offset of the data block in the new version read-only file system and the length of the data block; the location of the data block in the upgrade file where the update occurs may be represented by the offset of the data block in the upgrade file and the length of the data block.
In practical applications,step 102 may be further followed by:
according to the position of a data block which is updated in an upgrade file in a new version read-only file system, finding a data block to be updated in an old version read-only file system, wherein the position of the data block to be updated in the old version read-only file system corresponds to the position of the data block which is updated in the new version read-only file system; and erasing the data block to be updated, and writing the data block which is updated in the new version.
By the embodiment, when the read-only file system is updated, only the erasing and writing operation of the data block is needed to be carried out on the position where the updated data block is located in the read-only file system of the old version, so that the upgrading speed of the file system is accelerated.
In practical applications, afterstep 101 and beforestep 102, the method may further include: when a plurality of continuous data blocks in the new version are updated, taking the plurality of continuous data blocks as a data segment, and taking the independent data blocks which are updated as a data segment;
instep 102, the position of the data segment in the new version, which is updated, in the read-only file system of the new version and the position of the data segment in the new version, which is updated, in the upgrade file are put into the upgrade file;
and, after thestep 102, further comprising: reading the updated data segment from the content part of the upgrade file according to the position of the updated data segment in the upgrade file; according to the position of the updated data segment in the updated file in the new version read-only file system, the data segment to be updated is found in the old version read-only file system; and erasing the data segment to be updated, and writing the data segment which is updated in the new version.
Specifically, the placing the position of the data segment updated in the new version read-only file system and the position of the data segment updated in the new version in the upgrade file may include:
the method comprises the steps of placing the position of a data segment which is updated in a new version in a read-only file system of the new version into a file header or a file tail or a content part of an upgrade file, and preferentially selecting the file header of the upgrade file, wherein when the file tail or the content part of the upgrade file is placed, the position of the file tail or the content part is required to be marked in the file header;
and placing the position of the data segment which is updated in the new version in the upgrade file into the file header or the file tail or the content part of the upgrade file, and preferentially selecting the file header which is placed in the upgrade file, wherein when the file tail or the content part of the upgrade file is placed, the position of the file tail or the content part is required to be marked in the file header.
The position of the data segment which is updated in the new version read-only file system can be represented by the offset of the data segment in the new version read-only file system and the length of the data segment; the location of the data segment in the upgrade file where the update occurs in the new version may be represented by the offset of the data segment in the upgrade file and the length of the data segment.
Through the embodiment, the plurality of continuous data blocks which are updated are used as one data segment, so that the length of the upgrade file is further reduced, and the transmission speed of the upgrade file is further increased.
In practical applications,step 101 may further include: when the read-only file system of the initial version is manufactured, data blocks are distributed for each file according to the maximum data block number contained in each file in the file system which is configured in advance, and then the initial data of each file is written into the data blocks distributed for the file in sequence.
Through the embodiment, the data blocks are distributed for the files according to the maximum data block number contained in each file in the file system which is configured in advance, so that the file systems with different sizes can be upgraded by adopting the upgrading method provided by the embodiment of the invention.
In practical applications, afterstep 102, the method may further include: and calculating the encrypted value of the upgrade file by adopting a message digest algorithm, sending the encrypted value and the upgrade file to the equipment using the read-only file system, calculating the encrypted value of the upgrade file by adopting the same message digest algorithm after the equipment receives the encrypted value and the upgrade file, and determining that the upgrade file is normal if the calculated encrypted value is the same as the received encrypted value.
Through the embodiment, the upgrading file is encrypted, and the safe transmission of the upgrading file is ensured.
The read-only file system in the embodiment of the invention can be Squashfs or Cramfs.
Fig. 2 is a flowchart of an upgrade file generation method according to another embodiment of the present invention, which includes the following specific steps:
step 200: when a read-only file system of an initial version is manufactured, distributing data blocks for each file according to the maximum data block number contained in each file in the file system configured in advance, and then writing initial data of each file into the data blocks distributed for the file in sequence; the initial version of the read-only file system is configured on the device.
A read-only file system contains one or more files. The individual files are typically arranged in a read-only file system in the order of the file names from a to z.
Table 1 is a configuration table of the maximum number of data blocks included in each file in a read-only file system:
Figure BDA0002158761330000071
Figure BDA0002158761330000081
TABLE 1
In a read-only file system of each version (including the original version), the data blocks included in each file are not necessarily written with data, i.e., there are some reserved data blocks.
Fig. 3 is a schematic structural diagram of Squashfs when the read-only file system in table 1 is Squashfs. As shown in fig. 3, block 0 is a super block and is used to store the structure of file system metadata, block n is used to store information such as index, and other blocks include: blocks 1-n-1 are used to store file data, where which blocks are assigned to which file is predefined, as in FIG. 3, blocks 1-3 are used to store data for file 1, and blocks 4-7 are used to store data for file 2, …. Since it is ensured that all versions of file data can be written into corresponding blocks, enough blocks are allocated to each file, so that after the initial version of file data is written into a block, some reserved blocks exist, as shown in fig. 3, the data of file 1 only occupies all of block 1 and a part of block 2, and the data of file 2 only occupies all of block 4 and a part of block 5.
FIG. 4 is a schematic structural diagram of Cramfs when the read-only file system in Table 1 is Cramfs. As shown in FIG. 4, blocks 0 through x-1 are used to store superblock information, indexes, directories, etc., and blocks x and beyond are used to store file data, where which blocks are assigned to which file is predefined, as in FIG. 4, blocks x through x +2 are used to store data for file 1, and blocks x +3 through x +6 are used to store data for file 2, …. Since it is ensured that all versions of file data can be written into corresponding blocks, enough blocks are allocated to each file, so that after the initial version of file data is written into a block, some reserved blocks exist, as shown in fig. 4, the data of file 1 only occupies all of block x and a part of block x +1, and the data of file 2 only occupies all of block x +3 and a part of block x + 4.
Step 201: when a remote client finds that the read-only file system generates a new version, sequentially comparing each data block pair at the same position in the new version and the old version of the read-only file system, if the contents of two data blocks in any data block pair are different, determining that the data block in the new version is updated, and storing the data block which is updated in the new version, the offset of the data block in the read-only file system of the new version and the length of the data block.
Since the location of each file in the read-only file system is fixed. Therefore, by comparing whether the contents of the data blocks at the same position in the new version and the old version are the same or not, which data blocks are updated can be known, and only the data blocks in the new version which are updated need to be stored.
Step 202: and when the remote client determines that all the data block pairs are compared, regarding each updated data block in the stored new version, if continuous data blocks exist, taking each group of continuous data blocks as a data segment, and taking each remaining data block as a data segment.
Consecutive data blocks, i.e. data blocks where an update has occurred, are located adjacently in the new version of the read-only file system.
Step 203: the remote client constructs an upgrade file.
The method comprises the following steps of placing the offset of each data segment which is updated in a new version in a read-only file system of the new version, the length of each data segment and the number of the data segments which are updated into a file header of an upgrade file; sequentially placing the data segments into the content part of the upgrade file according to the sequence from small to large of the data block numbers contained in the data segments; then, the offset of each data segment in the upgrade file is put into the file header of the upgrade file.
It should be noted that, in practical application, the offset of each data segment in the new version that is updated in the read-only file system of the new version, the length of each data segment, and the number of data segments that are updated may also be placed at the end of the file and the content of the updated file, and at this time, the specific positions of the end of the file and the content of the updated file need to be marked in the header of the updated file;
meanwhile, the offset of each data segment in the upgrade file can also be placed in the file tail or the content part of the upgrade file, and at this time, the specific positions of the file tail and the content part of the upgrade file need to be marked in the file header of the upgrade file.
Fig. 5 is a diagram showing a structure example of an upgrade file, and as shown in fig. 5, the upgrade file mainly includes an upgrade file header and an upgrade file content, and data of data segments 1 to k in a new version, which are updated, are stored in the upgrade file content.
Fig. 6 is a diagram showing an example of the structure of a file header of an upgrade file, in this example, the number k of data segments in which an update occurs in a new version, and each data segment in which an update occurs in a new version include: the offset of the data segments 1-k in the upgrade file and each data segment updated in the new version comprise: the offsets of the data segments 1-k in the read-only file system of the new version are all placed in the header of the upgrade file.
Step 204: the remote client calculates the encryption value of the upgrade file by using an MD (Message-Digest) 5 algorithm, and generates an MD5 file according to the encryption value.
Step 205: and the remote client packs the upgrade file and the MD5 file into an upgrade pack and then sends the upgrade pack to the equipment.
Step 206: the equipment receives the upgrade package, obtains the upgrade file and the MD5 file after decompression, analyzes the encryption value from the MD5 file, performs MD5 calculation on the upgrade file to obtain the encryption value, and determines that the upgrade file is normal if the obtained encryption value is consistent with the analyzed encryption value.
Step 207: the equipment analyzes the file header of the upgrade file, and reads each data segment from the content part of the upgrade file in sequence according to the analyzed number of the updated data segments and the offset of each data segment in the upgrade file.
Step 208: the device searches each data segment to be updated in the read-only file system of the old version stored on the device in sequence according to the offset of each data segment which is analyzed from the file header and is updated in the read-only file system of the new version and the length of each data segment, erases the data segment to be updated from the corresponding storage position, and writes the corresponding data segment of the new version in the corresponding storage position.
The read-only file system in the embodiment of the present invention may be a mirror file system, such as: binary file system in format of BIN (Binary), etc.
Fig. 7 is an upgrade file generation apparatus according to an embodiment of the present invention, where the apparatus mainly includes: acomparison module 71 and an upgradefile construction module 72, wherein:
thecomparison module 71 is configured to, when the read-only file system generates a new version, store a data block that is updated with respect to the read-only file system of the old version in the new version, and a position of the data block in the read-only file system of the new version; the number of data blocks occupied by each file in the read-only file system is fixed, and the position of each data block in the read-only file system is fixed.
An upgradefile constructing module 72, configured to construct an upgrade file according to the data block updated in the new version and the location of the data block in the new version read-only file system, which are stored in the comparingmodule 71, and place the location of the data block in the new version read-only file system, the data content of the data block, and the location of the data block in the upgrade file.
Another embodiment of the present invention provides an upgrade file generation apparatus, which includes a processor configured to perform the steps of the method as described in fig. 1 or fig. 2.
Embodiments of the invention also provide a non-transitory computer readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the method as described in fig. 1 or fig. 2.
Embodiments of the present invention also provide an electronic device, including the non-transitory computer readable storage medium as described above, and the above processor having access to the non-transitory computer readable storage medium.
The embodiment of the invention has the following beneficial technical effects:
the structure of the read-only file system is set as follows: the number of the data blocks occupied by each file is fixed, and the position of each data block in the read-only file system is fixed, so that when a new version is generated in the read-only file system, only the data block which is updated in the new version compared with the old version needs to be put into the upgrade file, the length of the upgrade file is reduced on the premise of ensuring the successful upgrade of the read-only file system, and the transmission speed of the upgrade file is accelerated;
in addition, for the equipment using the read-only file system, the whole read-only file system is not required to be erased and written, but only the data block which needs to be updated in the old version of the read-only file system is required to be erased and written, the upgrading speed is greatly improved, the system stability is also improved, if the equipment is powered off in the upgrading process, only the file which is being upgraded is influenced, other files cannot be influenced, and after the equipment is restarted, the upgrading process of the file which is being upgraded is required to be restarted.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

Translated fromChinese
1.一种升级文件生成方法,其特征在于,该方法包括:1. A method for generating an upgrade file, characterized in that the method comprises:当只读文件系统产生新的版本时,则保存新版本中相对旧版本只读文件系统发生更新的数据块、该数据块在新版本只读文件系统中的位置;其中,只读文件系统中每个文件占用的数据块的数目固定,且,每个数据块在只读文件系统中的位置固定;When the read-only file system generates a new version, the data block in the new version that is updated relative to the read-only file system of the old version and the position of the data block in the read-only file system of the new version are saved; wherein, in the read-only file system The number of data blocks occupied by each file is fixed, and the position of each data block in the read-only file system is fixed;构造升级文件,将发生更新的数据块在新版本只读文件系统中的位置、发生更新的数据块的数据内容、以及发生更新的数据块在升级文件中的位置放入升级文件中。An upgrade file is constructed, and the location of the updated data block in the read-only file system of the new version, the data content of the updated data block, and the location of the updated data block in the upgrade file are put into the upgrade file.2.根据权利要求1所述的方法,其特征在于,将发生更新的数据块在新版本只读文件系统中的位置、发生更新的数据块的数据内容、以及发生更新的数据块在升级文件中的位置放入升级文件中包括:2. method according to claim 1 is characterized in that, the position of the updated data block in the new version read-only file system, the data content of the updated data block and the updated data block in the upgrade file The location in the upgrade file includes:将发生更新的数据块在新版本只读文件系统中的位置放入升级文件的文件头或者文件尾,将发生更新的数据块的数据内容放入升级文件的内容部分,并将发生更新的数据块在升级文件中的位置放入升级文件的文件头或者文件尾。Put the position of the updated data block in the read-only file system of the new version into the file header or file end of the upgrade file, put the data content of the updated data block into the content part of the upgrade file, and put the updated data The position of the block in the upgrade file is placed in the header or footer of the upgrade file.3.根据权利要求1所述的方法,其特征在于,在构造升级文件之后进一步包括:3. The method according to claim 1, further comprising: after constructing the upgrade file:根据升级文件中发生更新的数据块在升级文件中的位置,从升级文件的内容部分读取发生更新的数据块;According to the position of the updated data block in the upgrade file, the updated data block is read from the content part of the upgrade file;根据升级文件中发生更新的数据块在新版本只读文件系统中的位置,在旧版本只读文件系统中查找到待更新数据块,所述待更新数据块在旧版本只读文件系统中位置与所述发生更新的数据块在新版本只读文件系统中的位置相对应;According to the position of the updated data block in the upgrade file in the read-only file system of the new version, the data block to be updated is found in the read-only file system of the old version, and the data block to be updated is located in the read-only file system of the old version. Corresponding to the position of the updated data block in the read-only file system of the new version;将待更新的数据块擦除,并写入新版本中发生更新的数据块。Erase the data block to be updated and write the updated data block in the new version.4.根据权利要求1所述的方法,其特征在于,所述保存新版本中相对旧版本只读文件系统发生更新的数据块、该数据块在新版本只读文件系统中的位置之后、构造升级文件之前,进一步包括:4. The method according to claim 1 , wherein the data block in the new version that is updated relative to the read-only file system of the old version, the data block after the position in the read-only file system of the new version, the structure Before the upgrade file, further include:当新版本中存在连续的多个数据块都发生更新,则将该连续的多个数据块作为一个数据段,将独立的发生更新的数据块作为一个数据段;When multiple consecutive data blocks are updated in the new version, the consecutive multiple data blocks are regarded as a data segment, and the independently updated data blocks are regarded as a data segment;所述构造升级文件包括:The construction upgrade file includes:将新版本中发生更新的数据段在新版本只读文件系统中的位置放入升级文件的文件头或者文件尾;Put the position of the updated data segment in the new version in the read-only file system of the new version into the file header or file end of the upgrade file;将发生更新的数据段在升级文件中的位置放入升级文件的文件头或者文件尾。Put the position of the updated data segment in the upgrade file into the file header or file tail of the upgrade file.5.根据权利要求4所述的方法,其特征在于,所述构造升级文件之后进一步包括:5. The method according to claim 4, characterized in that, after said constructing the upgrade file, it further comprises:根据升级文件的文件头或者文件尾中的发生更新的数据段在升级文件中的位置,从升级文件的内容部分读取发生更新的数据段;According to the position of the updated data segment in the file header or file tail of the update file in the update file, read the updated data segment from the content part of the update file;根据升级文件的文件头或者文件尾中的发生更新的数据段在新版本只读文件系统中的位置,在旧版本只读文件系统中查找到待更新数据段;According to the position of the updated data segment in the file header or file tail of the upgrade file in the read-only file system of the new version, the data segment to be updated is found in the read-only file system of the old version;将待更新数据段擦除,并写入新版本中发生更新的数据段。Erase the data segment to be updated and write the updated data segment in the new version.6.根据权利要求1所述的方法,其特征在于,所述只读文件系统产生新的版本之前进一步包括:6. The method according to claim 1, wherein before the read-only file system generates a new version, the method further comprises:在制作初始版本的只读文件系统时,根据预先配置的该文件系统中各个文件包含的最大数据块数,为各个文件分配数据块,然后将每个文件的初始数据依次写入为该文件分配的数据块。When making the initial version of the read-only file system, according to the pre-configured maximum number of data blocks contained in each file in the file system, data blocks are allocated to each file, and then the initial data of each file is written in turn to allocate for the file data block.7.根据权利要求1或5所述的方法,其特征在于,所述构造升级文件之后进一步包括:7. The method according to claim 1 or 5, wherein after constructing the upgrade file, the method further comprises:采用消息摘要算法计算升级文件的加密值,将该加密值和升级文件一起发送给使用该只读文件系统的设备。A message digest algorithm is used to calculate the encrypted value of the upgrade file, and the encrypted value and the upgrade file are sent to the device using the read-only file system.8.一种升级文件生成装置,其特征在于,该装置包括:8. A device for generating an upgrade file, characterized in that the device comprises:对比模块,用于当只读文件系统产生新的版本时,则保存新版本中相对旧版本只读文件系统发生更新的数据块、该数据块在新版本只读文件系统中的位置;其中,只读文件系统中每个文件占用的数据块的数目固定,且,每个数据块在只读文件系统中的位置固定;The comparison module is used for, when the read-only file system generates a new version, to save the updated data block in the new version relative to the read-only file system of the old version, and the position of the data block in the read-only file system of the new version; wherein, The number of data blocks occupied by each file in the read-only file system is fixed, and the position of each data block in the read-only file system is fixed;升级文件构造模块,用于构造升级文件,将发生更新的数据块在新版本只读文件系统中的位置、发生更新的数据块的数据内容、以及发生更新的数据块在升级文件中的位置放入升级文件中。The upgrade file construction module is used to construct an upgrade file, and put the position of the updated data block in the read-only file system of the new version, the data content of the updated data block, and the position of the updated data block in the upgrade file. into the upgrade file.9.一种升级文件生成装置,其特征在于,该装置包括处理器,用于执行如权利要求1至7任一所述方法的步骤。9 . An apparatus for generating an upgrade file, characterized in that the apparatus comprises a processor for executing the steps of the method according to any one of claims 1 to 7 . 10 .10.一种非瞬时计算机可读存储介质,其特征在于,该非瞬时计算机可读存储介质存储指令,该指令在由处理器执行时使得处理器执行如权利要求1至7任一所述方法的步骤。10. A non-transitory computer-readable storage medium, characterized in that, the non-transitory computer-readable storage medium stores instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 7 A step of.
CN201910725422.8A2019-08-072019-08-07 Upgrade file generation method and deviceActiveCN112346771B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201910725422.8ACN112346771B (en)2019-08-072019-08-07 Upgrade file generation method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201910725422.8ACN112346771B (en)2019-08-072019-08-07 Upgrade file generation method and device

Publications (2)

Publication NumberPublication Date
CN112346771Atrue CN112346771A (en)2021-02-09
CN112346771B CN112346771B (en)2024-05-31

Family

ID=74366690

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910725422.8AActiveCN112346771B (en)2019-08-072019-08-07 Upgrade file generation method and device

Country Status (1)

CountryLink
CN (1)CN112346771B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113282325A (en)*2021-06-172021-08-20北京紫光展锐通信技术有限公司Method and device for upgrading file system, storage medium and computing equipment
CN113626872A (en)*2021-10-112021-11-09宁波集联软件科技有限公司Control method for integrity of preset resources in automobile memory chip module

Citations (16)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP0994425A2 (en)*1998-06-302000-04-19iOra Ltd.System and method for generating file updates for files stored on read-only media
TW428146B (en)*1999-05-052001-04-01Inventec CorpData file updating method by increment
CN1310388A (en)*2000-02-212001-08-29英业达股份有限公司 A method for updating data files in an incremental manner
US6374268B1 (en)*1998-04-142002-04-16Hewlett-Packard CompanyMethods and systems for an incremental file system
US20050065986A1 (en)*2003-09-232005-03-24Peter BixbyMaintenance of a file version set including read-only and read-write snapshot copies of a production file
CN101770515A (en)*2010-01-182010-07-07杭州顺网科技股份有限公司Data block comparison based data updating method
CN102054041A (en)*2010-12-302011-05-11用友软件股份有限公司Method and system for upgrading metadata
CN102096615A (en)*2011-01-252011-06-15上海爱数软件有限公司Remote incremental backup method and system
CN103777986A (en)*2014-01-262014-05-07宝龙计算机系统(湖南)有限公司Method and device for saving modification of Unix-like operating system
CN104298532A (en)*2014-11-042015-01-21上海斐讯数据通信技术有限公司Upgrading method and upgrading system for software
CN104834547A (en)*2015-05-142015-08-12烽火通信科技股份有限公司Remote upgrade method and system of Squashfs read-only root file system
CN105786563A (en)*2016-02-192016-07-20联州(上海)信息科技有限公司Device, system and method for achieving software online update
CN106598576A (en)*2016-11-302017-04-26深圳市泛海三江科技发展有限公司Equipment parameter updating method and device based on squashfs read-only file
CN106886436A (en)*2017-01-232017-06-23青岛海信移动通信技术股份有限公司A kind of method and apparatus of android system upgrading
CN108228224A (en)*2017-12-212018-06-29杭州中天微系统有限公司A kind of method and device of embedded system difference upgrading
US20190146773A1 (en)*2017-11-162019-05-16Atlassian Pty LtdSystems and processes for updating computer applications

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6374268B1 (en)*1998-04-142002-04-16Hewlett-Packard CompanyMethods and systems for an incremental file system
EP0994425A2 (en)*1998-06-302000-04-19iOra Ltd.System and method for generating file updates for files stored on read-only media
TW428146B (en)*1999-05-052001-04-01Inventec CorpData file updating method by increment
CN1310388A (en)*2000-02-212001-08-29英业达股份有限公司 A method for updating data files in an incremental manner
US20050065986A1 (en)*2003-09-232005-03-24Peter BixbyMaintenance of a file version set including read-only and read-write snapshot copies of a production file
CN101770515A (en)*2010-01-182010-07-07杭州顺网科技股份有限公司Data block comparison based data updating method
CN102054041A (en)*2010-12-302011-05-11用友软件股份有限公司Method and system for upgrading metadata
CN102096615A (en)*2011-01-252011-06-15上海爱数软件有限公司Remote incremental backup method and system
CN103777986A (en)*2014-01-262014-05-07宝龙计算机系统(湖南)有限公司Method and device for saving modification of Unix-like operating system
CN104298532A (en)*2014-11-042015-01-21上海斐讯数据通信技术有限公司Upgrading method and upgrading system for software
CN104834547A (en)*2015-05-142015-08-12烽火通信科技股份有限公司Remote upgrade method and system of Squashfs read-only root file system
CN105786563A (en)*2016-02-192016-07-20联州(上海)信息科技有限公司Device, system and method for achieving software online update
CN106598576A (en)*2016-11-302017-04-26深圳市泛海三江科技发展有限公司Equipment parameter updating method and device based on squashfs read-only file
CN106886436A (en)*2017-01-232017-06-23青岛海信移动通信技术股份有限公司A kind of method and apparatus of android system upgrading
US20190146773A1 (en)*2017-11-162019-05-16Atlassian Pty LtdSystems and processes for updating computer applications
CN108228224A (en)*2017-12-212018-06-29杭州中天微系统有限公司A kind of method and device of embedded system difference upgrading

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
1-10: "AFC数据块快速备份与恢复策略", 《电脑编程技巧与维护》, no. 7, 3 April 2013 (2013-04-03), pages 49 - 52*
BASEM ASSIRI, ET.AL: "Approximately Opaque Multi-version Permissive Transactional Memory", 《45TH INTERNATIONAL CONFERENCE ON PARALLEL PROCESSING WORKSHOPS (ICPPW)》, 26 September 2016 (2016-09-26), pages 393 - 402*
王广辉: "嵌入式固件远程升级技术的研究与实现", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》, no. 1, 15 January 2012 (2012-01-15), pages 137 - 41*
赵伟华等: "《计算机操作系统》", 西安电子科技大学出版社, pages: 304 - 307*

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113282325A (en)*2021-06-172021-08-20北京紫光展锐通信技术有限公司Method and device for upgrading file system, storage medium and computing equipment
CN113626872A (en)*2021-10-112021-11-09宁波集联软件科技有限公司Control method for integrity of preset resources in automobile memory chip module

Also Published As

Publication numberPublication date
CN112346771B (en)2024-05-31

Similar Documents

PublicationPublication DateTitle
US7873956B2 (en)Communication terminal and communication network for partially updating software, software update method, and software creation device and method therefor
US5802549A (en)Method and apparatus for patching pages of ROM
KR102319657B1 (en)Managing operations on stored data units
JP4777426B2 (en) Apparatus, system and method for accessing persistent files in NON-EXECUTE-IN-PLACE flash memory
US8176009B2 (en)Performing a pre-update on a non volatile memory
US10804930B2 (en)Compressed data layout with variable group size
CN110032339B (en)Data migration method, device, system, equipment and storage medium
US9465538B2 (en)Flash memory control chip and data storage device and flash memory control method
CN109542495A (en)A kind of method for upgrading software and device
CN101983376A (en)Access device, information recording device, information recording system, file management method, and program
KR20170010810A (en)Method, device and user equipment for reading/writing data in nand flash
JP2013235531A (en)Control device, storage device, and storage control method
WO2020107436A1 (en)Program upgrade method and embedded device
WO2019041891A1 (en)Method and device for generating upgrade package
CN112346771A (en)Upgrade file generation method and device
US20120151005A1 (en)Image file download method
US11176089B2 (en)Systems and methods for implementing dynamic file systems
CN110554934B (en)Embedded equipment and system partitioning and upgrading method thereof
CN109669628B (en)Data storage management method and device based on flash equipment
JP2007133541A (en) Storage device, memory management device, memory management method, and program
CN117098105A (en)Firmware upgrading method, device and system for embedded equipment cluster
CN116009923A (en)Control method, device and storage medium for firmware differential upgrade
CN101339513B (en)Data updating method for basic input/output system
JP2014225297A (en)Flash memory module and storage device
US20110082995A1 (en)Information processing apparatus

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
TR01Transfer of patent right

Effective date of registration:20250729

Address after:Rooms 602 and 605, No. 85 Xiangxue Avenue Middle, Huangpu District, Guangzhou City, Guangdong Province 510000

Patentee after:Guangzhou Gaohang Technology Transfer Co.,Ltd.

Country or region after:China

Address before:Hangzhou City, Zhejiang province 310051 Binjiang District Qianmo Road No. 555

Patentee before:Hangzhou Hikvision Digital Technology Co.,Ltd.

Country or region before:China

TR01Transfer of patent right

[8]ページ先頭

©2009-2025 Movatter.jp