Method and device for verifying logic partition exception and computer storage medium

By setting probes in the logical partition for data checksum error intercepting, the problem of update failure caused by abnormal data in OTA updates is solved, and a fast and efficient verification process is achieved.

CN119690735APending Publication Date: 2025-03-25纳欣科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411686311.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

When remote update of the system, firmware or software is achieved through OTA, an exception occurs in the old data that needs to be replaced in the logical partition, resulting in the inability to complete data replacement and update. The existing technology requires setting up additional computing units for verification, which takes a long time.

Method used

By setting the probe, data verification is triggered while reading data in the logical partition. If there is an error in the data, use the probe to intercept the error and save the error and the error position to quickly verify the data exceptions in the logical partition.

Benefits of technology

No additional computing units are required to quickly verify data exceptions in logical partitions, improve verification efficiency and avoid update failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690735A_ABST
    Figure CN119690735A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for verifying logic partition abnormity and a computer storage medium, a logic partition is at least one part of area in a physical partition, the method comprises the steps that a probe is arranged, and the probe is used for intercepting data errors in the logic partition; reading data from the logic partition; in response to the occurrence of the read data, triggering verification for the read data to determine the correctness of the data; in response to an error in the read data, intercepting the error by using the probe; and storing the error and the error position of the data corresponding to the error. According to the method, whether the data in the logic partition is abnormal or not can be checked without arranging an additional calculation unit, and the efficiency of checking the logic partition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure generally relates to the field of data processing technology. More specifically, the present disclosure relates to a method and apparatus for checking logical partition anomalies and a computer storage medium. Background Art

[0002] OTA (Over-The-Air) is a technology that uses wireless communication technology to remotely update device systems, firmware or software. After an electronic device is released, the manufacturer of the electronic device needs to update or upgrade the system, firmware or software of the electronic device through OTA in order to improve the user experience.

[0003] When remotely updating the system, firmware or software through OTA, the old data that needs to be replaced must first be found in the logical partition of the electronic device, and then the new data must be used to replace the old data to complete the replacement of the old and new data, thereby completing the update or upgrade. If the old data that needs to be replaced in the logical partition is abnormal, the old data that needs to be replaced cannot be found in the storage space, and the data replacement cannot be completed, resulting in update failure. Therefore, before updating the electronic device, it is necessary to check whether the storage space in the electronic device is abnormal. In the prior art, an additional computing unit needs to be set up to determine whether the data in the logical partition is abnormal, and this verification method takes a long time.

[0004] In view of this, there is an urgent need to provide a method for checking logical partition anomalies so as to improve the efficiency of checking logical partitions. Summary of the invention

[0005] In order to at least solve one or more of the technical problems mentioned above, the present disclosure proposes a method and apparatus for checking logical partition anomalies and a computer storage medium in multiple aspects.

[0006] In a first aspect, the present disclosure provides a method for checking an abnormality of a logical partition, wherein the logical partition is at least a portion of an area in a physical partition, and the method comprises: setting a probe, wherein the probe is used to intercept errors in data in the logical partition; reading data from the logical partition; in response to the occurrence of the read data, triggering a check on the read data to determine the correctness of the data; in response to the presence of an error in the read data, intercepting the error using the probe; and saving the error and the error position of the data corresponding to the error.

[0007] In a second aspect, the present disclosure provides a device for checking logical partition anomalies, wherein the logical partition is at least a portion of an area in a physical partition, and the device includes: a setting module for setting a probe, wherein the probe is used to save the location of data where an error occurs in the logical partition; a reading module for reading data from the logical partition; a verification module for triggering a verification of the read data in response to the occurrence of the read data to determine the correctness of the data; and a saving module for saving the error location of the data corresponding to the error according to the probe in response to the existence of an error in the read data.

[0008] In a third aspect, the present disclosure provides a computer storage medium having stored thereon a computer program for checking for anomalies in a logical partition, wherein when the computer program is executed by one or more processors, the method for checking for anomalies in a logical partition as described in the first aspect is implemented.

[0009] In a fourth aspect, the present disclosure provides a method for checking a logical partition anomaly, wherein the logical partition is at least a portion of an area in a physical partition, and the physical partition is at least a portion of a storage space of an electronic device or apparatus, and the method comprises: after the electronic device or apparatus is flashed, in response to the electronic device or apparatus being turned on for the first time, executing the computer program as described in the third aspect to obtain errors existing in the data of the logical partition and error positions of the data corresponding to the errors.

[0010] Through the method for checking logical partition anomalies provided above, the disclosed embodiment first sets a probe, which is used to intercept erroneous data in the logical partition; then, reads data from the logical partition; when the data is read, triggers a check on the read data to determine the correctness of the data; when an error exists in the data, the error is immediately intercepted by the probe, and the error and the error position of the data corresponding to the error are saved, so that it is possible to check whether the data in the logical partition is abnormal without setting up an additional computing unit, and the efficiency of checking the logical partition can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0012] Figure 1 A schematic diagram showing the structure of the logical partitions of an embodiment of the present disclosure is shown;

[0013] Figure 2aA schematic diagram showing an existing solution for checking whether data in a logical partition is abnormal;

[0014] Figure 2b A schematic diagram showing another existing solution for checking whether data in a logical partition is abnormal;

[0015] Figure 3 An exemplary flow chart of a method for checking a logical partition abnormality according to some embodiments of the present disclosure is shown;

[0016] Figure 4 An exemplary flow chart showing a method of reading data from a logical partition according to some embodiments of the present disclosure;

[0017] Figure 5a An exemplary flow chart showing a method for determining the correctness of data according to some embodiments of the present disclosure;

[0018] Figure 5b An exemplary flow chart showing a method for determining the correctness of data according to other embodiments of the present disclosure;

