CN111273928B - Bootloader design method for self-upgrading - Google Patents

Bootloader design method for self-upgrading Download PDF

Info

Publication number
CN111273928B
CN111273928B CN202010060383.7A CN202010060383A CN111273928B CN 111273928 B CN111273928 B CN 111273928B CN 202010060383 A CN202010060383 A CN 202010060383A CN 111273928 B CN111273928 B CN 111273928B
Authority
CN
China
Prior art keywords
bootloader
module
upgrading
firmware
bootloader module
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
CN202010060383.7A
Other languages
Chinese (zh)
Other versions
CN111273928A (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.)
Shenzhen Fitcare Electronics Co ltd
Original Assignee
Shenzhen Fitcare Electronics 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 Shenzhen Fitcare Electronics Co ltd filed Critical Shenzhen Fitcare Electronics Co ltd
Publication of CN111273928A publication Critical patent/CN111273928A/en
Application granted granted Critical
Publication of CN111273928B publication Critical patent/CN111273928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1417Boot up procedures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/142Reconfiguring to eliminate the error
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1433Saving, restoring, recovering or retrying at system level during software upgrading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating

Abstract

The invention relates to a bootloader device with self-elevating level and a design method thereof, comprising the following steps: bootloader module, bootloader configuration module and guide module; the bootloader module includes: the device comprises a first bootloader module and a second bootloader module, wherein the second bootloader module is a backup module of the first bootloader module; the bootloader configuration module is used for storing parameter information of the bootloader module; the boot module is used for checking the integrity and the legality of the bootloader module and repairing the bootloader module. The invention can repair and restore normal operation by itself when the bootloader module is damaged in the upgrading process such as abnormal or using process, thereby ensuring the safe and reliable program starting and upgrading process.

Description

