System recovery method and device, computer equipment and storage medium
By determining the binary file information to be replaced based on the fault information and memory layout information, replacing and verification, the problem of time-consuming and data risk of substrate management controller repair in the prior art is solved, and fast and accurate system recovery is achieved.
Patent Information
- Application Number
- CN202411971877.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-09
AI Technical Summary
The existing substrate management controller repair method requires updating the entire file, resulting in data loss, system instability or compatibility issues, and the recovery process takes a long time to meet the needs of quickly recovering the system.
By determining the binary file information to be replaced based on the type of fault information and memory layout information, obtaining historical binary file information, replacing the binary file to be replaced based on the replacement information, obtaining the restored binary file and performing verification. If the verification is successful, the restored binary file is used to perform operations.
The rapid location and replacement of faulty binary files is achieved, reducing the risk of data loss and system instability, and improving the efficiency and accuracy of system recovery.
Smart Images

Figure CN119961051A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of system recovery, and in particular to a system recovery method, apparatus, computer equipment and storage medium. Background Art
[0002] With the continuous upgrading and updating of computer systems, higher requirements are also placed on the repair and maintenance of baseboard management controllers. In order to meet these challenges, researchers and engineers are constantly exploring new repair technologies to improve repair efficiency, reduce risks and meet the needs of modern computer systems. Existing baseboard management controller problem troubleshooting methods mostly rely on traditional troubleshooting processes, such as observing the baseboard management controller startup process, checking hardware connections, using debug tools, etc. Traditional baseboard management controller repair methods often require updating the entire baseboard management controller file, which may cause data loss, system instability or new compatibility issues. In addition, the comprehensive baseboard management controller update or recovery process takes a long time, which is not applicable for scenarios that require rapid system recovery. Summary of the invention
[0003] Based on this, it is necessary to provide a system recovery method, device, computer equipment and storage medium that can quickly realize system recovery in response to the above technical problems.
[0004] In order to solve the above technical problems, in a first aspect, a system recovery method is provided, the method comprising:
[0005] Determine the target binary file information to be replaced according to the type of fault information and the memory layout information, wherein the target binary file information to be replaced includes the information to be replaced, the address of the information to be replaced, and the size of the information to be replaced;
[0006] Acquire historical binary file information, and determine target replacement binary file information from the historical binary file information based on the type of fault information, where the target replacement binary file information includes replacement information, replacement information address, and replacement information size;
[0007] Replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file;
[0008] The recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; if the verification result is successful, the operation is performed using the recovered binary file that has successfully been verified.
[0009] In one embodiment, determining the target binary file information to be replaced according to the type of fault information and the memory layout information includes:
[0010] Obtain fault information, parse the fault information, and obtain the type of the fault information;
[0011] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0012] Selecting memory layout information of a target function type matching the type of the fault information;
[0013] The target to-be-replaced binary file information is determined from the memory layout information based on the memory layout information of the target function type.
[0014] In one embodiment, obtaining historical binary file information, and determining target replacement binary file information from the historical binary file information based on the type of fault information includes:
[0015] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0016] Selecting memory layout information of a target function type matching the type of the fault information;
[0017] The replacement information, the replacement information address, and the replacement information size are determined from the historical binary file information based on the memory layout information of the target function type.
[0018] In one embodiment, the information to be replaced at the address of the information to be replaced in the target binary file to be replaced is replaced based on the replacement information, and the recovered binary file includes:
[0019] Parse the address of the information to be replaced to obtain the starting address and the ending address of the information to be replaced;
[0020] The replacement information is used to replace the information to be replaced in the target binary file to be replaced. The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced to obtain a restored binary file.
[0021] In one embodiment, the recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information, and obtaining the verification result includes:
[0022] Acquire the information to be replaced within a preset range and the size of the information to be replaced within the preset range, and calculate a first redundant cyclic check value based on the information to be replaced within the preset range and the size of the information to be replaced within the preset range;
[0023] Acquire replacement information within a preset range and the size of the replacement information within the preset range, and calculate a second redundancy cyclic check value based on the replacement information within the preset range and the size of the replacement information within the preset range;
[0024] Determining whether the first redundant cyclic check value and the second redundant cyclic check value are consistent;
[0025] If they are consistent, the verification result of the restored binary file is considered to be successful.
[0026] In one embodiment, if the verification result is a verification failure, the method includes:
[0027] Obtain a target binary file, where the target binary file is a backup file of the target binary file to be replaced;
[0028] The recovered binary file is replaced with the target binary file to obtain the recovered target binary file, and an operation is performed based on the recovered target binary file.
[0029] In one embodiment, the replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced, and the recovered binary file includes:
[0030] Dividing the information address to be replaced into a plurality of sub-information addresses to be replaced;
[0031] Obtain the sub-information to be replaced corresponding to each sub-information to be replaced address;
[0032] The target tree is constructed by taking the address of the information to be replaced as a node, multiple addresses of the sub-information to be replaced as sub-nodes, and the sub-information to be replaced corresponding to each address of the sub-information to be replaced as a leaf node;
[0033] Parse the replacement information to obtain multiple sub-replacement information;
[0034] Calculate the similarity value between each sub-replacement information and each sub-information to be replaced;
[0035] Taking the sub-replacement information whose similarity value is greater than a preset threshold as the target replacement information;
[0036] Obtaining sub-information to be replaced corresponding to the target replacement information, and replacing the sub-information to be replaced corresponding to the target replacement information with the target information;
[0037] Traverse the target tree to determine whether there are any leaf nodes whose child information to be replaced has not been replaced;
[0038] If so, delete the child information to be replaced of the leaf node, obtain the placeholder, and use the placeholder to fill the leaf node.
[0039] In order to solve the above technical problem, in a second aspect, a system recovery device is provided, the device comprising:
[0040] an acquisition module, configured to determine target binary file information to be replaced according to the type of fault information and the memory layout information, wherein the target binary file information to be replaced includes the information to be replaced, the address of the information to be replaced, and the size of the information to be replaced; and to acquire historical binary file information, and to determine target replacement binary file information from the historical binary file information based on the type of fault information, wherein the target replacement binary file information includes replacement information, the address of the replacement information, and the size of the replacement information;
[0041] A replacement module, used for replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information, so as to obtain a restored binary file;
[0042] The verification module is used to verify the recovered binary file based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; if the verification result is successful, the operation is performed using the recovered binary file that has successfully verified.
[0043] In order to solve the above technical problem, in the third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the following steps are implemented: when the processor executes the computer program, the steps of the method in the first aspect are implemented.
[0044] In order to solve the above technical problems, in a fourth aspect, the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of the above first aspect are implemented.
[0045] Different from the prior art, the present application determines the target binary file information to be replaced according to the type of fault information and the memory layout information, the target binary file information to be replaced includes the information to be replaced, the address of the information to be replaced and the size of the information to be replaced; determines the target replacement binary file information from the historical binary file information based on the type of fault information, the target replacement binary file information includes the replacement information, the address of the replacement information and the size of the replacement information; replaces the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file; verifies the restored binary file based on the size of the information to be replaced and the size of the replacement information to obtain the verification result; and uses the verification result to perform operations on the successfully restored binary file. In this way, the target binary file information to be replaced is quickly located based on the type of fault information and the memory layout information, and the file recovery operation is performed based on the target binary file information to be replaced, so that system recovery can be quickly achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of a system recovery method in one embodiment;
[0047] Figure 2 is a structural block diagram of a system recovery device in one embodiment;
[0048] Figure 3 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In computer systems, BIOS (Basic Input Output System) is the key interface between hardware and operating system, and its stability and reliability are crucial. BIOS is responsible for initializing hardware devices, performing self-test (POST), and loading operating system boot program when the system starts. However, with the continuous development of computer technology, BIOS functions are becoming increasingly complex and the amount of code is increasing dramatically, making BIOS maintenance and repair more difficult.
[0051] The challenges faced by current BIOS repair technologies include: Complexity: The BIOS code is large and contains multiple functional modules, which makes it difficult to accurately locate the problem when a failure occurs. Risk: Traditional BIOS repair methods often require updating the entire BIOS file, which may cause data loss, system instability, or new compatibility issues. Time cost: The comprehensive BIOS update or recovery process takes a long time and is not suitable for scenarios that require rapid system recovery.
[0052] With the continuous upgrading and updating of computer systems, higher requirements are also placed on the repair and maintenance of BIOS. In order to meet these challenges, researchers and engineers are constantly exploring new BIOS repair technologies to improve repair efficiency, reduce risks and meet the needs of modern computer systems. Existing BIOS troubleshooting methods mostly rely on traditional troubleshooting processes, such as observing the BIOS startup process, checking hardware connections, and using debug tools. Although these methods are effective, they may seem powerless in the face of some complex or difficult to reproduce problems. In addition, directly updating the BIOS or restoring the BIOS default settings may not solve the problem and there are certain risks.
[0053] In view of the above technical problems, in one embodiment, Figure 1As shown, a system recovery method is provided, the method comprising the following steps:
[0054] Step 101 : determining target binary file information to be replaced according to the type of fault information and memory layout information, wherein the target binary file information to be replaced includes information to be replaced, an address of the information to be replaced, and a size of the information to be replaced.
[0055] Specifically, fault information is obtained, the fault information is parsed, and the type of the fault information is obtained; memory layout information is obtained, the memory layout information is parsed, and memory layout information corresponding to multiple function types in the memory layout information is obtained; memory layout information of a target function type that matches the type of the fault information is selected; and target binary file information to be replaced is determined from the memory layout information based on the memory layout information of the target function type.
[0056] Fault information refers to relevant fault information of a fault that occurs in the system, which may include fault type, fault area, etc. Memory layout information refers to Rom Layout information for the baseboard management controller, wherein Rom Layout (read-on ly memory layout) is also called read-only memory layout, which indicates the area allocation inside the read-only memory, such as the name, address and occupied space size of FV, etc. The program code layout of the baseboard management controller is set in the read-only memory layout information. The complex structure of the binary file of the baseboard management controller can be parsed according to the read-only memory layout information. By parsing the read-only memory layout information, the read-only memory layout information corresponding to multiple functional types can be obtained. Multiple functional types are used to divide the read-only memory layout information into read-only memory layout information blocks supporting different functions.
[0057] In actual applications, a certain part of the read-only memory layout information records the allocation of the system baseboard management controller code area. For example, a certain part of the read-only memory layout information may be: the system baseboard management controller code area (address from 00500h-07FFFh) contains the core code of the baseboard management controller, which is responsible for initializing system hardware, detecting and configuring devices, starting the operating system, and other functions.
[0058] Assuming that the type of fault information at this time is a failure to start the operating system, the read-only memory layout information corresponding to the target function type that matches the type of the fault information is selected as the division of the system baseboard management controller code area. The address of the system baseboard management controller code area (the address ranges from 00500h-07FFFh) is the address of the target binary file to be replaced. According to the address of the information to be replaced, the information stored at the address of the target binary file to be replaced is searched, that is, the information to be replaced is searched. After obtaining the information to be replaced, the size of the information to be replaced can be obtained.
[0059] In the present application, a method is provided for quickly locating target binary file information to be replaced according to the type of fault information and read-only memory layout information, so as to facilitate rapid file recovery operations based on the target binary file information to be replaced, thereby improving system recovery efficiency.
[0060] Step 102, obtaining historical binary file information, and determining target replacement binary file information from the historical binary file information based on the type of fault information, wherein the target replacement binary file information includes replacement information, replacement information address, and replacement information size.
[0061] Specifically, memory layout information is obtained, the memory layout information is parsed, and memory layout information corresponding to multiple function types in the memory layout information is obtained; memory layout information of a target function type that matches the type of fault information is selected; and replacement information, a replacement information address, and a replacement information size are determined from historical binary file information based on the memory layout information of the target function type.
[0062] Similarly, after obtaining the read-only memory layout information of the target function type that matches the type of the fault information, the address recorded in the read-only memory layout information of the target function type is used as the replacement information address of the historical binary file information. The information stored at the address of the historical binary file is searched according to the replacement information address, that is, the replacement information is searched, and the replacement information size can be obtained after obtaining the replacement information. The historical binary file here can be a binary file of the historical version of the target file to be replaced.
[0063] The target replacement binary file information and historical binary file information in this application are information of different versions of baseboard management controller (BIOS) binary files. Baseboard management controller binary files (such as .bin and .rom files) are mainly used to store firmware data and configuration information in computer systems, which play a vital role in the computer startup process.
[0064] Step 103: replace the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file.
[0065] Specifically, the address of the information to be replaced is parsed to obtain the starting address and the ending address of the information to be replaced; the information to be replaced in the target binary file to be replaced is replaced using the replacement information, and the replacement information fills the address of the information to be replaced based on the starting address and the ending address of the information to be replaced to obtain a restored binary file.
[0066] In the present application, a replacement tool can be used to input replacement information into the starting address and the ending address of the information to be replaced, so as to replace the information to be replaced stored at the information address to be replaced in the target binary file to be replaced, and then combine it with the information stored at the non-information address to be replaced in the target binary file to be replaced, so as to obtain a restored binary file.
[0067] The replacement tool can be prepared before obtaining the fault information. In this application, a special tool or script for performing the baseboard management controller binary file block reading operation is prepared. The tool can read a block of the baseboard management controller binary file, input the starting address and length of the read, and read it to generate a binary file. The replacement tool can be a BIOS binary file block reading tool, for example, a binary file block reading tool developed by Open-Watcom C / C++, an FPTW file block reading tool, or a CH341 A EEPROM Programmer file block reading tool. The FPTW file block reading tool is a tool for reading BIOS information, and the information can be obtained through the interface provided by the operating system or by directly reading the BIOS chip. The CH341AEEPROM Programmer file block reading tool is used to extract the BIN file in the BIOS chip, select the target chip model through the software interface, read the data and save it as a BIN file. The tool should have a data verification and error handling mechanism to ensure the accuracy and security of the replacement process.
[0068] In this application, the replacement information and the backup replacement information are taken as blocks, and the starting and ending position ranges of these blocks are checked from the Layout file of the BIOS binary file. These blocks contain critical data that may affect the startup or operation of the system. Before performing the replacement operation, back up the target binary file to be replaced to prevent the system from failing to start due to replacement failure. Extract the block data that needs to be replaced, that is, the question sea data, from a known normal or specific version of a historical binary file. Then use a special tool to overwrite the extracted replacement data to the corresponding position of the target binary file to be replaced. A strict verification mechanism is implemented during the replacement process to ensure the accuracy and integrity of the replacement data. After the replacement is completed, restart the system and verify whether the BIOS can work normally. In the event of a replacement failure or the system cannot start, immediately use the backup BIOS binary file for recovery.
[0069] In one embodiment, the replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced, and the recovered binary file includes: dividing the address of the information to be replaced into multiple sub-information addresses to be replaced; obtaining the sub-information to be replaced corresponding to each sub-information address to be replaced; taking the address of the information to be replaced as a node, multiple sub-information addresses to be replaced as sub-nodes, and taking the sub-information to be replaced corresponding to each sub-information address to be replaced as a leaf node to construct a target tree; parsing the replacement information to obtain multiple sub-replacement information; calculating the similarity value between each sub-replacement information and each sub-information to be replaced; taking the sub-replacement information with a similarity value greater than a preset threshold as the target replacement information, obtaining the sub-information to be replaced corresponding to the target replacement information, and replacing the sub-information to be replaced corresponding to the target replacement information with the target information; traversing the target tree to determine whether there is a leaf node whose sub-information to be replaced has not been replaced; if so, deleting the leaf node's sub-information to be replaced, and obtaining a placeholder, and filling the leaf node with the placeholder.
[0070] In this embodiment, the address of the information to be replaced can be divided to obtain multiple sub-information to be replaced addresses, and the sub-information to be replaced addresses and the sub-information to be replaced stored at the addresses can be obtained. The address of the information to be replaced is a node, the multiple sub-information to be replaced addresses are sub-nodes, and the sub-information to be replaced corresponding to each sub-information to be replaced address is a leaf node to construct a target tree. The target tree can be constructed based on a binary tree, a quadtree, or the like.
[0071] The replacement information address can be divided to obtain multiple sub-replacement information addresses, and the sub-replacement information address and the sub-replacement information stored at the address are obtained. The similarity value between the sub-replacement information and the sub-information to be replaced is calculated using cosine similarity, spatial distance, and other methods. A preset threshold is set, and the threshold here can be any value, which is set based on actual experience. The sub-replacement information corresponding to the similarity value greater than the preset threshold is used as the target replacement information, and the sub-information to be replaced corresponding to the similarity value greater than the preset threshold is used as the target information to be replaced, and the target information to be replaced is replaced with the target replacement information.
[0072] Here, the address of the information to be replaced and the address of the replacement information are divided, and the address of the information to be replaced and the address of the replacement information are divided equally, for example, every 3-byte address is a sub-address of the information to be replaced or the sub-address of the replacement information.
[0073] Traverse the leaf nodes in the target tree and filter out the leaf nodes that have not been replaced. Generally, the sub-information to be replaced stored in the leaf nodes that have not been replaced is usually an auxiliary word and has no practical meaning. It can be replaced by a placeholder here. The placeholder can be any symbol, and this application does not limit the specific symbol form of the placeholder.
[0074] In the present application, a target tree is constructed according to the target binary file information to be replaced, and the target binary file information to be replaced is parsed at multiple levels, accurately to the sub-information to be replaced corresponding to each sub-information to be replaced address, each sub-information to be replaced and the sub-replacement information are matched, and the matched sub-replacement information is used as the target information to replace the sub-information to be replaced. In this way, the precise replacement of information at each sub-generation replacement information address can be refined, and the leaf nodes that have not been replaced can be filled with placeholders to ensure data alignment.
[0075] In one embodiment, semantic analysis can be performed on the information to be replaced and the replacement information. The information to be replaced and the replacement information can be semantically analyzed in the form of adjective / (adjective+particle)+noun / (noun+particle)+verb / (verb+particle). For example, the information to be replaced is "back up the files in area A". After semantic analysis, adjective: area A, particle: of; noun: file; verb: back up. Obtain a preset dictionary, which includes standard vocabulary commonly used in the industry, and replace the information to be replaced after semantic analysis and the replacement information after semantic analysis according to the standard vocabulary in the preset dictionary. For example, assuming that area A is a ROM on a baseboard management controller, it can be replaced with a memory on the baseboard management controller according to the standard vocabulary. Assuming that the replacement information includes BIOS, the BIOS is replaced with a baseboard management controller. In this way, semantic analysis is performed on the information to be replaced and the replacement information according to the preset dictionary, and the words with the same semantic meaning in different expressions in the information to be replaced and the replacement information can be identified, which is conducive to accurate replacement according to the position of the words with the same semantic meaning.
[0076] Step 104, verify the restored binary file based on the size of the information to be replaced and the size of the replacement information, and obtain a verification result; if the verification result is successful, perform an operation using the restored binary file that has successfully verified.
[0077] The information to be replaced within a preset range and the size of the information to be replaced within the preset range can be obtained, and a first redundant cyclic check value is calculated based on the information to be replaced within the preset range and the size of the information to be replaced within the preset range; the replacement information within the preset range and the size of the replacement information within the preset range are obtained, and a second redundant cyclic check value is calculated based on the replacement information within the preset range and the size of the replacement information within the preset range; it is determined whether the first redundant cyclic check value and the second redundant cyclic check value are consistent; if they are consistent, it is considered that the verification result of the restored binary file is a successful verification.
[0078] Specifically, the preset range can be the information header or tail position, which is formed by the number of characters within a certain number as the division standard. Exemplarily, specifically, the address 0x08005000 to 0x08006000 area can be used as the preset range to calculate the cyclic redundancy check value of the information in the area, that is, the CRC value. It can be understood that the first 4k area of the replacement information and the replaced information is the area where the CRC needs to be calculated.
[0079] Here, the first few percent of the data can be used as the data that needs to calculate the CRC code in an equal proportion, or the CRC value can be calculated by setting a fixed value, such as the head 4K or the tail 4K data. Because the amount of data calculated in this embodiment is small, the calculation time is short, and it will not take up much verification time, which can meet the requirements of rapid response. After calculating the first cyclic redundancy check value and the second cyclic redundancy check value, the first cyclic redundancy check value and the second cyclic redundancy check value will be compared. If they are the same, it means that the content of the replaced binary file is the same as that of the replaced binary file, and no error occurred during the replacement process. Compared with the redundant check value corresponding to the recovery binary file and the target binary file to be replaced, only the redundant check value corresponding to the information to be replaced and the replacement information is calculated in this application, which improves the security of the replacement operation while reducing the amount of calculation, and can further improve the efficiency of system recovery.
[0080] In one embodiment, if the verification result is a verification failure, it means that the restored binary file still cannot enable the system to start normally. At this time, a target binary file can be obtained, which is a backup file of the target binary file to be replaced; the restored binary file is replaced with the target binary file to obtain the restored target binary file, and the operation is performed based on the restored target binary file.
[0081] Specifically, before obtaining historical binary file information, the historical binary file can be backed up, and the backed up historical binary file can be used as the target binary file. The target binary file is stored in an encrypted database. When the verification result of the restored binary file is a failure, the target binary file can be used to replace the restored binary file to obtain the restored target binary file, and the corresponding system operation is performed based on the restored binary file.
[0082] Here, the storage address of the restored binary file can be obtained first, and the target binary file can be input into the storage address of the restored binary file to obtain the restored target binary file. In this application, the restored binary file and the restored target binary file can be backed up. In this way, data loss caused by accidents during the replacement process can be prevented.
[0083] The present invention achieves accurate location and repair of BIOS problems by accurately defining replaceable information of replaceable blocks in BIOS binary files. Compared with traditional comprehensive update or recovery methods, this method is more focused and accurate, avoiding unnecessary modifications and potential risks.
[0084] Efficiency: Block replacement is faster and more efficient than updating the entire BIOS file. Since only problematic blocks are processed, the complexity and time cost of data processing are reduced, and the repair efficiency is improved.
[0085] Reduced risk of data loss: During the repair process, only the information of the file to be replaced in the specific block of the BIOS file is modified, rather than the entire file, which greatly reduces the risk of data loss or damage. This is crucial to protecting user data and system stability.
[0086] Flexibility and customization: The present invention allows users or technicians to define different blocks for replacement according to specific needs, thus realizing customized local repair or testing of BIOS. This flexibility makes the repair process more in line with the actual situation and improves the pertinence and effectiveness of the repair.
[0087] Simplify user operations: By developing dedicated tools or scripts, block replacement operations become simpler and easier to operate.
[0088] Improve user experience: Fast and effective BIOS repair methods can quickly solve problems encountered by users, improve user satisfaction and trust in computer systems. At the same time, it reduces system downtime caused by BIOS problems and improves the overall user experience.
[0089] Promoting the development of BIOS technology: The proposal and application of this invention will promote the further development of BIOS troubleshooting and repair technology. By continuously optimizing the technical implementation of key links such as block definition, reading, overwriting and verification, the reliability and stability of BIOS can be further improved, providing a strong guarantee for the safe and stable operation of computer systems.
[0090] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0091] In one embodiment, Figure 2 As shown, a system recovery device is provided, including: an acquisition module 20, a replacement module 21 and a verification module 22, wherein:
[0092] The acquisition module 20 is used to determine the target binary file information to be replaced according to the type of the fault information and the memory layout information, the target binary file information to be replaced includes the information to be replaced, the address of the information to be replaced and the size of the information to be replaced; obtain the historical binary file information, and determine the target replacement binary file information from the historical binary file information based on the type of the fault information, the target replacement binary file information includes the replacement information, the address of the replacement information and the size of the replacement information;
[0093] A replacement module 21, configured to replace the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information, so as to obtain a restored binary file;
[0094] The verification module 22 is used to verify the restored binary file based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; if the verification result is successful, the operation is performed using the restored binary file that has successfully verified.
[0095] In one embodiment, another implementation of the system recovery method that can be implemented by the above device includes the following specific steps:
[0096] Determine the target binary file information to be replaced based on the type of fault information and memory layout information, including:
[0097] Obtain fault information, parse the fault information, and obtain the type of the fault information;
[0098] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0099] Selecting memory layout information of a target function type matching the type of the fault information;
[0100] The target to-be-replaced binary file information is determined from the memory layout information based on the memory layout information of the target function type.
[0101] In one embodiment, another implementation of the system recovery method that can be implemented by the above device includes the following specific steps:
[0102] Obtaining historical binary file information, and determining target replacement binary file information from the historical binary file information based on the type of fault information includes:
[0103] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0104] Selecting memory layout information of a target function type matching the type of the fault information;
[0105] The replacement information, the replacement information address, and the replacement information size are determined from the historical binary file information based on the memory layout information of the target function type.
[0106] In one embodiment, another implementation of the system recovery method that can be implemented by the above device includes the following specific steps:
[0107] The information to be replaced at the address of the information to be replaced in the target binary file to be replaced is replaced based on the replacement information, and the recovered binary file includes:
[0108] Parse the address of the information to be replaced to obtain the starting address and the ending address of the information to be replaced;
[0109] The replacement information is used to replace the information to be replaced in the target binary file to be replaced. The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced to obtain a restored binary file.
[0110] In one embodiment, another implementation of the system recovery method that can be implemented by the above device includes the following specific steps:
[0111] The recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information. The verification results include:
[0112] Acquire the information to be replaced within a preset range and the size of the information to be replaced within the preset range, and calculate a first redundant cyclic check value based on the information to be replaced within the preset range and the size of the information to be replaced within the preset range;
[0113] Acquire replacement information within a preset range and the size of the replacement information within the preset range, and calculate a second redundancy cyclic check value based on the replacement information within the preset range and the size of the replacement information within the preset range;
[0114] Determining whether the first redundant cyclic check value and the second redundant cyclic check value are consistent;
[0115] If they are consistent, the verification result of the restored binary file is considered to be successful.
[0116] In one embodiment, another implementation of the system recovery method that can be implemented by the above device includes the following specific steps:
[0117] If the verification result is verification failure, the method includes:
[0118] Obtain a target binary file, where the target binary file is a backup file of the target binary file to be replaced;
[0119] The recovered binary file is replaced with the target binary file to obtain the recovered target binary file, and an operation is performed based on the recovered target binary file.
[0120] In one embodiment, another implementation of the system recovery method that can be implemented by the above device includes the following specific steps:
[0121] The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced, and the recovered binary file includes:
[0122] Dividing the information address to be replaced into a plurality of sub-information addresses to be replaced;
[0123] Obtain the sub-information to be replaced corresponding to each sub-information to be replaced address;
[0124] The target tree is constructed by taking the address of the information to be replaced as a node, multiple addresses of the sub-information to be replaced as sub-nodes, and the sub-information to be replaced corresponding to each address of the sub-information to be replaced as a leaf node;
[0125] Parse the replacement information to obtain multiple sub-replacement information;
[0126] Calculate the similarity value between each sub-replacement information and each sub-information to be replaced;
[0127] Taking the sub-replacement information whose similarity value is greater than a preset threshold as the target replacement information;
[0128] Obtain sub-information to be replaced corresponding to the target replacement information, and replace the sub-information to be replaced corresponding to the target replacement information with the target information;
[0129] Traverse the target tree to determine whether there are any leaf nodes whose child information to be replaced has not been replaced;
[0130] If so, delete the child information to be replaced of the leaf node, obtain the placeholder, and use the placeholder to fill the leaf node.
[0131] For the specific definition of the system recovery device, please refer to the definition of the system recovery method above, which will not be repeated here. Each module in the above system recovery device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0132] In one embodiment, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the system recovery methods provided by the above methods.
[0133] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data applied by the system recovery method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a system recovery method is implemented.
[0134] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0135] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0136] Determine the target binary file information to be replaced according to the type of fault information and the memory layout information, wherein the target binary file information to be replaced includes the information to be replaced, the address of the information to be replaced, and the size of the information to be replaced;
[0137] Acquire historical binary file information, and determine target replacement binary file information from the historical binary file information based on the type of fault information, where the target replacement binary file information includes replacement information, replacement information address, and replacement information size;
[0138] Replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file;
[0139] The recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; if the verification result is successful, the operation is performed using the recovered binary file that has successfully been verified.
[0140] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0141] The target binary file information to be replaced is determined based on the type of fault information and the memory layout information, including:
[0142] Obtain fault information, parse the fault information, and obtain the type of the fault information;
[0143] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0144] Selecting memory layout information of a target function type matching the type of the fault information;
[0145] The target to-be-replaced binary file information is determined from the memory layout information based on the memory layout information of the target function type.
[0146] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0147] Obtaining historical binary file information, and determining target replacement binary file information from the historical binary file information based on the type of fault information includes:
[0148] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0149] Selecting memory layout information of a target function type matching the type of the fault information;
[0150] The replacement information, the replacement information address, and the replacement information size are determined from the historical binary file information based on the memory layout information of the target function type.
[0151] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0152] The information to be replaced at the address of the information to be replaced in the target binary file to be replaced is replaced based on the replacement information, and the recovered binary file includes:
[0153] Parse the address of the information to be replaced to obtain the starting address and the ending address of the information to be replaced;
[0154] The replacement information is used to replace the information to be replaced in the target binary file to be replaced. The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced to obtain a restored binary file.
[0155] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0156] The recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information. The verification results include:
[0157] Acquire the information to be replaced within a preset range and the size of the information to be replaced within the preset range, and calculate a first redundant cyclic check value based on the information to be replaced within the preset range and the size of the information to be replaced within the preset range;
[0158] Acquire replacement information within a preset range and the size of the replacement information within the preset range, and calculate a second redundancy cyclic check value based on the replacement information within the preset range and the size of the replacement information within the preset range;
[0159] Determining whether the first redundant cyclic check value and the second redundant cyclic check value are consistent;
[0160] If they are consistent, the verification result of the restored binary file is considered to be successful.
[0161] In one embodiment, if the verification result is a verification failure, the method includes:
[0162] Obtain a target binary file, where the target binary file is a backup file of the target binary file to be replaced;
[0163] The recovered binary file is replaced with the target binary file to obtain the recovered target binary file, and an operation is performed based on the recovered target binary file.
[0164] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0165] The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced, and the recovered binary file includes:
[0166] Dividing the information address to be replaced into a plurality of sub-information addresses to be replaced;
[0167] Obtain the sub-information to be replaced corresponding to each sub-information to be replaced address;
[0168] The target tree is constructed by taking the address of the information to be replaced as a node, multiple addresses of the sub-information to be replaced as sub-nodes, and the sub-information to be replaced corresponding to each address of the sub-information to be replaced as a leaf node;
[0169] Parse the replacement information to obtain multiple sub-replacement information;
[0170] Calculate the similarity value between each sub-replacement information and each sub-information to be replaced;
[0171] Taking the sub-replacement information whose similarity value is greater than a preset threshold as the target replacement information;
[0172] Obtain sub-information to be replaced corresponding to the target replacement information, and replace the sub-information to be replaced corresponding to the target replacement information with the target information;
[0173] Traverse the target tree to determine whether there are any leaf nodes whose child information to be replaced has not been replaced;
[0174] If so, delete the child information to be replaced of the leaf node, obtain the placeholder, and use the placeholder to fill the leaf node.
[0175] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0176] Determine the target binary file information to be replaced according to the type of fault information and the memory layout information, wherein the target binary file information to be replaced includes the information to be replaced, the address of the information to be replaced, and the size of the information to be replaced;
[0177] Acquire historical binary file information, and determine target replacement binary file information from the historical binary file information based on the type of fault information, where the target replacement binary file information includes replacement information, replacement information address, and replacement information size;
[0178] Replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file;
[0179] The recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; if the verification result is successful, the operation is performed using the recovered binary file that has successfully been verified.
[0180] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0181] The target binary file information to be replaced is determined based on the type of fault information and the memory layout information, including:
[0182] Obtain fault information, parse the fault information, and obtain the type of the fault information;
[0183] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0184] Selecting memory layout information of a target function type matching the type of the fault information;
[0185] The target to-be-replaced binary file information is determined from the memory layout information based on the memory layout information of the target function type.
[0186] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0187] Obtaining historical binary file information, and determining target replacement binary file information from the historical binary file information based on the type of fault information includes:
[0188] Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information;
[0189] Selecting memory layout information of a target function type matching the type of the fault information;
[0190] The replacement information, the replacement information address, and the replacement information size are determined from the historical binary file information based on the memory layout information of the target function type.
[0191] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0192] The information to be replaced at the address of the information to be replaced in the target binary file to be replaced is replaced based on the replacement information, and the recovered binary file includes:
[0193] Parse the address of the information to be replaced to obtain the starting address and the ending address of the information to be replaced;
[0194] The replacement information is used to replace the information to be replaced in the target binary file to be replaced. The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced to obtain a restored binary file.
[0195] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0196] The recovered binary file is verified based on the size of the information to be replaced and the size of the replacement information. The verification results include:
[0197] Acquire the information to be replaced within a preset range and the size of the information to be replaced within the preset range, and calculate a first redundant cyclic check value based on the information to be replaced within the preset range and the size of the information to be replaced within the preset range;
[0198] Acquire replacement information within a preset range and the size of the replacement information within the preset range, and calculate a second redundancy cyclic check value based on the replacement information within the preset range and the size of the replacement information within the preset range;
[0199] Determining whether the first redundant cyclic check value and the second redundant cyclic check value are consistent;
[0200] If they are consistent, the verification result of the restored binary file is considered to be successful.
[0201] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0202] If the verification result is verification failure, the method includes:
[0203] Obtain a target binary file, where the target binary file is a backup file of the target binary file to be replaced;
[0204] The recovered binary file is replaced with the target binary file to obtain the recovered target binary file, and an operation is performed based on the recovered target binary file.
[0205] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0206] The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced, and the recovered binary file includes:
[0207] Dividing the information address to be replaced into a plurality of sub-information addresses to be replaced;
[0208] Obtain the sub-information to be replaced corresponding to each sub-information to be replaced address;
[0209] The target tree is constructed by taking the address of the information to be replaced as a node, multiple addresses of the sub-information to be replaced as sub-nodes, and the sub-information to be replaced corresponding to each address of the sub-information to be replaced as a leaf node;
[0210] Parse the replacement information to obtain multiple sub-replacement information;
[0211] Calculate the similarity value between each sub-replacement information and each sub-information to be replaced;
[0212] Taking the sub-replacement information whose similarity value is greater than a preset threshold as the target replacement information;
[0213] Obtain sub-information to be replaced corresponding to the target replacement information, and replace the sub-information to be replaced corresponding to the target replacement information with the target information;
[0214] Traverse the target tree to determine whether there are any leaf nodes whose child information to be replaced has not been replaced;
[0215] If so, delete the child information to be replaced of the leaf node, obtain the placeholder, and use the placeholder to fill the leaf node.
[0216] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0217] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0218] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A system recovery method, characterized in that: include: Determine target binary file information to be replaced according to the type of fault information and memory layout information, wherein the target binary file information to be replaced includes information to be replaced, an address of the information to be replaced, and a size of the information to be replaced; Acquire historical binary file information, and determine target replacement binary file information from the historical binary file information based on the type of the fault information, wherein the target replacement binary file information includes replacement information, a replacement information address, and a replacement information size; Replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file; Verifying the restored binary file based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; If the verification result is successful, the operation is performed using the recovered binary file that has successfully been verified.
2. The method according to claim 1, characterized in that Determining the target binary file information to be replaced according to the type of fault information and the memory layout information includes: Obtain fault information, parse the fault information, and obtain the type of the fault information; Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information; Selecting memory layout information of a target function type matching the type of the fault information; The target to-be-replaced binary file information is determined from the memory layout information based on the memory layout information of the target function type.
3. The method according to claim 1, characterized in that The acquiring of historical binary file information and determining target replacement binary file information from the historical binary file information based on the type of the fault information includes: Acquire memory layout information, parse the memory layout information, and acquire memory layout information corresponding to multiple function types in the memory layout information; Selecting memory layout information of a target function type matching the type of the fault information; The replacement information, the replacement information address, and the replacement information size are determined from the historical binary file information based on the memory layout information of the target function type.
4. The method according to claim 1, characterized in that: The step of replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information to obtain a restored binary file comprises: Parse the address of the information to be replaced to obtain the starting address and the ending address of the information to be replaced; The information to be replaced in the target binary file to be replaced is replaced by using the replacement information, wherein the replacement information fills the address of the information to be replaced based on the start address and the end address of the address of the information to be replaced, so as to obtain a restored binary file.
5. The method according to claim 1, characterized in that: The verifying the restored binary file based on the size of the information to be replaced and the size of the replacement information, and obtaining the verification result includes: Acquire information to be replaced within a preset range and the size of the information to be replaced within the preset range, and calculate a first redundant cyclic check value based on the information to be replaced within the preset range and the size of the information to be replaced within the preset range; Acquire replacement information within a preset range and the size of the replacement information within the preset range, and calculate a second redundancy cyclic check value based on the replacement information within the preset range and the size of the replacement information within the preset range; Determining whether the first redundancy cyclic check value and the second redundancy cyclic check value are consistent; If they are consistent, the verification result of the restored binary file is considered to be successful.
6. The method according to claim 1, characterized in that If the verification result is a verification failure, the method includes: Obtain a target binary file, where the target binary file is a backup file of the target binary file to be replaced; The restored binary file is replaced with the target binary file to obtain the restored target binary file, and an operation is performed based on the restored target binary file.
7. The method according to claim 4, characterized in that The replacement information fills the address of the information to be replaced based on the starting address and the ending address of the address of the information to be replaced, and the recovered binary file includes: Dividing the information address to be replaced into a plurality of sub-information addresses to be replaced; Obtain the sub-information to be replaced corresponding to each sub-information to be replaced address; The target tree is constructed by taking the address of the information to be replaced as a node, multiple addresses of the sub-information to be replaced as sub-nodes, and the sub-information to be replaced corresponding to each address of the sub-information to be replaced as a leaf node; Parsing the replacement information to obtain multiple sub-replacement information; Calculate the similarity value between each sub-replacement information and each sub-information to be replaced; Taking the sub-replacement information whose similarity value is greater than a preset threshold as the target replacement information; Obtaining sub-information to be replaced corresponding to the target replacement information, and replacing the sub-information to be replaced corresponding to the target replacement information with the target information; Traverse the target tree to determine whether there are any leaf nodes whose child information to be replaced has not been replaced; If so, delete the child information to be replaced of the leaf node, obtain the placeholder, and use the placeholder to fill the leaf node.
8. A system recovery device, characterized in that: The device comprises: an acquisition module, configured to determine target binary file information to be replaced according to the type of fault information and memory layout information, wherein the target binary file information to be replaced includes information to be replaced, an address of the information to be replaced, and a size of the information to be replaced; and to acquire historical binary file information, and to determine target replacement binary file information from the historical binary file information based on the type of fault information, wherein the target replacement binary file information includes replacement information, an address of the replacement information, and a size of the replacement information; A replacement module, used for replacing the information to be replaced at the address of the information to be replaced in the target binary file to be replaced based on the replacement information, so as to obtain a restored binary file; The verification module is used to verify the restored binary file based on the size of the information to be replaced and the size of the replacement information to obtain a verification result; if the verification result is successful, the operation is performed using the restored binary file with a successful verification result.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.