[0019] Figure 5c An exemplary flow chart showing a method for determining an error location according to some embodiments of the present disclosure;

[0020] Figure 6 An exemplary structural block diagram of an apparatus for checking logical partition abnormalities according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0022] It should be understood that the terms "include" and "comprising" used in the specification and claims of the present disclosure indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0023] It should also be understood that the terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. As used in this disclosure and claims, the singular forms of "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in this disclosure and claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations.

[0024] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0025] The specific implementation of the present disclosure is described in detail below with reference to the accompanying drawings.

[0026] Exemplary application scenarios

[0027] Figure 1 FIG. 2 shows a schematic diagram of the structure of the logical partitions of the embodiment of the present disclosure. Figure 1 As shown, in the storage system of the electronic device, there are multiple physical partitions such as partition A, partition B, partition C, ... and partition N, and each physical partition can be divided into one or more logical partitions, namely logical partition 1, logical partition 2, logical partition 3, ... and logical partition n. In this scenario, the system or software can be flashed into the logical partition of the electronic device through a transmission line.

[0028] If a problem occurs during the process of flashing system, firmware or software data into an electronic device, the data flashed in will be incomplete or wrong data will be flashed, causing abnormal data in the logical partition of the electronic device, where "abnormal" refers to incomplete data flashed into the electronic device or wrong data flashed into the electronic device. Specifically, the cause of the problem during the process of flashing system, firmware or software data into an electronic device may be a problem with the quality of the transmission line used to flash the data, poor memory stability of the transmission device used to flash the data, poor power supply quality, etc. Moreover, it is also possible that the data is tampered with when the above data is flashed into the electronic device, resulting in wrong data being flashed into the electronic device.

[0029] After an electronic device is released, the manufacturer of the electronic device needs to update or upgrade the system, firmware or software of the electronic device through OTA in order to improve the user experience. The specific process of updating or upgrading includes: first, searching for the old data that needs to be updated in the logical partition of the electronic device; then, replacing the old data with the corresponding updated new data to achieve the update or upgrade. However, if a problem occurs in the process of flashing the old data into the electronic device, it will cause the old data that needs to be replaced in the electronic device to be abnormal. When the system, firmware or software is remotely updated through OTA, the correct old data that needs to be updated cannot be found, resulting in the inability to complete the replacement of the new data with the old data, that is, the inability to complete the update or upgrade.

[0030] For example, the system, firmware or software data before being flashed into the electronic device include data a1, data b1 and data c1. For the convenience of description, the "system, firmware or software data before being flashed into the electronic device" is referred to as the "original data ORI". If a problem occurs during the process of flashing the original data ORI into the electronic device, after the original data ORI is flashed into a logical partition of the electronic device, the data currently stored in the logical partition includes data a1, data b2 and data c1. The "data currently stored in the logical partition" is referred to as the "current data CUR". It can be seen from the above description that the original data ORI is inconsistent with the current data CUR.

[0031] Therefore, when the system, firmware or software of the electronic device D1 is updated or upgraded through OTA, if the old data to be replaced is data b1, and the current data CUR of the logical partition in the electronic device D1 includes data a1, data b2 and data c1, that is, the current data CUR does not include data b1, therefore, the old data to be replaced cannot be found in the current data CUR of the logical partition in the electronic device D1, and thus the replacement of the new data with the old data cannot be completed, that is, the update or upgrade cannot be completed.

[0032] From the above, it can be seen that before remotely updating the system, firmware or software of an electronic device through OTA, it is also necessary to verify whether there is any abnormality in the data in the logical partition of the electronic device. Only when there is no abnormality in the data in the logical partition of the electronic device can the update or upgrade of the electronic device be completed normally.

[0033] Figure 2aA schematic diagram of an existing solution for checking whether the data in a logical partition is abnormal is shown. As shown in the figure, specifically, the method includes: first, after the original data corresponding to the system, firmware or software is flashed into the logical partition of the electronic device through a flashing tool, the current data corresponding to the system, firmware or software is read from the logical partition of the electronic device through a transmission line; then, in the memory of the flashing tool, the current data is compared with the original data to check whether the data in the logical partition of the electronic device is abnormal. The "flashing tool" here refers to a specific tool for flashing the system, firmware or software into the logical partition of the electronic device, and the flashing tool can be a personal computer (Personal Computer, referred to as PC).

[0034] In the above-mentioned scheme for verifying whether the data in the logical partition is abnormal, the current data corresponding to the system, firmware or software in the electronic device needs to be read out through the transmission line, and the rate of reading and transmitting data will be limited by the transmission rate of the transmission line. Therefore, this verification method needs to spend a certain amount of time to read the current data. Therefore, this verification method takes a long time.

[0035] It should be noted that due to the limitation of the memory size of the flashing tool, when comparing the current data with the original data in the memory of the flashing tool, only the part of the current data that meets the memory size can be compared with the corresponding part of the original data each time. Therefore, this verification scheme will perform multiple comparisons to complete the comparison of all the current data with the original data. Multiple comparisons will cause the verification to take a longer time, which will cause the verification scheme to take a longer time.

[0036] In addition, in the existing factory environment for producing electronic devices, it is necessary to flash multiple sets of system, firmware or software data into the corresponding multiple electronic devices through the above-mentioned flashing tools, and it is also necessary to verify the logical partitions of the multiple electronic devices separately. The flashing tools put a lot of pressure on flashing data and verifying logical partitions, which will reduce the efficiency of flashing data and verifying the efficiency of the logical partitions of the electronic devices.