Bootloader design method for self-upgrading
Technical Field
The invention relates to the field of embedded electronic products, in particular to a bootloader device capable of self-upgrading and a design method.
Background
At present, most of embedded electronic products have bootloader functions and are used for online upgrading of firmware, so that new characteristics of the products or potential bug repairing can be quickly added to the products in an online upgrading mode. In most cases, bootloader functions are relatively single, only firmware is upgraded, but in many application scenarios, bootloader itself needs to be upgraded to support some new features and new functions, for example, the original single bank firmware upgrading mode is changed into a dual bank firmware upgrading mode.
Based on this, engineers have designed various bootloader devices or programs that can be upgraded, however, in these designs, there are obvious drawbacks, and often the programs cannot be started normally due to the bootloader module being damaged, or the embedded product application cannot be loaded due to sudden power failure in the upgrade process, and the online upgrade fails.
The existing scheme has the following defects:
1, a bootloader module is damaged to cause that a program cannot be started normally;
2. the sudden power failure in the upgrading process causes that the embedded product application program cannot be loaded and the online upgrading fails.
Disclosure of Invention
The invention aims to solve the technical problems that in the existing design, programs cannot be started normally due to the damage of bootloader modules or embedded product application programs cannot be loaded and online upgrading fails due to sudden power failure in the upgrading process.
The technical scheme adopted for solving the technical problems is as follows: the bootloader device and the design method for the self-upgrading are constructed, the self-upgrading function of the bootloader module is realized by adopting a combination mode of a guide module, a bootloader double module and a bootloader configuration module, and meanwhile, when the bootloader module is damaged in the upgrading process or is damaged in the using process, the bootloader device can be automatically repaired and can recover to normally work, so that the program starting and upgrading processes are safe and reliable.
In the self-elevating bootloader device of the present invention, the bootloader device includes: bootloader module, bootloader configuration module and guide module;
the bootloader module includes: the device comprises a first bootloader module and a second bootloader module, wherein the second bootloader module is a backup module of the first bootloader module;
the bootloader configuration module is used for storing parameter information of the bootloader module;
the boot module is used for checking the integrity and the legality of the bootloader module and repairing the bootloader module.
In a self-elevating bootloader device of the present invention, the function of the first bootloader module further includes: and receiving an upgrade command and judging whether to upgrade itself.
In the bootloader device with self-elevating level, the guiding module, the first bootloader module and the second bootloader module are all independent and operable firmware modules.
In a bootloader device of the present invention, parameter information of a bootloader module includes: version information, program size, valid flags and check codes.
In a self-elevating bootloader device of the present invention, the device further comprises the following functions: judging whether the downloading of the upgrading bootloader firmware is finished or not and whether the upgrading bootloader firmware is wrong or not, and sending a corresponding instruction according to a judging result.
The bootloader design method for self-upgrading comprises the following steps of;
s1, after the device is electrified or reset, a program is executed from a guide module;
in the guide module, checking the integrity and the legality of the first bootloader module and the second bootloader module;
if the test is qualified, the test is successful, and if the test is not qualified, the test is failed;
s2, if the verification fails, executing a repair flow, if the verification is successful, jumping the program to the first bootloader module and executing an upgrade command;
s3, judging whether the first bootloader module is upgraded or not, if so, upgrading the first bootloader module;
and if the judgment result is negative, executing firmware upgrading or skipping the application program.
In the bootloader design method of the self-upgrading, if the first bootloader module judges whether to upgrade itself, the judging result is yes, at the moment, the second bootloader module is erased, and then parameters related to the second bootloader module in the bootloader configuration area are erased;
and then downloading and upgrading bootloader firmware, judging whether the downloading is completed or is wrong in real time, and checking the integrity and the legality of the first bootloader module and the second bootloader module.
In the bootloader design method of the self-upgrading, if the downloading of the firmware of the bootloader is wrong, the downloading is not completed or the integrity or the legality of the first bootloader module and the second bootloader module are not qualified, restarting immediately, re-entering the guide module and repairing the second bootloader module; otherwise, continuing to download until the downloading is completed.
In the bootloader design method of the self-upgrading of the invention, after the bootloader firmware is downloaded, firstly, the parameters related to the second bootloader module in the bootloader configuration area are updated, and then the second bootloader module firmware is copied into the first bootloader module.
In the bootloader design method of the self-upgrading method, parameters related to the first bootloader module in the bootloader configuration module are updated finally.
According to the self-upgrading bootloader device and the design method, the self-upgrading function of the bootloader module is achieved by adopting a combination mode of the guide module, the bootloader double module and the bootloader configuration module, meanwhile, when upgrading fails due to special conditions such as abnormal conditions and power failure in the upgrading process, or the bootloader module is damaged in the using process, the bootloader device can automatically repair and recover normal work, and safety and reliability in the program starting and upgrading process are ensured.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a schematic diagram of a self-elevating bootloader device and design method according to the present invention;
FIG. 2 is a self-upgrade flowchart of a bootloader module of a self-upgrade bootloader device and a design method according to the present invention;
FIG. 3 is a schematic diagram of a self-elevating bootloader device and a design method for the same, and a self-repairing process.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, a bootloader device with self-elevating stage includes: bootloader module, bootloader configuration module and guide module;
the bootloader module includes: the device comprises a first bootloader module and a second bootloader module, wherein the second bootloader module is a backup module of the first bootloader module;
the bootloader configuration module is used for storing parameter information of the bootloader module;
the boot module is used for checking the integrity and the legality of the bootloader module and repairing the bootloader module.
Further, bootloader refers to: an applet that runs before the operating system kernel runs. Through the applet, the hardware device can be initialized, and a mapping diagram of the memory space can be established, so that the software and hardware environment of the system is brought into a proper state, and the correct environment is prepared for finally calling the kernel of the operating system.
Still further, the function of the first bootloader module further includes: and receiving an upgrade command and judging whether to upgrade itself.
Further, the boot module, the first bootloader module and the second bootloader module are all independent executable firmware modules.
Further, the parameter information of the bootloader module includes: version information, program size, valid flags and check codes.
Further, the method also comprises the following functions: judging whether the downloading of the upgrading bootloader firmware is finished or not and whether the upgrading bootloader firmware is wrong or not, and sending a corresponding instruction according to a judging result.
As shown in FIG. 2, a bootloader design method for self-upgrading comprises the following steps;
s1, after the device is electrified or reset, a program is executed from a guide module;
in the guide module, checking the integrity and the legality of the first bootloader module and the second bootloader module;
if the test is qualified, the test is successful, and if the test is not qualified, the test is failed;
s2, if the verification fails, executing a repair flow, if the verification is successful, jumping the program to the first bootloader module and executing an upgrade command;
s3, judging whether the first bootloader module is upgraded or not, if so, upgrading the first bootloader module;
and if the judgment result is negative, executing firmware upgrading or skipping the application program.
Further, if the first bootloader module judges whether to upgrade itself, if yes, then the second bootloader module is erased, and then parameters related to the second bootloader module in the bootloader configuration area are erased;
and then downloading and upgrading bootloader firmware, judging whether the downloading is completed or is wrong in real time, and checking the integrity and the legality of the first bootloader module and the second bootloader module.
Further, if the downloading of the updated bootloader firmware is wrong, the downloading is not completed or the integrity or the legality of the first bootloader module and the second bootloader module are not qualified, restarting is performed immediately, and then the bootloader module is re-entered and the second bootloader module is repaired; otherwise, continuing to download until the downloading is completed.
Further, after the downloading of the updated bootloader firmware is completed, the parameters related to the second bootloader module in the bootloader configuration area are updated first, and then the firmware of the second bootloader module is copied into the first bootloader module.
Further, the parameters related to the first bootloader module in the bootloader configuration module are updated finally, and the whole autogenous stage process is completed.
Furthermore, it should be noted that, in the whole upgrading process, parameters of a complete bootloader module and its related bootloader configuration module are always maintained, so that an abnormal situation occurs in any link, and another damaged or destroyed bootloader module can be repaired based on the complete bootloader module, thereby ensuring safety and reliability of the whole upgrading process.
As shown in fig. 3, if the first bootloader module is damaged in the upgrade process, such as power is turned off halfway, when the configuration area is powered on again, the first bootloader module is damaged and the second bootloader module is normal can be judged by combining the parameters stored in the configuration area and the calculated verification parameters of the first bootloader module or the second bootloader module, at the same time, the firmware of the second bootloader module is copied into the first bootloader module, and meanwhile, the related parameters of the first bootloader module in the configuration area are modified to complete the repair of the damaged area.
The second bootloader module is assumed to be damaged in the upgrade process, and the same is true for the operation performed when the first bootloader module is assumed to be damaged in the upgrade process.
Furthermore, the boot loader module, the first bootloader module, the second bootloader module and the bootloader configuration module are combined to realize the self-upgrading function of the bootloader module, and meanwhile, when the upgrading failure is caused by special conditions such as abnormal conditions, power failure and the like in the upgrading process, or the bootloader module is damaged in the using process, the bootloader module can be automatically repaired and restored to normal work, so that the safe and reliable program starting and upgrading processes are ensured.
Further, a combination mode of a guide module, a first bootloader module, a second bootloader module and a bootloader configuration module is adopted to realize a safe self-elevating bootloader. The boot module, the first bootloader module and the second bootloader module are independently operable firmware areas, and the boot areas are used for verifying the integrity and the legality of the bootloader modules and repairing damaged modules; the second bootloader module is a backup module of the first bootloader module, and codes are identical; the bootloader configuration module is used for storing parameter information related to the first bootloader module and the second bootloader module.
The invention provides a bootloader device for self-upgrading and a design method thereof, which realize the self-upgrading function of a bootloader module by adopting a combination mode of a guide module, a bootloader double module and a bootloader configuration module, and simultaneously can automatically repair and restore normal work when the bootloader module is damaged in the upgrading process such as abnormal condition, power failure and other special conditions, or in the using process, thereby ensuring the safe and reliable program starting and upgrading process.
Although the present invention has been disclosed by the above embodiments, the scope of the present invention is not limited thereto, and modifications, substitutions, etc. made to the above components will fall within the scope of the claims of the present invention without departing from the spirit of the present invention.

