CN112882757A - Embedded system double-partition safe starting method - Google Patents

Embedded system double-partition safe starting method Download PDF

Info

Publication number
CN112882757A
CN112882757A CN202110114614.2A CN202110114614A CN112882757A CN 112882757 A CN112882757 A CN 112882757A CN 202110114614 A CN202110114614 A CN 202110114614A CN 112882757 A CN112882757 A CN 112882757A
Authority
CN
China
Prior art keywords
partition
starting
reading
double
embedded
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.)
Pending
Application number
CN202110114614.2A
Other languages
Chinese (zh)
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.)
Saivante Systems
Original Assignee
Dongguan Fenggu 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 Dongguan Fenggu Technology Co ltd filed Critical Dongguan Fenggu Technology Co ltd
Priority to CN202110114614.2A priority Critical patent/CN112882757A/en
Publication of CN112882757A publication Critical patent/CN112882757A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4403Processor initialisation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operations
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • G06F9/441Multiboot arrangements, i.e. selecting an operating system to be loaded

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of embedded industrial equipment, in particular to a double-partition safe starting method of an embedded system, which comprises the following steps: step A, equipment is powered on; b, initializing a CPU, a memory and a serial port; step C, starting a counting module; step D, adding 1 to the restart times; e, judging whether the restart times are smaller than a preset threshold value through a counting module; if yes, reading the first system partition, and if not, reading the second system partition; and F, starting the system OS to execute the command according to the reading of the step E. The invention solves the problem that the system can not be recovered when the system fails by optimizing the technical combination of the system partition configuration and the starting step, thereby greatly improving the reliability and stability of the system; the equipment can recover normal operation even if the system is damaged.

Description