[0037] Figure 2bA schematic diagram of another existing scheme for checking whether the data in a logical partition is abnormal is shown. As shown in the figure, the method needs to set an additional computing module or unit to perform a cyclic redundancy check calculation on the original data of the system, firmware or software to obtain the original cyclic redundancy check (CRC) code corresponding to the original data, and save the original CRC code. When it is necessary to verify the data of the logical partition in the electronic device, first, a cyclic redundancy check calculation is performed on the current data of the logical partition in the electronic device through a computing module or unit to obtain a current CRC code corresponding to the current data. The computing module or unit here can be a CPU or other computing tool; then, the original CRC code is compared with the current CRC code, and it is determined whether the data of the logical partition in the electronic device is abnormal based on the comparison result.

[0038] Since this verification scheme requires the setting of an additional computing module or unit to calculate the current CRC code corresponding to the current data of the system, firmware or software, and the original CRC code needs to be compared with the current CRC code, this method requires more calculation and comparison verification steps before verification can be performed, which will cause the verification process to take a certain amount of time, resulting in a longer verification process.

[0039] Exemplary Application Scenarios

[0040] In view of this, the embodiment of the present disclosure provides a method for checking the abnormality of a logical partition, which reads data from a logical partition by setting a probe, and triggers verification of the read data while reading the data to determine the correctness of the data; when there is an error in the read data, the probe is used to immediately intercept the error, and the error and the error position of the data corresponding to the error are saved, so that whether the data of the logical partition is abnormal can be quickly checked. The specific implementation methods of the present disclosure are described in detail below in conjunction with the accompanying drawings.

[0041] Figure 3 An exemplary flowchart 100 of a method for checking a logical partition abnormality according to some embodiments of the present disclosure is shown.

[0042] As shown in the figure, in step S110, a probe is set, and the probe is used to intercept erroneous data in the logical partition; in step S120, data is read from the logical partition; in step S130, in response to the occurrence of read data, a check is triggered for the read data to determine the correctness of the data; in step S140, in response to the existence of an error in the read data, the error is intercepted by the probe; in step S150, the error and the error position of the data corresponding to the error are saved.

[0043] In the embodiments of the present disclosure, the storage space that physically exists in the electronic device is called a physical partition. There are one or more physical partitions in the electronic device. Each physical partition can be divided into one or more virtual spaces. The "virtual space" here is called a "logical partition."

[0044] In some embodiments, the "probe" in step S110 refers to a kernel probe (Kernel Probe, kprobe for short). The kernel probe can be used to track the execution state of the kernel, where the "kernel" refers to the core of the operating system of the electronic device, which is the basis of the operating system. In some embodiments of the present disclosure, the probe is set in the kernel layer to intercept errors in the data in the logical partition. Specifically, whenever an error occurs in the data in the logical partition, the error will be intercepted by the probe. Those skilled in the art should understand that the "kernel layer" here refers to the core of the operating system, and the kernel layer is used to provide system services and implement resource management of smart devices, which will not be elaborated here.

[0045] In this embodiment, the data in the logical partition is read in step S120 so as to determine whether the data in the logical partition is erroneous in a subsequent step. Since a physical partition can be divided into multiple logical partitions, in this embodiment, the data in each logical partition can be read separately, and the data in one or more logical partitions can be read simultaneously.

[0046] It should be noted that, therefore, in step S130, whenever the step corresponding to reading the data of the logical partition occurs, the verification of the read data will be immediately triggered to determine the correctness of the read data, that is, to determine whether there is any error in the read logical partition data.

[0047] In some embodiments, device mapper-verity (dm-verity for short) is a target device type under the device mapper architecture, which can be used to ensure the integrity of a device or device partition. In some embodiments, in step S130, the data of the read logical partition can be verified by device mapper-verity.

[0048] In some embodiments, through step S140, whenever there is an error in the read data, the probe described above can be used to intercept the error, that is, the error is captured, so as to facilitate subsequent processing of the error.

[0049] It should be noted that in order to protect the data in the electronic device from being tampered with at will, it is also necessary to set the permission of the storage space in the electronic device to read-only. For example, the storage space in the electronic device can be a hard disk, that is, the data in the storage space of the electronic device can only be accessed or read, and the data in the storage space of the electronic device cannot be modified.

[0050] In some methods for checking logical partition anomalies in the field, data in the storage space of the electronic device is first read out and stored in the dynamic random access memory (DRAM) of the checking device. The "checking device" here refers to a device used to check whether the logical partition is abnormal in some methods for checking logical partition anomalies in the field; then, the data in the DRAM is checked; if an error is found in the data in the DRAM, the erroneous data is automatically repaired in the DRAM, but because the permission of the storage space of the electronic device, such as the data in the hard disk, is set to read-only, the data in the storage space of the electronic device cannot be modified. Therefore, some methods for checking logical partition anomalies in the field cannot repair the erroneous data in the storage space of the electronic device even if the erroneous data can be repaired in the DRAM.

[0051] Moreover, in some methods of checking logical partition anomalies in the field, after the erroneous data in the DRAM is repaired, it is assumed that the error has been repaired, that is, the error no longer exists. However, since the erroneous data in the storage space has not been modified, some methods of checking logical partition anomalies in the field cannot detect the error in the data in the storage space of the electronic device, resulting in the inability to identify the error.

[0052] It can be seen from the above description that, through step S140, the probe can be used to intercept or capture errors occurring in the data, so as to avoid the inability to identify the error after the error is repaired in the DRAM.

[0053] Then, after intercepting the error, the error and the error position of the data corresponding to the error are saved through step S150. "Saving the error" in step S150 refers to saving information used to indicate whether an error has occurred in the data in the logical partition. For example, an exception flag can be set, and the initial value of the exception flag is 0. Whenever there is an error in the data in the read logical partition, the exception flag corresponding to the logical partition is set to 1, so that other programs can judge whether an error has occurred in the data of the logical partition through the exception flag, so as to save the error.

