Controller upgrading method, system, equipment and medium
By setting multiple running partitions and storage partitions in the controller, obtaining and comparing hash values to determine the installation status, the problem of the controller being unable to continue upgrading after abnormal power outage/reset is solved, and the success rate and efficiency of system upgrades are improved.
Patent Information
- Application Number
- CN202311470286.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-06
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, the controller cannot continue the system upgrade after abnormal power outage/reset, resulting in a low upgrade success rate and a long time.
By setting the storage partition, the first running partition and the second running partition in the controller, obtaining the hash values of the upgrade file and the reference file, determining the current installation status of the upgrade file, and continuing to upgrade from the correct data segment after the controller is powered on/reset.
It realizes that the system upgrade can continue after the controller is powered off/reset abnormally, improving the success rate and efficiency of the upgrade.
Smart Images

Figure CN119938087A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software upgrade, and in particular to a controller upgrade method, system, device and medium. Background Art
[0002] During the use of intelligent controllers, system upgrades are required to maintain the normal operation of the controller. At the same time, system upgrades can bring new functions and enrich the use of the controller. The existing upgrade process is to store the installation package in the controller and perform an overwrite installation, replacing the system files before the upgrade with the files in the installation package; however, after the controller is abnormally powered off / reset, the existing upgrade process cannot continue the system upgrade after the controller is powered on / reset again. The controller needs to re-issue the system upgrade command and restart the system upgrade from the beginning, which greatly reduces the success rate of the system upgrade and increases the time required for the system upgrade.
[0003] Therefore, there are technical problems in the prior art such as low upgrade success rate and long upgrade time when abnormal power failure / reset occurs during controller upgrade. Summary of the invention
[0004] The purpose of the present invention is to solve the problems in the prior art of low upgrade success rate and long upgrade time when abnormal power failure / reset occurs during controller upgrade.
[0005] To solve the above problem, an embodiment of the present invention discloses a controller upgrade method, comprising the following steps:
[0006] The controller includes a storage partition, a first running partition, and a second running partition; the storage partition stores the acquired target file required for upgrading, wherein the target file includes a plurality of data segments; the first running partition acquires each data segment of the target file from the storage partition, and sequentially overwrites each data segment of the target file to the second running partition; wherein all data segments of the target file stored in the storage partition are used as reference files, and data segments of the target file stored in the second running partition are used as upgrading files; and the upgrading method includes the following steps:
[0007] Get the hash value of each data segment in the upgrade file and the baseline file;
[0008] Install the data segments of the upgrade file in sequence, and synchronously obtain the current hash value of the current data segment currently installed;
[0009] When the controller is powered on / reset during the upgrade process, the current installation status of the upgrade file is determined based on the current hash value, the baseline hash value of the data segment corresponding to the current data segment in the baseline file, and the target hash value of the data segment corresponding to the current data segment in the upgrade file. The data segment to be installed again is determined based on the current installation status, and all remaining data segments of the upgrade file required for the controller upgrade are installed starting from the data segment to be installed again.
[0010] By adopting the above scheme, the system file installation is upgraded through the first running partition and the second running partition of the controller. The overlay installation method is adopted to ensure that all system files are installed, thereby improving the success rate of the system upgrade; further, the first running partition obtains each data segment of the target file, and stores the target file in the storage partition as a reference file for system upgrade, obtains the hash value of the target file and the reference file, and by comparing the above hash value with the current hash value, it can be ensured that each data segment of the target file is successfully installed in the second partition, thereby ensuring the integrity of the target file and improving the success rate of the controller upgrade.
[0011] According to another specific embodiment of the present invention, an embodiment of the present invention discloses a controller upgrade method, wherein the current installation state includes: the current data segment is successfully installed, the current data segment is damaged, and the current data segment is not successfully installed; and
[0012] The current installation status of the upgrade file is determined according to the current hash value, the baseline hash value of the baseline file, and the target hash value of the upgrade file, including:
[0013] Compare the current hash value with the target hash value to determine whether the current hash value is the same as the target hash value;
[0014] If so, the file status is determined as the current data segment is successfully installed;
[0015] If not, determine whether the current hash value is the same as the reference hash value;
[0016] If they are the same, the file status is determined as the current data segment is not successfully installed;
[0017] If they are different, the file status is determined to be that the current data segment is damaged.
[0018] By adopting the above technical solution, by comparing the current hash value with the target hash value, it is determined whether the current hash value and the target hash value are the same, and whether the current data segment is installed successfully. When the current hash value and the target hash value are different, the benchmark hash value and the current hash value are compared to determine whether the current data segment is damaged. By comparing the current hash value, the target hash value, and the benchmark hash value, the installation status of each data segment can be clearly determined, and the successful installation of each data segment can be guaranteed.
[0019] An embodiment of the present invention discloses a controller upgrade method, comprising determining to restart the installation of a data segment according to a current installation state, including:
[0020] If the current installation status is that the current data segment is successfully installed, the next data segment of the current data segment is used as the data segment to be installed again;
[0021] If the current installation status is that the current data segment is not installed successfully or the current data segment is damaged, the current data segment is used as the restart installation data segment.
[0022] By adopting the above technical solution, determining to start installing the data segment according to the current installation status can ensure that the controller completely installs each data segment according to the data segment arrangement of the target file during the system upgrade process, thereby improving the success rate of the controller upgrade.
[0023] The embodiment of the present invention discloses a controller upgrade method, during which an upgrade flag corresponding to the current installation state in the controller is generated and updated in real time; wherein
[0024] If the current installation status is that the current data segment is successfully installed, the upgrade flag position is set to 1;
[0025] If the current installation status is that the current data segment is not successfully installed or the current data segment is damaged, the upgrade flag position is set to 0; and
[0026] If the controller is powered on / reset during the upgrade process, check the value of the upgrade flag bit.
[0027] If the upgrade flag is 0, the controller runs the system before the upgrade and continues the controller upgrade process from the current data segment;
[0028] If the upgrade flag is 1, the controller upgrade process will continue to run from the next data segment of the current data segment.
[0029] By adopting the above technical solution, by real-time generation and updating of the upgrade flag corresponding to the current installation status in the controller, it can be ensured that the controller can clearly check whether the current data segment is successfully installed during the upgrade process. Furthermore, if the controller is powered on / reset during the upgrade process, the value of the upgrade flag is checked, and a judgment is made based on the checked value. The installation position of the data segment after the controller is powered on / reset can be accurately determined, ensuring that each data segment is successfully installed during the upgrade process.
[0030] The embodiment of the present invention discloses a controller upgrade method, including a system flag, which detects whether the controller is successfully upgraded after all data segments of the upgrade file required for the controller upgrade are installed; wherein
[0031] If the controller is successfully upgraded, the system flag in the controller is set to 1, and after the controller is powered on / reset, the upgraded system file is run and the data in the upgrade flag is erased; or
[0032] If the controller upgrade fails, set the system flag in the controller to 0, and run the system file before the upgrade after the controller is powered on / reset.
[0033] By adopting the above technical solution, by detecting whether the controller is upgraded successfully after installing all data segments of the upgrade file required for the controller upgrade, it is possible to quickly determine whether the system is upgraded successfully. Furthermore, based on the system flag, the controller can determine whether to run the file before the upgrade or the file after the upgrade, thereby improving the upgrade efficiency of the controller.
[0034] An embodiment of the present invention discloses a controller upgrade system, the upgrade system comprising:
[0035] Client: The client sends an upgrade start command;
[0036] The controller sequentially installs the data segments of the upgrade file and synchronously obtains the current hash value of the currently installed data segment; and when the controller is powered on / reset during the upgrade process, the controller determines the current installation status according to the current hash value of the current data segment, the baseline hash value of the current data segment, and the target hash value of the current data segment, determines to restart the installation of the data segment according to the current installation status, and installs all the remaining data segments of the upgrade file required for the controller upgrade starting from the restarted installation data segment.
[0037] By adopting the above technical solution, the upgrade system sets the client and the controller to perform system upgrades. The client sends instructions to the controller, and the controller obtains the target file after receiving the instructions. By synchronously obtaining the current hash value of the current data segment currently installed, the installation location of the current data segment can be accurately determined based on the comparison of the target hash value, the benchmark hash value and the current hash value, which greatly shortens the time required for the controller upgrade. Furthermore, by determining the location and installation status of the data segment, the success rate of the controller upgrade is greatly improved.
[0038] An embodiment of the present invention discloses a controller upgrade method, comprising: a client further sending an upgrade progress request instruction, the controller receiving the upgrade progress request instruction from the client, obtaining a current value of an upgrade flag according to the upgrade progress request instruction, generating upgrade progress response information according to the current value of the upgrade flag, and sending the upgrade progress response information to the client; and
[0039] The controller includes:
[0040] The boot partition receives the upgrade start instruction from the client;
[0041] System partition, which stores target files, upgrade files, and baseline files;
[0042] The instruction sending partition is connected to the boot partition and the storage partition respectively to control the information exchange between the boot partition and the storage partition.
[0043] By adopting the above technical solution, by setting the interaction process between the client and the controller, the client sends a request, the controller receives the request, and obtains the upgrade flag according to the request to generate an upgrade progress response information and send it to the client. By generating an upgrade flag and generating an upgrade progress response and sending it to the client, the process of the controller upgrade can be clearly understood. The controller includes a boot partition, a system partition, and an instruction sending partition. Each partition implements different functions, thereby ensuring the success rate of the controller upgrade.
[0044] An embodiment of the present invention discloses a controller upgrade method, including a system partition, wherein the system partition also includes a storage partition, a first running partition, and a second running partition; wherein the first running partition and the second running partition respectively include at least one root file storage area and at least one driver storage area corresponding to the root file storage area; and the root file storage area stores the root file of the controller system; the driver storage stores the system kernel of the controller system and the drivers of each control device corresponding to the controller.
[0045] By adopting the above technical solution, by setting the first running partition, the second running partition, and the storage partition, the accurate storage of the upgrade files and the benchmark files can be guaranteed. Furthermore, the first running partition and the second running partition respectively include at least one root file storage area and at least one driver storage area corresponding to the root file storage area; the root file storage area stores the root files of the controller system; the driver memory stores the system kernel of the controller system and the drivers of each control device corresponding to the controller, which can ensure the normal operation of the controller.
[0046] Another embodiment of the present invention discloses an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0047] Memory stores computer-executable instructions;
[0048] The processor executes the computer execution instructions stored in the memory to implement the controller upgrade method.
[0049] The memory stores computer execution instructions to perform system upgrades of the controller. The upgrade system that runs through the instructions can ensure the stability of the upgrade after encountering abnormal situations during the system upgrade process and shorten the time required for the upgrade.
[0050] Another embodiment of the present invention discloses a computer-readable storage medium, comprising:
[0051] The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by the processor, they are used to implement the controller upgrade method of the above-mentioned embodiment.
[0052] The beneficial effects of the present invention are:
[0053] During the system upgrade process, after the controller is abnormally powered off / reset, the system upgrade can continue after it is powered on / reset again without the client resending the system upgrade command. The controller restarts the system upgrade, which improves the success rate of the system upgrade and shortens the time required for the upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a schematic diagram of the upgrade process of the controller provided by the embodiment of the invention.
[0055] Figure 2 It is a schematic diagram of a system upgrade process provided by an embodiment of the invention.
[0056] Figure 3 It is a schematic diagram of a controller upgrade system provided by an embodiment of the invention.
[0057] Figure 4 It is a schematic diagram of the internal partition of the controller provided by an embodiment of the invention.
[0058] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the invention.
[0059] Description of reference numerals:
[0060] 121. transceiver; 122. processor; 123. memory. DETAILED DESCRIPTION
[0061] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0062] Embodiment 1:
[0063] In order to solve the problem in the prior art that after the controller is abnormally powered off / reset during the system upgrade process, the system upgrade cannot be continued after powering on / resetting again, and the upgrade instruction has to be resent from the client, the present invention provides a controller upgrade method. Figure 1, the method comprises the following steps: the controller comprises a storage partition, a first running partition, and a second running partition; the storage partition stores the acquired target file required for the upgrade, wherein the target file comprises a plurality of data segments; the first running partition acquires each data segment of the target file from the storage partition, and sequentially overwrites each data segment of the target file to the second running partition; wherein all data segments of the target file stored in the storage partition are used as the reference file, and the data segments of the target file stored in the second running partition are used as the upgrade file; the upgrade method comprises the following steps:
[0064] Get the hash value of each data segment in the upgrade file and the baseline file;
[0065] Install the data segments of the upgrade file in sequence, and synchronously obtain the current hash value of the current data segment currently installed;
[0066] When the controller is powered on / reset during the upgrade process, the current installation status of the upgrade file is determined based on the current hash value, the baseline hash value of the data segment corresponding to the current data segment in the baseline file, and the target hash value of the data segment corresponding to the current data segment in the upgrade file. The data segment to be installed again is determined based on the current installation status, and all remaining data segments of the upgrade file required for the controller upgrade are installed starting from the data segment to be installed again.
[0067] For example, in a specific embodiment, the storage partition obtains the target file required for the upgrade from the host computer or the cloud storage, and the first operation partition stores each data segment of the target file. It should be noted that the process of dividing the target file into several data segments can be performed in the storage partition or in the first operation partition. For example, after the first operation partition obtains the stored target file, the target file is divided into 6 data segments, and the first operation partition sequentially installs the 6 data segments to the second operation partition in sequence. Further, the target file stored in the storage partition is also divided into 6 data segments. Similarly, the division of the data segments can be performed in the storage area, or the data segments can be obtained from the storage area after the first operation partition is performed. Furthermore, when the first operation partition installs each data segment to the second operation partition at one time, the hash value of each installed data segment, as well as the hash value of the target file and the reference file are recorded, and the above three hash values are compared in real time during the installation process; if the controller encounters a power outage, the installation status of each data segment can be determined according to the comparison results of the above three hash values when it is powered on again, so that each data segment of the first partition can be installed in the second operation partition in an overwritten manner.
[0068] In the embodiment of the present invention, the hash value is a hash algorithm that maps a binary value of any length into a smaller binary value of a fixed length, and this small binary value is called a hash value. The hash value is a unique and extremely compact numerical representation of a piece of data.
[0069] For example, in one specific embodiment, referring to Figure 2 The hash value of the upgrade file is T_hash, and the hash value of the benchmark file is recorded as S_hash. T_hash is compared with the current hash value to determine the installation status of the current data segment. S_hash is compared with the benchmark hash value to determine whether the current data segment is damaged. After two judgments, the control
[0070] After the controller is powered on / reset, confirm to restart the installation of the data segment, and start installing all the remaining data segments of the upgrade file required for the controller upgrade from the restart installation data segment.
[0071] The system file installation is upgraded through the first running partition and the second running partition of the controller, and an overlay installation method is adopted to ensure that all system files are installed, thereby improving the success rate of the system upgrade; further, the first running partition obtains each data segment of the target file, and stores the target file in the storage partition as a reference file for system upgrade, obtains the hash value of the target file and the reference file, and by comparing the above hash value with the current hash value, it can be ensured that each data segment of the target file is successfully installed in the second partition, thereby ensuring the integrity of the target file and improving the success rate of the controller upgrade.
[0072] Embodiment 1 of the present invention further provides a controller upgrade method, wherein the current installation status includes: the current data segment is successfully installed, the current data segment is damaged, and the current data segment is not successfully installed; and
[0073] The current installation status of the upgrade file is determined according to the current hash value, the baseline hash value of the baseline file, and the target hash value of the upgrade file, including:
[0074] Compare the current hash value with the target hash value to determine whether the current hash value is the same as the target hash value;
[0075] If so, the file status is determined as the current data segment is successfully installed;
[0076] If not, determine whether the current hash value is the same as the reference hash value;
[0077] If they are the same, the file status is determined as the current data segment is not successfully installed;
[0078] If they are different, the file status is determined to be that the current data segment is damaged.
[0079] Specifically, firstly, the current hash value is compared with the target hash value, and the result of the judgment can be used to determine whether the current data segment is successfully installed. If the two hash values are the same, the current data segment is successfully installed; if the two hash values are different, it is determined whether the reference hash value is the same as the current hash value. Further, if the reference hash value is the same as the current hash value, the file status is determined to be that the current data segment is successfully installed and not damaged. If the two hash values are different, it is determined that the current data segment is damaged.
[0080] By comparing the current hash value with the target hash value, it is determined whether the current hash value is the same as the target hash value, and whether the current data segment is installed successfully. When the current hash value is different from the target hash value, the baseline hash value is compared with the current hash value to determine whether the current data segment is damaged. By comparing the current hash value, the target hash value, and the baseline hash value, the installation status of each data segment can be clearly determined, and the successful installation of each data segment can be guaranteed.
[0081] The controller upgrade method disclosed in this embodiment includes determining to re-install the data segment according to the current installation state, including:
[0082] If the current installation status is that the current data segment is successfully installed, the next data segment of the current data segment is used as the data segment to be installed again;
[0083] If the current installation status is that the current data segment is not installed successfully or the current data segment is damaged, the current data segment is used as the restart installation data segment.
[0084] Furthermore, in the embodiment 1 of the present invention, a flag is set during the system upgrade process, wherein:
[0085] During the controller upgrade process, the upgrade flag corresponding to the current installation status in the controller is generated and updated in real time;
[0086] If the current installation status is that the current data segment is successfully installed, the upgrade flag position is set to 1;
[0087] If the current installation status is that the current data segment is not successfully installed or the current data segment is damaged, the upgrade flag position is set to 0; and
[0088] If the controller is powered on / reset during the upgrade process, check the value of the upgrade flag bit.
[0089] If the upgrade flag is 0, the controller runs the system before the upgrade and continues the controller upgrade process from the current data segment;
[0090] If the upgrade flag is 1, the controller upgrade process will continue to run from the next data segment of the current data segment.
[0091] For example, in a specific embodiment, the upgrade flag is updated in real time during the system upgrade process. At this time, the controller encounters a power outage. After power is restored, the controller first checks the upgrade flag. If the upgrade flag is 1 at this time, the controller continues to upgrade from the next data segment of the current data segment. If the upgrade flag is 0, the controller first runs the system before the upgrade and continues to upgrade the controller from the current data segment.
[0092] By generating and updating the upgrade flag corresponding to the current installation status in the controller in real time, it can be ensured that the controller can clearly check whether the current data segment is successfully installed during the upgrade process. Furthermore, if the controller is powered on / reset during the upgrade process, the value of the upgrade flag is checked, and a judgment is made based on the checked value. The installation position of the data segment after the controller is powered on / reset can be accurately determined, ensuring that each data segment is successfully installed during the upgrade process.
[0093] Furthermore, after all data segments of the upgrade file required for the controller upgrade are installed, it is detected whether the controller upgrade is successful; wherein
[0094] If the controller is successfully upgraded, the system flag in the controller is set to 1, and after the controller is powered on / reset, the upgraded system file is run and the data in the upgrade flag is erased;
[0095] If the controller upgrade fails, set the system flag in the controller to 0, and run the system file before the upgrade after the controller is powered on / reset.
[0096] For example, in a specific embodiment, if the controller is successfully upgraded, the system files in the second operation partition are run, that is, the upgraded new system; if the controller upgrade fails, the system files in the first operation partition are run, that is, the system before the upgrade.
[0097] By detecting whether the controller upgrade is successful after installing all data segments of the upgrade file required for the controller upgrade, it is possible to quickly determine whether the system upgrade is successful. Furthermore, based on the system flag, the controller can determine whether to run the file before the upgrade or the file after the upgrade, thereby improving the upgrade efficiency of the controller.
[0098] In summary, the present invention provides a controller upgrade method, which obtains the hash value of each data segment of the target file for upgrading and the benchmark file for comparison, and records the hash value of the currently installed data segment; by comparing the target hash value, the benchmark hash value, and the current hash value, the progress of the system upgrade can be determined, and it is ensured that each data segment of the upgrade file is successfully installed. During the upgrade process, an upgrade flag bit and a system flag bit are set, which can clearly show the progress of the system upgrade and the results of the upgrade. The controller upgrade method provided by the present invention can continue the upgrade process after powering on / resetting again when the controller encounters an abnormal power failure / reset, which greatly shortens the time required for the controller upgrade and improves the success rate of the upgrade.
[0099] Embodiment 2:
[0100] Based on the controller system upgrade method provided in the above embodiment, this embodiment also provides a controller upgrade system, referring to Figure 3 , the system includes: a client and a controller.
[0101] Among them, the client is responsible for sending instructions and receiving controller upgrade progress responses;
[0102] Furthermore, the controller is responsible for receiving instructions and performing the system upgrade process, updating and installing system files to complete the system upgrade and sending an upgrade progress response to the client.
[0103] For example, in a specific embodiment, the client sends an upgrade start request instruction to the controller, and the system flag is 0. After receiving the instruction, the controller first starts the A system kernel of the first running partition, and then starts the system file and starts to install the upgrade package of the B system. At this time, the upgrade flag in the controller is 1; if the controller is restarted, the system flag is judged after the restart. When the system flag is 0, the upgrade continues, and the upgrade flag is judged to determine the location of the installation data segment, and the installation continues; if the system flag is 1 after the controller restarts, the B system (upgraded system) in the second running partition is run at this time, and all upgrade flags are set to 0.
[0104] Furthermore, in the above specific implementation process, the controller may send an upgrade progress response to the client, and the client may receive and view the upgrade progress response.
[0105] Embodiment 2 of the present invention further provides an upgrade system, wherein:
[0106] Client: The client sends an upgrade start command;
[0107] The controller sequentially installs the data segments of the upgrade file and synchronously obtains the current hash value of the currently installed data segment; and when the controller is powered on / reset during the upgrade process, the controller determines the current installation status according to the current hash value of the current data segment, the baseline hash value of the current data segment, and the target hash value of the current data segment, determines to restart the installation of the data segment according to the current installation status, and installs all the remaining data segments of the upgrade file required for the controller upgrade starting from the restarted installation data segment.
[0108] Furthermore, the client also sends an upgrade progress request instruction, the controller receives the upgrade progress request instruction from the client, obtains the current value of the upgrade flag according to the upgrade progress request instruction, generates upgrade progress response information according to the current value of the upgrade flag, and sends the upgrade progress response information to the client; and Figure 4 As shown, embodiment 2 of the present invention provides a controller in which the controller includes:
[0109] The boot partition receives the upgrade start instruction from the client;
[0110] A storage partition, where the storage partition stores upgrade files and baseline files;
[0111] The instruction sending partition is connected to the boot partition and the storage partition respectively to control the information exchange between the boot partition and the storage partition.
[0112] By setting up the interaction process between the client and the controller, the client sends a request, the controller receives the request, and obtains the upgrade flag according to the request to generate an upgrade progress response message and send it to the client. By generating an upgrade flag and generating an upgrade progress response and sending it to the client, the controller upgrade process can be clearly understood. The controller includes a boot partition, a storage partition, and a command sending partition. Each partition implements different functions, thereby ensuring the success rate of the controller upgrade.
[0113] Among them, the boot partition is generally loaded and run by the chip's BOOTROM;
[0114] Storage partitions include Kernel1, Kernel2, Rootfs1, Rootfs2, and Cache;
[0115] The instruction sending partition includes Misc, which is an independent partition mainly used for exchanging information between Bootloader and System;
[0116] Among them, Kernel is the partition where the Linux Kernel of the main system is stored, including the system kernel and the drivers of various devices, etc., which are loaded and run by the Bootloader;
[0117] Rootfs1 is the root file system of the main system, including the application function modules of the system;
[0118] Kernel2 is the partition where the Linux Kernel of the main system is stored, including the system kernel and drivers of various devices, etc., which are loaded and run by the Bootloader;
[0119] Rootfs2 is the root file system of the main system, including the application function modules of the system;
[0120] Cache is an independent partition with permanent storage capabilities. This partition is mainly used to store FOTA packages and some log information.
[0121] Further, embodiment 2 of the present invention provides a storage partition, a first operation partition and a second operation partition; wherein
[0122] The first running partition and the second running partition respectively include at least one root file storage area and at least one driver program storage area corresponding to the root file storage area; and
[0123] The root file storage area stores the root files of the controller system;
[0124] The driver program memory stores the system kernel of the controller system and the drivers of each control device corresponding to the controller;
[0125] Among them, Kernel1 and Rootfs1 are the first running partitions of the above embodiment, and Kernel2 and Rootfs2 are the second running partitions of the above embodiment; Cache is a storage partition that permanently stores files.
[0126] For example, in a specific embodiment, the first running partition may include a root file storage area, and the second running partition also includes a root file storage area; and the first running partition may include a root file storage area, and the second running partition may include a root file storage area and a corresponding driver storage area; further, the first running partition may include a root file storage area and a corresponding driver storage area, and the second running partition may include a root file storage area and a corresponding driver storage area; further, the first running partition may include a root file storage area and a corresponding driver storage area, and the second running partition also includes a root file storage area, and the first running partition may include a root file storage area and a corresponding driver storage area, and the second running partition also includes a root file storage area; in the above method, both the first and second running partitions can operate normally, ensuring the normal operation of the above embodiment.
[0127] Embodiment 3:
[0128] An embodiment of the present invention provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0129] Memory stores computer-executable instructions;
[0130] The processor executes the computer execution instructions stored in the memory to implement the above controller upgrade method.
[0131] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Figure 5 As shown, the electronic device may include: a transceiver 121 , a processor 122 , and a memory 123 .
[0132] The processor 122 executes the computer execution instructions stored in the memory, so that the processor 122 executes the scheme in the above embodiment. The processor 122 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0133] The memory 123 is connected to the processor 122 via a system bus and completes communication between them. The memory 123 is used to store computer program instructions.
[0134] The transceiver 121 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.
[0135] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver 121 is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.
[0136] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.
[0137] Embodiment 4:
[0138] Furthermore, an embodiment of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned controller upgrade method.
[0139] Although the present invention has been illustrated and described with reference to certain preferred embodiments of the present invention, it should be understood by those skilled in the art that the above is a further detailed description of the present invention in conjunction with specific embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. Those skilled in the art may make various changes in form and details, including making several simple deductions or substitutions, without departing from the spirit and scope of the present invention.
Claims
1. A controller upgrade method, characterized in that: The controller includes a storage partition, a first running partition, and a second running partition; the storage partition stores an acquired target file required for upgrading, wherein the target file includes a plurality of data segments; the first running partition acquires each data segment of the target file from the storage partition, and sequentially overwrites each data segment of the target file to the second running partition; wherein all data segments of the target file stored in the storage partition are used as reference files, and the data segments of the target file stored in the second running partition are used as upgrade files; and The upgrading method comprises the following steps: Obtaining hash values of each data segment in the upgrade file and the benchmark file; Install the data segments of the upgrade file in sequence, and synchronously obtain the current hash value of the current data segment currently installed; When the controller is powered on / reset during the upgrade process, the current installation status of the upgrade file is determined based on the current hash value, the baseline hash value of the data segment corresponding to the current data segment in the baseline file, and the target hash value of the data segment corresponding to the current data segment in the upgrade file. The data segment to be restarted for installation is determined based on the current installation status, and all remaining data segments of the upgrade file required for the controller upgrade are installed starting from the data segment to be restarted for installation.
2. The controller upgrade method according to claim 1, characterized in that: The current installation status includes: the current data segment is successfully installed, the current data segment is damaged, and the current data segment is not successfully installed; and Determining a current installation state of the upgrade file according to the current hash value, a reference hash value of the reference file, and a target hash value of the upgrade file includes: Compare the current hash value with the target hash value to determine whether the current hash value is the same as the target hash value; If yes, the file status is determined as the current data segment is successfully installed; If not, determining whether the current hash value is the same as the reference hash value; If they are the same, the file status is determined as the current data segment is not successfully installed; If they are different, the file status is determined as the current data segment is damaged.
3. The controller upgrade method according to claim 2, characterized in that: Determining to restart the installation of the data segment according to the current installation state includes: If the current installation status is that the current data segment is successfully installed, the next data segment of the current data segment is used as the restart installation data segment; If the current installation status is that the current data segment is not successfully installed or the current data segment is damaged, the current data segment is used as the restart installation data segment.
4. The controller upgrade method according to claim 3, characterized in that: The upgrading method further comprises: During the upgrade process of the controller, an upgrade flag corresponding to the current installation state in the controller is generated and updated in real time; wherein If the current installation status is that the current data segment is successfully installed, the upgrade flag is set to 1; If the current installation status is that the current data segment is not successfully installed or the current data segment is damaged, the upgrade flag is set to 0; and If the controller is powered on / reset again during the upgrade process, the value of the upgrade flag is checked, where If the upgrade flag is 0, the controller runs the system before the upgrade and continues the upgrade process of the controller starting from the current data segment; If the upgrade flag is 1, the upgrade process of the controller will continue to run from the next data segment of the current data segment.
5. The controller upgrade method according to claim 4, characterized in that: The upgrading method further comprises: After all data segments of the upgrade file required for the controller upgrade are installed, detecting whether the controller is upgraded successfully; wherein If the controller is successfully upgraded, the system flag in the controller is set to 1, and after the controller is powered on / reset again, the upgraded system file is run and the data of the upgrade flag is erased; or If the controller upgrade fails, the system flag in the controller is set to 0, and after the controller is powered on / reset, the system file before the upgrade is run.
6. A controller upgrade system, characterized in that: A controller upgrade method for implementing any one of claims 1 to 5; Furthermore, the upgrade system comprises: A client sends an upgrade start instruction; A controller, wherein the controller sequentially installs the data segments of the upgrade file and synchronously obtains the current hash value of the currently installed data segment; and when the controller is powered on / reset during the upgrade process, the controller determines the current installation status based on the current hash value of the current data segment, the baseline hash value of the current data segment, and the target hash value of the current data segment, determines the restart installation data segment based on the current installation status, and installs all remaining data segments of the upgrade file required for the controller upgrade starting from the restart installation data segment.
7. The controller upgrade system according to claim 6, characterized in that: The client also sends an upgrade progress request instruction, the controller receives the upgrade progress request instruction from the client, obtains the current value of the upgrade flag according to the upgrade progress request instruction, generates upgrade progress response information according to the current value of the upgrade flag, and sends the upgrade progress response information to the client; and The controller comprises: A boot partition, wherein the boot partition receives the upgrade start instruction from the client; a system partition, wherein the system partition stores the target file, the upgrade file, and the benchmark file; An instruction sending partition, wherein the instruction sending partition is connected to the boot partition and the storage partition respectively, and controls information exchange between the boot partition and the storage partition.
8. The controller upgrade system according to claim 7, characterized in that: The system partition also includes the storage partition, the first operation partition, and the second operation partition; in The first running partition and the second running partition respectively include at least one root file storage area and at least one driver program storage area corresponding to the root file storage area; and The root file storage area stores the root file of the controller system; The driver program memory stores a system kernel of the controller system and driver programs of each control device corresponding to the controller.
9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the controller upgrade method according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the controller upgrade method according to any one of claims 1 to 5.