Embedded system double-partition safe starting method
Technical Field
The invention relates to the technical field of embedded industrial equipment, in particular to a double-partition safe starting method of an embedded system.
Background
Embedded devices are very common in daily production and life. Such as routers, cell phones, car navigation, industrial computers, etc. They have many functions and large differences in categories. The function realization of the embedded device is composed of hardware and software together. The embedded system software is generally composed of a boot program Bootloader + a system OS. The Bootloader is responsible for initializing hardware, transmitting startup parameters, and then loading a boot system OS for startup. Common bootloaders include Uboot, and system OSs include Linux, iOS, Android, and the like. The storage medium partitions such as a disk and Flash of a general embedded device software system are shown in fig. 2: the area where the disk starts is written to the Bootloader program as a boot partition. And a part of the disk is used as a system partition for installing the OS, and a part of the disk is finally reserved as a user partition for storing user operation data. The biggest defect of the partition mode is that when the system partition file is damaged due to sudden power failure, electromagnetic interference, misoperation and the like, the equipment cannot run, and the normal state cannot be recovered even if the system partition file is restarted after power failure.
A typical embedded system boot process is shown in fig. 1: after the device is powered on, Bootloader initializes a CPU, a memory and a serial port, and then checks a storage medium, which is usually a hard disk, a Flash memory and the like, in which a system OS is installed. If the operating system is legal, the Bootloader reads the operating system to the corresponding memory address, and then jumps to the past to start executing the OS kernel. The kernel may first initialize various device drivers, such as a display, a hard disk, a mouse, a keyboard, and the like. The system files and network are then initialized. And finally, the application program which interacts with the user and executes the specific function is started to run.
For household equipment, when the equipment is abnormally operated or crashed, the equipment can be restarted manually or factory settings are restored to enable the equipment to normally work. However, for devices applied in industrial automation, severe use environment, unattended situations and other scenarios, the requirements for system stability and reliability are higher, and if a fault occurs, the devices can preferably recover by themselves. However, some situations, such as a sudden power off, may cause the critical programs and files to be damaged, and even the system is shut down and restarted, the critical programs and files cannot be recovered. Therefore, a mechanism is needed to automatically recover the operation of the device when the device has a serious fault, so as to improve the stability and reduce the downtime.
Disclosure of Invention
The invention provides a double-partition safe starting method of an embedded system aiming at the problems in the prior art.
In order to solve the technical problems, the invention adopts the following technical scheme:
the invention provides a double-partition safe starting method of an embedded system, which comprises the following steps:
step A, equipment is powered on;
b, initializing a CPU, a memory and a serial port;
step C, starting a counting module;
step D, adding 1 to the restart times;
e, judging whether the restart times are smaller than a preset threshold value through a counting module; if yes, reading the first system partition, and if not, reading the second system partition;
and F, starting the system OS to execute the command according to the reading of the step E.
And B, the memory in the step B is a disk, and the disk is provided with a Bootloader partition, a parameter partition, the first system partition, the second system partition and a user partition.
And D, when the restart times in the step D are increased by 1, storing the restart times into a parameter partition for storage.
And E, setting the preset threshold value to be 3.
Wherein, the step F of starting the system OS to execute the command includes the steps of:
step F1, various initialization, execution application programs;
step F2, writing a start success flag;
step F3, starting a task;
step F4, the first system partition is started or the second system partition is started and repaired.
The invention has the beneficial effects that:
the invention solves the problem that the system can not be recovered when the system fails by optimizing the technical combination of the system partition configuration and the starting step, thereby greatly improving the reliability and stability of the system; the invention has the advantages that the Bootloader reads the starting of the operating system from the first system partition in normal operation; if the first system partition is damaged and cannot work normally during operation, the first system partition can automatically jump to start from the second system partition, and therefore the equipment can restore normal work even if the system is damaged.
Drawings
Fig. 1 is a flowchart of a typical embedded system boot process in the prior art.
FIG. 2 is a diagram of a disk partition in the prior art.
FIG. 3 is a flowchart of a dual-partition secure booting method of an embedded system according to the present invention.
FIG. 4 is a schematic diagram of a disk partition according to the present invention.
Detailed Description
In order to facilitate understanding of those skilled in the art, the present invention will be further described with reference to the following examples and drawings, which are not intended to limit the present invention. The present invention is described in detail below with reference to the attached drawings.
A safe starting method for double partitions of an embedded system comprises the following steps:
step A, equipment is powered on;
b, initializing a CPU, a memory and a serial port;
step C, starting a counting module;
step D, adding 1 to the restart times;
e, judging whether the restart times are smaller than a preset threshold value through a counting module; if yes, reading the first system partition, and if not, reading the second system partition;
and F, starting the system OS to execute the command according to the reading of the step E.
And B, the memory in the step B is a disk, and the disk is provided with a Bootloader partition, a parameter partition, the first system partition, the second system partition and a user partition.
And D, when the restart times in the step D are increased by 1, storing the restart times into a parameter partition for storage. And E, setting the preset threshold value to be 3.
Wherein, the step F of starting the system OS to execute the command includes the steps of:
step F1, various initialization, execution application programs;
step F2, writing a start success flag;
step F3, starting a task;
step F4, the first system partition is started or the second system partition is started and repaired.
In this embodiment, first, as in the prior art, the device is powered on, and the Bootloader initializes core hardware such as a CPU and a memory. Then, one more step than the original flow is to start the watchdog (i.e. a counting module, which is built in the CPU). The method can automatically restart when the system is abnormal, then the Bootloader reads the restart times in the parameter partition to add 1 and writes the restart times back to the parameter partition, and then the Bootloader judges whether the restart times are more than 3.
In the embodiment, 3 times are set as the limit value that the partition 1 cannot be started; if the number of times is 1, it may be misjudgment due to a power failure or the like. So if greater than 3 indicates that the system has not been successfully started three consecutive times, then the second system partition (backup partition) is read and started from the backup partition; if the number of reboots is less than 3, indicating that the limit has not been reached, an attempt is still made to read the first system partition.
After the first system partition or the second system partition is read, the system OS is started, and various initializations are performed to execute the application program as before. Compared with the previous flow, the method comprises three steps of successfully starting the write-in process, starting a dog feeding task (clearing a counting module) and repairing a first system partition; the successful writing and starting mark is actually to clear the restarting count in the parameter partition, so that the system still can be started from the first system partition after the power is supplied again under the conditions of shutdown, unexpected power failure and the like.
When the first system partition is really damaged and cannot be started, the first system partition cannot perform a dog feeding task (clear the counting module), so that the watchdog (the counting module) started in the Bootloader stage is restarted overtime; restarting the still timeout restart for the same reason; after the system is restarted for three times continuously, the restart count reaches 3, the Bootloader can be automatically switched to read the second system partition, and the Bootloader is started from the backup partition, so that the system can be recovered to normal operation.
After the restart times are cleared, the dog feeding task is started, then the restart count of the cache when the successful start mark is written is judged, if the times reach 3, the starting from the second system partition is indicated, at the moment, the second system partition can be copied to the first system partition, and the work of repairing the first system partition is started; therefore, the damaged first system partition can be automatically recovered to be normal, the system is complete as before when the system is continuously started from the first system partition next time, the problem that the system cannot be recovered when the system fails is solved by optimizing the technical combination of the system partition configuration and the starting steps, and the reliability and the stability of the system are greatly improved.
Although the present invention has been described with reference to the above preferred embodiments, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (5)