[0054] According to the above description, through steps S110 to S150, first, a probe is set, and the probe is used to intercept erroneous data in the logical partition; then, data is read from the logical partition; when the data is read, verification of the read data is triggered to determine the correctness of the data; when an error exists in the data, the error is immediately intercepted by the probe, and the error can be saved as a misplacement and the misplacement of the data corresponding to the error. In this way, it is possible to verify whether the data in the logical partition is abnormal without setting up an additional computing unit, thereby improving the efficiency of verifying whether the logical partition is abnormal.

[0055] In some embodiments, the specific process of the aforementioned step S110 may include: first, initializing and registering a hook through the kernel probe kprobe, the hook is used to monitor and capture data errors, and the "hook" here can be a function, such as pre_handler or post_handler.

[0056] Then, the hook is hooked to the function, module or function used to verify whether the data of the logical partition has any abnormality; for the sake of convenience of description, the aforementioned "function, module or function used to verify whether the data of the logical partition has any abnormality" is called a "verification unit". The "verification unit" can be device mapping verification (dm-verity). Specifically, the hook function can be hooked to the verification unit by pointing the function pointer corresponding to the verification unit to the hook function.

[0057] Then, whenever the verification unit finds that there is an error in the data in the logical partition, it will immediately take the hook, that is, trigger and execute the hook function to intercept the error, so as to record and save the error. In some embodiments of the present disclosure, the specific execution function of the hook function can be set by itself.

[0058] It should be noted that device mapping verification (dm-verity) cannot actively verify data. Only when the data of the logical partition is read, can the verification of the read data be triggered. Therefore, in this embodiment, the data of each logical partition of the electronic device is read to trigger the verification of the data of multiple logical partitions, so that there is no need to set up additional computing units or modules to realize the verification of all data in the storage space of the electronic device. The above-mentioned computing unit or module can be a CPU.

[0059] Figure 4 FIG. 1 is an exemplary flow chart of a method for reading data from a logical partition according to some embodiments of the present disclosure. It can be understood that the method for reading data from a logical partition is a specific embodiment of the aforementioned step S120, so the aforementioned method is combined with the method described in FIG. Figure 3 and Figure 4The features described can analogously apply here.

[0060] As shown in the figure, the specific process of the aforementioned step S120 includes: in step S121, obtaining the mapping relationship between the logical partition and the physical partition from the device mapping file; the mapping relationship includes the corresponding relationship between the physical partition and the logical partition and the location information of the logical partition in the physical partition; in step S122, reading data according to the location information of the logical partition.

[0061] In the embodiments of the present disclosure, the "device mapping" mentioned above refers to a framework mechanism provided by the kernel for implementing and managing the mapping between physical partitions and logical partitions, and the device mapping may be a device mapper. The "device mapping file" mentioned above refers to a file for storing relevant information of the mapping mechanism, and the device mapping file may include the mapping relationship between the physical partition and the logical partition and the location information of each logical partition in the physical partition, and the device mapping file may be a devicemapper file.

[0062] Specifically, the "mapping relationship" mentioned above refers to the corresponding relationship between the physical partition and the logical partition. For example, the physical partition S is divided into two logical partitions, namely, logical partition L1 and logical partition L2. Then, the logical partitions corresponding to the physical partition S are the mapping relationship between logical partition L1 and logical partition L2. The "logical partition location information" mentioned above can be the address corresponding to each logical partition.

[0063] It can be seen from the embodiments described above that through step S121, the mapping relationship between the logical partition and the physical partition can be obtained from the device mapping file (device mapper file), and the logical partition corresponding to the physical partition and the address of the logical partition can be obtained from the mapping relationship. In this way, in step S122, the data of the logical partition can be read from the address of the logical partition, thereby realizing the reading of the data of the logical partition.

[0064] In some embodiments of the present disclosure, data of one or more logical partitions can be read simultaneously through the above steps S121 - S122 , and the number of logical partitions to be read simultaneously can be set by oneself.

[0065] Through step S121 to step S122, the address corresponding to each logical partition can be obtained, and the data of one or more logical partitions can be read from the address corresponding to each logical partition, so as to read the data of all logical partitions in the electronic device. Moreover, the data of one or more logical partitions can be read at the same time.

[0066] Figure 5aFIG. 1 is an exemplary flow chart of a method for determining the correctness of data according to an embodiment of the present disclosure. It can be understood that the method for determining the correctness of data is a specific implementation of the aforementioned step S130, so the aforementioned method is combined with Figure 3 and Figure 5a The features described can analogously apply here.

[0067] As shown in the figure, in step S131, the data is verified to obtain a first current verification value of the logical partition; in step S132, the first current verification value and the first original verification value are compared to determine whether there is an error in the data.

[0068] In the embodiments of the present disclosure, when producing an electronic device, the corresponding system, firmware, software, or image file data needs to be written into the electronic device by flashing the device before the electronic device can be shipped and released. For the sake of convenience of description, "data such as the system, firmware, software, or image file that has not been flashed into the electronic device" is referred to as "original data".

[0069] It should be noted that if there is a problem with the quality of the transmission line used to transmit data, the memory stability of the transmission device is poor, the power supply quality is poor, etc., the process of flashing data such as system, firmware, software or image files into the electronic device may be unstable, resulting in incomplete data or erroneous data being flashed into the electronic device, and further causing abnormalities in the data within the logical partition of the electronic device. The "abnormality" here refers to incomplete data flashed into the electronic device or erroneous data being flashed into the electronic device.

[0070] For example, when the data that needs to be flashed into an electronic device is data A, if the power supply quality of device G used to flash data into the electronic device is poor, the device G cannot work normally, resulting in instability in the process of flashing data into the electronic device, thereby resulting in only part of data A being flashed into the electronic device, or causing an error in one bit (Byte) of data in data A.

