Embedded system startup method, device, electronic device and storage medium
By obtaining configuration files in the embedded system and judging its normality, if it is normal, judge and start the corresponding program from multiple dimensions, the system startup problem caused by abnormal power outage or operation is solved, and the startup stability of the embedded system is improved.
Patent Information
- Application Number
- CN202410908020.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-07-08
AI Technical Summary
When the startup method of the existing embedded system encounters abnormal power outage, errors and abnormal operations during file reading and writing, it may cause program files to be damaged or deleted accidentally, affecting the system startup.
By obtaining the configuration file of the embedded system, determine whether it is normal. If it is normal, determine whether the preset startup conditions are met from multiple dimensions (upgrade dimension, execution dimension, backup dimension) until the target dimension that meets the conditions is determined, and the corresponding program is started to start the system.
Ensure that the embedded system can make judgments from multiple dimensions when the configuration file is normal, avoiding the system being unable to start due to single-dimensional exceptions, and improving the startup stability of the embedded system.
Smart Images

Figure CN118747095B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of embedded technology, and in particular to a startup method, device, electronic device and storage medium for an embedded system. Background Art
[0002] Embedded systems have shown broad application prospects in the fields of automobiles, medical equipment, smart homes, and industrial automation. For example, in the automotive industry, with the development of intelligent driving technology, embedded systems are used in in-vehicle entertainment, navigation, and security monitoring. In the field of medical equipment, embedded systems are used for real-time monitoring and data collection to improve the efficiency and accuracy of equipment. In addition, smart homes and industrial automation are also important application areas for embedded systems. With the delivery and use of embedded systems, technology updates and iterations, the stable operation of the system is an issue that equipment manufacturers must consider. A stable system continuous operation technology can greatly improve customer satisfaction and reduce the difficulty of guarantee.
[0003] At present, the startup of embedded systems is generally done by using the ifconfig command in the startup script rc.local to configure network parameters such as IP address and gateway information, and then directly starting the program file to complete the system startup. However, in actual applications, when encountering situations such as abnormal power failure during file reading and writing, erroneous and abnormal operations, program files may be damaged or accidentally deleted, affecting system startup. Therefore, how to stably start the embedded system has become an urgent problem to be solved. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a startup method, device, electronic device and storage medium for an embedded system, which can ensure the normal startup of the embedded system by making judgments from multiple dimensions in sequence after determining that the configuration file is normal. Even if one dimension is abnormal, it can still be started from other dimensions, thereby improving the stability of the startup of the embedded system.
[0005] This application mainly includes the following aspects:
[0006] In a first aspect, an embodiment of the present application provides a method for starting an embedded system, the method comprising:
[0007] Obtain a configuration file of the embedded system, and determine whether the configuration file is normal;
[0008] If normal, then based on the configuration file, determine in turn whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system until a target dimension that meets the preset startup conditions is determined, and start the program corresponding to the target dimension to start the embedded system.
[0009] Further, determine whether the configuration file is normal by the following steps:
[0010] Obtaining preset judgment conditions, and determining whether the configuration file meets any one of the preset judgment conditions; wherein the preset judgment conditions include that the configuration file does not exist, the size of the configuration file is zero bytes, and the size of the configuration file is one byte;
[0011] If satisfied, it is determined that the configuration file is abnormal;
[0012] If all the conditions in the preset judgment conditions are not met, it is determined that the configuration file is normal.
[0013] Further, the dimensions include an upgrade dimension, an execution dimension, and a backup dimension; the step of determining whether the main program of the embedded system meets corresponding preset conditions from multiple dimensions in sequence based on the configuration file until a target dimension that meets the preset conditions is determined, and starting the program corresponding to the target dimension includes:
[0014] Based on the upgrade flag in the configuration file, determine whether the preset conditions of the upgrade dimension are met, and if the preset conditions of the upgrade dimension are met, start the upgrade program;
[0015] If the preset conditions of the upgrade dimension are not met, it is determined whether the preset conditions of the execution dimension are met. If the preset conditions of the execution dimension are met, the default program is started;
[0016] If the preset conditions of the execution dimension are not met, then determine whether the preset conditions of the backup dimension are met, and if the preset conditions of the backup dimension are met, start the backup program;
[0017] If the preset conditions of the backup dimension are not met, obtain the compressed package, decompress the target backup file in the compressed package, update the backup file with the target backup file, and re-determine whether the backup file meets the preset conditions of the backup dimension until the backup program corresponding to the backup file is started.
[0018] Furthermore, the step of determining whether a preset condition of an upgrade dimension is met based on the upgrade flag in the configuration file includes:
[0019] Based on the upgrade flag in the configuration file, determining whether the upgrade flag is set;
[0020] If set, switch the soft link to the upgrade file, read the entire package of data in the upgrade file, and determine the cyclic redundancy check value of the upgrade file;
[0021] After re-determining that the configuration file is normal, obtaining a target check value of the upgrade file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the upgrade file is consistent with the target check value of the upgrade file;
[0022] If they are consistent, it is determined that the preset conditions of the upgrade dimension are met;
[0023] If they are inconsistent, it is determined that the preset conditions for the upgrade dimension are not met.
[0024] Further, the following steps are performed to determine whether the preset conditions of the execution dimension are met:
[0025] Switch the soft link to a default file, read the entire package of data in the default file, and determine the cyclic redundancy check value of the default file;
[0026] After re-determining that the configuration file is normal, obtaining a target check value of a default file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the default file is consistent with the target check value of the default file;
[0027] If they are consistent, it is determined that the preset conditions of the execution dimension are met;
[0028] If not, it is determined that the preset conditions of the execution dimension are not met.
[0029] Further, the following steps are performed to determine whether the preset conditions of the backup dimension are met:
[0030] Switch the soft link to the backup file, read the entire package of data in the backup file, and determine the cyclic redundancy check value of the backup file;
[0031] After re-determining that the configuration file is normal, obtaining a target check value of a backup file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the backup file is consistent with the target check value of the backup file;
[0032] If they are consistent, it is determined that the preset conditions of the backup dimension are met;
[0033] If they are inconsistent, it is determined that the preset conditions of the backup dimension are not met.
[0034] Furthermore, the startup method also includes:
[0035] If the configuration file is abnormal, decompress the compressed package;
[0036] The configuration file is updated with the target configuration file decompressed in the compressed package, the upgrade file is updated with the target upgrade file supporting the decompressed target configuration file, the default file is updated with the target default file supporting the decompressed target configuration file, the backup file is updated with the target backup file supporting the decompressed target configuration file, and the target check value of the upgrade file, the target check value of the default file and the target check value of the backup file are updated at the same time, and it is re-determined whether the configuration file is normal.
[0037] In a second aspect, an embodiment of the present application further provides a startup device for an embedded system, the startup device comprising:
[0038] A detection module, used to obtain a configuration file of the embedded system and determine whether the configuration file is normal;
[0039] A startup module is used to determine whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system based on the configuration file when it is determined that the configuration file is normal, until a target dimension that meets the preset startup conditions is determined, and start the program corresponding to the target dimension to start the embedded system.
[0040] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the startup method of the embedded system as described above are performed.
[0041] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the startup method of the embedded system as described above are executed.
[0042] An embodiment of the present application provides a startup method, device, electronic device and storage medium for an embedded system. The startup method includes: obtaining a configuration file of the embedded system and determining whether the configuration file is normal; if normal, determining whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system based on the configuration file in sequence, until a target dimension that meets the preset startup conditions is determined, and starting a program corresponding to the target dimension to start the embedded system.
[0043] In this way, the technical solution provided by the present application can ensure the normal startup of the embedded system by making judgments from multiple dimensions in sequence after determining that the configuration file is normal. Even if one dimension is abnormal, it can still be started from other dimensions, thereby ensuring the normal startup of the embedded system and improving the stability of the startup of the embedded system.
[0044] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A flowchart of a method for starting an embedded system provided by an embodiment of the present application is shown;
[0047] Figure 2 A flowchart showing another method for starting an embedded system provided in an embodiment of the present application is shown;
[0048] Figure 3 A schematic diagram of a process for determining whether a configuration file is normal provided in an embodiment of the present application is shown;
[0049] Figure 4 A schematic diagram of a process of starting an embedded system provided in an embodiment of the present application is shown;
[0050] Figure 5 One of the structural schematic diagrams of a startup device of an embedded system provided in an embodiment of the present application is shown;
[0051] Figure 6 A second structural schematic diagram of a startup device for an embedded system provided in an embodiment of the present application is shown;
[0052] Figure 7 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0053] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art, under the guidance of the content of the present application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.
[0054] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0055] In order to enable those skilled in the art to use the contents of this application, the following implementation is given in combination with a specific application scenario "starting an embedded system". For those skilled in the art, the general principles defined here can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application.
[0056] The following methods, devices, electronic devices or computer-readable storage media of the embodiments of the present application can be applied to any scenario where an embedded system needs to be started. The embodiments of the present application are not limited to specific application scenarios. Any scheme using an embedded system startup method, device, electronic device and storage medium provided by the embodiments of the present application is within the protection scope of the present application.
[0057] Based on this, the present application proposes a startup method, device, electronic device and storage medium for an embedded system, the startup method comprising: obtaining a configuration file of the embedded system and determining whether the configuration file is normal; if normal, determining in sequence from multiple dimensions of the embedded system whether corresponding preset startup conditions are met based on the configuration file, until a target dimension that meets the preset startup conditions is determined, and starting a program corresponding to the target dimension to start the embedded system.
[0058] In this way, the technical solution provided by the present application can ensure the normal startup of the embedded system by making judgments from multiple dimensions in sequence after determining that the configuration file is normal. Even if one dimension is abnormal, it can still be started from other dimensions, thereby ensuring the normal startup of the embedded system and improving the stability of the startup of the embedded system.
[0059] To facilitate understanding of the embodiments of the present application, a startup method of an embedded system disclosed in the embodiments of the present application is first introduced in detail.
[0060] See also Figure 1 , Figure 1 A flowchart of a method for starting an embedded system provided in an embodiment of the present application is shown in FIG. Figure 1 As shown in , the startup method includes:
[0061] S101, obtaining a configuration file of the embedded system, and determining whether the configuration file is normal;
[0062] In this step, see Figure 2 , Figure 2 A flowchart of another method for starting an embedded system provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, check whether the configuration file is normal by following the steps below:
[0063] S201, obtaining preset judgment conditions, and determining whether the configuration file satisfies any one of the preset judgment conditions;
[0064] In this step, the preset judgment conditions include that the configuration file does not exist, the size of the configuration file is zero bytes, and the size of the configuration file is one byte;
[0065] S202: If the conditions are met, determining that the configuration file is abnormal;
[0066] S203: If all the conditions in the preset judgment conditions are not met, it is determined that the configuration file is normal.
[0067] In the above steps S201 to S203, it is a step to determine whether the configuration file is normal. For example, see Figure 3 , Figure 3 A schematic diagram of a process for determining whether a configuration file is normal provided in an embodiment of the present application, such as Figure 3 As shown, the configuration file (ini file) is judged to determine whether the ini file exists or whether the size of the ini file is 0 or 1. If any one of the conditions of the ini file not existing, the size of the ini file is 0, or the size of the ini file is 1 is met, it means that the ini file is abnormal, otherwise it is determined that the ini file is normal and the judgment program is exited. When it is determined that the ini file is abnormal, the following steps 1 to 2 are executed.
[0068] It should be noted that the startup method also includes:
[0069] 1. If the configuration file is abnormal, decompress the compressed package;
[0070] 2. Update the configuration file with the target configuration file decompressed in the compressed package, update the upgrade file with the target upgrade file supporting the decompressed target configuration file, update the default file with the target default file supporting the decompressed target configuration file, update the backup file with the target backup file supporting the decompressed target configuration file, and update the target check value of the upgrade file, the target check value of the default file and the target check value of the backup file at the same time, and re-determine whether the configuration file is normal.
[0071] In the above steps 1 and 2, it is the processing steps when it is determined that the configuration file is abnormal, such as Figure 3 As shown, after determining that the configuration file, i.e., the ini file is abnormal, the compressed package of the embedded system uploaded previously is decompressed to obtain the configuration file in the compressed package (i.e., the target configuration file), and the abnormal ini file is replaced with the target configuration file, and then the execution permission is added. After having the permission, the program files such as the default file containing the default program and the backup file containing the backup program that are matched with the ini file in the decompressed compressed package are overwritten again, and the target check (CyclicRedundancy Check, CRC) value in the ini file is refreshed to re-determine whether the configuration file is normal.
[0072] S102: If normal, determine whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system in turn based on the configuration file, until a target dimension that meets the preset startup conditions is determined, and start the program corresponding to the target dimension to start the embedded system.
[0073] It should be noted that the dimensions include upgrade dimensions, execution dimensions, and backup dimensions; based on the configuration file, determining whether the main program of the embedded system meets corresponding preset conditions from multiple dimensions in sequence until a target dimension that meets the preset conditions is determined, and the steps of starting the program corresponding to the target dimension include:
[0074] S1021. Determine whether a preset condition of an upgrade dimension is met based on the upgrade flag in the configuration file, and if the preset condition of the upgrade dimension is met, start the upgrade program;
[0075] It should be noted that the step of determining whether the preset conditions of the upgrade dimension are met based on the upgrade flag in the configuration file includes:
[0076] 1) Based on the upgrade flag in the configuration file, determine whether the upgrade flag is set;
[0077] 2) If set, switch the soft link to the upgrade file, read the entire package of data in the upgrade file, and determine the cyclic redundancy check value of the upgrade file;
[0078] 3) After re-confirming that the configuration file is normal, obtaining a target check value of the upgrade file pre-stored in the configuration file, and determining whether the cyclic redundancy check value of the upgrade file is consistent with the target check value of the upgrade file;
[0079] 4) If they are consistent, it is determined that the preset conditions of the upgrade dimension are met;
[0080] 5) If they are inconsistent, it is determined that the preset conditions of the upgrade dimension are not met.
[0081] In the above steps 1) to 5), it is a step to determine whether to start the upgrade program. For example, please refer to Figure 4 , Figure 4 A schematic diagram of a process of starting an embedded system provided in an embodiment of the present application is shown as follows: Figure 4 As shown, when determining whether to start the upgrade program, first read the configuration file (i.e., ini file), and determine whether the upgrade is successful by judging whether the upgrade flag is set. If the upgrade flag is not set, it means that the upgrade has failed or has not been performed, and enter step S1022; if the upgrade flag is set, it means that a valid upgrade recognized by the system has been performed. At this time, run the "soft link upgrade file toggle script" (do_start_udp.sh), switch the soft link to the upgrade file, read the entire package data of the upgrade program, calculate the cyclic redundancy check value (CRC value) of the upgrade file, and after determining that the ini file is normal, read the cyclic redundancy check value (i.e., target check value) of the upgrade file stored in the ini file, and compare the calculated CRC value of the upgrade file with the target check value of the upgrade file stored in the ini file. If the comparison is consistent, start the upgrade program of the upgrade file; if not, enter step S1022.
[0082] S1022: If the preset condition of the upgrade dimension is not met, determine whether the preset condition of the execution dimension is met; if the preset condition of the execution dimension is met, start the default program;
[0083] It should be noted that the following steps are used to determine whether the preset conditions of the execution dimension are met:
[0084] 1] Switch the soft link to the default file, read the entire package of data in the default file, and determine the cyclic redundancy check value of the default file;
[0085] 2], after re-determining that the configuration file is normal, obtaining a target check value of a default file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the default file is consistent with the target check value of the default file;
[0086] 3], if they are consistent, it is determined that the preset conditions of the execution dimension are met;
[0087] 4], If not, it is determined that the preset conditions of the execution dimension are not met.
[0088] In the above steps 1] to 4], it is a step to determine whether to start the default program, such as Figure 4 As shown, when the calculated CRC value of the upgrade file is inconsistent with the cyclic redundancy check (CRC) value of the upgrade file stored in the ini file (i.e., the target check value), run the "soft link default file toggle script" (do_start_dft.sh) to switch the soft link to the default file. At this time, all the data content of the default file is read, the cyclic redundancy check value (CRC value) of the default file is calculated, and after determining that the ini file is normal, the cyclic redundancy check value (i.e., the target check value) of the default file stored in the ini file is read, and the calculated CRC value of the default file is compared with the target check value of the default file stored in the ini file. If the comparison is consistent, the default program of the default file is started; if it is inconsistent, enter step S1023.
[0089] S1023: If the preset condition of the execution dimension is not met, determine whether the preset condition of the backup dimension is met; if the preset condition of the backup dimension is met, start the backup program;
[0090] It should be noted that the following steps are used to determine whether the preset conditions of the backup dimension are met:
[0091] 1] Switch the soft link to the backup file, read the entire package of data in the backup file, and determine the cyclic redundancy check value of the backup file;
[0092] 2] After re-confirming that the configuration file is normal, obtaining a target checksum value of a backup file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the backup file is consistent with the target checksum value of the backup file;
[0093] 3] If they are consistent, it is determined that the preset conditions of the backup dimension are met;
[0094] 4] If there is inconsistency, it is determined that the preset conditions of the backup dimension are not met.
[0095] In the above steps 1] to 4], it is a step to determine whether to start the backup program, such as Figure 4As shown, when the calculated CRC value of the default file is inconsistent with the cyclic redundancy check (CRC) value of the default file stored in the ini file (i.e., the target check value), run the "soft link backup file toggle script" to switch the soft link to the backup file. At this time, all the data content of the backup file is read, the cyclic redundancy check value (CRC value) of the backup file is calculated, and after determining that the ini file is normal, the cyclic redundancy check value (i.e., the target check value) of the backup file stored in the ini file is read, and the calculated CRC value of the backup file is compared with the target check value of the backup file stored in the ini file. If the comparison is consistent, the backup program of the backup file is started; if it is inconsistent, enter step S1024.
[0096] S1024. If the preset condition of the backup dimension is not met, obtain a compressed package, decompress the target backup file in the compressed package, update the backup file with the target backup file, and re-determine whether the backup file meets the preset condition of the backup dimension until the backup program corresponding to the backup file is started.
[0097] This step is the final guaranteed startup step, such as Figure 4 As shown, when the backup program cannot be started, a compressed version of the backup file (target backup file) is decompressed, the CRC of the backup file is recalculated, the ini file is written back, the soft link is dialed to the backup file again, and the verification is continued until the backup program of the decompressed backup file is started.
[0098] In addition, for the startup of embedded systems, the ifconfig command is generally used in the startup script rc.local to configure network parameters such as IP address and gateway information, execute the executable file, and complete the program startup. However, in actual application, the ifconfig command is often unstable. Therefore, in actual design, IP commands are used in the script, such as using ipaddr add 192.168.1.1 / 24dev eth0 to configure the IP address; and in the actual development process, due to abnormal power failure, loose lines and other reasons, the ini file has been damaged, the ini file does not exist, the size is zero, or the size is 1. Therefore, in the above process, before reading the ini file each time, the ini file detection function is called, that is, the execution is as follows Figure 3 The process of determining whether the ini file is normal is shown. When an ini file abnormality is detected, the normal startup process is abandoned, a new ini file is decompressed, and the supporting program file is replaced, and the subsequent judgment process is performed until the program is started normally. This method of starting the daemon program instead of directly starting the program file in the script avoids the problem that the embedded system program cannot start or cannot be used after startup.
[0099] In summary, in order to ensure the stable operation of the embedded system, this embodiment designs a daemon mechanism, which starts the main program by the daemon process, thereby increasing the stability of the embedded system startup, avoiding technical problems such as program file damage caused by abnormal power outages, which causes the main program to fail to start and affects the use of the embedded system, improving the robustness and stability of the embedded system startup, and reducing the after-sales difficulty of the embedded system.
[0100] An embodiment of the present application provides a method for starting an embedded system, the method comprising: obtaining a configuration file of the embedded system, and determining whether the configuration file is normal; if normal, determining in sequence from multiple dimensions of the embedded system whether corresponding preset startup conditions are met based on the configuration file, until a target dimension that meets the preset startup conditions is determined, and starting a program corresponding to the target dimension to start the embedded system.
[0101] In this way, the technical solution provided by the present application can ensure the normal startup of the embedded system by making judgments from multiple dimensions in sequence after determining that the configuration file is normal. Even if one dimension is abnormal, it can still be started from other dimensions, thereby ensuring the normal startup of the embedded system and improving the stability of the startup of the embedded system.
[0102] Based on the same inventive concept, an embodiment of the present application also provides a startup device for an embedded system corresponding to the startup method of the above-mentioned embedded system. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0103] See also Figure 5 , Figure 6 , Figure 5 This is one of the structural schematic diagrams of a startup device of an embedded system provided in an embodiment of the present application. Figure 6 The second structural diagram of a startup device of an embedded system provided in an embodiment of the present application is as follows: Figure 5 As shown in , the starting device 510 includes:
[0104] The detection module 511 is used to obtain a configuration file of the embedded system and determine whether the configuration file is normal;
[0105] The startup module 512 is used to determine whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system based on the configuration file when it is determined that the configuration file is normal, until a target dimension that meets the preset startup conditions is determined, and start the program corresponding to the target dimension to start the embedded system.
[0106] Optionally, the detection module 511 is specifically used for:
[0107] Obtaining preset judgment conditions, and determining whether the configuration file meets any one of the preset judgment conditions; wherein the preset judgment conditions include that the configuration file does not exist, the size of the configuration file is zero bytes, and the size of the configuration file is one byte;
[0108] If satisfied, it is determined that the configuration file is abnormal;
[0109] If all the conditions in the preset judgment conditions are not met, it is determined that the configuration file is normal.
[0110] Optionally, the dimension includes an upgrade dimension, an execution dimension, and a backup dimension; when the startup module 512 is used to determine whether the main program of the embedded system meets corresponding preset conditions from multiple dimensions in sequence based on the configuration file until a target dimension that meets the preset conditions is determined and the program corresponding to the target dimension is started, the startup module 512 is specifically used to:
[0111] Based on the upgrade flag in the configuration file, determine whether the preset conditions of the upgrade dimension are met, and if the preset conditions of the upgrade dimension are met, start the upgrade program;
[0112] If the preset conditions of the upgrade dimension are not met, determine whether the preset conditions of the execution dimension are met. If the preset conditions of the execution dimension are met, start the default program;
[0113] If the preset conditions of the execution dimension are not met, it is determined whether the preset conditions of the backup dimension are met. If the preset conditions of the backup dimension are met, the backup program is started;
[0114] If the preset conditions of the backup dimension are not met, obtain the compressed package, decompress the target backup file in the compressed package, update the backup file with the target backup file, and re-determine whether the backup file meets the preset conditions of the backup dimension until the backup program corresponding to the backup file is started.
[0115] Optionally, when the starting module 512 is used to determine whether a preset condition of an upgrade dimension is met based on the upgrade flag in the configuration file, the starting module 512 is specifically used to:
[0116] Based on the upgrade flag in the configuration file, determining whether the upgrade flag is set;
[0117] If set, switch the soft link to the upgrade file, read the entire package of data in the upgrade file, and determine the cyclic redundancy check value of the upgrade file;
[0118] After re-determining that the configuration file is normal, obtaining a target check value of the upgrade file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the upgrade file is consistent with the target check value of the upgrade file;
[0119] If they are consistent, it is determined that the preset conditions of the upgrade dimension are met;
[0120] If they are inconsistent, it is determined that the preset conditions for the upgrade dimension are not met.
[0121] Optionally, when the starting module 512 is used to determine whether a preset condition of the execution dimension is met, the starting module 512 is specifically used to:
[0122] Switch the soft link to a default file, read the entire package of data in the default file, and determine the cyclic redundancy check value of the default file;
[0123] After re-determining that the configuration file is normal, obtaining a target check value of a default file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the default file is consistent with the target check value of the default file;
[0124] If they are consistent, it is determined that the preset conditions of the execution dimension are met;
[0125] If not, it is determined that the preset conditions of the execution dimension are not met.
[0126] Optionally, when the starting module 512 is used to determine whether a preset condition of the backup dimension is met, the starting module 512 is specifically used to:
[0127] Switch the soft link to the backup file, read the entire package of data in the backup file, and determine the cyclic redundancy check value of the backup file;
[0128] After re-determining that the configuration file is normal, obtaining a target check value of a backup file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the backup file is consistent with the target check value of the backup file;
[0129] If they are consistent, it is determined that the preset conditions of the backup dimension are met;
[0130] If they are inconsistent, it is determined that the preset conditions of the backup dimension are not met.
[0131] Optional, such as Figure 6 As shown, the startup device 510 further includes an updating module 513, and the updating module 513 is used to:
[0132] If the configuration file is abnormal, decompress the compressed package;
[0133] The configuration file is updated with the target configuration file decompressed in the compressed package, the upgrade file is updated with the target upgrade file supporting the decompressed target configuration file, the default file is updated with the target default file supporting the decompressed target configuration file, the backup file is updated with the target backup file supporting the decompressed target configuration file, and the target check value of the upgrade file, the target check value of the default file and the target check value of the backup file are updated at the same time, and it is re-determined whether the configuration file is normal.
[0134] An embodiment of the present application provides a startup device for an embedded system, the startup device comprising: a detection module, used to obtain a configuration file of the embedded system and determine whether the configuration file is normal; a startup module, used to determine whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system based on the configuration file in sequence when it is determined that the configuration file is normal, until a target dimension that meets the preset startup conditions is determined, and start a program corresponding to the target dimension to start the embedded system.
[0135] In this way, the technical solution provided by the present application can ensure the normal startup of the embedded system by making judgments from multiple dimensions in sequence after determining that the configuration file is normal. Even if one dimension is abnormal, it can still be started from other dimensions, thereby ensuring the normal startup of the embedded system and improving the stability of the startup of the embedded system.
[0136] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown in , the electronic device 700 includes a processor 710 , a memory 720 and a bus 730 .
[0137] The memory 720 stores machine-readable instructions executable by the processor 710. When the electronic device 700 is running, the processor 710 communicates with the memory 720 via the bus 730. When the machine-readable instructions are executed by the processor 710, the above-mentioned Figure 1 to Figure 2 The steps of the method for starting the embedded system in the method embodiment shown in the figure, and the specific implementation manner can be found in the method embodiment, which will not be described in detail here.
[0138] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 to Figure 2 The steps of the method for starting the embedded system in the method embodiment shown in the figure, and the specific implementation manner can be found in the method embodiment, which will not be described in detail here.
[0139] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0140] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0141] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0142] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0143] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0144] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A startup method for an embedded system, characterized in that: The startup method comprises: Obtain a configuration file of the embedded system, and determine whether the configuration file is normal; If normal, determining whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system in sequence based on the configuration file until a target dimension that meets the preset startup conditions is determined, and starting a program corresponding to the target dimension to start the embedded system; The dimensions include an upgrade dimension, an execution dimension, and a backup dimension; the step of determining whether the main program of the embedded system meets corresponding preset conditions from multiple dimensions in sequence based on the configuration file until a target dimension that meets the preset conditions is determined, and starting the program corresponding to the target dimension includes: Based on the upgrade flag in the configuration file, determine whether the preset conditions of the upgrade dimension are met, and if the preset conditions of the upgrade dimension are met, start the upgrade program; If the preset conditions of the upgrade dimension are not met, it is determined whether the preset conditions of the execution dimension are met. If the preset conditions of the execution dimension are met, the default program is started; If the preset conditions of the execution dimension are not met, then determine whether the preset conditions of the backup dimension are met, and if the preset conditions of the backup dimension are met, start the backup program; If the preset conditions of the backup dimension are not met, obtain the compressed package, decompress the target backup file in the compressed package, update the backup file with the target backup file, and re-determine whether the backup file meets the preset conditions of the backup dimension until the backup program corresponding to the backup file is started.
2. The startup method according to claim 1, characterized in that: Determine whether the configuration file is normal by following these steps: Obtaining preset judgment conditions, and determining whether the configuration file meets any one of the preset judgment conditions; wherein the preset judgment conditions include that the configuration file does not exist, the size of the configuration file is zero bytes, and the size of the configuration file is one byte; If satisfied, it is determined that the configuration file is abnormal; If all the conditions in the preset judgment conditions are not met, it is determined that the configuration file is normal.
3. The startup method according to claim 1, characterized in that: The step of determining whether a preset condition of an upgrade dimension is met based on the upgrade flag in the configuration file includes: Based on the upgrade flag in the configuration file, determining whether the upgrade flag is set; If set, switch the soft link to the upgrade file, read the entire package of data in the upgrade file, and determine the cyclic redundancy check value of the upgrade file; After re-determining that the configuration file is normal, obtaining a target check value of the upgrade file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the upgrade file is consistent with the target check value of the upgrade file; If they are consistent, it is determined that the preset conditions of the upgrade dimension are met; If they are inconsistent, it is determined that the preset conditions for the upgrade dimension are not met.
4. The startup method according to claim 1, characterized in that: Use the following steps to determine whether the preset conditions for the execution dimension are met: Switch the soft link to a default file, read the entire package of data in the default file, and determine the cyclic redundancy check value of the default file; After re-determining that the configuration file is normal, obtaining a target check value of a default file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the default file is consistent with the target check value of the default file; If they are consistent, it is determined that the preset conditions of the execution dimension are met; If not, it is determined that the preset conditions of the execution dimension are not met.
5. The startup method according to claim 1, characterized in that: Use the following steps to determine whether the backup dimension preset conditions are met: Switch the soft link to the backup file, read the entire package of data in the backup file, and determine the cyclic redundancy check value of the backup file; After re-determining that the configuration file is normal, obtaining a target check value of a backup file pre-stored in the configuration file, and determining whether a cyclic redundancy check value of the backup file is consistent with the target check value of the backup file; If they are consistent, it is determined that the preset conditions of the backup dimension are met; If they are inconsistent, it is determined that the preset conditions of the backup dimension are not met.
6. The startup method according to claim 1, characterized in that: The startup method also includes: If the configuration file is abnormal, decompress the compressed package; The configuration file is updated with the target configuration file decompressed in the compressed package, the upgrade file is updated with the target upgrade file supporting the decompressed target configuration file, the default file is updated with the target default file supporting the decompressed target configuration file, the backup file is updated with the target backup file supporting the decompressed target configuration file, and the target check value of the upgrade file, the target check value of the default file and the target check value of the backup file are updated at the same time, and it is re-determined whether the configuration file is normal.
7. A startup device for an embedded system, characterized in that: The starting device comprises: A detection module, used to obtain a configuration file of the embedded system and determine whether the configuration file is normal; A startup module, configured to determine whether the corresponding preset startup conditions are met from multiple dimensions of the embedded system in sequence based on the configuration file when it is determined that the configuration file is normal, until a target dimension that meets the preset startup conditions is determined, and start a program corresponding to the target dimension to start the embedded system; The dimensions include an upgrade dimension, an execution dimension, and a backup dimension; when the startup module is used to determine whether the main program of the embedded system meets corresponding preset conditions from multiple dimensions in sequence based on the configuration file until a target dimension that meets the preset conditions is determined and the program corresponding to the target dimension is started, the startup module is specifically used to: Based on the upgrade flag in the configuration file, determine whether the preset conditions of the upgrade dimension are met, and if the preset conditions of the upgrade dimension are met, start the upgrade program; If the preset conditions of the upgrade dimension are not met, it is determined whether the preset conditions of the execution dimension are met. If the preset conditions of the execution dimension are met, the default program is started; If the preset conditions of the execution dimension are not met, then determine whether the preset conditions of the backup dimension are met, and if the preset conditions of the backup dimension are met, start the backup program; If the preset conditions of the backup dimension are not met, obtain the compressed package, decompress the target backup file in the compressed package, update the backup file with the target backup file, and re-determine whether the backup file meets the preset conditions of the backup dimension until the backup program corresponding to the backup file is started.
8. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to execute the steps of the startup method of the embedded system as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the startup method of the embedded system according to any one of claims 1 to 6 are executed.
Citation Information
Patent Citations
Method and system for starting embedded type equipment
CN104407888A
Data file processing method and device, equipment and storage medium
CN114296827A