A method, device and medium for restoring user configuration data
By judging and comparing the validity and version consistency of the initial configuration parameters before and after the firmware update, the problem of abnormal user configuration data recovery after the firmware upgrade is solved and the accuracy of the configuration data is improved.
Patent Information
- Application Number
- CN202210460944.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-28
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-04-28
AI Technical Summary
After firmware upgrade, it is common for user configuration data to be restored abnormally, resulting in inaccuracy of configuration data.
Obtain and write the initial configuration parameters to the storage area before firmware update, and judge their validity after the update. If invalid, use the default configuration parameters to restore. If valid, compare the version information. If they are consistent, use the initial configuration parameters to restore the data. If inconsistent, initialize the storage area and restore using default configuration parameters.
It effectively avoids data anomalies caused by version inconsistencies and improves the accuracy of configuration data.
Smart Images

Figure CN114816852B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer systems, and in particular to a method, device and medium for restoring user configuration data. Background Art
[0002] There are multiple sub-function modules in a complex computer system. As the function needs to be upgraded, there is a need to upgrade the firmware during the product life cycle. Currently, after the firmware is upgraded, the user configuration uses the default configuration, so the user configuration also needs to be updated.
[0003] Currently, it is possible to automatically restore user configurations, but when configuration items change, restoration exceptions may occur.
[0004] It can be seen that how to avoid abnormal configuration data recovery is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0005] The purpose of the present application is to provide a method, device and medium for restoring user configuration data, so as to avoid abnormal configuration data recovery and improve the accuracy of configuration data.
[0006] To solve the above technical problems, the present application provides a method for restoring user configuration data, comprising:
[0007] Before the firmware is updated, the initial configuration parameters of the firmware are obtained and written into the storage area;
[0008] After the firmware is updated, the initial configuration parameters in the storage area are called and it is determined whether the initial configuration parameters are valid;
[0009] If invalid, restore the configuration data using the firmware's default configuration parameters;
[0010] If valid, compare the version information of the initial configuration parameters in the storage area with the version information of the firmware to see if they are consistent;
[0011] If they are inconsistent, the storage area is initialized and the step of restoring the configuration data using the default configuration parameters of the firmware is entered;
[0012] If they are consistent, the configuration data is restored using the initial configuration parameters.
[0013] Preferably, if there are multiple storage areas, before writing the initial configuration parameters into the storage area, the method further includes:
[0014] Check whether there is an invalid storage area in each storage area;
[0015] If it exists, the invalid storage area is initialized, and the step of writing the initial configuration parameters into the storage area is entered;
[0016] If it does not exist, the process proceeds to the step of writing the initial configuration parameters into the storage area.
[0017] Preferably, after writing the initial configuration parameters into the storage area, the method further comprises:
[0018] Read back the current configuration parameters of the firmware, and check whether the current configuration parameters of the firmware are consistent with the initial configuration parameters stored in each storage area;
[0019] If they are not consistent, each storage area is initialized, and the step of writing the initial configuration parameters into the storage area is entered;
[0020] If there are multiple inconsistencies, it is determined that the initial configuration parameter writing has failed and an alarm is issued.
[0021] Preferably, if the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware, before using the initial configuration parameters to restore the configuration data, the method further includes:
[0022] Check whether the initial configuration parameters in each storage area are consistent;
[0023] If they are inconsistent, the initial configuration parameters in each storage area are arbitrated, and the configuration data is restored according to the arbitration result.
[0024] Preferably, arbitrating the initial configuration parameters in each storage area and restoring the configuration data according to the arbitration result includes:
[0025] Determine whether all initial configuration parameters are invalid;
[0026] If all are not invalid, then invalid parameters are removed from each storage area, and the invalid parameters are synchronized to the abnormal area, and the step of obtaining the initial configuration parameters of the firmware is entered;
[0027] If all are invalid, initialize each storage area and enter the step of restoring configuration data using the default configuration parameters of the firmware.
[0028] Preferably, it also includes:
[0029] When obtaining the initial configuration parameters and writing the initial configuration parameters into the storage area, a timestamp is generated;
[0030] Save timestamp.
[0031] In order to solve the above technical problems, the present application also provides a device for restoring user configuration data, including:
[0032] The acquisition module is used to acquire the initial configuration parameters of the firmware before the firmware is updated, and write the initial configuration parameters into the storage area;
[0033] A calling module, used to call the initial configuration parameters in the storage area after the firmware is updated, and determine whether the initial configuration parameters are valid; if valid, trigger the comparison module; if invalid, trigger the first recovery module;
[0034] A first recovery module, used to restore configuration data using default configuration parameters of the firmware;
[0035] A comparison module, used to compare whether the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware; if they are consistent, the second recovery module is triggered; if they are inconsistent, the initialization module is triggered;
[0036] An initialization module, used for initializing the storage area and triggering the first recovery module;
[0037] The second recovery module is used to restore the configuration data using the initial configuration parameters.
[0038] In order to solve the above technical problems, the present application also provides a device for restoring user configuration data, including:
[0039] Memory for storing computer programs;
[0040] The processor is used to implement the steps of the above method for restoring user configuration data when executing a computer program.
[0041] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method for restoring user configuration data are implemented.
[0042] The present application provides a method for restoring user configuration data, which method writes initial configuration parameters into a storage area before the firmware is updated; after the firmware is updated, the initial configuration parameters in the storage area are called, and it is determined whether the initial configuration parameters are valid; if invalid, the default configuration parameters of the firmware are used to restore the configuration data; if valid, the version information of the initial configuration parameters in the storage area is compared with the version information of the firmware to see if they are consistent; if not, the storage area is initialized, and the step of restoring the configuration data using the default configuration parameters of the firmware is entered; if consistent, the configuration data is restored using the initial configuration parameters. It can be seen that when the version information of the initial configuration parameters in the storage area is inconsistent with the version information of the firmware, the configuration data will not be restored to the initial configuration parameters, but the default configuration parameters are used to restore the configuration data, which effectively avoids data anomalies caused by version inconsistency and improves the accuracy of the configuration data.
[0043] In addition, the present application also provides a device and medium for restoring user configuration data, which have the same beneficial effects as the method for restoring user configuration data. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 A flowchart of a method for restoring user configuration data provided by the present application;
[0046] Figure 2 A structural diagram of a device for restoring user configuration data provided by the present application;
[0047] Figure 3 A structural diagram of another device for restoring user configuration data provided by the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] The core of the present application is to provide a method, device and medium for restoring user configuration data, so as to avoid abnormal configuration data recovery and improve the accuracy of configuration data.
[0050] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0051] It should be noted that the method for restoring user configuration data provided in the present application can be used to save and restore user configuration data of firmware such as Basic Input Output System (BIOS) and Baseboard Management Controller (BMC).
[0052] Figure 1 A flowchart of a method for restoring user configuration data provided by this application, such as Figure 1 As shown, the method includes:
[0053] S1: Before the firmware is updated, the initial configuration parameters of the firmware are obtained and written into the storage area.
[0054] In a specific implementation, before the firmware is updated, it is necessary to first obtain the initial configuration parameters of the firmware set by the user, and after obtaining the initial configuration parameters, the initial configuration parameters should be used as the configuration data of the firmware, and the initial configuration parameters should be written into the storage area for subsequent calls. It can be understood that in order to increase the security of storage, multiple storage areas can be set, and the initial configuration parameters can be written into all storage areas, so that when calling, the consistency of the initial configuration parameters in each storage area can be checked to determine whether the initial configuration parameters are disordered, so as to ensure the accuracy of the called initial configuration parameters. In addition, after the initial configuration parameters are written into the storage area, in order to facilitate the verification of the initial configuration parameters when calling, the version information of the initial configuration parameters, the data storage time of the storage area itself, the timestamp and other data can be written into the storage area together, thereby improving the fault tolerance of the initial configuration parameters.
[0055] S2: After the firmware is updated, the initial configuration parameters in the storage area are called and it is determined whether the initial configuration parameters are valid; if not valid, the process proceeds to S3; if valid, the process proceeds to S4.
[0056] After the firmware is updated, the user configuration items need to be updated. At this time, the initial configuration parameters in the storage area can be called to restore the user configuration data. After the initial configuration parameters are called, in order to verify the validity of the initial configuration parameters, the data storage time and timestamp of the storage area can be used to determine whether the called initial configuration parameters are valid. Specifically, a timestamp can be generated each time the initial configuration parameters are operated. According to the timestamp, it can be determined whether the initial configuration parameters have been tampered with after being written into the storage area. If the initial configuration parameters have been tampered with, it can be determined that they are invalid; in addition, the storage time of the initial configuration parameters can be obtained according to the timestamp of writing the initial configuration parameters into the storage area and the timestamp of calling the initial configuration parameters from the storage area. The storage time of the initial configuration parameters is compared with the data storage time of the corresponding storage area. If the storage time of the initial configuration parameters is greater than the data storage time of the storage area, it can be determined that the initial configuration parameters called from the storage area are invalid, and if the storage time of the initial configuration parameters is not greater than the data storage time of the storage area, it can be determined that the called initial configuration parameters are valid. It should be noted that, in a specific implementation, the method of determining whether the initial configuration parameters are valid is not limited to the determination based on the data storage time and timestamp of the storage area as described in this embodiment. An identification of whether the written initial configuration parameters are valid may also be stored in the storage area. When calling, the identification may be used to determine whether it is valid. This embodiment does not limit the method of determining whether the initial configuration parameters are valid.
[0057] S3: Restore the configuration data using the default configuration parameters of the firmware.
[0058] It is understandable that after determining that the initial configuration parameters in the storage area are invalid, the initial configuration parameters in the storage area are not used to restore the configuration data, but the default configuration parameters of the firmware are used to restore the configuration parameters to start the firmware. It should be noted that the default configuration parameters of the firmware are always stored in the firmware and are not affected by the firmware update. This is an inherent property of the firmware.
[0059] S4: Compare the version information of the initial configuration parameters in the storage area with the version information of the firmware to see if they are consistent; if not, proceed to S5; if consistent, proceed to S6.
[0060] After determining that the initial configuration parameters in the storage area are valid, since the initial configuration parameters in the storage area may be tampered with by addition, reduction, or order adjustment, in order to avoid confusion in the configuration data after the firmware upgrade, it is necessary to compare whether the version information of the initial configuration parameters in the storage area is consistent with the version information of the current firmware; if they are inconsistent, the initial configuration parameters in the storage area cannot be used to restore the configuration data. At this time, step S5 is entered to initialize the storage area, use the default configuration parameters of the firmware to restore the configuration data, and re-acquire the initial configuration parameters input by the user to write into the initialized storage area; if they are consistent, it is determined that the initial configuration parameters in the storage area can be used to restore the configuration data, and step S6 is entered to restore the configuration data using the initial configuration parameters in the storage area.
[0061] S5: Initialize the storage area and enter S3.
[0062] S6: Restore the configuration data using the initial configuration parameters.
[0063] This embodiment provides a method for restoring user configuration data, which writes initial configuration parameters into a storage area before the firmware is updated; after the firmware is updated, the initial configuration parameters in the storage area are called, and it is determined whether the initial configuration parameters are valid; if not, the default configuration parameters of the firmware are used to restore the configuration data; if valid, the version information of the initial configuration parameters in the storage area is compared with the version information of the firmware to see if they are consistent; if not, the storage area is initialized, and the step of restoring the configuration data using the default configuration parameters of the firmware is entered; if consistent, the configuration data is restored using the initial configuration parameters. It can be seen that when the version information of the initial configuration parameters in the storage area is inconsistent with the version information of the firmware, the configuration data will not be restored to the initial configuration parameters, but the default configuration parameters are used to restore the configuration data, which effectively avoids data anomalies caused by version inconsistency and improves the accuracy of the configuration data.
[0064] On the basis of the above embodiment, if there are multiple storage areas, in order to ensure that each storage area is valid, it is necessary to check the validity of each storage area before writing the initial configuration parameters into the storage area. This step includes:
[0065] Check whether there is an invalid storage area in each storage area;
[0066] If it exists, initialize the invalid storage area and enter S1;
[0067] If it does not exist, go to S1.
[0068] In a specific implementation, if data has been pre-stored in the storage area, it can be determined that the storage area is invalid. In addition, if the data storage time of the storage area is short, it can also be determined that the storage area is invalid. Specifically, the data storage time of the storage area can be compared with a preset time threshold. If the data storage time of the storage area is greater than the time threshold, it can be determined that the storage area is valid, otherwise it is determined that the storage area is invalid. It should be noted that the time threshold is related to the firmware update cycle. In a specific implementation, the user can set it based on experience, and this embodiment does not make a specific description of this.
[0069] Before writing the initial configuration parameters into each storage area, this embodiment first checks whether there are invalid storage areas in each storage area. If there are invalid storage areas, the invalid storage areas are initialized first, and then the initial configuration parameters are written into each storage area. By ensuring the validity of each storage area, the reliability of the initial configuration parameters stored in each storage area is effectively guaranteed.
[0070] On the basis of the above embodiment, after the initial configuration parameters are written into the storage area, in order to ensure the accuracy of the written initial configuration parameters, it is also necessary to check the consistency between the written initial configuration parameters and the current configuration parameters of the firmware. This step includes:
[0071] Read back the current configuration parameters of the firmware, and check whether the current configuration parameters of the firmware are consistent with the initial configuration parameters stored in each storage area;
[0072] If they are inconsistent, initialize each storage area and enter S1;
[0073] If there are multiple inconsistencies, it is determined that the initial configuration parameter writing has failed and an alarm is issued.
[0074] Specifically, the current configuration parameters of the firmware can be read, and the current configuration parameters of the firmware can be compared with the initial configuration parameters in each storage area. If the current configuration parameters of the firmware are consistent with the values and sequences of the initial configuration parameters in the storage area, it can be determined that the current configuration parameters of the firmware are consistent with the initial configuration parameters in the storage area, otherwise it is determined that the two are inconsistent. It can be understood that only when the current configuration parameters of the firmware are consistent with the initial configuration parameters in the storage area can the initial configuration parameters be saved. When the current configuration parameters of the firmware are inconsistent with the initial configuration parameters in the storage area, it is necessary to initialize the corresponding storage area, re-acquire the initial configuration parameters, write the re-acquired initial configuration parameters into the corresponding storage area and check again; if the current configuration parameters of the firmware are still inconsistent with the initial configuration parameters in the storage area after multiple checks, it can be determined that the initial configuration parameters have failed to be written. At this time, it is necessary to remind the user to check the firmware and each storage area through an alarm to find out the reason for the write failure.
[0075] This embodiment compares the current configuration parameters of the firmware with the initial configuration parameters in each storage area to check the consistency between the two, and ensures the accuracy of the written initial configuration parameters by checking the consistency between the two.
[0076] Based on the above embodiment, if the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware, in order to verify the accuracy of the initial configuration parameters in each storage area, before using the initial configuration parameters to restore the configuration data, it is also necessary to perform a consistency check on the initial configuration parameters in each storage area. This step includes:
[0077] Check whether the initial configuration parameters in each storage area are consistent;
[0078] If they are inconsistent, the initial configuration parameters in each storage area are arbitrated, and the configuration data is restored according to the arbitration result.
[0079] In a specific implementation, the consistency of the initial configuration parameters in each storage area can be checked by comparing the values and the order of the initial configuration parameters in each storage area. If the values and the order of the initial configuration parameters in each storage area are consistent, it can be determined that the initial configuration parameters in each storage area are consistent, otherwise it is determined that they are inconsistent; if they are inconsistent, the initial configuration parameters in each storage area can be arbitrated by an existing arbitration algorithm to restore the configuration data according to the arbitration result. Specifically, valid parameters can be identified from the initial configuration parameters in each storage area according to the arbitration algorithm, and the identified valid parameters can be used to try to restore the configuration data.
[0080] This embodiment verifies the accuracy of the initial configuration parameters in each storage area by performing a consistency check on the initial configuration parameters in each storage area. When the initial configuration parameters in each storage area are inconsistent, arbitration is performed on the initial configuration parameters in each storage area, and the configuration data is restored according to the arbitration result, thereby effectively improving the possibility of configuration data recovery.
[0081] On the basis of the above embodiment, when it is found that the initial configuration parameters in each storage area are not all consistent, it can be determined that there are invalid parameters. In order to facilitate the recovery of configuration data, it is necessary to process the invalid parameters. This step includes:
[0082] Determine whether all initial configuration parameters are invalid;
[0083] If not all are invalid, invalid parameters are removed from each storage area, and the invalid parameters are synchronized to the abnormal area, and enter S1;
[0084] If all are invalid, initialize each storage area and enter S3.
[0085] Specifically, the arbitration algorithm can be used to identify valid parameters in the initial configuration parameters in each storage area, and then the invalid parameters in the initial configuration parameters can be obtained; if the initial configuration parameters are all invalid, then each storage area is initialized, and the configuration data is restored using the default configuration parameters of the firmware; and if the initial configuration parameters are not all invalid, then the invalid parameters can be eliminated from each storage area, and the configuration data can be restored using the valid parameters in each storage area to increase the possibility of restoring the configuration data. In addition, the invalid parameters can be synchronized to the abnormal area to prompt the user to re-enter the corresponding parameters. When the user completes the input, the parameters entered by the user are obtained and combined with the valid parameters in each storage area to restore the configuration data.
[0086] After determining that there are invalid parameters, this embodiment determines whether all initial configuration parameters in the storage area are invalid. When all initial configuration parameters are invalid, the default configuration parameters are used to restore the configuration data. When not all initial configuration parameters are invalid, the invalid parameters are eliminated and the remaining valid parameters are used to try to restore the configuration data, which effectively increases the possibility of restoring the configuration data. In addition, synchronizing the invalid parameters to the abnormal area can make the user aware of the invalid parameters to remind the user to re-enter the corresponding parameters.
[0087] On the basis of the above embodiment, for the convenience of tracking, this embodiment generates a timestamp when obtaining the initial configuration parameters and writing the initial configuration parameters into the storage area. When it is found that the stored initial configuration parameters are abnormal, the timestamp can be used for tracking to find the cause of the data abnormality. This step includes:
[0088] When obtaining the initial configuration parameters and writing the initial configuration parameters into the storage area, a timestamp is generated;
[0089] Save timestamp.
[0090] Specifically, a timestamp is generated when the initial configuration parameters are obtained and written into the storage area. In addition, after the initial configuration parameters are stored in the storage area, the timestamp is updated each time the initial configuration parameters are operated. By saving the timestamp, when an abnormality occurs in the initial configuration parameters, the cause of the data abnormality can be tracked by querying the timestamp.
[0091] This embodiment generates and saves a timestamp when acquiring the initial configuration parameters and writing the initial configuration parameters into the storage area. When an abnormality occurs in the initial configuration parameters stored in the storage area, the timestamp can be queried for tracking so as to find the cause of the data abnormality.
[0092] In the above embodiments, the method for restoring user configuration data is described in detail, and the present application also provides an embodiment corresponding to the device for restoring user configuration data. It should be noted that the present application describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.
[0093] Figure 2 A structural diagram of a device for restoring user configuration data provided by this application, such as Figure 2 As shown, the device comprises:
[0094] The acquisition module 10 is used to acquire the initial configuration parameters of the firmware before the firmware is updated, and write the initial configuration parameters into the storage area;
[0095] The calling module 11 is used to call the initial configuration parameters in the storage area after the firmware is updated, and determine whether the initial configuration parameters are valid; if valid, the comparison module 13 is triggered; if invalid, the first recovery module 12 is triggered;
[0096] A first recovery module 12, used to restore configuration data using default configuration parameters of the firmware;
[0097] The comparison module 13 is used to compare the version information of the initial configuration parameters in the storage area with the version information of the firmware to see if they are consistent; if they are consistent, the second recovery module 15 is triggered; if they are inconsistent, the initialization module 14 is triggered;
[0098] An initialization module 14, used for initializing the storage area and triggering the first recovery module 12;
[0099] The second recovery module 15 is used to recover the configuration data using the initial configuration parameters.
[0100] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0101] The device for restoring user configuration data provided in this embodiment obtains the initial configuration parameters of the firmware before the firmware is updated through the acquisition module, and writes the initial configuration parameters into the storage area; after the firmware is updated, the initial configuration parameters in the storage area are called through the calling module, and it is determined whether the initial configuration parameters are valid; if valid, the comparison module is triggered; if invalid, the first recovery module is triggered; the configuration data is restored by using the default configuration parameters of the firmware through the first recovery module; the comparison module is used to compare whether the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware; if consistent, the second recovery module is triggered; if inconsistent, the initialization module is triggered; the initialization module is used to initialize the storage area and trigger the first recovery module; the second recovery module is used to restore the configuration data using the initial configuration parameters. It can be seen that when the version information of the initial configuration parameters in the storage area of the device is inconsistent with the version information of the firmware, the configuration data will not be restored to the initial configuration parameters, but the default configuration parameters are used to restore the configuration data, which effectively avoids the situation of data abnormality caused by version inconsistency and improves the accuracy of the configuration data.
[0102] Figure 3 A structural diagram of another device for restoring user configuration data provided by this application, such as Figure 3 As shown, the device comprises: a memory 20 for storing a computer program;
[0103] The processor 21 is configured to implement the steps of the method for restoring user configuration data mentioned in the above embodiment when executing a computer program.
[0104] The device for restoring user configuration data provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0105] Among them, the processor 21 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 21 may be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0106] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the method for restoring user configuration data disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include but is not limited to initial configuration parameters, etc.
[0107] In some embodiments, the device for restoring user configuration data may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .
[0108] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the apparatus for restoring user configuration data, and may include more or fewer components than those shown in the figure.
[0109] The device for restoring user configuration data provided in this embodiment includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the above method for restoring user configuration data, and the effect is the same as above.
[0110] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for restoring user configuration data as described in the above method embodiment are implemented.
[0111] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0112] The computer-readable storage medium provided in this embodiment includes the above-mentioned method for restoring user configuration data, and the effect is the same as above.
[0113] The above is a detailed introduction to the method, device and medium for restoring user configuration data provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0114] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for restoring user configuration data, characterized in that: include: Before the firmware is updated, initial configuration parameters of the firmware are obtained, and the initial configuration parameters are written into a storage area; After the firmware is updated, the initial configuration parameters in the storage area are called and it is determined whether the initial configuration parameters are valid; a timestamp is generated each time the initial configuration parameters are operated, and it is determined according to the timestamp whether the initial configuration parameters have been tampered with after being written into the storage area, and if the initial configuration parameters have been tampered with, it is determined to be invalid; In addition, the storage time of the initial configuration parameters can be obtained according to the timestamp of writing the initial configuration parameters into the storage area and the timestamp of calling the initial configuration parameters from the storage area, and the storage time of the initial configuration parameters is compared with the data preservation time of the corresponding storage area. If the storage time of the initial configuration parameters is greater than the data preservation time of the storage area, it is determined that the initial configuration parameters called from the storage area are invalid. If the storage time of the initial configuration parameters is not greater than the data preservation time of the storage area, it is determined that the called initial configuration parameters are valid. If invalid, the configuration data is restored using the default configuration parameters of the firmware; the default configuration parameters of the firmware are always stored in the firmware and are not affected by firmware updates, which is an inherent property of the firmware; If valid, comparing the version information of the initial configuration parameters in the storage area with the version information of the firmware to see whether they are consistent; If not, initializing the storage area and entering the step of restoring configuration data using the default configuration parameters of the firmware; If they are consistent, restoring the configuration data using the initial configuration parameters; If there are multiple storage areas, before writing the initial configuration parameters into the storage area, the method further includes: Checking whether there is an invalid storage area in each of the storage areas; If it exists, then initialize the invalid storage area and enter the step of writing the initial configuration parameters into the storage area; If not, entering the step of writing the initial configuration parameters into the storage area; If the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware, before using the initial configuration parameters to restore the configuration data, the method further includes: Checking whether the initial configuration parameters in each storage area are consistent; If they are inconsistent, arbitrating the initial configuration parameters in each of the storage areas, and restoring the configuration data according to the arbitration result; The arbitrating the initial configuration parameters in each of the storage areas and restoring the configuration data according to the arbitration result comprises: Determining whether the initial configuration parameters are all invalid; If not all of them are invalid, then the invalid parameters are removed from each of the storage areas, and the invalid parameters are synchronized to the abnormal area, and the step of obtaining the initial configuration parameters of the firmware is entered; If all are invalid, each storage area is initialized, and the step of restoring configuration data using the default configuration parameters of the firmware is entered.
2. The method for restoring user configuration data according to claim 1, characterized in that: After writing the initial configuration parameters into the storage area, the method further includes: Reading back the current configuration parameters of the firmware, and checking whether the current configuration parameters of the firmware are consistent with the initial configuration parameters stored in each of the storage areas; If they are inconsistent, each of the storage areas is initialized, and the step of writing the initial configuration parameters into the storage area is entered; If there are multiple inconsistencies, it is determined that the writing of the initial configuration parameters has failed, and an alarm is issued.
3. The method for restoring user configuration data according to claim 1, characterized in that: Also includes: When acquiring the initial configuration parameters and writing the initial configuration parameters into the storage area, generating a timestamp; The timestamp is saved.
4. A device for restoring user configuration data, characterized in that: include: An acquisition module, used for acquiring initial configuration parameters of the firmware before the firmware is updated, and writing the initial configuration parameters into a storage area; A calling module, used for calling the initial configuration parameters in the storage area after the firmware is updated, and determining whether the initial configuration parameters are valid; generating a timestamp each time the initial configuration parameters are operated, and determining whether the initial configuration parameters have been tampered with after being written into the storage area according to the timestamp, and determining that the initial configuration parameters are invalid if they have been tampered with; In addition, the storage time of the initial configuration parameters can be obtained according to the timestamp of writing the initial configuration parameters into the storage area and the timestamp of calling the initial configuration parameters from the storage area, and the storage time of the initial configuration parameters is compared with the data preservation time of the corresponding storage area. If the storage time of the initial configuration parameters is greater than the data preservation time of the storage area, it is determined that the initial configuration parameters called from the storage area are invalid; if the storage time of the initial configuration parameters is not greater than the data preservation time of the storage area, it is determined that the called initial configuration parameters are valid; if valid, the comparison module is triggered; if invalid, the first recovery module is triggered; The first recovery module is used to restore the configuration data using the default configuration parameters of the firmware; the default configuration parameters of the firmware are always stored in the firmware and are not affected by firmware updates, and are inherent properties of the firmware; The comparison module is used to compare whether the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware; if they are consistent, the second recovery module is triggered; if they are inconsistent, the initialization module is triggered; The initialization module is used to initialize the storage area and trigger the first recovery module; The second recovery module is used to restore the configuration data using the initial configuration parameters; If there are multiple storage areas, before writing the initial configuration parameters into the storage area, the method further includes: Checking whether there is an invalid storage area in each of the storage areas; If it exists, then initialize the invalid storage area and enter the step of writing the initial configuration parameters into the storage area; If not, entering the step of writing the initial configuration parameters into the storage area; If the version information of the initial configuration parameters in the storage area is consistent with the version information of the firmware, before using the initial configuration parameters to restore the configuration data, the method further includes: Checking whether the initial configuration parameters in each storage area are consistent; If they are inconsistent, arbitrating the initial configuration parameters in each of the storage areas, and restoring the configuration data according to the arbitration result; The arbitrating the initial configuration parameters in each of the storage areas and restoring the configuration data according to the arbitration result comprises: Determining whether the initial configuration parameters are all invalid; If not all of them are invalid, then the invalid parameters are removed from each of the storage areas, and the invalid parameters are synchronized to the abnormal area, and the step of obtaining the initial configuration parameters of the firmware is entered; If all are invalid, each storage area is initialized, and the step of restoring configuration data using the default configuration parameters of the firmware is entered.
5. A device for restoring user configuration data, characterized in that: comprising a memory for storing a computer program; A processor, configured to implement the steps of the method for restoring user configuration data as claimed in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for restoring user configuration data according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Mobile terminal and updating method of configuration information thereof
CN101667131A
Method, device and terminal device for updating configuration parameter
CN103064712A
A data storage management method and device based on flash equipment
CN109669628A
Configuration updating method and device
CN110750274A
Starting framework and method of Bootloader flashing program for vehicle control unit
CN110865822A