[0071] In the embodiments of the present disclosure, after the aforementioned original data is flashed into the electronic device, the data stored in the electronic device is the data after the original data is flashed into the electronic device, and the "data stored in each logical partition in the electronic device" is referred to as "current data". Moreover, after the aforementioned original data is flashed into the electronic device, the original data will be stored in one or more physical partitions in the electronic device, and each physical partition includes one or more logical partitions, so the data stored in each logical partition in the electronic device is part of the original data.

[0072] In the embodiments of the present disclosure, both "original data" and "current data" refer to data such as system, firmware, software, or image files, but original data refers to data such as system, firmware, software, or image files before being flashed into the electronic device, and current data refers to data such as system, firmware, software, or image files stored in the electronic device after the data such as system, firmware, software, or image files are flashed into the electronic device. Since problems may occur during the process of flashing data such as system, firmware, software, or image files into the electronic device, the original data and the current data may not be exactly the same.

[0073] The aforementioned "first original check value" refers to the check value obtained by checking and calculating the original data before the original data is flashed into the electronic device. In this embodiment, the hash algorithm can be used to check and calculate the original data, and the calculated hash value is used as the first original check value. Since each logical partition stores a portion of the original data, the corresponding portion of the original data in each logical partition is checked and calculated, and the calculated check value is used as the first original check value corresponding to each logical partition. The correspondence between each logical partition and the first original check value and the specific value of the first original check value can be stored in a verification table. Whenever the logical partition of the electronic device is to be checked, the first original check value corresponding to each logical partition is obtained from the verification table.

[0074] In this embodiment, in step S131, the data stored in the logical partition of the current electronic device is verified and calculated, that is, the data stored in each logical partition, that is, a part of the current data is verified and calculated to obtain the verification value corresponding to the data stored in each logical partition. Here, the above-mentioned "the verification value corresponding to the data stored in each logical partition" is referred to as the "first current verification value", that is, the first current verification value refers to the verification value obtained by verifying and calculating a part of the current data. Moreover, for any logical partition, the current data stored in the logical partition will be verified and calculated to obtain the first current verification value corresponding to each logical partition.

[0075] It should be noted that the specific method of performing verification calculation on the original data is the same as the specific method of performing verification calculation on the current data. For example, the hash algorithm used for verification calculation on the original data is the same as the hash algorithm used for verification calculation on the current data, and both use the Secure Hash Algorithm (SHA).

[0076] Next, since the specific method of performing verification calculation on the original data is the same as the specific method of performing verification calculation on the current data, after obtaining the first current verification value corresponding to the logical partition, the first current verification value of each logical partition is compared with the corresponding first original verification value one by one through step S132, and the comparison result of each logical partition can be obtained, and according to the comparison result of the logical partition, it can be determined whether there is an error in the data in the logical partition. Specifically, if the comparison result of a logical partition is that the first current verification value and the corresponding first original verification value are inconsistent, it is determined that there is an error in the data in the logical partition; if the comparison result of a logical partition is that the first current verification value and the corresponding first original verification value are consistent, it is determined that there is no error in the data in the logical partition.

[0077] From the above description, it can be seen that through steps S131 to S132, when the steps corresponding to reading the data of the logical partition occur, it is possible to quickly determine whether the data of the read logical partition is erroneous without setting up additional computing modules or units, thereby improving the efficiency of judging the correctness of the data of the logical partition.

[0078] Figure 5b An exemplary flow chart of a method for determining the correctness of data in some other embodiments of the present disclosure is shown. As shown in the figure, after the aforementioned step S132, step S130 further includes: in response to the first current check value and the first original check value being consistent, in step S133, determining that there is no error in the logical partition; in response to the first current check value and the first original check value being inconsistent, in step S134, determining that there is an error in the logical partition.

[0079] In the above step S133, if the first current check value is consistent with the first original check value, it means that the original data is consistent with the current data, that is, there is no error in the data in the corresponding logical partition. Further, if there is no error in the data in each logical partition in the electronic device, the system, firmware, software or image file and other data have been completely and correctly flashed into the electronic device; if there is an error in the data in a logical partition, it means that there is an error in the current system, firmware, software or image file and other data in the electronic device.

[0080] In step S134, if the first current check value and the first original check value are inconsistent, it means that the current data corresponding to the logical partition is different from the original data. Therefore, it can be determined that there is a problem with the system, firmware or software data when being flashed into the electronic device, resulting in the inconsistency between the system, firmware or software data before being flashed and the system, firmware or software data after being flashed. In this way, when performing OTA on the electronic device, if the data that needs to be replaced or upgraded is part of the erroneous current data in the logical partition of the electronic device, the correct data that needs to be replaced or upgraded cannot be found, resulting in the inability to replace or upgrade the data of the electronic device, that is, causing OTA failure.

[0081] Furthermore, if it is determined in step S134 that there is an error in the data of the logical partition, the location of the data corresponding to the error may be further determined.

[0082] In some embodiments, the data of the logical partition includes one or more data blocks, each data block having a second original check value.

[0083] Figure 5c An exemplary flow chart of a method for determining an error location in some embodiments of the present disclosure is shown. As shown in the figure, after step S134, step S130 further includes steps S135-S136. In response to an error in the data of the logical partition, in step S135, each data block is checked to obtain a second current check value of each data block; in step S136, each second current check value is compared with each second original check value to determine an abnormal data block with an error; in step S137, the error location is determined based on the abnormal data block.

[0084] In this embodiment, the original data can be divided into one or more groups of data, and each group of data obtained by dividing the original data is referred to as a "data block". In the embodiment disclosed herein, the size of each data block can be set by itself, for example, the size of each data block can be 4KB, and the size of the data block is not subject to any restrictions. Moreover, after the original data is flashed into the electronic device, the data blocks corresponding to the original data will also be input into the logical partition of the electronic device, that is, the current data is also composed of one or more data blocks.

