CN106843192B - The system start method and device of controller - Google Patents

The system start method and device of controller Download PDF

Info

Publication number
CN106843192B
CN106843192B CN201611261641.8A CN201611261641A CN106843192B CN 106843192 B CN106843192 B CN 106843192B CN 201611261641 A CN201611261641 A CN 201611261641A CN 106843192 B CN106843192 B CN 106843192B
Authority
CN
China
Prior art keywords
operating system
file system
data
verification code
storage address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611261641.8A
Other languages
Chinese (zh)
Other versions
CN106843192A (en
Inventor
马亮
谢华峰
卫乾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kunlun Digital Technology Co ltd
China National Petroleum Corp
BGP Inc
Original Assignee
BGP Inc
CNPC Beijing Richfit Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BGP Inc, CNPC Beijing Richfit Information Technology Co Ltd filed Critical BGP Inc
Priority to CN201611261641.8A priority Critical patent/CN106843192B/en
Publication of CN106843192A publication Critical patent/CN106843192A/en
Application granted granted Critical
Publication of CN106843192B publication Critical patent/CN106843192B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0259Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterized by the response to fault detection
    • G05B23/0286Modifications to the monitored process, e.g. stopping operation or adapting control
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/24Pc safety
    • G05B2219/24065Real time diagnostics

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method and devices of the system of controller starting, belong to production of hydrocarbons automation field.This method comprises: obtaining the first storage address and the second storage address from the environmental variance of storage when detecting system enabled instruction;Based on the first storage address, the data of the first operating system are obtained, and are based on the second storage address, obtain the data of the first file system;Based on the data of the first operating system, the first operating system is verified, based on the data of the first file system, the first file system is verified;When the first operating system and the first file system verify successfully, start the first operating system and the first file system.The embodiment of the present invention is by verifying the first operating system and the first file system, to can determine that the first operating system and the first file system can normally start when verifying successfully, and then guarantees the stable operation of controller.

Description

System starting method and device of controller
Technical Field
The invention relates to the field of automatic control of oil and gas production, in particular to a system starting method and device of a controller.
Background
With the rapid development of the automatic control technology of oil and gas production, in the current oil and gas production process, people can control a motor on a production site through a controller and carry out signal acquisition on each device on the production site, so that remote measurement and control on the oil and gas production site are realized. The controller is usually provided with a system for managing and controlling resources, wherein the system comprises an operating system for ensuring the basic operation of the controller and a file system for managing and storing file information.
Generally, when a controller starts a system, if a module for storing system start information in a storage device of the controller is broken, the controller cannot call the system start information when starting the system, so that the system cannot be started normally.
Disclosure of Invention
In order to solve the problem that a controller system cannot be normally started due to the fact that a module used for storing system starting information in a storage device of a controller generates a bad block, the embodiment of the invention provides a system starting method and device of the controller. The technical scheme is as follows:
in one aspect, a method for starting a system of a controller is provided, where the method includes:
when a system starting instruction is detected, acquiring a first storage address and a second storage address from a stored environment variable, wherein the first storage address is a storage address of data required by starting an operating system, and the second storage address is a storage address of data required by starting a file system;
acquiring data of a first operating system based on the first storage address, and acquiring data of a first file system based on the second storage address;
verifying the first operating system based on the data of the first operating system, and verifying the first file system based on the data of the first file system;
and when the first operating system and the first file system are verified successfully, starting the first operating system and the first file system.
Optionally, the verifying the first operating system based on the data of the first operating system, and the verifying the first file system based on the data of the first file system include:
acquiring a first preset verification code and a second preset verification code, wherein the first preset verification code is a verification code preset for the first operating system, and the second preset verification code is a verification code preset for the first file system;
performing integrity calculation on the data of the first operating system to obtain a first calculation verification code, and performing integrity calculation on the data of the first file system to obtain a second calculation verification code;
comparing the first calculated verification code with the first preset verification code, and comparing the second calculated verification code with the second preset verification code;
and when the first calculation verification code is consistent with the first preset verification code, determining that the first operating system is successfully verified, and when the second calculation verification code is consistent with the second preset verification code, determining that the first file system is successfully verified.
Optionally, the verifying the first operating system based on the data of the first operating system, and after the verifying the first file system based on the data of the first file system, further include:
when the first operating system fails to check and the first operating system is not a mirror image operating system, acquiring data of a second operating system, wherein the second operating system is obtained by carrying out mirror image on the first operating system; verifying the second operating system based on the data of the second operating system; when the second operating system is verified successfully and the first file system is verified successfully, starting the second operating system and the first file system; or,
when the first file system fails to be verified and the first file system is not a mirror image file system, acquiring data of a second file system, wherein the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
Optionally, the verifying the first operating system based on the data of the first operating system, and after the verifying the first file system based on the data of the first file system, further include:
when the first operating system and the first file system fail to be checked, judging whether the first operating system is a mirror image operating system or not, and judging whether the first file system is a mirror image file system or not;
when the first operating system is not a mirror image operating system, acquiring data of a second operating system, and verifying the second operating system based on the data of the second operating system;
when the first file system is not a mirror image file system, acquiring data of a second file system, and verifying the second file system based on the data of the second file system;
and when the second operating system and the second file system are verified successfully, starting the second operating system and the second file system.
Optionally, the method further comprises:
when the first operating system is failed to be checked and the second operating system is successfully checked, replacing the first storage address included in the environment variable with a storage address of data required for starting the second operating system;
and when the first file system is failed to be verified and the second file system is successfully verified, replacing the second storage address included in the environment variable with a storage address of data required for starting the second file system.
In another aspect, there is provided a system start-up apparatus of a controller, the apparatus including:
the system comprises a first acquisition module, a second acquisition module and a first storage module, wherein the first acquisition module is used for acquiring a first storage address and a second storage address from a stored environment variable when a system starting instruction is detected, the first storage address is a storage address of data required by starting an operating system, and the second storage address is a storage address of data required by starting a file system;
the second acquisition module is used for acquiring data of the first operating system based on the first storage address and acquiring data of the first file system based on the second storage address;
the verification module is used for verifying the first operating system based on the data of the first operating system and verifying the first file system based on the data of the first file system;
the first starting module is used for starting the first operating system and the first file system when the first operating system and the first file system are verified successfully.
Optionally, the verification module includes:
an obtaining unit, configured to obtain a first preset verification code and a second preset verification code, where the first preset verification code is a verification code preset for the first operating system, and the second preset verification code is a verification code preset for the first file system;
the computing unit is used for carrying out integrity computation on the data of the first operating system to obtain a first computation verification code, and carrying out integrity computation on the data of the first file system to obtain a second computation verification code;
the comparison unit is used for comparing the first calculation verification code with the first preset verification code and comparing the second calculation verification code with the second preset verification code;
the determining unit is configured to determine that the first operating system is successfully verified when the first computing verification code is consistent with the first preset verification code, and determine that the first file system is successfully verified when the second computing verification code is consistent with the second preset verification code.
Optionally, the apparatus further comprises:
the second starting module is used for acquiring data of a second operating system when the first operating system fails to check and the first operating system is not a mirror image operating system, wherein the second operating system is obtained by carrying out mirror image on the first operating system; verifying the second operating system based on the data of the second operating system; when the second operating system is verified successfully and the first file system is verified successfully, starting the second operating system and the first file system; or,
the third starting module is used for acquiring data of a second file system when the first file system fails to be verified and the first file system is not a mirror image file system, wherein the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
Optionally, the apparatus further comprises:
the judging module is used for judging whether the first operating system is a mirror image operating system or not and judging whether the first file system is a mirror image file system or not when the first operating system and the first file system fail to check;
the third obtaining module is used for obtaining data of a second operating system when the first operating system is not a mirror image operating system, and verifying the second operating system based on the data of the second operating system;
the fourth obtaining module is used for obtaining data of a second file system when the first file system is not the mirror image file system, and verifying the second file system based on the data of the second file system;
and the fourth starting module is used for starting the second operating system and the second file system when the second operating system and the second file system are verified successfully.
Optionally, the apparatus further comprises:
a first replacement module, configured to replace the first storage address included in the environment variable with a storage address of data required to start the second operating system when the first operating system fails to check and the second operating system succeeds in checking;
and the second replacement module is used for replacing the second storage address included in the environment variable with the storage address of the data required for starting the second file system when the first file system is failed to be checked and the second file system is successfully checked.
The technical scheme provided by the embodiment of the invention has the following beneficial effects: in the embodiment of the present invention, when the controller detects a system start instruction, the controller may obtain a first storage address and a second storage address from the stored environment variable, that is, obtain a storage address of data required to start the operating system and a storage address of data required to start the file system, then obtain data of the first operating system based on the first storage address, and obtain data of the first file system based on the second storage address, and further may check the first operating system and the first file system.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a system startup method of a controller according to an embodiment of the present invention;
FIG. 2A is a flow chart of another method for system booting of a controller according to an embodiment of the present invention;
FIG. 2B is a schematic diagram of a partition of a controller storage device according to an embodiment of the present invention;
fig. 3A is a block diagram of a system starting apparatus of a controller according to an embodiment of the present invention;
FIG. 3B is a block diagram of a verification module provided by embodiments of the present invention;
fig. 3C is a block diagram of a system startup device of another controller according to an embodiment of the present invention;
fig. 3D is a block diagram of a system startup device of a third controller according to an embodiment of the present invention;
fig. 3E is a block diagram of a system startup device of a fourth controller according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The embodiment of the invention provides a system starting method of a controller, and referring to fig. 1, the method comprises the following steps:
step 101: when a system starting instruction is detected, a first storage address and a second storage address are obtained from the stored environment variables, the first storage address is a storage address of data required by starting an operating system, and the second storage address is a storage address of data required by starting a file system.
Step 102: and acquiring data of the first operating system based on the first storage address, and acquiring data of the first file system based on the second storage address.
Step 103: and verifying the first operating system based on the data of the first operating system, and verifying the first file system based on the data of the first file system.
Step 104: and when the first operating system and the first file system are verified successfully, starting the first operating system and the first file system.
In the embodiment of the present invention, when the controller detects a system start instruction, the controller may obtain a first storage address and a second storage address from the stored environment variable, that is, obtain a storage address of data required to start the operating system and a storage address of data required to start the file system, then obtain data of the first operating system based on the first storage address, and obtain data of the first file system based on the second storage address, and further may check the first operating system and the first file system.
Optionally, the verifying the first operating system based on the data of the first operating system, and the verifying the first file system based on the data of the first file system include:
acquiring a first preset verification code and a second preset verification code, wherein the first preset verification code is a verification code preset for a first operating system, and the second preset verification code is a verification code preset for a first file system;
performing integrity calculation on data of the first operating system to obtain a first calculation verification code, and performing integrity calculation on data of the first file system to obtain a second calculation verification code;
comparing the first calculation verification code with a first preset verification code, and comparing the second calculation verification code with a second preset verification code;
and when the first calculation verification code is consistent with the first preset verification code, the first operating system is determined to be successfully verified, and when the second calculation verification code is consistent with the second preset verification code, the first file system is determined to be successfully verified.
Optionally, after verifying the first operating system based on the data of the first operating system and verifying the first file system based on the data of the first file system, the method further includes:
when the first operating system fails to be checked and the first operating system is not a mirror image operating system, acquiring data of a second operating system, wherein the second operating system is obtained by carrying out mirror image on the first operating system; verifying the second operating system based on the data of the second operating system; when the second operating system is successfully verified and the first file system is successfully verified, starting the second operating system and the first file system; or,
when the first file system fails to be verified and the first file system is not a mirror image file system, acquiring data of a second file system, wherein the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
Optionally, after verifying the first operating system based on the data of the first operating system and verifying the first file system based on the data of the first file system, the method further includes:
when the first operating system and the first file system fail to be verified, judging whether the first operating system is a mirror image operating system or not, and judging whether the first file system is a mirror image file system or not;
when the first operating system is not a mirror image operating system, acquiring data of a second operating system, and verifying the second operating system based on the data of the second operating system;
when the first file system is not the mirror image file system, acquiring data of a second file system, and verifying the second file system based on the data of the second file system;
and when the second operating system and the second file system are verified successfully, starting the second operating system and the second file system.
Optionally, the method further comprises:
when the first operating system fails to be verified and the second operating system is successfully verified, replacing a first storage address included in the environment variable with a storage address of data required for starting the second operating system;
and when the first file system is failed to be verified and the second file system is successfully verified, replacing the second storage address included in the environment variable with the storage address of the data required by starting the second file system.
All the above optional technical solutions can be combined arbitrarily to form an optional embodiment of the disclosure, which is not described in detail in the embodiments of the present invention.
The embodiment of the invention provides a system starting method of a controller, and referring to fig. 2A, the method comprises the following steps:
step 201: when a system starting instruction is detected, a first storage address and a second storage address are obtained from the stored environment variables, the first storage address is a storage address of data required by starting an operating system, and the second storage address is a storage address of data required by starting a file system.
It should be noted that the environment variable includes a plurality of parameters of the system operating environment of the controller, such as a storage address of system data, an application installation path, and the like, and therefore, when the controller detects a system start instruction, the first storage address and the second storage address may be obtained from the stored environment variable.
In addition, the system start command is used for starting an operating system and a file system of the controller, and the system start command can be triggered by a user by pressing a switch button of the controller.
Moreover, an oil and gas production worker can store a program required by the operation of the controller, a mirror image operating system obtained by mirroring the current operating system of the controller, a mirror image file system obtained by mirroring the current file system of the controller and the like in the controller in advance through a terminal connected with the controller, and when the operating system and the file system carried by the controller leave a factory are failed and cannot be normally started, the controller can be normally started through the mirror image operating system and the mirror image file system. Of course, in practical applications, when the controller is connected to the terminal of the operator before being started, the operator may also trigger the operation of interrupting the system start after turning on the controller start switch, so as to manually select and start the operating system and the file system or the mirror operating system and the mirror file system of the controller that is brought from the factory through the terminal connected to the controller. When the operation of starting the interrupt system is not detected within the preset time, the controller automatically starts the operating system and the file system according to the first storage address and the second storage address in the environment variable.
In addition, in practical application, a worker can partition the storage device of the controller, and store the own operating system, the mirror image operating system, the own file system and the mirror image file system of the controller when the controller leaves a factory in different areas of the storage device, so that when the area where the data of the own operating system and the file system of the controller leaves the factory is bad, the controller can start the controller through the mirror image operating system and the mirror image file system.
For example, when the storage device of the controller is a NAND Flash (NAND-type Flash memory), a worker may partition the NAND Flash, and the partition result is as shown in fig. 2B, where a size of a first area may be 256KB (kilobytes) and is used to store a BPS (Board Support Package) including a program corresponding to the system boot method provided in the embodiment of the present invention, a size of a second area may be 128KB and is used to store an environment variable, a size of a third area may be 2MB (megabytes) and is used to store operating system data of the controller itself when the controller leaves the factory, a size of a fourth area may be 2MB and is used to store mirror operating system data, a size of a fifth area may be 10MB and is used to store file system data of the controller itself when the controller leaves the controller, a size of a sixth area may be 10MB and is used to store mirror file system data, the remaining space is a seventh area for storing other data such as applications and application data. In practical applications, the storage device of the controller may be NAND Flash, but may be other storage devices such as NOR Flash (NOR Flash memory).
For each start of the controller, when the operating system and the file system started by the controller this time are inconsistent with the operating system and the file system started last time, it is described that the operating system and the file system started last time have a fault, at this time, the controller will replace the first storage address included in the environment variable with the storage address of the data required by the operating system started this time, and replace the second storage address included in the environment variable with the storage address of the data required by the file system started this time, that is, the operating system corresponding to the first storage address is the operating system that the controller can normally start the last time before the current time, and the file system corresponding to the second storage address is the file system that the controller can normally start the last time before the current time, so that when the controller is started next time, the operating system corresponding to the first storage address and the file system corresponding to the second storage address can be directly checked, the operating system and the file system which are determined to have faults before do not need to be checked, so that the starting time of the controller is saved, and the starting efficiency of the controller is improved.
For each startup of the controller, the operating system started by the controller may be an operating system installed in the factory or may be a mirror operating system, and therefore, the data corresponding to the first storage address may be data required to start the operating system installed in the factory or may be data required to start the mirror operating system.
Step 202: and acquiring data of the first operating system based on the first storage address, and acquiring data of the first file system based on the second storage address.
Since the first storage address is the storage address of the data required for starting the operating system, the data of the first operating system is the data required for starting the operating system correspondingly, and similarly, since the second storage address is the storage address of the data required for starting the file system, the data of the first file system is the data required for starting the file system correspondingly.
Step 203: the method comprises the steps of obtaining a first preset verification code and a second preset verification code, wherein the first preset verification code is a verification code preset for a first operating system, and the second preset verification code is a verification code preset for a first file system.
The controller can obtain a first preset verification code from data required for starting the operating system, and obtain a second preset verification code from data required for starting the file system, wherein the first preset verification code is a verification code obtained after integrity calculation is performed on operating system data which can be normally started by the controller and stored in the local, and the second preset verification code is a verification code obtained after integrity calculation is performed on file system data which can be normally started by the controller and stored in the local.
It should be noted that, in practical application, the integrity calculation on the operating system data and the file system data may be implemented by integrity algorithms such as MD5(Message Digest Algorithm 5, fifth version of information Digest Algorithm), SHA (Secure HashAlgorithm), and the like, and the obtained first preset verification code and the second preset verification code may both be a character string.
Step 204: and performing integrity calculation on the data of the first operating system to obtain a first calculation verification code, and performing integrity calculation on the data of the first file system to obtain a second calculation verification code.
The controller performs integrity calculation on the data of the first operating system through a stored integrity algorithm to obtain a first calculation verification code, and performs integrity calculation on the data of the first file system to obtain a second calculation verification code.
Step 205: the first calculated verification code is compared with a first preset verification code, and the second calculated verification code is compared with a second preset verification code.
If the data of the current first operating system has integrity, the first calculation verification code obtained through integrity calculation is consistent with the first preset verification code, and if the data of the current first operating system does not have integrity, the first calculation verification code obtained through integrity calculation is inconsistent with the first preset verification code. Similarly, if the data of the current first file system has integrity, the second calculation verification code obtained through integrity calculation is consistent with the second preset verification code, and if the data of the current first file system does not have integrity, the second calculation verification code obtained through integrity calculation is inconsistent with the second preset verification code.
Step 206: and when the first calculation verification code is consistent with the first preset verification code, the first operating system is determined to be successfully verified, and when the second calculation verification code is consistent with the second preset verification code, the first file system is determined to be successfully verified.
And when the second calculation verification code is inconsistent with the second preset verification code, determining that the first file system is failed to verify.
To this end, the controller may implement a process of verifying the first operating system based on the data of the first operating system and verifying the first file system based on the data of the first file system through the steps 203 to 206.
Step 207: and when the first operating system and the first file system are verified successfully, starting the first operating system and the first file system.
When the first operating system is successfully verified, it can be determined that the first operating system can be normally started, and when the first file system is successfully verified, it can be determined that the first file system can be normally started, so that the controller can start the first operating system and the first file system, and further stably operate.
Further, after the first operating system and the first file system are verified, the controller may further perform any one of the following steps (1), (2) and (3), including:
step (1): when the first operating system fails to be checked and the first operating system is not a mirror image operating system, acquiring data of a second operating system, wherein the second operating system is obtained by carrying out mirror image on the first operating system; verifying the second operating system based on the data of the second operating system; and when the second operating system is successfully verified and the first file system is successfully verified, starting the second operating system and the first file system.
When the first operating system fails to be checked and the first operating system is not the mirror image operating system, namely when the operating system of the controller which leaves the factory and is carried by the controller fails, the second operating system, namely the mirror image operating system, can be started, so that the controller is started. Before the mirror image operating system is started, the mirror image operating system also needs to be checked, and when the mirror image operating system is successfully checked, the mirror image operating system can be normally started.
In addition, when the first operating system fails to verify and the second operating system also fails to verify, that is, when both the operating system and the mirror operating system of the controller that leave the factory are failed, the controller may perform an alarm prompt, such as flashing an alarm LED (Light Emitting Diode) lamp, displaying an alarm prompt window, and so on, and the worker may inspect the controller after seeing the alarm prompt.
Moreover, when the first operating system fails to be verified and is the mirror operating system, it is indicated that the operating system of the controller from factory has a fault verified before the current time, the first storage address has been replaced with the storage address of the data required for starting the mirror operating system, and both the operating system of the controller from factory and the mirror operating system in the current controller have faults, and even if the file system is normal, the controller cannot be normally started, so the controller can directly perform alarm prompt.
Step (2): when the first file system fails to be verified and the first file system is not a mirror image file system, acquiring data of a second file system, wherein the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
When the first file system fails to be checked and the first file system is not the mirror image file system, namely when the file system of the controller which leaves the factory and is carried by the controller fails, the second file system, namely the mirror image file system, can be started, so that the controller is started. Before the mirror image file system is started, the mirror image file system also needs to be checked, and when the mirror image file system is successfully checked, the mirror image file system can be normally started.
In addition, when the first file system fails to verify and the second file system also fails to verify, that is, when both the file system and the mirror file system of the controller which leave the factory and are carried out the failure, the controller may perform an alarm prompt, for example, a Light Emitting Diode (LED) lamp may flash, an alarm prompt window may be displayed, and the like, so that the worker may inspect the controller after seeing the alarm prompt.
Moreover, when the first file system fails to be verified and the first file system is the mirror image file system, it is indicated that the file system of the controller which leaves the factory and is provided with a fault is verified before the current time, the second storage address is replaced by the storage address of the data required for starting the mirror image file system, and both the file system of the controller which leaves the factory and the mirror image file system in the current controller have faults, even if the operating system is normal, the controller cannot be normally started, so that the controller can directly give an alarm.
And (3): when the first operating system and the first file system fail to be verified, judging whether the first operating system is a mirror image operating system or not, and judging whether the first file system is a mirror image file system or not; when the first operating system is not a mirror image operating system, acquiring data of a second operating system, and verifying the second operating system based on the data of the second operating system; when the first file system is not the mirror image file system, acquiring data of a second file system, and verifying the second file system based on the data of the second file system; and when the second operating system and the second file system are verified successfully, starting the second operating system and the second file system.
When the first operating system and the first file system fail to be verified, whether the first operating system is a mirror image operating system and whether the first file system is a mirror image file system need to be judged, when the first operating system is not the mirror image operating system and the first file system is not the mirror image file system, it is indicated that both the operating system and the file system of the controller which leave the factory and are carried by the controller fail, and then when the second operating system and the second file system, namely the mirror image operating system and the mirror image file system are successfully verified, the mirror image operating system and the mirror image file system can be started, so that the controller is normally started.
In addition, when the verification of both the second operating system and the second file system fails, it is indicated that the operating system and the file system which are produced in the current controller and the mirror image operating system and the mirror image file system both have faults, the controller can give an alarm prompt at the moment, and then a worker can overhaul the controller after seeing the alarm prompt.
Furthermore, when the first operating system is a mirror image operating system and the first file system is a mirror image file system, it indicates that the operating system and the file system of the controller that leave factory are checked to have a fault before the current time, the first storage address has been replaced with a storage address of data required for starting the mirror image operating system, the second storage address has been replaced with a storage address of data required for starting the mirror image file system, and the file system and the mirror image file system that leave factory in the current controller, as well as the mirror image operating system and the mirror image file system, have faults, and at this time, the controller may directly perform an alarm prompt.
Further, after the controller executes the above-described step (1), step (2), and step (3), at least one of the following step (4) and step (5) may also be executed.
And (4): and when the first operating system fails to check and the second operating system succeeds to check, replacing the first storage address included in the environment variable with the storage address of the data required by starting the second operating system.
And (5): and when the first file system is failed to be verified and the second file system is successfully verified, replacing the second storage address included in the environment variable with the storage address of the data required by starting the second file system.
By executing at least one of the step (4) and the step (5), the controller can replace the operating system corresponding to the first storage address with the operating system which can be normally started at this time, or replace the file system corresponding to the second storage address with the file system which can be normally started at this time, so that when the controller is started next time, the replaced operating system or file system can be directly checked, the starting time of the controller is saved, and the starting efficiency of the controller is improved.
In the embodiment of the present invention, when the controller detects a system start instruction, the controller may obtain a first storage address and a second storage address from the stored environment variable, that is, obtain a storage address of data required to start the operating system and a storage address of data required to start the file system, then obtain data of the first operating system based on the first storage address, and obtain data of the first file system based on the second storage address, and further may check the first operating system and the first file system.
Referring to fig. 3A, an embodiment of the present invention provides a system starting apparatus 300 for a controller, including: a first obtaining module 301, a second obtaining module 302, a checking module 303 and a first starting module 304.
A first obtaining module 301, configured to, when a system start instruction is detected, obtain a first storage address and a second storage address from a stored environment variable, where the first storage address is a storage address of data required to start an operating system, and the second storage address is a storage address of data required to start a file system;
a second obtaining module 302, configured to obtain data of the first operating system based on the first storage address, and obtain data of the first file system based on the second storage address;
the verifying module 303 is configured to verify the first operating system based on data of the first operating system, and verify the first file system based on data of the first file system;
the first starting module 304 is configured to start the first operating system and the first file system when both the first operating system and the first file system are successfully verified.
Optionally, referring to fig. 3B, the verification module 303 includes:
an obtaining unit 3031, configured to obtain a first preset verification code and a second preset verification code, where the first preset verification code is a verification code preset for the first operating system, and the second preset verification code is a verification code preset for the first file system;
a calculating unit 3032, configured to perform integrity calculation on data of the first operating system to obtain a first calculation verification code, and perform integrity calculation on data of the first file system to obtain a second calculation verification code;
a comparing unit 3033, configured to compare the first calculation verification code with a first preset verification code, and compare the second calculation verification code with a second preset verification code;
the determining unit 3034 is configured to determine that the first operating system is successfully verified when the first computed verification code is consistent with the first preset verification code, and determine that the first file system is successfully verified when the second computed verification code is consistent with the second preset verification code.
Optionally, referring to fig. 3C, the apparatus further comprises:
a second starting module 305, configured to obtain data of a second operating system when the first operating system fails to be checked and the first operating system is not a mirror image operating system, where the second operating system is obtained by mirroring the first operating system; verifying the second operating system based on the data of the second operating system; when the second operating system is successfully verified and the first file system is successfully verified, starting the second operating system and the first file system; or,
a third starting module 306, configured to obtain data of a second file system when the first file system fails to be checked and the first file system is not a mirror image file system, where the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
Optionally, referring to fig. 3D, the apparatus further comprises:
a determining module 307, configured to determine whether the first operating system is a mirror image operating system and determine whether the first file system is a mirror image file system when both the first operating system and the first file system fail to be checked;
a third obtaining module 308, configured to obtain data of the second operating system when the first operating system is not a mirror image operating system, and check the second operating system based on the data of the second operating system;
a fourth obtaining module 309, configured to obtain data of the second file system when the first file system is not the mirror image file system, and check the second file system based on the data of the second file system;
the fourth starting module 310 is configured to start the second operating system and the second file system when both the second operating system and the second file system are successfully verified.
Optionally, referring to fig. 3E, the apparatus further comprises:
a first replacing module 311, configured to replace a first storage address included in the environment variable with a storage address of data required to start the second operating system when the first operating system fails to be checked and the second operating system succeeds to be checked;
the second replacing module 312 is configured to replace the second storage address included in the environment variable with the storage address of the data required to start the second file system when the first file system fails to be checked and the second file system succeeds to be checked.
To sum up, in the embodiment of the present invention, when the controller detects a system start instruction, the controller may obtain the first storage address and the second storage address from the stored environment variable, that is, obtain the storage address of the data required to start the operating system and the storage address of the data required to start the file system, then obtain the data of the first operating system based on the first storage address, and obtain the data of the first file system based on the second storage address, and further may check the first operating system and the first file system.
It should be noted that: in the system starting device of the controller provided in the above embodiment, when starting the system of the controller, only the division of the above functional modules is exemplified, and in practical application, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above described functions. In addition, the system starting device of the controller and the system starting method embodiment of the controller provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (8)

1. A method for system startup of a controller, the method comprising:
when a system starting instruction is detected, acquiring a first storage address and a second storage address from a stored environment variable, wherein the first storage address is a storage address of data required by starting an operating system, and the second storage address is a storage address of data required by starting a file system;
acquiring data of a first operating system based on the first storage address, and acquiring data of a first file system based on the second storage address;
verifying the first operating system based on the data of the first operating system, and verifying the first file system based on the data of the first file system; when the first operating system and the first file system are verified successfully, starting the first operating system and the first file system;
when the first operating system fails to check and the first operating system is not a mirror image operating system, acquiring data of a second operating system, wherein the second operating system is obtained by carrying out mirror image on the first operating system; verifying the second operating system based on the data of the second operating system; when the second operating system is verified successfully and the first file system is verified successfully, starting the second operating system and the first file system; or,
when the first file system fails to be verified and the first file system is not a mirror image file system, acquiring data of a second file system, wherein the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
2. The method of claim 1, wherein the verifying the first operating system based on the data of the first operating system and the verifying the first file system based on the data of the first file system comprises:
acquiring a first preset verification code and a second preset verification code, wherein the first preset verification code is a verification code preset for the first operating system, and the second preset verification code is a verification code preset for the first file system;
performing integrity calculation on the data of the first operating system to obtain a first calculation verification code, and performing integrity calculation on the data of the first file system to obtain a second calculation verification code;
comparing the first calculated verification code with the first preset verification code, and comparing the second calculated verification code with the second preset verification code;
and when the first calculation verification code is consistent with the first preset verification code, determining that the first operating system is successfully verified, and when the second calculation verification code is consistent with the second preset verification code, determining that the first file system is successfully verified.
3. The method of claim 1, wherein the verifying the first operating system based on the data of the first operating system, after the verifying the first file system based on the data of the first file system, further comprises:
when the first operating system and the first file system fail to be checked, judging whether the first operating system is a mirror image operating system or not, and judging whether the first file system is a mirror image file system or not;
when the first operating system is not a mirror image operating system, acquiring data of a second operating system, and verifying the second operating system based on the data of the second operating system;
when the first file system is not a mirror image file system, acquiring data of a second file system, and verifying the second file system based on the data of the second file system;
and when the second operating system and the second file system are verified successfully, starting the second operating system and the second file system.
4. The method of any of claims 1-3, wherein the method further comprises:
when the first operating system is failed to be checked and the second operating system is successfully checked, replacing the first storage address included in the environment variable with a storage address of data required for starting the second operating system;
and when the first file system is failed to be verified and the second file system is successfully verified, replacing the second storage address included in the environment variable with a storage address of data required for starting the second file system.
5. A system startup device for a controller, the device comprising:
the system comprises a first acquisition module, a second acquisition module and a first storage module, wherein the first acquisition module is used for acquiring a first storage address and a second storage address from a stored environment variable when a system starting instruction is detected, the first storage address is a storage address of data required by starting an operating system, and the second storage address is a storage address of data required by starting a file system;
the second acquisition module is used for acquiring data of the first operating system based on the first storage address and acquiring data of the first file system based on the second storage address;
the verification module is used for verifying the first operating system based on the data of the first operating system and verifying the first file system based on the data of the first file system;
the first starting module is used for starting the first operating system and the first file system when the first operating system and the first file system are verified successfully;
the second starting module is used for acquiring data of a second operating system when the first operating system fails to check and the first operating system is not a mirror image operating system, wherein the second operating system is obtained by carrying out mirror image on the first operating system; verifying the second operating system based on the data of the second operating system; when the second operating system is verified successfully and the first file system is verified successfully, starting the second operating system and the first file system; or,
the third starting module is used for acquiring data of a second file system when the first file system fails to be verified and the first file system is not a mirror image file system, wherein the second file system is obtained by mirroring the first file system; verifying the second file system based on the data of the second file system; and when the first operating system is successfully verified and the second file system is successfully verified, starting the first operating system and the second file system.
6. The apparatus of claim 5, wherein the verification module comprises:
an obtaining unit, configured to obtain a first preset verification code and a second preset verification code, where the first preset verification code is a verification code preset for the first operating system, and the second preset verification code is a verification code preset for the first file system;
the computing unit is used for carrying out integrity computation on the data of the first operating system to obtain a first computation verification code, and carrying out integrity computation on the data of the first file system to obtain a second computation verification code;
the comparison unit is used for comparing the first calculation verification code with the first preset verification code and comparing the second calculation verification code with the second preset verification code;
the determining unit is configured to determine that the first operating system is successfully verified when the first computing verification code is consistent with the first preset verification code, and determine that the first file system is successfully verified when the second computing verification code is consistent with the second preset verification code.
7. The apparatus of claim 5, wherein the apparatus further comprises:
the judging module is used for judging whether the first operating system is a mirror image operating system or not and judging whether the first file system is a mirror image file system or not when the first operating system and the first file system fail to check;
the third obtaining module is used for obtaining data of a second operating system when the first operating system is not a mirror image operating system, and verifying the second operating system based on the data of the second operating system;
the fourth obtaining module is used for obtaining data of a second file system when the first file system is not the mirror image file system, and verifying the second file system based on the data of the second file system;
and the fourth starting module is used for starting the second operating system and the second file system when the second operating system and the second file system are verified successfully.
8. The apparatus of any of claims 5-7, wherein the apparatus further comprises:
a first replacement module, configured to replace the first storage address included in the environment variable with a storage address of data required to start the second operating system when the first operating system fails to check and the second operating system succeeds in checking;
and the second replacement module is used for replacing the second storage address included in the environment variable with the storage address of the data required for starting the second file system when the first file system is failed to be checked and the second file system is successfully checked.
CN201611261641.8A 2016-12-30 2016-12-30 The system start method and device of controller Active CN106843192B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611261641.8A CN106843192B (en) 2016-12-30 2016-12-30 The system start method and device of controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611261641.8A CN106843192B (en) 2016-12-30 2016-12-30 The system start method and device of controller

Publications (2)

Publication Number Publication Date
CN106843192A CN106843192A (en) 2017-06-13
CN106843192B true CN106843192B (en) 2018-12-28

Family

ID=59114204

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611261641.8A Active CN106843192B (en) 2016-12-30 2016-12-30 The system start method and device of controller

Country Status (1)

Country Link
CN (1) CN106843192B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110780942A (en) * 2019-09-29 2020-02-11 华为技术有限公司 System starting method and device, node equipment and computer readable storage medium
CN110764486B (en) * 2019-09-30 2020-09-29 华人运通(江苏)技术有限公司 Method and device for operating vehicle-mounted controller, vehicle-mounted controller and storage medium
CN111177752B (en) * 2019-12-20 2023-02-10 全球能源互联网研究院有限公司 Credible file storage method, device and equipment based on static measurement
CN113656078A (en) * 2021-07-28 2021-11-16 北京车和家信息技术有限公司 Equipment starting method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101673211A (en) * 2009-10-19 2010-03-17 中兴通讯股份有限公司 Embedded equipment and starting method thereof
US8402269B2 (en) * 2004-02-24 2013-03-19 Softcamp Co., Ltd. System and method for controlling exit of saved data from security zone
CN103955158A (en) * 2014-04-15 2014-07-30 中国石油集团东方地球物理勘探有限责任公司 Remote telemetry terminal controller and system start method
CN104063477A (en) * 2014-06-30 2014-09-24 广东威创视讯科技股份有限公司 Processing method and processing device for startup abnormalities of embedded system
CN105975864A (en) * 2016-04-29 2016-09-28 北京小米移动软件有限公司 Operation system starting method and device, and terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8402269B2 (en) * 2004-02-24 2013-03-19 Softcamp Co., Ltd. System and method for controlling exit of saved data from security zone
CN101673211A (en) * 2009-10-19 2010-03-17 中兴通讯股份有限公司 Embedded equipment and starting method thereof
CN103955158A (en) * 2014-04-15 2014-07-30 中国石油集团东方地球物理勘探有限责任公司 Remote telemetry terminal controller and system start method
CN104063477A (en) * 2014-06-30 2014-09-24 广东威创视讯科技股份有限公司 Processing method and processing device for startup abnormalities of embedded system
CN105975864A (en) * 2016-04-29 2016-09-28 北京小米移动软件有限公司 Operation system starting method and device, and terminal

Also Published As

Publication number Publication date
CN106843192A (en) 2017-06-13

Similar Documents

Publication Publication Date Title
CN106843192B (en) The system start method and device of controller
CN110765026B (en) Automatic test method, device, storage medium and equipment
CN104166561B (en) Electronic equipment system starting method and electronic equipment
CN101882085B (en) System starting method and embedded equipment
CN111338656B (en) Method and device for installing software package to target host and computer equipment
CN108874582A (en) A kind of system recovery method, device and terminal
CN103970564A (en) Automatic repairing and upgrading method of embedded operating system and embedded operating system with automatic repairing and upgrading functions
EP3879399A1 (en) Method and apparatus for upgrading vehicle-mounted tbox, device, and storage medium
CN110737481A (en) Starting method of embedded LINUX operating system based on multiple backup bootstrap programs
CN106897166B (en) Mobile terminal and repairing method thereof
CN111158968B (en) BIOS configuration information self-checking method, device and storage medium
CN112948190A (en) Hardware testing method, system and related device of server
CN113094251A (en) Embedded system testing method and device, computer equipment and storage medium
CN113315675B (en) White box switch U-Boot automatic testing method, system and storage medium
CN106201787A (en) Terminal control method and device
CN113961199A (en) Model deployment system, method, device and storage medium
CN111124760A (en) Uboot-based embedded equipment starting method and apparatus
CN107015827B (en) Embedded system and method for automatically operating third-party extension program thereof
CN115687021A (en) Server memory deployment method and server
CN115113904A (en) Firmware upgrading processing method and device, electronic equipment and storage medium
CN108920210B (en) Method, system and related assembly for loading storage control software
CN106095623A (en) Terminal control method and device
CN105827413A (en) Electronic terminal, and system safety verification device and method thereof
CN114968294A (en) Firmware upgrading method and device for equipment, electronic equipment and storage medium
CN112596750A (en) Application testing method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Room 1501, Gehua building, No.1 Qinglong Hutong, Dongcheng District, Beijing

Patentee after: Kunlun Digital Technology Co.,Ltd.

Patentee after: BGP INC., CHINA NATIONAL PETROLEUM Corp.

Address before: 1501, Gehua building, 1 Qinglong Hutong, Dongcheng District, Beijing

Patentee before: RICHFIT INFORMATION TECHNOLOGY Co.,Ltd.

Patentee before: BGP INC., CHINA NATIONAL PETROLEUM Corp.

CP03 Change of name, title or address
TR01 Transfer of patent right

Effective date of registration: 20220325

Address after: Room 1501, Gehua building, No.1 Qinglong Hutong, Dongcheng District, Beijing

Patentee after: Kunlun Digital Technology Co.,Ltd.

Patentee after: CHINA NATIONAL PETROLEUM Corp.

Address before: Room 1501, Gehua building, No.1 Qinglong Hutong, Dongcheng District, Beijing

Patentee before: Kunlun Digital Technology Co.,Ltd.

Patentee before: BGP INC., CHINA NATIONAL PETROLEUM Corp.

TR01 Transfer of patent right