Claims (2)

1. A bootloader device for self-elevating, comprising: bootloader module, bootloader configuration module and guide module;
the bootloader module includes: the device comprises a first bootloader module and a second bootloader module, wherein the second bootloader module is a backup module of the first bootloader module;
the bootloader configuration module is used for storing parameter information of the bootloader module;
the bootstrap module is used for checking the integrity and legitimacy of the bootloader module and repairing the bootloader module at the same time;
the function of the first bootloader module further comprises: receiving an upgrade command and judging whether to upgrade itself or not;
the guide module, the first bootloader module and the second bootloader module are all independent and operable firmware modules;
the parameter information of the bootloader module includes: version information, program size, valid flag and check code;
the method also comprises the following functions: judging whether the downloading of the updated bootloader firmware is finished or not and whether the updating is wrong or not, and sending a corresponding instruction according to a judging result;
the bootloader design method of the self-upgrading is that the bootloader device of the self-upgrading is used, comprising the following steps;
s1, after the device is electrified or reset, a program is executed from a guide module;
in the guide module, checking the integrity and the legality of the first bootloader module and the second bootloader module;
if the test is qualified, the test is successful, and if the test is not qualified, the test is failed;
s2, if the verification fails, executing a repair flow, if the verification is successful, jumping the program to the first bootloader module and executing an upgrade command;
s3, judging whether the first bootloader module is upgraded or not, if so, upgrading the first bootloader module;
if the judgment result is negative, executing firmware upgrading or skipping the application program;
if the first bootloader module judges whether to upgrade itself, the second bootloader module is erased at the moment, and then parameters related to the second bootloader module in the bootloader configuration area are erased;
then, downloading the updated bootloader firmware, judging whether the downloading is completed or is wrong in real time, and checking the integrity and the legality of the first bootloader module and the second bootloader module;
if the upgrade bootloader firmware is downloaded in error, not downloaded or the integrity or legitimacy of the first bootloader module and the second bootloader module is not qualified, restarting immediately, reentering the guide module and repairing the second bootloader module; otherwise, continuing to download until the downloading is completed;
after the downloading of the updated bootloader firmware is completed, firstly updating parameters related to the second bootloader module in the bootloader configuration area, and then copying the second bootloader module firmware into the first bootloader module.
2. The bootloader design method of claim 1, wherein the parameters associated with the first bootloader module in the bootloader configuration module are updated last.
CN202010060383.7A 2019-09-10 2020-01-19 Bootloader design method for self-upgrading Active CN111273928B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2019214991760 2019-09-10
CN201921499176 2019-09-10