1. A safe starting method for double partitions of an embedded system is characterized by comprising the following steps:
step A, equipment is powered on;
b, initializing a CPU, a memory and a serial port;
step C, starting a counting module;
step D, adding 1 to the restart times;
e, judging whether the restart times are smaller than a preset threshold value through a counting module; if yes, reading the first system partition, and if not, reading the second system partition;
and F, starting the system OS to execute the command according to the reading of the step E.
2. The embedded system double-partition secure boot method according to claim 1, characterized in that: and the memory in the step B is a disk, and the disk is provided with a Bootloader partition, a parameter partition, the first system partition, the second system partition and a user partition.
3. The embedded system double-partition secure boot method according to claim 2, wherein: and D, when the restart times in the step D is increased by 1, storing the restart times into the parameter partition for storage.
4. The embedded system double-partition secure boot method according to claim 1, characterized in that: and E, setting the preset threshold value to be 3.
5. The embedded system double-partition secure boot method according to claim 1, wherein the step F of booting the system OS to execute the command comprises the steps of:
step F1, various initialization, execution application programs;
step F2, writing a start success flag;
step F3, starting a task;
step F4, the first system partition is started or the second system partition is started and repaired.
CN202110114614.2A 2021-01-26 2021-01-26 Embedded system double-partition safe starting method Pending CN112882757A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110114614.2A CN112882757A (en) 2021-01-26 2021-01-26 Embedded system double-partition safe starting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110114614.2A CN112882757A (en) 2021-01-26 2021-01-26 Embedded system double-partition safe starting method

Publications (1)

Publication Number Publication Date
CN112882757A true CN112882757A (en) 2021-06-01

Family

ID=76053638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110114614.2A Pending CN112882757A (en) 2021-01-26 2021-01-26 Embedded system double-partition safe starting method

Country Status (1)

Country Link
CN (1) CN112882757A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114670869A (en) * 2022-03-15 2022-06-28 阿波罗智能技术(北京)有限公司 System, system activation method, device, and autonomous vehicle
CN115328563A (en) * 2022-10-09 2022-11-11 荣耀终端有限公司 System starting method and electronic equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650662A (en) * 2009-08-26 2010-02-17 中兴通讯股份有限公司 Memory device of embedded system and staring method and upgrading of firmware
CN103135995A (en) * 2011-11-22 2013-06-05 中兴通讯股份有限公司 BootLoader backup management method and device
CN103826162A (en) * 2014-02-28 2014-05-28 深圳市佳创视讯技术股份有限公司 Embedded system of intelligent set top box based on Android and recovery method of embedded system
CN104063477A (en) * 2014-06-30 2014-09-24 广东威创视讯科技股份有限公司 Processing method and processing device for startup abnormalities of embedded system
CN104915226A (en) * 2015-05-21 2015-09-16 北京星网锐捷网络技术有限公司 Network device software starting method, device and network device
CN105511976A (en) * 2015-12-01 2016-04-20 长城信息产业股份有限公司 Embedded system application program self-recovery operation method and device
CN106095625A (en) * 2016-07-13 2016-11-09 上海斐讯数据通信技术有限公司 Radio reception device starts method and system
CN109471670A (en) * 2018-12-21 2019-03-15 迈普通信技术股份有限公司 Equipment starting method and electronic equipment
CN110333891A (en) * 2019-07-08 2019-10-15 四川爱联科技有限公司 The method of enhanced OTA upgrading based on Internet of Things
CN111767172A (en) * 2020-06-29 2020-10-13 深圳市宽宏科技有限公司 Self-repairing method for set top box based on watchdog and bootloader
US20200363855A1 (en) * 2019-05-17 2020-11-19 Trane International Inc. Bas/hvac control device automatic failure recovery
EP3742295A1 (en) * 2019-05-23 2020-11-25 NXP USA, Inc. Automatic firmware rollback

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650662A (en) * 2009-08-26 2010-02-17 中兴通讯股份有限公司 Memory device of embedded system and staring method and upgrading of firmware
CN103135995A (en) * 2011-11-22 2013-06-05 中兴通讯股份有限公司 BootLoader backup management method and device
CN103826162A (en) * 2014-02-28 2014-05-28 深圳市佳创视讯技术股份有限公司 Embedded system of intelligent set top box based on Android and recovery method of embedded system
CN104063477A (en) * 2014-06-30 2014-09-24 广东威创视讯科技股份有限公司 Processing method and processing device for startup abnormalities of embedded system
CN104915226A (en) * 2015-05-21 2015-09-16 北京星网锐捷网络技术有限公司 Network device software starting method, device and network device
CN105511976A (en) * 2015-12-01 2016-04-20 长城信息产业股份有限公司 Embedded system application program self-recovery operation method and device
CN106095625A (en) * 2016-07-13 2016-11-09 上海斐讯数据通信技术有限公司 Radio reception device starts method and system
CN109471670A (en) * 2018-12-21 2019-03-15 迈普通信技术股份有限公司 Equipment starting method and electronic equipment
US20200363855A1 (en) * 2019-05-17 2020-11-19 Trane International Inc. Bas/hvac control device automatic failure recovery
EP3742295A1 (en) * 2019-05-23 2020-11-25 NXP USA, Inc. Automatic firmware rollback
CN110333891A (en) * 2019-07-08 2019-10-15 四川爱联科技有限公司 The method of enhanced OTA upgrading based on Internet of Things
CN111767172A (en) * 2020-06-29 2020-10-13 深圳市宽宏科技有限公司 Self-repairing method for set top box based on watchdog and bootloader

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114670869A (en) * 2022-03-15 2022-06-28 阿波罗智能技术(北京)有限公司 System, system activation method, device, and autonomous vehicle
CN115328563A (en) * 2022-10-09 2022-11-11 荣耀终端有限公司 System starting method and electronic equipment
CN115328563B (en) * 2022-10-09 2023-04-14 荣耀终端有限公司 System startup method and electronic device

