Method, device and storage medium for upgrading embedded device
Patent Information
- Application Number
- CN202611003529.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]上述升级方式在生成差分包的过程中,容易存在目标镜像文件与原始镜像文件的潜在匹配未被充分利用的情况,存在生成的差分包比较大需要占用嵌入式设备更多内存的问题
本发明实施例中,对原始镜像文件采用固定分段大小和改变首段分段大小的两种分段方式,可以避免目标镜像文件的分段同时落在两种分段方式的分段边界的情况,避免造成相邻两端数据均需要更新造成差分包变大,提升差分准确性,减少差分包大小,能够大幅减少差分数据写入待升级设备,进一步提升用户体验,增加用户体验。在本发明实施例方法中,通过改变原始镜像文件分段方式,减小了差分包大小,优化了内存使用,避免了因待升级设备内存不足导致的升级失败。
Smart Images

Figure CN122924802A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of device upgrade technology, and more specifically to an embedded device upgrade method, device, and storage medium. Background Technology
[0002] Upgrading embedded devices is essential for updating and maintaining their functionality or data. Currently, embedded device upgrades typically employ a differential upgrade method, which involves: identifying the original image file corresponding to the old firmware and the target image file corresponding to the new firmware; matching the original and target image files to determine their commonalities; and then packaging the remaining portion of the target image file into a differential package. During differential restoration, the commonalities are copied from the original image file, and the differential package is inserted into the appropriate location to reassemble the new firmware.
[0003] The above upgrade method may result in underutilization of potential matching between the target image file and the original image file during the generation of the differential package, leading to a larger generated differential package that requires more memory from the embedded device. Summary of the Invention
[0004] In view of this, this application provides an embedded device upgrade method, device, and storage medium that can reduce the size of differential upgrade packages and differential data writing, thereby further improving the user experience.
[0005] In a first aspect, embodiments of the present invention provide an embedded device upgrade method, applied to a device to be upgraded, the method comprising: Divide the target image file into segments according to the first length; The first segmentation method involves dividing the original image file into segments of a second length, where the second length is more than twice the first length. The second segmentation method involves segmenting the first segment of the original image file according to a third length, and segmenting the remaining part according to the second length, wherein the third length is no greater than half of the second length; The segments of the target image file are compared with the segments of the original image file in the first segmentation method in a first direction. If they are not completely matched, the segments of the target image file are compared with the segments of the original image file in the second segmentation method in a second comparison. If it is not a perfect match, perform difference to obtain the difference result; if it is a perfect match, there is no need to perform difference. The difference results of each segment of the target image file are collected into a difference package.
[0006] In some embodiments, the first comparison and the second comparison include: Extract the first feature vector of the i-th segment of the target image file, where the i-th segment is one of the segments of the target image file; Extract the second feature vector of the j-th segment of the original image file, where the j-th segment is the segment of the original image file to be compared with the i-th segment; The first feature vector and the second feature vector are input into a neural network model trained using historical upgrade data. The neural network model is used to predict the matching degree between the i-th segment and the j-th segment, where i and j are natural numbers. When the matching degree is greater than the first threshold, it is determined that the i-th segment of the target image file completely matches the j-th segment of the original image file. Otherwise, it is determined that the i-th segment of the target image file does not completely match the j-th segment of the original image file.
[0007] In some embodiments, a first comparison is performed between the segments of the target image file and the segments of the original image file in a first direction, including: The i-th segment of the target image file is compared with the x-th part of the j-th segment of the original image file, wherein the i-th segment is a segment of the target image file, the j-th segment is the segment of the original image file to be compared with the i-th segment in the first segmentation method, and the x-th part is a part of the j-th segment; If the i-th segment completely matches the x-th part in the j-th segment, then the (i+1)-th segment of the target image file is compared with the (x+1)-th part of the original image file in the first segmentation method according to the first direction; In the first segmentation method, the (x+1)th part is located in the j-th segment or the (j+1)-th segment of the original image file.
[0008] In some embodiments, the method further includes: If the i-th segment does not completely match the x-th part of the j-th segment, then the i-th segment is compared with the y-th part of the p-th segment of the original image file in the second segmentation method in the first direction until a completely matching part is found in the original image file in the second segmentation method or all remaining segments of the original image file are compared; the p-th segment is the segment of the original image file in the second segmentation method to be compared with the i-th segment, and the y-th part is one of the parts of the p-th segment; If the i-th segment does not completely match any of the segments of the original image file in the second segmentation method, then the i-th segment is differentially analyzed to obtain the first differential result of the i-th segment.
[0009] In some embodiments, the method further includes: If the i-th segment completely matches the y-th part of the p-th segment of the original image file in the second segmentation method, then the (i+1)-th segment of the target image file is compared with the (y+1)-th part of the original image file in the second segmentation method according to the first direction; In the second segmentation method, the y+1th part is located in the pth segment or the p+1th segment of the original image file.
[0010] In some embodiments, after obtaining the first difference result of the i-th segment, the method further includes: The (i+1)th segment of the target image file is compared with the yth part of the pth segment of the original image file in the second segmentation method, until a completely matching part is found in the original image file in the second segmentation method or all remaining segments of the original image file are compared.
[0011] In some embodiments, if the i-th segment and the x-th part of the j-th segment do not completely match, after comparing the i-th segment with the y-th part of the original image file in the second segmentation method according to the first direction, the method further includes: If the i-th segment completely matches the y-th part of the original image file in the second segmentation method, then the (i+1)-th segment of the target image file is matched with the (x+q)-th part of the original image file in the first segmentation method. The x+q part is determined based on the address of the y part in the original image file. The x+q part is located in the j-th segment or the j+k-th segment of the original image file, where k is a natural number.
[0012] In some embodiments, the x-th portion of the j-th segment is completely or partially identical to the address of the i-th segment of the target image file.
[0013] In a second aspect, embodiments of the present invention provide an embedded device, comprising: at least one processor; and at least one memory communicatively connected to the processor, wherein the memory stores program instructions executable by the processor, and the processor invokes the program instructions to perform the method described in the first aspect or any one thereof based on the operation instructions.
[0014] Thirdly, embodiments of the present invention provide a computer-readable storage medium comprising a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform the method described in the first aspect or any one of the first aspects.
[0015] The embedded device upgrade method, apparatus, and storage medium of the present invention have at least the following beneficial effects: In this embodiment of the invention, two segmentation methods are used on the original image file: one with a fixed segment size and the other with a changed first segment size. This avoids situations where segments of the target image file simultaneously fall on the segmentation boundaries of both methods, preventing the differential packet from becoming too large due to the need to update data at both adjacent ends. This improves differential accuracy, reduces the differential packet size, and significantly reduces the amount of differential data written to the device to be upgraded, further enhancing the user experience. In the method of this embodiment, by changing the segmentation method of the original image file, the differential packet size is reduced, memory usage is optimized, and upgrade failures due to insufficient memory on the device to be upgraded are avoided. Attached Figure Description
[0016] Figure 1 This diagram illustrates the segmentation methods for target and original image files in related technologies. Figure 2 A flowchart illustrating an embedded device upgrade method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating a segmentation method for a target image file provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of a first segmentation method for an original image file provided in an embodiment of the present invention; Figure 5 This is a schematic diagram illustrating a second segmentation method for an original image file provided in an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating a segmented comparison between a target image file and an original image file, provided as an embodiment of the present invention. Figure 7 This is a schematic diagram of an embedded device provided in an embodiment of the present invention. Detailed Implementation
[0017] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0018] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0019] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0020] In related technologies, such as Figure 1 As shown, the target image file and the original image file are typically segmented with the same segment length. Then, in one direction, as indicated by the arrow, the segments of the target image file are compared with the segments of the original image file. Based on the comparison results, segments in the original image file that completely match the segments of the target image file are identified, and segments that do not completely match are identified. A differential packet is generated based on the segments that do not completely match. In related technologies, segmenting the target image file and the original image file with the same segment length is limited by segment boundaries. Some potential matches between the target image file and the original image file are not fully utilized, resulting in a low match hit rate. Furthermore, the generated differential packet is relatively large and requires more memory from the device to be upgraded. In one example, as... Figure 1 As shown, the original image file is 500MB in size and is divided into 5 segments of 100MB each. Assume the difference between the original and target image files is that the target image file has removed 20MB of data from the second segment of the original image file. The target image file is still divided into 5 segments of 100MB each, with the fifth segment being 80MB long. It can be understood that, apart from the missing 20MB of data, the target image file is completely identical to the original image file. However, according to the segment comparison method in related technologies, such as... Figure 1 As shown, segments 2-5 of the target image file do not match segments 2-5 of the original image file. Differential calculations are required for all segments 2-5 of the target image file, resulting in a low matching rate and a large generated differential package. Furthermore, if the device to be upgraded has insufficient memory, it will be unable to download the differential upgrade package, leading to upgrade failure.
[0021] To address the aforementioned technical problems, embodiments of the present invention provide an embedded device upgrade method. This method is applied to a device to be upgraded, which is an embedded device, such as... Figure 2 As shown, the processing steps of this method include: 101. Divide the target image file into segments according to the first length.
[0022] The target image file originates from the device providing the upgrade package, such as a server or other external device. The first length refers to the length of each segment of the target image file; this first length is a non-negative real number. For example... Figure 3 As shown, the target image file can be divided into segments 0, 1, 2...m according to the first length, and the length of any segment in the m+1 segment is the first length.
[0023] 102, First segmentation method: The original image file is segmented according to a second length, which is more than twice the first length.
[0024] The original image file comes from the device to be upgraded, such as an image forming device or a mobile electronic device. Image forming devices include, but are not limited to, printers, copiers, fax machines, scanners, and multifunction printers that integrate printing, copying, faxing, and scanning functions; their function is to print images or text on an imaging medium.
[0025] The second length is the length of the segments in the original image file. The second length is a non-negative real number. In this embodiment of the invention, the method of segmenting the original image file according to the second length is referred to as the first segmentation method. Figure 4 As shown, according to the first segmentation method, the original image file is divided into segments 0, 1, 2...n, and the length of any segment in these n+1 segments is the second length. Since the second length is more than twice the first length, under the first segmentation method, the length of each segment of the original image file is more than twice that of each segment of the target image file. This ensures that the original image and the target image are sufficiently misaligned during comparison.
[0026] 103. Second segmentation method: The first segment of the original image file is segmented according to the third length, and the remaining part is segmented according to the second length. The third length is no more than half of the second length.
[0027] In this embodiment of the invention, the segmentation method of dividing the first segment into segments of the third length and the remaining portion into segments of the second length is called the second segmentation method. In one possible segmentation result, such as... Figure 5 As shown, the original image file can be divided into n+1 segments according to the second segmentation method.
[0028] In this embodiment of the invention, by changing the segmentation method of the original image file, it can be ensured that the segments of the target image file do not fall on the segmentation boundary of two adjacent original segments at the same time, avoiding the need to update the data at both adjacent ends, which would cause the differential packet to become larger, improve the accuracy of differential processing, reduce the size of differential packets, and significantly reduce the amount of flash written to the image forming device, thereby further improving the user experience.
[0029] 104. Perform a first comparison between the segments of the target image file and the segments of the original image file in the first segmentation method according to the first direction. If they are not completely matched, perform a second comparison between the segments of the target image file and the segments of the original image file in the second segmentation method.
[0030] In this embodiment of the invention, the comparison object of the target image is changed from the first segmentation method of the original image to the second segmentation method. Since the segmentation methods of the first segmentation method and the second segmentation method are different, changing the comparison object can further ensure the accuracy of the comparison.
[0031] 105. If it is not a perfect match, perform difference to obtain the difference result; if it is a perfect match, there is no need to perform difference.
[0032] The device adaptively selects the processing method based on the matching status, which ensures that the difference value can be accurately extracted for subsequent processing when there are differences in the difference results, and avoids unnecessary calculations when the difference results are completely consistent, thereby effectively improving the processing efficiency and operational stability of the device.
[0033] 106. The difference results of each segment of the target image file are combined into a difference package.
[0034] In embodiments of the present invention, such as Figure 3 and Figure 4 As shown, the direction indicated by the arrow to the right is called the first direction; in other embodiments, the direction indicated by the arrow to the left may also be called the first direction. In this embodiment of the invention, the solution of the embodiment of the invention is described using the direction indicated by the arrow to the right as the first direction as an example.
[0035] In this embodiment of the invention, the segments of the target image file are compared with the segments of the first segmentation method. If no match is found under the first segmentation method, the segments are compared with the segments of the second segmentation method. If no completely identical segments are found under the second segmentation method, differential calculation is performed to obtain the differential result; if a complete match is found, no differential calculation is required.
[0036] In this embodiment of the invention, two segmentation methods are used for the original image file: fixed segment size and changing the size of the first segment. This can avoid the situation where the segments of the target image file fall on the segmentation boundaries of both segmentation methods at the same time, thus avoiding the need to update the data at both adjacent ends, which would cause the differential packet to become larger. This improves the accuracy of differential analysis, reduces the size of the differential packet, and can significantly reduce the amount of differential data written to the device to be upgraded, further improving the user experience.
[0037] In the method of this invention, when the device to be upgraded has insufficient memory, the size of the differential package is reduced by changing the segmentation method of the original image file, thus optimizing memory usage and avoiding upgrade failure due to insufficient memory of the device to be upgraded. Furthermore, for enterprise users or secondary manufacturers, this method reduces the upgrade time for large numbers of devices and the printer memory occupied during the upgrade, while also preventing upgrade failures caused by printer overheating or power outages due to excessively long upgrade times, optimizing user experience and extending printer lifespan.
[0038] In this embodiment of the invention, when comparing segments of the target image file with segments of the original image file, the segmentation methods differ, but the comparison method remains the same. Both the first and second comparisons can be performed using a neural network model. Specifically, a first feature vector is extracted from the i-th segment of the target image file, and a second feature vector is extracted from the j-th segment of the original image file. These first and second feature vectors are then input into a neural network model trained using historical upgrade data. The neural network model predicts the matching degree between the i-th and j-th segments. When the matching degree is greater than a first threshold, the i-th segment of the target image file and the j-th segment of the original image file are determined to be a complete match; otherwise, the i-th segment of the target image file and the j-th segment of the original image file are determined to be a non-complete match.
[0039] The i-th segment mentioned above is one of the segments in the target image file. The j-th segment is the segment in the original image file that is to be compared with the i-th segment. When the length of the j-th segment is greater than the length of the i-th segment, the j-th segment is divided into multiple parts. The extraction of the second feature vector of the j-th segment mentioned above includes extracting the feature vector of one part of the j-th segment, which is the part to be compared with the i-th segment.
[0040] In this embodiment of the invention, feature vectors and neural network models can capture complex similarities between segments, improving the accuracy of matching degree calculation. The matching degree value ranges from 0 to 1; the higher the matching degree value, the higher the similarity between the corresponding segments.
[0041] In this embodiment of the invention, the matching degree between the target image file and the original image file can be quantified by using feature vectors and neural network models for prediction. The matching status of the segments is determined based on the matching degree score, thereby achieving a quantitative evaluation of the difference results. Furthermore, in this embodiment of the invention, the difference results with matching degrees below a threshold are selected to generate the difference package, which can reduce the size of the difference package.
[0042] The following will describe the method for comparing the target image file and the original image file in this invention with reference to different embodiments.
[0043] Example 1 In the first segmentation method, since the length of each segment of the original image file is more than twice that of each segment of the target image file, the first comparison between the i-th segment of the target image file and the j-th segment of the original image file includes: dividing the j-th segment of the original image file into multiple parts according to a first length, including parts shorter than the first length, and comparing the i-th segment of the target image file with one part of the original image file. In the first segmentation method, the first comparison between the segments of the target image file and the segments of the original image file in a first direction includes: comparing the i-th segment of the target image file with the x-th part of the j-th segment of the original image file, where the i-th segment is one segment in the target image file, and the j-th segment is the segment of the original image file to be compared with the i-th segment in the first segmentation method. Optionally, the x-th part of the j-th segment of the original image file and the i-th segment of the target image file may have completely or partially identical addresses in the first segmentation method. Furthermore, the next adjacent part of the x-th part of the j-th segment is called the x+1-th part, which can be located in either the j-th segment or the j+1-th segment.
[0044] In this embodiment of the invention, if the i-th segment of the target image file completely matches the x-th part of the j-th segment of the original image file in the first segmentation method, then the next segment of the target image file, i.e., the (i+1)-th segment, is compared with the (x+1)-th part of the original image file in the first segmentation method according to the first direction.
[0045] In some embodiments, if the i-th segment of the target image file does not completely match the x-th part of the j-th segment of the original image file in the first segmentation method, the process jumps to the second segmentation method to compare the i-th segment of the target image file. In the second segmentation method, the first segment of the original image file is segmented according to a third length, and the remaining parts are segmented according to a second length, where the third length is no greater than half the second length. Specifically, the i-th segment of the target image file is compared with the y-th part of the p-th segment of the original image file in the second segmentation method until a complete match is found in the second segmentation method or all remaining segments of the original image file are compared. If the i-th segment does not completely match any of the segments in the original image file in the second segmentation method, a difference is performed on the i-th segment to obtain the first difference result. Then, the (i+1)-th segment of the target image file is continued to be compared with the y-th part of the p-th segment of the original image file in the second segmentation method until a complete match is found in the original image file in the second segmentation method or all remaining segments of the original image file are compared.
[0046] Here, segment p is the segment of the original image file to be compared with segment i in the second segmentation method. Optionally, the segment in the second segmentation method that has the same address as segment i of the target image file can be taken as part y of segment p, and the next adjacent part of part y of segment p is called part y+1. Part y+1 is located in segment p of the original image file or in segment p+1 of the original image file.
[0047] In some embodiments, if the i-th segment of the target image file completely matches the y-th part of the p-th segment of the original image file in the second segmentation method, then the (i+1)-th segment of the target image file is compared with the (y+1)-th part of the original image file in the second segmentation method in the first direction. It is understood that, in this embodiment of the invention, the segments in the target image file are first compared with the segments of the original image file in the first segmentation method. If they do not match completely, the process jumps to the second segmentation method and compares the segments in the second segmentation method. If a completely identical segment is found in the second segmentation method, the process does not jump back to the first segmentation method and continues to complete the comparison of the remaining segments of the target image file in the second segmentation method.
[0048] In a specific example, such as Figure 6 As shown, the target image file is divided into segments 0-m according to a first length, for example, 1M. Under the first segmentation method, the original image file is divided into segments 0-n according to a second length, for example, 4.5M, meaning each segment of the original image file is 4.5 times the length of each segment of the target image file. Under the second segmentation method, the first segment of the original image file is segmented according to a third length, which is no greater than half the second length, for example, 2M. The remaining parts of the original image file are still segmented according to the second length, which remains 4.5M. Under the second segmentation method, the first segment of the original image file is twice the length of a segment in the target image file, and the remaining segments are 4.5 times the length of a segment in the target image file.
[0049] In the first segmentation method, each segment of the original image file is divided into multiple parts according to a first length. For example, in the first segmentation method, segment 0 of the original image file is divided into parts 0-4 according to the first length, such as... Figure 6As shown by the dotted lines, segments 0, 1, 2, and 3 of the target image file have the same addresses as parts 0, 1, 2, and 3 of segment 0 of the original image file, respectively. Segment 4 of the target image file is inserted into the segment boundary of the original image file in the first segmentation method. In the first comparison process, segment 0 of the target image file is compared with part 0 of segment 0 of the original image file. The matching result is a complete match. Then, segment 1 of the target image file is compared with part 1 of segment 0 of the original image file. The matching result is also a complete match. Following this method, segments 2 and 3 of the target image file are completely matched with parts 2 and 3 of segment 0 of the original image file, respectively. Further, segment 4 of the target image file is inserted into the segment boundary of the original image file. Segment 4 of the target image file is not completely matched with part 4 of segment 0 of the original image file. Therefore, the comparison jumps to the second segmentation method. In the second segmentation method, the segment with the same address as the fourth segment of the target image file is taken as the segment to be compared, which is the second part of the first segment of the original image file in the second segmentation method. The fourth segment of the target image file is compared with the second part of the first segment of the original image file in the second segmentation method. If the comparison result is a complete match, the fifth segment of the target image file is compared with the third part of the first segment of the original image file in the second segmentation method. That is, after jumping to the second segmentation method, all subsequent segments of the target image file are compared with the original image file in the second segmentation method, and the jump back to the first segmentation method is not performed.
[0050] Example 2 In this embodiment, it is still based on Figure 6 The segmentation method shown divides the target image file and the original image file into segments.
[0051] In this embodiment, the i-th segment of the target image file is compared with the x-th part of the j-th segment of the original image file in the first segmentation method. If the i-th segment of the target image file does not completely match the x-th part of the j-th segment of the original image file in the first segmentation method, the process jumps to the second segmentation method to compare the i-th segment of the target image file. Specifically, after comparing the i-th segment of the target image file with the y-th part of the original image file in the second segmentation method according to the first direction, the method further includes: if the i-th segment completely matches the y-th part of the original image file in the second segmentation method, the process jumps back to the first segmentation method and matches the next segment of the target image file, i.e., the (i+1)-th segment, with the (x+q)-th part of the original image file in the first segmentation method.
[0052] The x+q-th part is determined based on the address of the y-th part in the original image file. The x+q-th part is located in the j-th segment or the j+k-th segment of the original image file, where k is a natural number.
[0053] In this embodiment of the invention, when the segments of the target image file do not completely match the segments of the original image file in the first segmentation method, the comparison is performed in the second segmentation method. If a complete match is found in the second segmentation method, the comparison is performed in the first segmentation method.
[0054] In a specific example, such as Figure 6 As shown, if the fourth segment of the target image file does not completely match the fourth part of the 0th segment of the original image file, the comparison jumps to the second segmentation method. In the second segmentation method, the fourth segment of the target image file is compared with the second part of the 1st segment of the original image file in the second segmentation method. If the comparison result is a complete match, the comparison jumps back to the first segmentation method. In the first segmentation method, the part whose address matches the second part of the 1st segment of the original image file in the second segmentation method is identified as the boundary part. The next part of this boundary part, such as comparing the first part of the 1st segment in the first segmentation method with the 5th segment of the target image file, also results in a non-complete match, and the comparison jumps back to the second segmentation method. This process is repeated until all segments of the target image file have been compared.
[0055] In this embodiment of the invention, the jump between the first segmentation method and the second segmentation method based on the comparison result of the target image file can minimize the impact of the segmentation boundary on the matching result, further reduce the size of the generated differential packet, and save memory of the device to be upgraded.
[0056] Example 3 In this embodiment of the invention, the i-th segment of the target image file is compared with the x-th part of the j-th segment of the original image file in the first segmentation method. If the i-th segment of the target image file does not completely match the x-th part of the j-th segment of the original image file in the first segmentation method, the comparison is performed on the i-th segment of the target image file in the second segmentation method. Specifically, after comparing the i-th segment of the target image file with the y-th part of the original image file in the second segmentation method according to the first direction, the method further includes: if the i-th segment completely matches the y-th part of the original image file in the second segmentation method, the (i+1)-th segment of the target image file is matched with the (y+1)-th part of the original image file in the second segmentation method; if they still completely match, the (i+2)-th segment of the target image file is matched with the (y3)-th part of the original image file in the second segmentation method; if the (i+1)-th segment of the target image file does not completely match the (y+1)-th part of the original image file in the second segmentation method, the comparison is performed again in the first segmentation method. It is understood that in this embodiment, when the target image file is compared using one of the segmentation methods, if the matching result is a complete match, the comparison continues under that segmentation method (such as the first segmentation method) until a non-complete match is found under that segmentation method. Then, the comparison is switched to another segmentation method (such as the second segmentation method) until a non-complete match is found, and then the comparison is switched back to the previous segmentation method (such as the first segmentation method). This cycle continues until the comparison of the target image file is completed.
[0057] In a specific example, such as Figure 6 As shown, if the fourth segment of the target image file does not completely match the fourth part of the 0th segment of the original image file in the first segmentation method, then the comparison will proceed to the second segmentation method. In the second segmentation method, the fourth segment of the target image file is compared with the second part of the first segment of the original image file in the second segmentation method. If the comparison result is a complete match, the fifth segment of the target image file is compared with the third part of the first segment of the original image file in the second segmentation method. If the comparison result is still a complete match, the sixth segment of the target image file is compared with the third part of the first segment of the second segmentation method. If the comparison result is a partial match, the process jumps back to the first segmentation method and compares the sixth segment of the target image file with the first part of the first segment in the first segmentation method. If the comparison result is a partial match, the sixth segment of the target image file is compared with the next part of the first part of the first segment in the first segmentation method until a complete match is achieved. If the comparison results are not complete matches, differential calculation is performed and the process jumps to the second segmentation method to compare the next segment of the target image file.
[0058] Corresponding to the above method embodiments, this invention also provides an embedded device, which is the device to be upgraded. For example... Figure 7 As shown, the embedded device includes a processor 301, a memory 302, and a communication unit 303. These components communicate via one or more buses. Those skilled in the art will understand that the structure of the embedded device shown in the figure does not constitute a limitation on the embodiments of this application. It can be a bus topology, a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0059] The communication unit 303 is used to establish a communication channel, enabling the embedded device to communicate with other devices. It receives user data from other devices or sends user data to other devices.
[0060] Processor 301 serves as the control center of the embedded device, connecting various parts of the fault handling unit via various interfaces and lines. It executes software programs, instructions, and / or modules stored in memory 302, and calls data stored in memory to perform various functions of the embedded device and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, processor 301 may include a central processing unit (CPU), a microcontroller unit (MCU), etc.
[0061] Memory 302 is used to store the execution instructions of processor 301. Memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0062] When the execution instructions in memory 302 are executed by processor 301, the embedded device 300 is able to execute the embedded device upgrade method in this embodiment of the invention.
[0063] In a specific implementation, this application also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, may include some or all of the steps of the embedded device upgrade method provided in this application. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0064] In a specific implementation, this application also provides a computer program product, wherein the computer program product includes executable instructions, which, when executed on a computer, cause the computer to perform some or all of the steps in the various embodiments of the embedded device upgrade method provided in this application.
[0065] This application also provides a non-transitory computer-readable storage medium that stores computer instructions that cause the computer to execute the embedded device upgrade method provided in this application.
[0066] The aforementioned non-transitory computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in connection with an instruction execution system, apparatus, or device.
[0067] Those skilled in the art will clearly understand that the technologies in the embodiments of this application can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or certain parts of the embodiments of this application.
[0068] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the device embodiments and terminal embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
Claims
1. An embedded device upgrade method, applied to a device to be upgraded, characterized in that, The method includes: Divide the target image file into segments according to the first length; The first segmentation method involves dividing the original image file into segments of a second length, where the second length is more than twice the first length. The second segmentation method involves segmenting the first segment of the original image file according to a third length, and segmenting the remaining part according to the second length, wherein the third length is no greater than half of the second length; The segments of the target image file are compared with the segments of the original image file in the first segmentation method in a first direction. If they are not completely matched, the segments of the target image file are compared with the segments of the original image file in the second segmentation method in a second comparison. If it is not a perfect match, perform difference to obtain the difference result; if it is a perfect match, there is no need to perform difference. The difference results of each segment of the target image file are collected into a difference package.
2. The method according to claim 1, characterized in that, The first comparison and the second comparison include: Extract the first feature vector of the i-th segment of the target image file, where the i-th segment is one of the segments of the target image file; Extract the second feature vector of the j-th segment of the original image file, where the j-th segment is the segment of the original image file to be compared with the i-th segment; The first feature vector and the second feature vector are input into a neural network model trained using historical upgrade data. The neural network model is used to predict the matching degree between the i-th segment and the j-th segment, where i and j are natural numbers. When the matching degree is greater than the first threshold, it is determined that the i-th segment of the target image file completely matches the j-th segment of the original image file. Otherwise, it is determined that the i-th segment of the target image file does not completely match the j-th segment of the original image file.
3. The method according to claim 1, characterized in that, The segment of the target image file is compared with the segment of the original image file in a first direction, including: The i-th segment of the target image file is compared with the x-th part of the j-th segment of the original image file, wherein the i-th segment is a segment of the target image file, the j-th segment is the segment of the original image file to be compared with the i-th segment in the first segmentation method, and the x-th part is a part of the j-th segment; If the i-th segment completely matches the x-th part in the j-th segment, then the (i+1)-th segment of the target image file is compared with the (x+1)-th part of the original image file in the first segmentation method according to the first direction; In the first segmentation method, the (x+1)th part is located in the j-th segment or the (j+1)-th segment of the original image file.
4. The method according to claim 3, characterized in that, The method further includes: If the i-th segment does not completely match the x-th part of the j-th segment, then the i-th segment is compared with the y-th part of the p-th segment of the original image file in the second segmentation method in the first direction until a completely matching part is found in the original image file in the second segmentation method or all remaining segments of the original image file are compared; the p-th segment is the segment of the original image file in the second segmentation method to be compared with the i-th segment, and the y-th part is one of the parts of the p-th segment; If the i-th segment does not completely match any of the segments of the original image file in the second segmentation method, then the i-th segment is differentially analyzed to obtain the first differential result of the i-th segment.
5. The method according to claim 4, characterized in that, The method further includes: If the i-th segment completely matches the y-th part of the p-th segment of the original image file in the second segmentation method, then the (i+1)-th segment of the target image file is compared with the (y+1)-th part of the original image file in the second segmentation method according to the first direction; In the second segmentation method, the y+1th part is located in the pth segment or the p+1th segment of the original image file.
6. The method according to claim 4, characterized in that, After obtaining the first difference result of the i-th segment, the method further includes: The (i+1)th segment of the target image file is compared with the yth part of the pth segment of the original image file in the second segmentation method, until a completely matching part is found in the original image file in the second segmentation method or all remaining segments of the original image file are compared.
7. The method according to claim 4, characterized in that, If the i-th segment does not completely match the x-th part of the j-th segment, then after comparing the i-th segment with the y-th part of the original image file in the second segmentation method according to the first direction, the method further includes: If the i-th segment completely matches the y-th part of the original image file in the second segmentation method, then the (i+1)-th segment of the target image file is matched with the (x+q)-th part of the original image file in the first segmentation method. The x+q part is determined based on the address of the y part in the original image file. The x+q part is located in the j-th segment or the j+k-th segment of the original image file, where k is a natural number.
8. The method according to claim 3, characterized in that, The x-th part of the j-th segment has the same address as or is partially the same as the i-th segment of the target image file.
9. An embedded device, characterized in that, include: At least one processor; And at least one memory communicatively connected to the processor, wherein the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any one of claims 1 to 8 based on the operation instructions.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the method according to any one of claims 1 to 8.