[0085] In some embodiments, before each data block of original data is flashed into the electronic device, it is necessary to perform a verification calculation on the data block before being flashed to obtain a verification value corresponding to each data block before being flashed. Here, the above-mentioned "verification value corresponding to each data block before being flashed" is referred to as the "second original verification value".

[0086] In the above-mentioned step S135, if an error occurs in the data of the logical partition, then after the original data is flashed into the electronic device, and it is determined that there is a data storage error in the logical partition of the electronic device, it is necessary to perform verification calculations on each data block after being flashed, so as to obtain a verification value corresponding to each data block after being flashed, where "the verification value corresponding to each data block after being flashed" is referred to as the "second current verification value".

[0087] It should be noted that the specific method of performing verification calculation on each data block before being flashed is the same as the specific method of performing verification calculation on each data block after being flashed. For example, the hash algorithm used for performing verification calculation on each data block before being flashed is the same as the hash algorithm used for performing verification calculation on each data block after being flashed, and both use the Secure Hash Algorithm (SHA).

[0088] After obtaining the second current check value of each data block through step S135, the second current check value is compared with the second original check value one by one through step S136 to obtain the comparison result of each pair of the second current check value and the second original check value; through the comparison result, it is determined which data block has abnormal data, and the data block with abnormal data is called "abnormal data block" here.

[0089] Next, in step S137, the position of the abnormal data block is obtained, and the position of the abnormal data block is used as the position where the error occurs. Specifically, the address corresponding to the abnormal data block can be obtained from a device mapper file, and the address corresponding to the abnormal data block is used as the position where the error occurs.

[0090] In some embodiments of the present disclosure, an error in the data of a logical partition may include a flip of a bit of data, for example, a bit of data in the original data is "1", and after the original data is flashed into the logical partition of the electronic device, the bit of data in the logical partition is "0".

[0091] In other embodiments, the method for obtaining the first original check value also includes: first, performing a check calculation on each data block to obtain a second original check value corresponding to each data block; then, performing a check calculation on one or more second original check values ​​to obtain the aforementioned first original check value.

[0092] It should be noted that if data in at least one data block has been tampered with, and the tampered data block is re-checked and calculated to obtain a new check value, and the new check value is used as the second original check value, then after the data block stored in the electronic device is checked and calculated to obtain a second current check value, the above-mentioned second original check value is the same as the second current check value, so by comparing the second original check value with the second current check value, it is impossible to determine that the above-mentioned data block has been tampered with.

[0093] Therefore, in the embodiment, it is also necessary to perform a verification calculation on the second original verification value to obtain the first original verification value, so that the first original verification value is obtained by performing a verification calculation on the second original verification value, and the first original verification value is encrypted. Therefore, if the second original verification value needs to be tampered with, the first original verification value also needs to be modified, and the first original verification value also needs to be encrypted in the same encryption method as before, so that the second original verification value and the first original verification value can be tampered with, which greatly increases the difficulty of tampering with the second original verification value, thereby preventing the second original verification value from being tampered with.

[0094] If the amount of original data to be verified is too large, the original data will be divided into a large number of data blocks. When the data blocks are verified and calculated, a large number of second original verification values ​​will be obtained. At this time, the verification calculation of the above-mentioned multiple second original verification values ​​will be performed to obtain a large number of first original verification values. In this case, it is necessary to verify and calculate the current data according to the method of verifying and calculating the original data, and a large number of first current verification values ​​will also be obtained. In this way, when the calculated multiple first current verification values ​​are compared with the multiple first original verification values, multiple comparisons are required, so that it takes a long time to determine whether the current data is abnormal. Therefore, in other embodiments, it is necessary to repeat the verification calculation of a large number of second original verification values ​​until a verification value is obtained, and the verification value is used as the first original verification value. In this way, there is no need to compare the data blocks one by one. Only the first current verification value is compared with the first original verification value, and it is possible to quickly determine whether the data of the logical partition is consistent with the original data before being flushed, that is, to quickly verify whether the data of the logical partition is abnormal.

[0095] Specifically, the method of obtaining a first original check value includes: first, dividing multiple second original check values ​​into one or more check value blocks, each check value block includes a preset number of second original check values; then, respectively performing check calculations on the second original check values ​​in each check value block to obtain an intermediate original check value corresponding to each check value block; then, taking the intermediate original check value as the second original check value, and returning to execute the step of performing check calculations on the second original check value until an intermediate check value is obtained, wherein the above-mentioned intermediate check value is taken as the first original check value.

[0096] Through the description of the above embodiments, after obtaining a first original check value, there is no need to compare the multiple second check values ​​of the data block one by one. Only by comparing a first current check value with the calculated first original check value, it is possible to quickly determine whether the data of the logical partition is consistent with the original data before being flushed, thereby quickly verifying whether there is any abnormality in the data of the logical partition.

[0097] By the inconsistency between the first current check value and the first original check value, it can be determined that an error occurs in the data of the logical partition. Furthermore, the corresponding position of the data in which the error occurs, that is, the error position, can be determined. Specifically, after comparing the first original check value with the first current check value, the second original check value corresponding to each data block is compared with the second current check value. If there is a data block whose second original check value is different from the second current check value, it is determined that an error occurs in the data in the data block, that is, the error position is the position where the data block is located.

[0098] In some embodiments, after step S150, that is, after saving the error and the error location of the data corresponding to the error, the method further includes: sending the error and the error location of the data corresponding to the error to the application layer.

[0099] The "application layer" here refers to the level at which users interact with computer systems, specifically an interface. The application layer includes application programs and function libraries.

[0100] According to the above-mentioned embodiment, the probe is set at the kernel layer, and step S140 is to intercept and save the error occurring in the logical partition at the kernel layer. Furthermore, the error and the location where the error occurs need to be sent from the kernel layer to the application layer so that the user can view the error and the location where the error occurs in the application layer. For example, after step S150, the user can check whether there is an error in the data of the logical partition of the electronic device through the application to determine whether there is an abnormality in the logical partition. If an error occurs, the specific location where the error occurs can also be checked.