Similar Documents

Publication Publication Date Title
US6807630B2 (en) Method for fast reinitialization wherein a saved system image of an operating system is transferred into a primary memory from a secondary memory
CN101221508B (en) Method and device for starting equipment
US7734945B1 (en) Automated recovery of unbootable systems
CN102298545B (en) System startup boot processing method and device
JP2006527423A (en) Computer operation system repair method
CN111552592A (en) Double-backup starting method and system
CN101329631A (en) Method and apparatus for automatically detecting and recovering start-up of embedded system
CN105786545B (en) Breakpoint recovery method and system based on heterogeneous hybrid memory
CN100395713C (en) Method and module for automatically repairing basic input output system element
CN111143132A (en) BIOS recovery method, device, equipment and readable storage medium
CN114047958B (en) Starting method, equipment and medium of baseboard management controller of server
JP2023064689A (en) Board management controller for computer system and startup method
CN115904512A (en) Method for realizing high-reliability starting of embedded system based on CPLD
CN114265603A (en) System upgrading method and device based on asymmetric partition and electronic equipment
CN112882757A (en) Embedded system double-partition safe starting method
WO2023103755A1 (en) Terminal starting method, electronic device, and computer-readable storage medium
CN113094107A (en) Data protection method, device, equipment and computer storage medium
WO2021103745A1 (en) Method for protectively desiging boot program
CN116501409B (en) Dual-Flash-based server starting method, computer equipment and storage medium
CN104102505A (en) Computer power-on method
CN112988465A (en) Method for automatically recovering operation of single chip microcomputer in upgrading failure
CN120255970B (en) Baseboard management controller starting method, computer equipment, medium and product
CN113849235A (en) Control method and device and electronic equipment
CN121166439A (en) Starting method, device, equipment, medium and program product of BMC firmware
JP2005284902A (en) Terminal device, control method and control program thereof, host device, control method and control program thereof, and method, system, and program for remote updating

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
TA01 Transfer of patent application right

Effective date of registration: 20231011

Address after: Delaware

Applicant after: Saivante Systems

Address before: 523000 building C7, we Valley, Everbright, No.16, Keji 4th Road, Songshanhu high tech Industrial Development Zone, Dongguan City, Guangdong Province

Applicant before: Dongguan Fenggu Technology Co.,Ltd.

TA01 Transfer of patent application right