Publications (2)

Publication Number Publication Date
CN111273928A CN111273928A (en) 2020-06-12
CN111273928B true CN111273928B (en) 2024-02-27

Family

ID=70998890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010060383.7A Active CN111273928B (en) 2019-09-10 2020-01-19 Bootloader design method for self-upgrading

Country Status (1)

Country Link
CN (1) CN111273928B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112379932B (en) * 2020-11-23 2023-05-23 歌尔科技有限公司 Boot method and device of electronic equipment and electronic equipment
CN112948183B (en) * 2021-03-30 2023-05-12 西安微电子技术研究所 Software and hardware combined embedded device and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693139A (en) * 2011-03-25 2012-09-26 比亚迪股份有限公司 Method and system for wirelessly upgrading mobile phone software
CN103995712A (en) * 2014-04-16 2014-08-20 潍柴动力股份有限公司 Boot loader device capable of updating automatically and updating method thereof
CN106406955A (en) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 A method and a device for upgrades of a bootloader program in an RSU apparatus
CN107608702A (en) * 2017-10-25 2018-01-19 迈普通信技术股份有限公司 Bootloader program modules update method and device
DE102017125172A1 (en) * 2017-10-26 2019-05-02 Schréder S.A. Method for updating a bootloader of a controller of a luminaire
CN109857426A (en) * 2018-12-27 2019-06-07 百度在线网络技术(北京)有限公司 Bootloader method for updating program, device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693139A (en) * 2011-03-25 2012-09-26 比亚迪股份有限公司 Method and system for wirelessly upgrading mobile phone software
CN103995712A (en) * 2014-04-16 2014-08-20 潍柴动力股份有限公司 Boot loader device capable of updating automatically and updating method thereof
CN106406955A (en) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 A method and a device for upgrades of a bootloader program in an RSU apparatus
CN107608702A (en) * 2017-10-25 2018-01-19 迈普通信技术股份有限公司 Bootloader program modules update method and device
DE102017125172A1 (en) * 2017-10-26 2019-05-02 Schréder S.A. Method for updating a bootloader of a controller of a luminaire
CN109857426A (en) * 2018-12-27 2019-06-07 百度在线网络技术(北京)有限公司 Bootloader method for updating program, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
嵌入式系统自更新机制的设计与应用;董维宁;《单片机与嵌入式系统应用》;20081231(第12期);63-65 *

Also Published As

Publication number Publication date
CN111273928A (en) 2020-06-12

Similar Documents

Publication Publication Date Title
GB2466685A (en) Fault tolerant updating of firmware
KR101515198B1 (en) Apparatus and method for firmware upgrade in mobile device
CN106775610B (en) Electronic equipment starting method and electronic equipment
CN109358887B (en) On-line upgrading method, device and system for single chip microcomputer program
CN105354063B (en) Program on-line upgrading method and system
CN109062598A (en) A kind of safe OTA upgrade method and system
CN111273928B (en) Bootloader design method for self-upgrading
US20170242685A1 (en) Updating of firmware
WO2020029967A1 (en) Method and apparatus for repairing fault in operating system
CN108345464A (en) A kind of the startup method and Android vehicle device of Android system
CN106775674B (en) Equipment based on universal boot loader and starting method thereof
CN114356361A (en) Embedded system and method for controlling nonvolatile memory
KR20080023841A (en) The method of firmware upgrade and automatic firmware recovery system
CN109634781A (en) One kind is based on embedded program two-region Backup Images system and starting method
WO2015184732A1 (en) Bootstrap storage method, bootstrap fault recovery method and device, and computer storage medium
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
CN113220319A (en) Data updating method and device and vehicle
CN116909611A (en) Electronic device firmware updating method, cleaning device and storage medium
CN111090443A (en) Method, equipment and storage medium for guaranteeing safe upgrade of linux system
CN106325912B (en) The starting method and device of embedded OS
US11768669B2 (en) Installing application program code on a vehicle control system
US9529581B2 (en) Circuit and method for writing program codes of basic input/output system
CN112395130A (en) System backup method and device
CN112596749A (en) Method and device for system power-on self-test and self-repair
CN112667444A (en) System upgrading method, storage medium and terminal equipment

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