[0101] In some embodiments, in response to an error existing in the read data, and after intercepting the error by using the probe, the method further comprises: repairing the error by using a forward error correction method.

[0102] When the read data is verified and there is an error in the read data, the error will be corrected by using the forward error correction method in step S160. The "forward error correction method" here refers to "Forward Error Correction", referred to as FEC. Those skilled in the art can understand that the specific process of forward error correction FEC includes: before the original data is flashed into the electronic device, the forward error correction code is added to the original data, and after the original data is flashed into the electronic device, the current data is read from the logical partition of the electronic device and the forward error correction code is used to correct the erroneous data, which will not be elaborated here.

[0103] It should be noted that in the method for checking the abnormality of the logical partition provided by the present disclosure, when there is an error in the read data, in addition to step S140, step S160 is also included. In the embodiment of the present disclosure, step S140 is performed first, and then step S160 is performed, and step S40 and step S160 can also be performed at the same time. Step S160 can be performed only after step S140 is performed, that is, the error occurring in the logical partition and the specific location where the error occurs are first saved, and then the error is repaired in DRAM, but because the permission of the data in the storage space of the electronic device, such as the hard disk, is set to read-only, the data in the storage space of the electronic device cannot be modified, and therefore, such repair cannot be performed in the storage space of the electronic device.

[0104] From the description of the above embodiment, it can be known that if step S160 is executed first, a small part of the data with errors will be repaired in the DRAM, and then step S140 is executed, the current data that has been repaired will be verified in the DRAM, so as to verify that the data has no errors, but this error will not be modified in the storage space of the electronic device. Therefore, it will make it impossible to identify the errors existing in the logical partition in the storage space of the electronic device.

[0105] For example, the bit stream data corresponding to the original data includes data A, and data A is 1011. After the original data is flashed into the electronic device, the data B corresponding to the data A in the logical partition is 1111. FEC repairs data B in DRAM through forward error correction code, that is, 1111 is modified to 1011. Next, after the repair, the current data in the logical partition is verified in DRAM, and the error in data B cannot be verified.

[0106] Therefore, executing step S140 first and then executing step S160, or executing step S40 and step S160 simultaneously, can avoid the problem of being unable to detect errors after repair. In addition, errors in one bit of data can also be verified.

[0107] In summary, the present disclosure provides a method for checking logical partition anomalies. The method sets a probe to trigger the verification of the data in the logical partition while reading the data in the logical partition. If there is an error in the data in the logical partition, the error is intercepted by the above-mentioned probe, and the error and the location corresponding to the error are saved. In this way, there is no need to set up additional computing modules or units, and it is possible to quickly determine whether the data of the read logical partition has an error, thereby improving the efficiency of judging the correctness of the data of the logical partition.

[0108] The disclosed embodiment also provides a device 600 for checking an abnormality of a logical partition, where the logical partition is at least a portion of a physical partition. Figure 6 An exemplary structural block diagram of an apparatus for checking a logical partition abnormality according to an embodiment of the present disclosure is shown. As shown in the figure, the apparatus 600 for checking a logical partition abnormality includes:

[0109] The setting module 601 is used to set a probe, and the probe is used to save the location of the data where the error occurs in the logical partition. Specifically, the function of the setting module is the same as step S110 in the above embodiment, and will not be repeated here.

[0110] The reading module 602 is used to read data from the logical partition.

[0111] In the embodiment of the present disclosure, the function of the reading module is the same as step S120 in the above embodiment, and will not be described in detail here.

[0112] The verification module 603 is used to trigger the verification of the read data in response to the occurrence of the read data to determine the correctness of the data. In the embodiment of the present disclosure, the function of the verification module is the same as step S130 in the above embodiment, which will not be repeated here.

[0113] The interception module 604 is used to intercept the error using the probe in response to the error in the read data. In the embodiment of the present disclosure, the function of the interception module is the same as step S140 in the above embodiment, which will not be described in detail here.

[0114] The saving module 605 is used to save the error position of the data corresponding to the error. In the embodiment of the present disclosure, the function of the saving module is the same as step S150 in the above embodiment, which will not be described in detail here.

[0115] The disclosed embodiment provides a device for checking the abnormality of a logical partition. The device sets a probe through a setting module; then, reads data from the logical partition through a reading module; then, triggers a check on the read data in response to the occurrence of the read data using a checking module to determine the correctness of the data; finally, in response to an error in the read data, a saving module saves the error position of the data corresponding to the error according to the probe. In this way, whether the data in the logical partition is abnormal can be checked without setting an additional computing unit, and the efficiency of checking the logical partition can be improved.

[0116] The disclosed embodiments also provide a computer storage medium on which is stored a computer program for checking logical partition anomalies. When the computer program is executed by one or more processors, the method for checking logical partition anomalies as described in any of the above embodiments is implemented.

[0117] The disclosed embodiment also provides a method for checking logical partition abnormalities, the method comprising: after the electronic device or apparatus is flashed, in response to the electronic device or apparatus being turned on for the first time, executing a computer program as described in the above embodiment to obtain errors existing in the data of the logical partition and error positions of the data corresponding to the errors.

[0118] The electronic device or apparatus here refers to a device released by a manufacturer and provided to users for use. For example, the electronic device or apparatus may be a mobile phone, a personal computer or other device. Flashing here refers to inputting data such as a system, software or firmware into the electronic device or apparatus. After the electronic device or apparatus is produced, when the electronic device or apparatus is turned on for the first time, the computer program described in the above embodiment will be executed, and the computer program will be used to check whether there is an abnormality in the logical partition of the electronic device or apparatus. Furthermore, if there is an abnormality in the logical partition of the electronic device or apparatus, the above-mentioned computer program can be used to obtain the existing error and the location of the data corresponding to the error.

[0119] It can be seen from the description of the above embodiments that electronic devices can identify and intercept electronic devices or devices with flashing problems during the production stage, thereby avoiding the release of electronic devices or devices with flashing problems. Moreover, there is no need to set up an additional computing unit or module for verifying whether the logical partition is abnormal. The verification of the logical partition in the electronic device or device can be completed only on one side of the electronic device or device, saving costs and resources.

[0120] According to different application scenarios, the electronic equipment or device disclosed herein may include servers, cloud servers, server clusters, data processing devices, robots, computers, printers, scanners, tablet computers, smart terminals, PC devices, IoT terminals, mobile terminals, mobile phones, driving recorders, navigators, sensors, cameras, cameras, video cameras, projectors, watches, headphones, mobile storage, wearable devices, visual terminals, automatic driving terminals, transportation, household appliances, and / or medical equipment. The transportation includes airplanes, ships and / or vehicles; the household appliances include televisions, air conditioners, microwave ovens, refrigerators, rice cookers, humidifiers, washing machines, electric lights, gas stoves, and range hoods; the medical equipment includes magnetic resonance imaging, ultrasound machines and / or electrocardiographs. The electronic equipment or device disclosed herein may also be applied to the Internet, IoT, data centers, energy, transportation, public administration, manufacturing, education, power grids, telecommunications, finance, retail, construction sites, and medical fields. Further, the electronic equipment or device disclosed herein may also be used in cloud, edge, and terminal applications related to artificial intelligence, big data, and / or cloud computing. In one or more embodiments, electronic devices or apparatuses with high computing power according to the disclosed solution can be applied to cloud devices (such as cloud servers), while electronic devices or apparatuses with low power consumption can be applied to terminal devices and / or edge devices (such as smartphones or cameras).

[0121] In one or more embodiments, the hardware information of the cloud device and the hardware information of the terminal device and / or the edge device are compatible with each other, so that according to the hardware information of the terminal device and / or the edge device, appropriate hardware resources can be matched from the hardware resources of the cloud device to simulate the hardware resources of the terminal device and / or the edge device, so as to complete the unified management, scheduling and collaborative work of end-to-end or cloud-edge-to-end.

[0122] Although multiple embodiments of the present disclosure have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art may think of many changes, modifications, and alternatives without departing from the thought and spirit of the present disclosure. It should be understood that in the process of practicing the present disclosure, various alternatives to the embodiments of the present disclosure described herein may be adopted. The attached claims are intended to define the scope of protection of the present disclosure, and therefore cover equivalents or alternatives within the scope of these claims.

Claims

1. A method for checking a logical partition abnormality, wherein the logical partition is at least a portion of a physical partition, the method comprising: Setting a probe, wherein the probe is used to intercept errors in data in the logical partition; Reading data from the logical partition; In response to the occurrence of the read data, triggering a check on the read data to determine the correctness of the data; In response to an error in the read data, intercepting the error using the probe; The error and the error position of the data corresponding to the error are saved.

2. The method according to claim 1, wherein: The probe is disposed in the inner core layer.

3. The method according to claim 1, wherein: The reading data from the logical partition comprises: Acquire a mapping relationship between the logical partition and the physical partition from a device mapping file, wherein the mapping relationship includes a corresponding relationship between the physical partition and the logical partition and location information of the logical partition in the physical partition; The data is read according to the location information of the logical partition.

4. The method according to claim 1, wherein: The logical partition has a first original check value, and the check performed on the read data to determine the correctness of the data includes: Verifying the data to obtain a first current verification value of the logical partition; The first current check value is compared with the first original check value to determine whether there is an error in the data.

5. The method according to claim 4, further comprising: In response to the first current check value and the first original check value being inconsistent, it is determined that an error exists in the data of the logical partition.

6. The method according to claim 5, wherein: The data of the logical partition includes one or more data blocks, each of the data blocks has a second original check value, and the method further includes: In response to an error in the data of the logical partition, verifying each of the data blocks to obtain a second current verification value of each of the data blocks; Compare each of the second current check values ​​with each of the second original check values ​​accordingly to determine an abnormal data block with errors; The error position is determined according to the abnormal data block.

7. The method according to claim 4, further comprising: In response to the first current check value and the first original check value being consistent, it is determined that no error exists in the logical partition.

8. The method according to claim 2, wherein: After the error and the error location of the data corresponding to the error are saved, the method further comprises: The error and the error position of the data corresponding to the error are sent to the application layer.

9. The method according to claim 1, wherein: In response to an error existing in the read data, and after intercepting the error by using the probe, the method further comprises: The error is repaired using forward error correction.

10. A device for checking a logical partition abnormality, wherein the logical partition is at least a portion of a physical partition, the device comprising: A setting module, used for setting a probe, wherein the probe is used for saving the location of the data where an error occurs in the logical partition; A reading module, used for reading data from the logical partition; A verification module, configured to trigger verification of the read data in response to the occurrence of the read data, so as to determine the correctness of the data; An interception module, configured to intercept the error using the probe in response to an error in the read data; A saving module is used to save the error position of the data corresponding to the error.

11. A computer storage medium storing a computer program for checking logical partition anomalies, wherein the computer program, when executed by one or more processors, implements the method according to any one of claims 1 to 9.

12. A method for checking a logical partition abnormality, wherein the logical partition is at least a portion of a physical partition, and the physical partition is at least a portion of a storage space of an electronic device or apparatus, the method comprising: After the electronic device or apparatus is flashed, in response to the electronic device or apparatus being turned on for the first time, the computer program as claimed in claim 11 is executed to obtain errors existing in the data of the logical partition and error locations of the data corresponding to the errors.