WO2021012170A1 - Firmware booting method and device, and computer-readable storage medium - Google Patents

Firmware booting method and device, and computer-readable storage medium Download PDF

Info

Publication number
WO2021012170A1
WO2021012170A1 PCT/CN2019/097176 CN2019097176W WO2021012170A1 WO 2021012170 A1 WO2021012170 A1 WO 2021012170A1 CN 2019097176 W CN2019097176 W CN 2019097176W WO 2021012170 A1 WO2021012170 A1 WO 2021012170A1
Authority
WO
WIPO (PCT)
Prior art keywords
boot program
flag bit
boot
preset
currently started
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.)
Ceased
Application number
PCT/CN2019/097176
Other languages
French (fr)
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.)
SZ DJI Technology Co Ltd
Original Assignee
SZ DJI 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 SZ DJI Technology Co Ltd filed Critical SZ DJI Technology Co Ltd
Priority to PCT/CN2019/097176 priority Critical patent/WO2021012170A1/en
Priority to CN201980012440.XA priority patent/CN111742297A/en
Publication of WO2021012170A1 publication Critical patent/WO2021012170A1/en
Anticipated expiration legal-status Critical
Ceased 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

Definitions

  • the embodiments of the present invention relate to the field of drones, and in particular to a firmware startup method, equipment, and computer-readable storage medium.
  • the software adopts a startup scheme in which the main and backup versions are mutually backup.
  • the software version of a certain device includes bootloader and firmware.
  • the diskless boot ROM interface (bootrom) of the device's soc chip boots the boot program, and then the boot program boots the firmware.
  • the two software versions are boot program 1, boot program 2, and firmware 1, firmware 2.
  • the mark bits can be slot1 and slot2 respectively.
  • bootrom boots the boot program 1 and firmware 1.
  • the mark bit is slot2
  • bootrom boots the bootloader 2 and firmware 2.
  • the device After the device is restarted, it can be switched to slot2 and the slot1 version will remain unchanged.
  • the current booting is the slot2 version, then only the boot program 1 and firmware 1 are upgraded, and then the mark bit is changed to slot1.
  • boot program since the boot program does not judge the flag bit during the startup process, it may cause the boot program and the firmware version to not match, which may cause the risk of malfunction. Take the actual application as an example.
  • the mark bit recorded by the software in the flash is slot2
  • the bootrom of the chip soc does not judge the mark bit and directly verifies boot program 1. If boot program 1 is successfully checked and started, boot program 1 Start firmware 2 according to the flag slot2 in the flash. In this scenario, bootloader1 and firmware2 will be started together, resulting in a mismatch in the startup version, and there is a risk of abnormal device application functions.
  • the embodiments of the present invention provide a firmware startup method, device, and computer-readable storage medium to solve the technical problem that the startup loader does not match the firmware version in the prior art, which may cause the risk of abnormal functions.
  • the first aspect of the embodiments of the present invention is to provide a firmware startup method, including:
  • the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program
  • the boot program matches; wherein the flag bit corresponds to a preset firmware, which is used to enable the currently started boot program to boot the firmware.
  • the second aspect of the embodiments of the present invention is to provide a firmware startup device, including: a memory and a processor;
  • the memory is used to store program codes
  • the processor calls the program code, and when the program code is executed, is used to perform the following operations:
  • the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program
  • the boot program matches; wherein the flag bit corresponds to a preset firmware, which is used to enable the currently started boot program to boot the firmware.
  • the third aspect of the embodiments of the present invention is to provide a movable platform, including:
  • a power system is provided in the body, and the power system is used to provide power to the movable platform; and one or more processors, and the one or more processors are used to execute the first aspect method.
  • the fourth aspect of the embodiments of the present invention is to provide a computer-readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the method described in the first aspect.
  • the firmware startup method, device, and computer-readable storage medium provided in this embodiment determine the currently started boot program by verifying N preset boot programs, and set the current boot program to the current flag When it does not match, the current flag bit is switched or the currently started boot program is jumped, so as to ensure that the currently started boot program matches the version of the firmware, so that the device application function can run normally.
  • FIG. 1 is a schematic flowchart of a firmware startup method provided by Embodiment 1 of the present invention
  • Embodiment 2 is a schematic flowchart of a firmware startup method provided by Embodiment 2 of the present invention
  • Embodiment 3 is a schematic flowchart of a firmware startup method provided by Embodiment 3 of the present invention.
  • FIG. 4 is another schematic flowchart of the firmware startup method provided by the third embodiment of the present invention.
  • Embodiment 4 of the present invention is a schematic flowchart of a firmware startup method provided by Embodiment 4 of the present invention.
  • Embodiment 6 is a schematic structural diagram of a firmware startup device provided by Embodiment 5 of the present invention.
  • FIG. 7 is a schematic structural diagram of a movable platform provided by Embodiment 6 of the present invention.
  • a component when a component is said to be “fixed to” another component, it can be directly on the other component or a central component may also exist. When a component is considered to be “connected” to another component, it can be directly connected to another component or there may be a centered component at the same time.
  • the present invention provides a firmware boot method, device and computer-readable storage medium.
  • firmware startup method, device, and computer-readable storage medium provided by the present invention can be applied to any system in which the startup loader does not match the firmware version.
  • FIG. 1 is a schematic flowchart of a firmware startup method provided by Embodiment 1 of the present invention. As shown in FIG. 1, the method includes:
  • Step 101 Perform a check sequentially on N preset boot programs or check N-1 of the N preset boot programs sequentially, to obtain the boot program currently started among the N boot programs; where , N ⁇ 2;
  • Step 102 If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program so that the current flag bit Matches the boot program currently started.
  • the execution subject of this embodiment is the firmware startup device.
  • the embedded device is provided with a boot program and firmware.
  • the diskless boot ROM interface (bootrom) of the embedded device's soc chip boots the boot program, and then the boot program boots the firmware.
  • N preset boot programs and N firmware are set in the embedded device, where N ⁇ 2. Therefore, when the embedded device upgrades the software version, a boot program and the firmware corresponding to the boot program identifier can be started to upgrade the boot program and firmware that are not currently started.
  • the boot program since the boot program is in the process of booting the firmware, the boot program needs to send application data to the firmware. If the boot program does not match the firmware version, it will cause the risk of malfunction. Therefore, in order to solve the above problems, when the boot program is started, the N preset boot programs can be checked in turn or N-1 of the N preset boot programs may be checked in turn to obtain N all the boot programs. The boot program currently started in the boot program.
  • the N preset boot programs are sequentially verified or N-1 of the N preset boot programs are sequentially verified to obtain N
  • the boot program currently started in the boot program includes:
  • the boot program that is currently successfully verified is used as the currently started boot program, and the verification of the remaining boot programs is stopped.
  • the N boot programs have corresponding identifiers, and the N boot programs can be verified in the order of the identifiers, and the boot program that is successfully verified is used as the currently started boot program.
  • the N preset boot programs are sequentially set at different offset addresses on the flash, and the bootrom starts according to the sequence of the N boot programs on the flash. For example, when the first boot program on the flash is normal (that is, the verification is successful), the first boot program is started; when the first boot program on the flash is abnormal (that is, the verification is unsuccessful), the next boot program is started. A normal boot procedure.
  • the N preset boot programs are sequentially verified or N-1 of the N preset boot programs are sequentially verified to obtain N
  • the boot program currently started in the boot program includes:
  • the Nth boot program is used as the currently started boot program.
  • N-1 boot programs can also be verified.
  • the successfully verified boot program is taken as the currently started boot program.
  • the boot program if all N-1 boot programs are not successfully verified, it can be determined that the boot program currently started is the Nth boot program. Thus, the identification of the currently started boot program can be accurately determined.
  • a flag bit recorded in the preset storage path is checked to determine which software version to start. Therefore, after the currently started boot program is obtained, it can be determined whether the identifier of the currently started boot program matches the flag bit. If they match, the firmware corresponding to the flag bit can be directly started. At this time, the boot program and the firmware Version matches. Correspondingly, if the identifier of the currently started boot program does not match the flag bit, the current flag bit can be switched, and the flag bit can be switched to be consistent with the currently started boot program identifier, so that the currently started boot program and firmware Matches the version.
  • the currently started boot program can also be jumped, so that the currently started boot program identifier can match the flag bit, so that the currently started boot program The program matches the version of the firmware.
  • the firmware startup method provided in this embodiment determines the currently started boot program by verifying N preset boot programs, and when the currently started boot program does not match the current flag bit, the current flag Bit switch or jump to the currently started boot program, so as to ensure that the currently started boot program matches the version of the firmware, so that the device application function can run normally.
  • the method before the step of verifying the N preset boot programs in turn or the step of verifying N-1 of the N preset boot programs, the method further includes :
  • the N preset boot programs are obtained from the preset first storage path.
  • the N preset boot programs need to be acquired first.
  • the N preset boot programs can be obtained from the preset first storage path.
  • the first storage path may specifically be Flash.
  • the currently started boot program may be determined according to the N preset boot programs.
  • the N preset boot programs The set boot program is checked in turn or N-1 of the N preset boot programs are checked in turn, including:
  • the digital signature of the decrypted boot program is verified.
  • the boot program is generally encrypted. Therefore, in order to verify the boot program, it is first necessary to perform an encryption operation on the N preset boot programs or N-1 of the N preset boot programs to obtain the decrypted boot program.
  • the boot program generally includes a code part and a data part. Therefore, after obtaining the decrypted boot program, the digital signature of the data part in the decrypted boot program can be verified. If a certain boot program is damaged or faulty, the verification cannot be successful. Therefore, the boot program that is successfully verified can be used as the currently started boot program.
  • the firmware startup method provided in this embodiment encrypts the boot program and verifies the digital signature of the decrypted boot program, so as to accurately determine the boot program currently started.
  • FIG. 2 is a schematic flowchart of a firmware startup method provided in Embodiment 2 of the present invention. Based on any of the above embodiments, the method includes:
  • Step 201 Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs, to obtain the currently started boot program among the N boot programs; where , N ⁇ 2;
  • Step 102 specifically includes:
  • Step 202 If the identifier of the currently started boot program is greater than the current flag bit, switch the current flag bit.
  • the current flag bit if the current flag bit does not match the currently started boot program, the current flag bit can be switched, or the currently started boot program can be jumped. Specifically, the size relationship between the identifier of the currently started boot program and the current flag bit can be judged, and if the flag of the currently started boot program is greater than the current flag bit, the current flag bit can be switched.
  • the boot program since the boot program tries to start sequentially according to the logo of the boot program during the startup process, if the logo of the currently started boot program is 2, it can be determined that the boot program 1 is faulty and cannot be started. However, if the current boot flag is 1, the firmware started according to the boot flag should also be firmware 1. However, the boot program 1 fails and cannot be started, and there is a mismatch between the boot program and the firmware. To switch. Optionally, the flag bit can be switched to 2. At this time, the currently started boot program is boot program 2, the booted firmware is firmware 2, and the boot program matches the firmware version.
  • the switching the current flag bit includes:
  • the switch of the flag bit can be realized through the boot program.
  • the boot program can be controlled to switch the current flag bit to a flag bit matching the boot program identifier. For example, if the currently started boot program is boot program 3, the boot program can switch the flag bit to 3.
  • the boot program 3 can start the firmware 3 according to the flag bit, and the boot program matches the firmware version.
  • the firmware startup method provided in this implementation can switch the current flag bit when the logo of the currently started boot program is greater than the current flag bit, so as to ensure that the boot program matches the firmware version, thereby ensuring that the embedded system normal operation.
  • Figure 3 is a schematic flow diagram of the firmware startup method provided in the third embodiment of the present invention
  • Figure 4 is a schematic flow diagram of the firmware startup method provided by an embodiment of the present invention. Based on any of the above embodiments, as shown in Figures 3 to 4 As shown, the method includes:
  • Step 301 Perform verification on N preset boot programs in turn or verify N-1 of the N preset boot programs in turn, to obtain the currently started boot program among the N boot programs; where , N ⁇ 2;
  • Step 102 specifically includes:
  • Step 302 If the identifier of the currently started boot program is smaller than the current flag bit, jump to the currently started boot program.
  • the current flag bit if the current flag bit does not match the currently started boot program, the current flag bit can be switched, or the currently started boot program can be jumped. Specifically, the size relationship between the logo of the currently started boot program and the current flag bit can be judged. If the logo of the currently started boot program is smaller than the current flag bit, then the currently started boot program can be jumped. .
  • the boot program currently started can be jumped to the boot matching firmware 2.
  • Program 2 so that the boot program matches the firmware version.
  • the jump to the currently started boot program includes:
  • a jump flag bit can be written in the preset second storage path to realize the jump to the currently started boot program.
  • the second storage path may be Ram. Furthermore, it is possible to determine whether to jump to the boot program by detecting whether there is a jump flag in the Ram, which provides a basis for matching the version of the boot program with the firmware.
  • the firmware startup method provided in this embodiment jumps to the currently started boot program when the identifier of the currently started boot program is less than the current mark bit, so as to ensure that the boot program matches the firmware version, thereby enabling Ensure the normal operation of the embedded system.
  • the jump to the currently started boot program includes:
  • the boot program that matches the current mark bit is verified, and when the check succeeds, the currently started boot program is jumped to make the current mark bit match the currently started boot program.
  • the check operation on the remaining boot program may be stopped.
  • the firmware startup method provided in this embodiment can verify the boot program that matches the current flag bit when the identifier of the currently started boot program is smaller than the current flag bit, so that the currently started boot program can be checked.
  • the method further includes:
  • the boot program that matches the current flag bit is checked, and when the check is unsuccessful, the current flag bit is switched to make the current flag bit match the boot program currently started.
  • the boot program that matches the current flag bit is checked, and when the check is unsuccessful, the current flag bit is switched so that the current flag bit and the currently started The boot program matches.
  • the current flag bit is 4, when boot program 4 is not successfully verified, it indicates that other boot programs may malfunction and cannot start normally.
  • the boot program 2 and firmware 2 version match .
  • the firmware startup method provided in this embodiment checks the boot program that matches the current flag bit, and when the check is unsuccessful, switches the current flag bit so that the switched flag bit is the same as the current boot program match. Thereby it can be ensured that the boot program started is consistent with the firmware version.
  • the embedded system can be equipped with boot program 1, boot program 2, firmware 1, and firmware 2.
  • Bootrom starts the boot program, and the boot program boots the firmware.
  • Bootrom generally tries to start the boot program in sequence according to the boot program number.
  • the boot program 1 fails, you can continue to start the boot program 2.
  • the boot program may be read from the preset first storage path, and the boot program after the read may be verified.
  • the method includes:
  • Step 401 Start the bootrom
  • Step 402 bootrom starts the boot program
  • Step 403 Determine whether there is a jump flag bit in the preset second storage path, if it does not exist, jump to step 404, and if it exists, jump to step 411;
  • Step 404 Verify the boot program 1 to determine whether the verification is successful, if the verification is successful, skip to step 405; if the verification fails, skip to step 411;
  • Step 405 Determine that the currently started boot program is boot program 1;
  • Step 406 Determine whether the current flag bit is 1, if yes, skip to step 407, and if not, skip to step 408;
  • Step 407 Start the firmware 1 according to the current flag bit
  • Step 408 Set a jump flag bit in the preset second storage path
  • Step 409 Verify the boot program 2. If the verification is successful, skip to step 402, and if the verification is not successful, skip to step 410;
  • Step 410 The startup fails, the current flag bit is switched to 1, and the firmware 1 is started according to the current flag bit 1;
  • Step 411 Determine that the currently started boot program is boot program 2;
  • Step 412 Determine whether the current flag bit is 1; if yes, skip to step 413, if not, skip to step 415;
  • Step 413 Modify the current flag bit to 2;
  • Step 414 Start the firmware 2 according to the current flag bit
  • Step 415 Start the firmware 2 according to the current flag bit.
  • the boot program 1 can be read from the preset first storage path first, and the boot program 1 can be verified. If the verification is passed, it means that the boot program 1 is currently started. Determine the current flag bit. If it is detected that the current flag bit is 1, then firmware 1 can be booted by boot program 1. At this time, boot program 1 and firmware 1 version match. Correspondingly, if the current flag bit is 2, then the jump flag bit needs to be written in the preset second storage path, and boot program 2 is read and verified from the storage path of boot program 2. If If the verification is passed, the next time the power is turned on, before the boot program is verified, it can be determined whether there is a jump flag in the second storage path.
  • a jump flag is detected in the second storage path, you can Start the boot program 2 so that the boot program 2 can start the firmware 2 according to the current flag bit. At this time, the boot program 2 matches the firmware 2 version. If the boot program 2 fails the verification, the current flag bit can be modified to 1, so that the boot program 1 can start the firmware 1 according to the flag bit 1. At this time, the boot program 1 matches the firmware 1 version. In addition, the boot program 1 is read from the preset first storage path, and after the boot program 1 is verified, if the verification fails, the boot program 2 currently started is represented. Determine the current flag bit. If it is detected that the current flag bit is 1, the current flag bit needs to be modified.
  • the current flag bit can be modified by the boot program 1 to 2, so that the boot program 2 can start the firmware 2.
  • the bootloader 2 matches the firmware 2 version. If it is detected that the current flag bit is 2, the boot program 2 can start the firmware 2. At this time, the boot program 2 matches the firmware 2 version. Further, in order to avoid occupying too much storage space, after the jump is completed according to the jump mark bit, the jump mark bit written in the preset second storage path may be deleted.
  • FIG. 5 is a schematic flowchart of a firmware startup method provided by Embodiment 4 of the present invention. Based on any of the above embodiments, before step 101, it further includes:
  • Step 501 Determine whether the jump flag bit exists in the preset second storage path
  • Step 502 If not, verify the N preset boot programs in turn or verify N-1 of the N preset boot programs in turn.
  • whether to jump to the boot program is determined by detecting whether there is a jump flag bit in Ram. Specifically, before the boot program is verified, it can be determined whether there is a jump mark in the second storage path. If the bit does not exist, it means that the current boot program does not need to jump. At this time, the N preset boot programs can be checked in turn or N-1 of the N preset boot programs can be checked in turn. To obtain the currently started boot program.
  • the firmware startup method determines whether to jump to the boot program by detecting whether there is a jump flag bit in the Ram, so that the currently started boot program can be quickly determined, so that the boot program and the firmware version are the same. Match, and then can ensure the normal operation of the embedded system.
  • the N preset boot programs include a first boot program and a second boot program
  • the method also includes:
  • the number of boot programs may be two, specifically including a first boot program and a second boot program. Specifically, since the boot program is generally started from the first boot program, if it is detected that there is a jump flag bit in the second storage path, it can be directly determined according to the jump flag bit that the currently started boot program is the second boot program. Bootloader.
  • the firmware startup method provided in this embodiment determines that the currently started boot program is the second boot program when the jump flag bit exists in the second storage path, so that the currently started boot program can be quickly controlled.
  • the program is determined so that the boot program and the firmware version match, thereby ensuring the normal operation of the embedded system.
  • the identification of the boot program that needs to be jumped can also be marked in the jump mark bit; specifically, the switch mark It also includes the logo of the boot program after the jump;
  • the method also includes:
  • the currently started boot program is determined according to the identifier of the boot program after the jump.
  • the identification of the boot program after the jump in the jump mark bit can also be determined, and the startup corresponds to the identification of the boot program after the jump. Bootloader. Then the firmware version to be subsequently started can match the boot program.
  • boot program 3 when it is detected that there is a jump flag in the second storage path, it is determined that the logo of the boot program after the jump in the jump flag is boot program 3, and boot program 3 can be started at this time. Furthermore, the firmware activated according to the flag bit is also firmware 3 that matches the boot program 3.
  • the firmware startup method provided in this embodiment determines the currently started boot program according to the identifier of the boot program after the jump when the jump flag bit exists in the second storage path, so that Quickly determine the boot program currently started to match the version of the boot program with the firmware, thereby ensuring the normal operation of the embedded system.
  • the switching the current flag bit or jumping the currently started boot program includes:
  • the flag bit corresponds to a preset firmware
  • the method further includes:
  • the firmware corresponding to the flag bit is booted according to the flag bit.
  • the flag bit corresponds to the preset firmware, so that the currently started boot program can start the corresponding firmware according to the flag bit , And then the boot program matches the firmware version. For example, if the currently started boot program is boot program 2, and the current flag bit is firmware 2, then firmware 2 can be directly booted to start.
  • the firmware startup method when the current flag bit matches the currently started boot program, the firmware corresponding to the flag bit is booted according to the flag bit, thereby ensuring that the boot program and the firmware Match the version of the embedded system, and then the embedded system can run normally.
  • FIG. 6 is a schematic structural diagram of a firmware startup device provided by Embodiment 5 of the present invention. As shown in FIG. 5, the firmware startup device includes a memory 61 and a processor 62;
  • the memory 61 is used to store program codes
  • the processor 62 calls the program code, and when the program code is executed, is used to perform the following operations:
  • the processor sequentially checks N preset boot programs or checks N-1 of the N preset boot programs sequentially, When obtaining the currently started boot program among the N boot programs, it is used to:
  • the boot program that is currently successfully verified is used as the currently started boot program, and the verification of the remaining boot programs is stopped.
  • firmware startup device may be an embedded device.
  • the processor sequentially checks N preset boot programs or checks N-1 of the N preset boot programs sequentially, When obtaining the currently started boot program among the N boot programs, it is used to:
  • the Nth boot program is used as the currently started boot program.
  • the N preset boot programs are obtained from the preset first storage path.
  • the firmware startup device also includes FLASH, which is used to store the boot program.
  • the digital signature of the decrypted boot program is verified.
  • the processor when the processor switches the current flag bit or jumps the currently started boot program, it is configured to:
  • the current flag bit is switched.
  • the processor when the processor switches the current flag bit or jumps the currently started boot program, it is configured to:
  • the processor when the processor jumps the currently started boot program, it is configured to:
  • the boot program that matches the current mark bit is verified, and when the check succeeds, the currently started boot program is jumped to make the current mark bit match the currently started boot program.
  • the processor when the processor switches the current flag bit, it is configured to:
  • the processor when the processor jumps the currently started boot program, it is configured to:
  • the firmware startup device also includes RAM for storing the jump flag bit.
  • the N preset boot programs include a first boot program and a second boot program
  • the processor is also used for:
  • the switching mark includes an identification of the boot program after the jump
  • the processor is also used for:
  • the currently started boot program is determined according to the identifier of the boot program after the jump.
  • the processor when the processor switches the current flag bit or jumps the currently started boot program, it is configured to:
  • the flag bit corresponds to a preset firmware
  • the processor is further configured to:
  • the firmware corresponding to the flag bit is booted according to the flag bit.
  • FIG. 7 is a schematic structural diagram of a movable platform provided by Embodiment 6 of the present invention. As shown in FIG. 7, the movable platform 71 includes:
  • the power system 73 is provided in the body 72, and the power system 73 is used to provide power to the movable platform 71; and one or more processors 74, the one or more processors 74 are used to execute The method described in any of the above embodiments.
  • the movable platform also includes FLASH, which is used to store the boot program.
  • the mobile platform also includes RAM for storing jump flag bits.
  • Yet another embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method according to any of the foregoing embodiments.
  • this embodiment also provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method described in the above-mentioned embodiment.
  • the disclosed device and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.
  • the above-mentioned integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium.
  • the above-mentioned software functional unit is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor execute the method described in the various embodiments of the present invention. Part of the steps.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

Landscapes

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

Abstract

Provided are a firmware booting method and device, and a computer-readable storage medium. The method comprises: sequentially verifying N preset bootloaders or sequentially verifying N-1 of the N preset bootloaders to acquire the currently booted bootloader from among the N bootloaders, wherein N ≥ 2; and if the current flag bit does not match the currently booted bootloader, switching the current flag bit or skipping the currently booted bootloader, such that the current flag bit matches the currently booted bootloader. Therefore, it can be ensured that the currently booted bootloader matches the version of firmware, so that a device application function can operate normally.

Description

固件启动方法、设备及计算机可读存储介质Firmware startup method, equipment and computer readable storage medium 技术领域Technical field

本发明实施例涉及无人机领域,尤其涉及一种固件启动方法、设备及计算机可读存储介质。The embodiments of the present invention relate to the field of drones, and in particular to a firmware startup method, equipment, and computer-readable storage medium.

背景技术Background technique

一般嵌入式设备为了启动及升级安全,软件上都采用了主备版本互为备份的启动方案。例如,某设备的软件版本包含引导程序(bootloader)和固件(firmware)。启动过程中,设备soc芯片的无盘启动ROM接口(bootrom)引导引导程序,然后引导程序引导固件。For the safety of startup and upgrade of general embedded devices, the software adopts a startup scheme in which the main and backup versions are mutually backup. For example, the software version of a certain device includes bootloader and firmware. During the startup process, the diskless boot ROM interface (bootrom) of the device's soc chip boots the boot program, and then the boot program boots the firmware.

为了降低引导程序或者固件损坏导致设备无法正常启动的概率,存储flash中一般存储至少两套软件版本互为备份。以软件版本为两份举例来说,两套软件版本分别为引导程序1、引导程序2和固件1、固件2。一般启动过程中通过查询记录在flash中的一个标记位来决定启动哪套软件版本。标记位分别可以为slot1、slot2。当标记位为slot1时,bootrom引导引导程序1和固件1。当标记位为slot2时,bootrom引导引导程序2和固件2。一般嵌入式设备升级软件版本时,如果当前启动的是slot1版本,那么只升级引导程序2和固件2,然后标记位改为slot2,设备重新启动之后可以切换到slot2运行,slot1的版本不变。当前启动的是slot2版本,那么只升级引导程序1和固件1,然后标记位改为slot1,设备重新启动之后可以切换到slot1运行,slot2的版本不变。In order to reduce the probability that the boot program or firmware is damaged and the device cannot start normally, at least two software versions are generally stored in the storage flash as a backup of each other. Taking two software versions as an example, the two software versions are boot program 1, boot program 2, and firmware 1, firmware 2. In the general startup process, it is determined which software version to start by querying a mark bit recorded in the flash. The mark bits can be slot1 and slot2 respectively. When the mark bit is slot1, bootrom boots the boot program 1 and firmware 1. When the mark bit is slot2, bootrom boots the bootloader 2 and firmware 2. When upgrading the software version of a general embedded device, if the current booting is the slot1 version, only the boot program 2 and firmware 2 will be upgraded, and then the mark bit will be changed to slot2. After the device is restarted, it can be switched to slot2 and the slot1 version will remain unchanged. The current booting is the slot2 version, then only the boot program 1 and firmware 1 are upgraded, and then the mark bit is changed to slot1. After the device restarts, it can be switched to slot1 to run, and the version of slot2 remains unchanged.

但是,由于引导程序在启动过程中不会判断标记位,因此,可能会导致引导程序与固件版本不匹配,而会造成功能异常的风险。以实际应用举例来说,当软件记录在flash中的标记位为slot2时,芯片soc的bootrom不判断标记位,直接校验引导程序1,如果引导程序1校验成功并启动之后,引导程序1根据flash中的标记位slot2启动固件2。此种场景下会bootloader1和firmware2配合启动,导致启动版本不匹配,有设备应用功能异常的风险。However, since the boot program does not judge the flag bit during the startup process, it may cause the boot program and the firmware version to not match, which may cause the risk of malfunction. Take the actual application as an example. When the mark bit recorded by the software in the flash is slot2, the bootrom of the chip soc does not judge the mark bit and directly verifies boot program 1. If boot program 1 is successfully checked and started, boot program 1 Start firmware 2 according to the flag slot2 in the flash. In this scenario, bootloader1 and firmware2 will be started together, resulting in a mismatch in the startup version, and there is a risk of abnormal device application functions.

发明内容Summary of the invention

本发明实施例提供一种固件启动方法、设备及计算机可读存储介质,以解决现有技术中启动加载程序与固件版本不匹配,而会造成功能异常的风险的技术问题。The embodiments of the present invention provide a firmware startup method, device, and computer-readable storage medium to solve the technical problem that the startup loader does not match the firmware version in the prior art, which may cause the risk of abnormal functions.

本发明实施例的第一方面是提供一种固件启动方法,包括:The first aspect of the embodiments of the present invention is to provide a firmware startup method, including:

对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs, and obtain the boot program currently started among the N boot programs; where N≥ 2;

若当前的标记位和所述当前启动的引导程序不匹配时,对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配;其中,所述标记位与预设的固件相对应,其用于使得所述当前启动的引导程序能够引导所述固件。If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program The boot program matches; wherein the flag bit corresponds to a preset firmware, which is used to enable the currently started boot program to boot the firmware.

本发明实施例的第二方面是提供一种固件启动设备,包括:存储器和处理器;The second aspect of the embodiments of the present invention is to provide a firmware startup device, including: a memory and a processor;

所述存储器用于存储程序代码;The memory is used to store program codes;

所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:

对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs, and obtain the boot program currently started among the N boot programs; where N≥ 2;

若当前的标记位和所述当前启动的引导程序不匹配时,对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配;其中,所述标记位与预设的固件相对应,其用于使得所述当前启动的引导程序能够引导所述固件。If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program The boot program matches; wherein the flag bit corresponds to a preset firmware, which is used to enable the currently started boot program to boot the firmware.

本发明实施例的第三方面是提供一种可移动平台,包括:The third aspect of the embodiments of the present invention is to provide a movable platform, including:

机体;Body

动力系统,设于所述机体,所述动力系统用于为所述可移动平台提供动力;以及一个或多个处理器,所述一个或多个处理器,用于执行第一方面所述的方法。A power system is provided in the body, and the power system is used to provide power to the movable platform; and one or more processors, and the one or more processors are used to execute the first aspect method.

本发明实施例的第四方面是提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行以实现第一方面所述的方法。The fourth aspect of the embodiments of the present invention is to provide a computer-readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the method described in the first aspect.

本实施例提供的固件启动方法、设备及计算机可读存储介质,通过对N个预设的引导程序进行校验,确定当前启动的引导程序,并在该当前启动的引导程序与当前的标记位不匹配时,对当前的标记位进行切换或对当前启动的引导程序进行跳转,从而能够保证当前启动的引导程序与固件的版本相匹配,进而能够使设备应用功能正常运行。The firmware startup method, device, and computer-readable storage medium provided in this embodiment determine the currently started boot program by verifying N preset boot programs, and set the current boot program to the current flag When it does not match, the current flag bit is switched or the currently started boot program is jumped, so as to ensure that the currently started boot program matches the version of the firmware, so that the device application function can run normally.

附图说明Description of the drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present invention more clearly, the following will briefly introduce the drawings used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.

图1为本发明实施例一提供的固件启动方法的流程示意图;FIG. 1 is a schematic flowchart of a firmware startup method provided by Embodiment 1 of the present invention;

图2为本发明实施例二提供的固件启动方法的流程示意图;2 is a schematic flowchart of a firmware startup method provided by Embodiment 2 of the present invention;

图3为本发明实施例三提供的固件启动方法的流程示意图;3 is a schematic flowchart of a firmware startup method provided by Embodiment 3 of the present invention;

图4为本发明实施例三提供的固件启动方法的另一流程示意图;FIG. 4 is another schematic flowchart of the firmware startup method provided by the third embodiment of the present invention;

图5为本发明实施例四提供的固件启动方法的流程示意图;5 is a schematic flowchart of a firmware startup method provided by Embodiment 4 of the present invention;

图6为本发明实施例五提供的固件启动设备的结构示意图;6 is a schematic structural diagram of a firmware startup device provided by Embodiment 5 of the present invention;

图7为本发明实施例六提供的可移动平台的结构示意图。FIG. 7 is a schematic structural diagram of a movable platform provided by Embodiment 6 of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.

需要说明的是,当组件被称为“固定于”另一个组件,它可以直接在另一个组件上或者也可以存在居中的组件。当一个组件被认为是“连接”另一个组件,它可以是直接连接到另一个组件或者可能同时存在居中组件。It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or a central component may also exist. When a component is considered to be "connected" to another component, it can be directly connected to another component or there may be a centered component at the same time.

除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的 技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。本文所使用的术语“及/或”包括一个或多个相关的所列项目的任意的和所有的组合。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of the present invention. The terms used in the description of the present invention herein are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The term "and/or" as used herein includes any and all combinations of one or more related listed items.

下面结合附图,对本发明的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Hereinafter, some embodiments of the present invention will be described in detail with reference to the drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other.

针对上述提及的现有技术中启动加载程序与固件版本不匹配,而会造成功能异常的风险的技术问题,本发明提供了一种固件启动方法、设备及计算机可读存储介质。In view of the above-mentioned technical problem that the boot loader and the firmware version in the prior art do not match, which may cause the risk of functional abnormality, the present invention provides a firmware boot method, device and computer-readable storage medium.

需要说明的是,本发明提供的固件启动方法、设备及计算机可读存储介质能够应用在任意一种启动加载程序与固件版本不匹配的系统中。It should be noted that the firmware startup method, device, and computer-readable storage medium provided by the present invention can be applied to any system in which the startup loader does not match the firmware version.

图1为本发明实施例一提供的固件启动方法的流程示意图,如图1所示,所述方法包括:FIG. 1 is a schematic flowchart of a firmware startup method provided by Embodiment 1 of the present invention. As shown in FIG. 1, the method includes:

步骤101、对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Step 101: Perform a check sequentially on N preset boot programs or check N-1 of the N preset boot programs sequentially, to obtain the boot program currently started among the N boot programs; where , N≥2;

步骤102、若当前的标记位和所述当前启动的引导程序不匹配时,对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。Step 102: If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program so that the current flag bit Matches the boot program currently started.

本实施例的执行主体为固件启动设备。实际应用中,嵌入式设备中设置有引导程序以及固件,在启动过程中,嵌入式设备soc芯片的无盘启动ROM接口(bootrom)引导引导程序,然后引导程序引导固件。为了启动及升级安全,嵌入式设备中设置有N个预设的引导程序,以及N个固件,其中,N≥2。故而在嵌入式设备升级软件版本时,可以启动一个引导程序以及与该引导程序标识对应的固件,对当前未当前启动的引导程序以及固件进行升级。但是,由于引导程序在引导固件的过程中,引导程序需要向固件发送应用数据,若引导程序与固件版本不匹配,而会造成功能异常的风险。因此,为了解决上述问题,在引导程序启动时,可以对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序。The execution subject of this embodiment is the firmware startup device. In practical applications, the embedded device is provided with a boot program and firmware. During the startup process, the diskless boot ROM interface (bootrom) of the embedded device's soc chip boots the boot program, and then the boot program boots the firmware. In order to start and upgrade safety, N preset boot programs and N firmware are set in the embedded device, where N≥2. Therefore, when the embedded device upgrades the software version, a boot program and the firmware corresponding to the boot program identifier can be started to upgrade the boot program and firmware that are not currently started. However, since the boot program is in the process of booting the firmware, the boot program needs to send application data to the firmware. If the boot program does not match the firmware version, it will cause the risk of malfunction. Therefore, in order to solve the above problems, when the boot program is started, the N preset boot programs can be checked in turn or N-1 of the N preset boot programs may be checked in turn to obtain N all the boot programs. The boot program currently started in the boot program.

进一步地,在上述任一实施例的基础上,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序,包括:Further, on the basis of any of the foregoing embodiments, the N preset boot programs are sequentially verified or N-1 of the N preset boot programs are sequentially verified to obtain N The boot program currently started in the boot program includes:

当对任意一个引导程序校验成功时,以当前校验成功的引动程序作为所述当前启动的引导程序,并停止对剩余引导程序进行校验。When the verification of any boot program is successful, the boot program that is currently successfully verified is used as the currently started boot program, and the verification of the remaining boot programs is stopped.

在本实施例中,N个引导程序分别具有对应的标识,可以按照标识的顺序对N个引导程序进行验证,将验证成功的引导程序作为当前启动的引导程序。In this embodiment, the N boot programs have corresponding identifiers, and the N boot programs can be verified in the order of the identifiers, and the boot program that is successfully verified is used as the currently started boot program.

需要说明的是,N个预设的引导程序依次设在flash上不同的偏移地址处,bootrom按照N个引导程序在flash上的排列顺序进行启动。例如,当flash上第一个引导程序正常(即可以校验成功)时,则启动第一个引导程序;当flash上第一个引导程序不正常(即校验不成功)时,则启动下一个正常的引导程序。It should be noted that the N preset boot programs are sequentially set at different offset addresses on the flash, and the bootrom starts according to the sequence of the N boot programs on the flash. For example, when the first boot program on the flash is normal (that is, the verification is successful), the first boot program is started; when the first boot program on the flash is abnormal (that is, the verification is unsuccessful), the next boot program is started. A normal boot procedure.

进一步地,在上述任一实施例的基础上,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序,包括:Further, on the basis of any of the foregoing embodiments, the N preset boot programs are sequentially verified or N-1 of the N preset boot programs are sequentially verified to obtain N The boot program currently started in the boot program includes:

当第N-1个引导程序校验不成功时,以第N个引导程序作为所述当前启动的引导程序。When the N-1th boot program is not successfully checked, the Nth boot program is used as the currently started boot program.

在本实施例中,也可以对N-1个引导程序进行验证,在验证过程中,若N-1个引导程序中有存在验证成功的引导程序,则将验证成功的引导程序作为当前启动的引导程序,若N-1个引导程序均验证不成功,则可以判定当前启动的引导程序为第N个引导程序。从而能够精准地确定当前启动的引导程序的标识。In this embodiment, N-1 boot programs can also be verified. In the verification process, if there is a successfully verified boot program in the N-1 boot programs, the successfully verified boot program is taken as the currently started boot program. The boot program, if all N-1 boot programs are not successfully verified, it can be determined that the boot program currently started is the Nth boot program. Thus, the identification of the currently started boot program can be accurately determined.

进一步地,一般启动过程中通过查询记录在预设存储路径中的一个标记位来决定启动哪套软件版本。因此,在获取到当前启动的引导程序之后,可以确定当前启动的引导程序的标识与标记位是否匹配,若匹配,则可以直接对标记位对应的固件进行启动,此时,引导程序与固件的版本匹配。相应地,若当前启动的引导程序的标识与标记位不匹配时,则可以对当前的标记位进行切换,将标记位切换为与当前启动的引导程序标识一致,从而当前启动的引导程序与固件的版本相匹配。可选地,若当前启动的引导 程序的标识与标记位不匹配时,还可以对当前启动的引导程序进行跳转,从而当前启动的引导程序的标识能够与标记位相匹配,从而当前启动的引导程序与固件的版本相匹配。Further, during the general startup process, a flag bit recorded in the preset storage path is checked to determine which software version to start. Therefore, after the currently started boot program is obtained, it can be determined whether the identifier of the currently started boot program matches the flag bit. If they match, the firmware corresponding to the flag bit can be directly started. At this time, the boot program and the firmware Version matches. Correspondingly, if the identifier of the currently started boot program does not match the flag bit, the current flag bit can be switched, and the flag bit can be switched to be consistent with the currently started boot program identifier, so that the currently started boot program and firmware Matches the version. Optionally, if the identifier of the currently started boot program does not match the flag bit, the currently started boot program can also be jumped, so that the currently started boot program identifier can match the flag bit, so that the currently started boot program The program matches the version of the firmware.

本实施例提供的固件启动方法,通过对N个预设的引导程序进行校验,确定当前启动的引导程序,并在该当前启动的引导程序与当前的标记位不匹配时,对当前的标记位进行切换或对当前启动的引导程序进行跳转,从而能够保证当前启动的引导程序与固件的版本相匹配,进而能够使设备应用功能正常运行。The firmware startup method provided in this embodiment determines the currently started boot program by verifying N preset boot programs, and when the currently started boot program does not match the current flag bit, the current flag Bit switch or jump to the currently started boot program, so as to ensure that the currently started boot program matches the version of the firmware, so that the device application function can run normally.

进一步地,在上述任一实施例的基础上,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还包括:Further, on the basis of any one of the foregoing embodiments, before the step of verifying the N preset boot programs in turn or the step of verifying N-1 of the N preset boot programs, the method further includes :

从预设的第一存储路径获取所述N个预设的引导程序。The N preset boot programs are obtained from the preset first storage path.

在本实施例中,为了实现对N个预设的引导程序或N个预设的引导程序中的N-1个进行校验,首先需要获取该N个预设的引导程序。具体地,可以从预设的第一存储路径中获取该N个预设的引导程序。其中,该第一存储路径具体可以为Flash。In this embodiment, in order to verify the N preset boot programs or N−1 of the N preset boot programs, the N preset boot programs need to be acquired first. Specifically, the N preset boot programs can be obtained from the preset first storage path. Wherein, the first storage path may specifically be Flash.

进一步地,在获取到N个预设的引导程序之后,可以根据N个预设的引导程序确定当前启动的引导程序,具体地,在上述任一实施例的基础上,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,包括:Further, after obtaining the N preset boot programs, the currently started boot program may be determined according to the N preset boot programs. Specifically, on the basis of any of the foregoing embodiments, the N preset boot programs The set boot program is checked in turn or N-1 of the N preset boot programs are checked in turn, including:

对所述N个预设的引导程序进行解密操作或对N个预设的引导程序中的N-1个进行解密操作,获得解密后的引导程序;Performing a decryption operation on the N preset boot programs or performing a decryption operation on N-1 of the N preset boot programs to obtain the decrypted boot program;

对所述解密后的引导程序的数字签名进行验证。The digital signature of the decrypted boot program is verified.

在本实施例中,引导程序中一般都是经过加密的。因此,为了实现对引导程序的验证,首先需要对N个预设的引导程序或对N个预设的引导程序中的N-1个进行加密操作,获得解密后的引导程序。引导程序中一般包括代码部分以及数据部分,因此,获取解密后的引导程序之后,可以对解密后的引导程序中的数据部分的数字签名进行验证。若某一引导程序存在破损或故障,则无法验证成功,因此,可以将验证成功的引导程序作为当前启动的引导程序。In this embodiment, the boot program is generally encrypted. Therefore, in order to verify the boot program, it is first necessary to perform an encryption operation on the N preset boot programs or N-1 of the N preset boot programs to obtain the decrypted boot program. The boot program generally includes a code part and a data part. Therefore, after obtaining the decrypted boot program, the digital signature of the data part in the decrypted boot program can be verified. If a certain boot program is damaged or faulty, the verification cannot be successful. Therefore, the boot program that is successfully verified can be used as the currently started boot program.

本实施例提供的固件启动方法,通过对引导程序进行加密,并对解密后的引导程序的数字签名进行验证,从而能够精准地确定当前启动的引导程序。The firmware startup method provided in this embodiment encrypts the boot program and verifies the digital signature of the decrypted boot program, so as to accurately determine the boot program currently started.

图2为本发明实施例二提供的固件启动方法的流程示意图,在上述任一实施例的基础上,所述方法包括:FIG. 2 is a schematic flowchart of a firmware startup method provided in Embodiment 2 of the present invention. Based on any of the above embodiments, the method includes:

步骤201、对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Step 201: Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs, to obtain the currently started boot program among the N boot programs; where , N≥2;

步骤102具体包括:Step 102 specifically includes:

步骤202、若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换。Step 202: If the identifier of the currently started boot program is greater than the current flag bit, switch the current flag bit.

在本实施例中,若当前的标记位和当前启动的引导程序不匹配时,可以对当前的标记位进行切换,也可以对当前启动的引导程序进行跳转。具体地,可以判断当前启动的引导程序的标识与当前的标记位之间的大小关系,若当前启动的引导程序的标识大于当前的标记位,则可以对当前的标记位进行切换。In this embodiment, if the current flag bit does not match the currently started boot program, the current flag bit can be switched, or the currently started boot program can be jumped. Specifically, the size relationship between the identifier of the currently started boot program and the current flag bit can be judged, and if the flag of the currently started boot program is greater than the current flag bit, the current flag bit can be switched.

以实际应用举例来说,由于引导程序在启动过程中,都是按照引导程序的标识依次尝试启动的,若当前启动的引导程序的标识为2,则可以判定引导程序1出现故障,无法启动。但是若当前的启动标识位为1,则根据该启动标识位启动的固件也应该为固件1,但是,引导程序1出现故障,无法启动,引导程序与固件之间不匹配,此时需要对当前的标记位进行切换。可选地,可以将标记位切换为2,此时当前启动的引导程序为引导程序2,启动的固件为固件2,引导程序与固件的版本相匹配。Taking a practical application as an example, since the boot program tries to start sequentially according to the logo of the boot program during the startup process, if the logo of the currently started boot program is 2, it can be determined that the boot program 1 is faulty and cannot be started. However, if the current boot flag is 1, the firmware started according to the boot flag should also be firmware 1. However, the boot program 1 fails and cannot be started, and there is a mismatch between the boot program and the firmware. To switch. Optionally, the flag bit can be switched to 2. At this time, the currently started boot program is boot program 2, the booted firmware is firmware 2, and the boot program matches the firmware version.

进一步地,在上述任一实施例的基础上,所述对所述当前的标记位进行切换,包括:Further, on the basis of any of the foregoing embodiments, the switching the current flag bit includes:

控制所述引导程序将所述当前的标记位切换为与所述引导程序的标识匹配的标记位。Controlling the boot program to switch the current flag bit to a flag bit matching the logo of the boot program.

在本实施例中,可以通过引导程序实现对标记位的切换处。具体地,可以控制引导程序将当前的标记位切换至与引导程序标识相匹配的标记位。举例来说,若当前启动的引导程序为引导程序3,则此时引导程序可 以将标记位切换为3。进而在实际应用中,引导程序3可以根据该标记位对固件3进行启动,引导程序与固件的版本相匹配。In this embodiment, the switch of the flag bit can be realized through the boot program. Specifically, the boot program can be controlled to switch the current flag bit to a flag bit matching the boot program identifier. For example, if the currently started boot program is boot program 3, the boot program can switch the flag bit to 3. Furthermore, in practical applications, the boot program 3 can start the firmware 3 according to the flag bit, and the boot program matches the firmware version.

本实施提供的固件启动方法,通过在当前启动的引导程序的标识大于当前的标记位时,对当前的标记位进行切换,从而能够保证引导程序与固件的版本相匹配,进而能够保证嵌入式系统正常运行。The firmware startup method provided in this implementation can switch the current flag bit when the logo of the currently started boot program is greater than the current flag bit, so as to ensure that the boot program matches the firmware version, thereby ensuring that the embedded system normal operation.

图3为本发明实施例三提供的固件启动方法的流程示意图;图4为本发明实施例提供的固件启动方法的流程示意图,在上述任一实施例的基础上,如图3-图4所示,所述方法包括:Figure 3 is a schematic flow diagram of the firmware startup method provided in the third embodiment of the present invention; Figure 4 is a schematic flow diagram of the firmware startup method provided by an embodiment of the present invention. Based on any of the above embodiments, as shown in Figures 3 to 4 As shown, the method includes:

步骤301、对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Step 301: Perform verification on N preset boot programs in turn or verify N-1 of the N preset boot programs in turn, to obtain the currently started boot program among the N boot programs; where , N≥2;

步骤102具体包括:Step 102 specifically includes:

步骤302、若所述当前启动的引导程序的标识小于所述当前的标记位,则对所述当前启动的引导程序进行跳转。Step 302: If the identifier of the currently started boot program is smaller than the current flag bit, jump to the currently started boot program.

在本实施例中,若当前的标记位和当前启动的引导程序不匹配时,可以对当前的标记位进行切换,也可以对当前启动的引导程序进行跳转。具体地,可以判断当前启动的引导程序的标识与当前的标记位之间的大小关系,若当前启动的引导程序的标识小于当前的标记位,则可以对当前的当前启动的引导程序进行跳转。In this embodiment, if the current flag bit does not match the currently started boot program, the current flag bit can be switched, or the currently started boot program can be jumped. Specifically, the size relationship between the logo of the currently started boot program and the current flag bit can be judged. If the logo of the currently started boot program is smaller than the current flag bit, then the currently started boot program can be jumped. .

以实际应用举例来说,若当前启动的引导程序为引导程序1,但是当前的标记位为固件2,此时,可以对当前启动的引导程序进行跳转,跳转为与固件2匹配的引导程序2,从而引导程序与固件的版本相匹配。Take the actual application as an example, if the currently started boot program is boot program 1, but the current flag bit is firmware 2, at this time, the boot program currently started can be jumped to the boot matching firmware 2. Program 2, so that the boot program matches the firmware version.

进一步地,在上述任一实施例的基础上,所述对所述当前启动的引导程序进行跳转,包括:Further, on the basis of any of the foregoing embodiments, the jump to the currently started boot program includes:

在预设的第二存储路径中写入跳转标记位。Write the jump flag bit in the preset second storage path.

在本实施例中,可以在预设的第二存储路径中写入跳转标记位,实现对当前启动的引导程序的跳转。其中,该第二存储路径可以为Ram。进而可以通过检测Ram中是否存在跳转标记位来确定是否对引导程序的跳转,为引导程序与固件的版本相匹配提供了基础。In this embodiment, a jump flag bit can be written in the preset second storage path to realize the jump to the currently started boot program. Wherein, the second storage path may be Ram. Furthermore, it is possible to determine whether to jump to the boot program by detecting whether there is a jump flag in the Ram, which provides a basis for matching the version of the boot program with the firmware.

本实施例提供的固件启动方法,通过在当前启动的引导程序的标识小 于当前的标记位时,则对当前启动的引导程序进行跳转,从而能够保证引导程序与固件的版本相匹配,进而能够保证嵌入式系统正常运行。The firmware startup method provided in this embodiment jumps to the currently started boot program when the identifier of the currently started boot program is less than the current mark bit, so as to ensure that the boot program matches the firmware version, thereby enabling Ensure the normal operation of the embedded system.

进一步地,在上述任一实施例的基础上,所述对所述当前启动的引导程序进行跳转,包括:Further, on the basis of any of the foregoing embodiments, the jump to the currently started boot program includes:

对所述当前的标记位相匹配的引导程序进行校验,当校验成功时,对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current mark bit is verified, and when the check succeeds, the currently started boot program is jumped to make the current mark bit match the currently started boot program.

可选地,为了节约资源,完成当前校验成功的引导程序的跳转之后,可以停止对剩余引导程序的校验操作。Optionally, in order to save resources, after completing the jump of the boot program that is currently successfully checked, the check operation on the remaining boot program may be stopped.

本实施例提供的固件启动方法,通过在当前启动的引导程序的标识小于当前的标记位时,对所述当前的标记位相匹配的引导程序进行校验,,从而能够实现对当前启动的引导程序的跳转,进而能够使当前启动的引导程序与固件之间的版本相匹配,避免嵌入式系统运行出现故障。The firmware startup method provided in this embodiment can verify the boot program that matches the current flag bit when the identifier of the currently started boot program is smaller than the current flag bit, so that the currently started boot program can be checked. The jump to enable the currently started boot program to match the version of the firmware to avoid malfunctions of the embedded system.

进一步地,在上述任一实施例的基础上,所述方法还包括:Further, on the basis of any of the foregoing embodiments, the method further includes:

对所述当前的标记位相匹配的引导程序进行校验,当校验不成功时,对所述当前的标记位进行切换,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current flag bit is checked, and when the check is unsuccessful, the current flag bit is switched to make the current flag bit match the boot program currently started.

在本实施例中,对所述当前的标记位相匹配的引导程序进行校验,当校验不成功时,对所述当前的标记位进行切换,以使得所述当前的标记位和当前启动的引导程序匹配。以实际应用举例来说,若当前启动的引导程序为引导程序2,当前的标记位为4,对引导程序4进行校验不成功时,表征其他的引导程序可能发生故障,无法正常启动。此时,为了实现固件的正常启动,可以对当前的标记位进行切换,将当前的标记位切换为2,并根据该当前的标记位启动固件2,此时引导程序2以及固件2版本相匹配。In this embodiment, the boot program that matches the current flag bit is checked, and when the check is unsuccessful, the current flag bit is switched so that the current flag bit and the currently started The boot program matches. Taking a practical application as an example, if the currently started boot program is boot program 2, and the current flag bit is 4, when boot program 4 is not successfully verified, it indicates that other boot programs may malfunction and cannot start normally. At this point, in order to realize the normal startup of the firmware, you can switch the current flag bit, switch the current flag bit to 2, and start firmware 2 according to the current flag bit. At this time, the boot program 2 and firmware 2 version match .

本实施例提供的固件启动方法,对所述当前的标记位相匹配的引导程序进行校验,当校验不成功时,对当前的标记位进行切换,使得切换后的标记位与当前的引导程序匹配。从而能够保证启动的引导程序与固件版本一致。The firmware startup method provided in this embodiment checks the boot program that matches the current flag bit, and when the check is unsuccessful, switches the current flag bit so that the switched flag bit is the same as the current boot program match. Thereby it can be ensured that the boot program started is consistent with the firmware version.

以实际应用举例来说,嵌入式系统中可以设置有引导程序1、引导程 序2、固件1以及固件2。Bootrom启动引导程序,引导程序引导固件。Bootrom一般都是按照引导程序编号的顺序依次尝试启动引导程序,当引导程序1出现故障时,可以继续启动引导程序2。但是,当引导程序启动时,其并不知道自身的编号。因此,为了确定当前启动的引导程序的编号,可以从预设的第一存储路径中对引导程序进行读取,对读取后的引导程序进行验证。具体地,如图4所示,所述方法包括:Taking practical applications as an example, the embedded system can be equipped with boot program 1, boot program 2, firmware 1, and firmware 2. Bootrom starts the boot program, and the boot program boots the firmware. Bootrom generally tries to start the boot program in sequence according to the boot program number. When the boot program 1 fails, you can continue to start the boot program 2. However, when the boot program starts, it does not know its own number. Therefore, in order to determine the number of the boot program currently started, the boot program may be read from the preset first storage path, and the boot program after the read may be verified. Specifically, as shown in FIG. 4, the method includes:

步骤401、启动bootrom;Step 401: Start the bootrom;

步骤402、bootrom启动引导程序;Step 402, bootrom starts the boot program;

步骤403、确定预设的第二存储路径中是否存在跳转标记位,若不存在,则跳转执行步骤404,若存在,则跳转执行步骤411;Step 403: Determine whether there is a jump flag bit in the preset second storage path, if it does not exist, jump to step 404, and if it exists, jump to step 411;

步骤404、对引导程序1进行验证,确定是否能够验证成功,若验证成功,则跳转执行步骤405;若验证失败,则跳转执行步骤411;Step 404: Verify the boot program 1 to determine whether the verification is successful, if the verification is successful, skip to step 405; if the verification fails, skip to step 411;

步骤405、确定当前启动的引导程序为引导程序1;Step 405: Determine that the currently started boot program is boot program 1;

步骤406、确定当前的标记位是否为1,若是,则跳转执行步骤407,若否,则跳转执行步骤408;Step 406: Determine whether the current flag bit is 1, if yes, skip to step 407, and if not, skip to step 408;

步骤407、根据当前的标记位启动固件1;Step 407: Start the firmware 1 according to the current flag bit;

步骤408、在预设的第二存储路径中设置跳转标记位;Step 408: Set a jump flag bit in the preset second storage path;

步骤409、对引导程序2进行验证,若验证成功,则跳转执行步骤402,若未验证成功,则跳转执行步骤410;Step 409: Verify the boot program 2. If the verification is successful, skip to step 402, and if the verification is not successful, skip to step 410;

步骤410、启动失败,切换当前的标记位为1,并根据当前的标记位1启动固件1;Step 410: The startup fails, the current flag bit is switched to 1, and the firmware 1 is started according to the current flag bit 1;

步骤411、确定当前启动的引导程序为引导程序2;Step 411: Determine that the currently started boot program is boot program 2;

步骤412、确定当前的标记位是否为1;若是,则跳转执行步骤413,若否,则跳转执行步骤415;Step 412: Determine whether the current flag bit is 1; if yes, skip to step 413, if not, skip to step 415;

步骤413、将当前的标记位修改为2;Step 413: Modify the current flag bit to 2;

步骤414、根据当前的标记位启动固件2;Step 414: Start the firmware 2 according to the current flag bit;

步骤415、根据当前的标记位启动固件2。Step 415: Start the firmware 2 according to the current flag bit.

在本实施例中,首先可以从预设的第一存储路径中读取引导程序1,并对引导程序1进行验证,若验证通过,则表征当前启动的是引导程序1。确定当前的标记位,若检测到当前的标记位为1,则可以通过引导程序1 引导固件1,此时,引导程序1与固件1版本匹配。相应地,若当前的标记位为2,则此时需要预设的第二存储路径中写入跳转标记位,从引导程序2的存储路径中对引导程序2进行读取以及校验,若校验通过,则下一次上电时,在对引导程序进行校验之前,可以确定第二存储路径中是否存在跳转标记位,若检测到第二存储路径中存在跳转标记位时,可以启动引导程序2,从而引导程序2可以根据当前的标记位对固件2进行启动,此时,引导程序2与固件2版本匹配。若对引导程序2校验不通过,则可以将当前的标记位修改为1,从而引导程序1可以根据标记位1对固件1进行启动,此时,引导程序1与固件1版本匹配。此外,从预设的第一存储路径中读取引导程序1,并对引导程序1进行验证之后,若验证未通过,则表征当前启动的引导程序2。确定当前的标记位,若检测到当前的标记位为1,需要对当前的标记位进行修改,具体可以由引导程序1将当前的标记位修改为2,从而引导程序2可以启动固件2,此时,引导程序2与固件2版本匹配。若检测到当前的标记位为2,从而引导程序2可以启动固件2,此时,引导程序2与固件2版本匹配。进一步地,为了避免占用过多的存储空间,在根据跳转标记位完成跳转之后,可以对预设的第二存储路径中写入的跳转标记位进行删除。In this embodiment, the boot program 1 can be read from the preset first storage path first, and the boot program 1 can be verified. If the verification is passed, it means that the boot program 1 is currently started. Determine the current flag bit. If it is detected that the current flag bit is 1, then firmware 1 can be booted by boot program 1. At this time, boot program 1 and firmware 1 version match. Correspondingly, if the current flag bit is 2, then the jump flag bit needs to be written in the preset second storage path, and boot program 2 is read and verified from the storage path of boot program 2. If If the verification is passed, the next time the power is turned on, before the boot program is verified, it can be determined whether there is a jump flag in the second storage path. If a jump flag is detected in the second storage path, you can Start the boot program 2 so that the boot program 2 can start the firmware 2 according to the current flag bit. At this time, the boot program 2 matches the firmware 2 version. If the boot program 2 fails the verification, the current flag bit can be modified to 1, so that the boot program 1 can start the firmware 1 according to the flag bit 1. At this time, the boot program 1 matches the firmware 1 version. In addition, the boot program 1 is read from the preset first storage path, and after the boot program 1 is verified, if the verification fails, the boot program 2 currently started is represented. Determine the current flag bit. If it is detected that the current flag bit is 1, the current flag bit needs to be modified. Specifically, the current flag bit can be modified by the boot program 1 to 2, so that the boot program 2 can start the firmware 2. When the bootloader 2 matches the firmware 2 version. If it is detected that the current flag bit is 2, the boot program 2 can start the firmware 2. At this time, the boot program 2 matches the firmware 2 version. Further, in order to avoid occupying too much storage space, after the jump is completed according to the jump mark bit, the jump mark bit written in the preset second storage path may be deleted.

图5为本发明实施例四提供的固件启动方法的流程示意图,在上述任一实施例的基础上,步骤101之前,还包括:FIG. 5 is a schematic flowchart of a firmware startup method provided by Embodiment 4 of the present invention. Based on any of the above embodiments, before step 101, it further includes:

步骤501、确定预设的第二存储路径中是否存在所述跳转标记位;Step 501: Determine whether the jump flag bit exists in the preset second storage path;

步骤502、若否,则对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验。Step 502: If not, verify the N preset boot programs in turn or verify N-1 of the N preset boot programs in turn.

在本实施例中,通过检测Ram中是否存在跳转标记位来确定是否对引导程序的跳转,具体地,在对引导程序进行校验之前,可以确定第二存储路径中是否存在跳转标记位,若不存在,则表征当前引导程序无需进行跳转,此时,可以对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取当前启动的引导程序。In this embodiment, whether to jump to the boot program is determined by detecting whether there is a jump flag bit in Ram. Specifically, before the boot program is verified, it can be determined whether there is a jump mark in the second storage path. If the bit does not exist, it means that the current boot program does not need to jump. At this time, the N preset boot programs can be checked in turn or N-1 of the N preset boot programs can be checked in turn. To obtain the currently started boot program.

本实施例提供的固件启动方法,通过检测Ram中是否存在跳转标记位来确定是否对引导程序的跳转,从而能够快速地对当前启动的引导程序进行确定,使引导程序与固件的版本相匹配,进而能够保证嵌入式系统正常 运行。The firmware startup method provided in this embodiment determines whether to jump to the boot program by detecting whether there is a jump flag bit in the Ram, so that the currently started boot program can be quickly determined, so that the boot program and the firmware version are the same. Match, and then can ensure the normal operation of the embedded system.

进一步地,在上述任一实施例的基础上,当N=2,所述N个预设的引导程序包括第一引导程序和第二引导程序;Further, on the basis of any of the foregoing embodiments, when N=2, the N preset boot programs include a first boot program and a second boot program;

所述方法还包括:The method also includes:

当所述第二存储路径中存在所述跳转标记位时,确定所述当前启动的引导程序为第二引导程序。When the jump flag bit exists in the second storage path, it is determined that the currently started boot program is the second boot program.

在本实施例中,引导程序的数量可以为两个,具体包括第一引导程序以及第二引导程序。具体地,由于引导程序一般都是从第一引导程序开始启动,若检测到第二存储路径中存在跳转标记位时,则可以直接根据该跳转标记位确定当前启动的引导程序为第二引导程序。In this embodiment, the number of boot programs may be two, specifically including a first boot program and a second boot program. Specifically, since the boot program is generally started from the first boot program, if it is detected that there is a jump flag bit in the second storage path, it can be directly determined according to the jump flag bit that the currently started boot program is the second boot program. Bootloader.

本实施例提供的固件启动方法,通过当所述第二存储路径中存在所述跳转标记位时,确定所述当前启动的引导程序为第二引导程序,从而能够快速地对当前启动的引导程序进行确定,使引导程序与固件的版本相匹配,进而能够保证嵌入式系统正常运行。The firmware startup method provided in this embodiment determines that the currently started boot program is the second boot program when the jump flag bit exists in the second storage path, so that the currently started boot program can be quickly controlled. The program is determined so that the boot program and the firmware version match, thereby ensuring the normal operation of the embedded system.

进一步地,在上述任一实施例的基础上,在写入跳转标记位的过程中,还可以在跳转标记位中标记需要跳转后的引导程序的标识;具体地,所述切换标记为中还包括跳转后的引导程序的标识;Further, on the basis of any of the foregoing embodiments, in the process of writing the jump mark bit, the identification of the boot program that needs to be jumped can also be marked in the jump mark bit; specifically, the switch mark It also includes the logo of the boot program after the jump;

所述方法还包括:The method also includes:

当所述第二存储路径中存在所述跳转标记位时,根据所述跳转后的引导程序的标识,确定所述当前启动的引导程序。When the jump flag bit exists in the second storage path, the currently started boot program is determined according to the identifier of the boot program after the jump.

在本实施例中,当检测到第二存储路径中存在跳转标记位时,还可以确定跳转标记位中跳转后的引导程序的标识,并启动与跳转后的引导程序的标识对应的引导程序。进而后续启动的固件版本能够与该引导程序相匹配。In this embodiment, when it is detected that there is a jump mark bit in the second storage path, the identification of the boot program after the jump in the jump mark bit can also be determined, and the startup corresponds to the identification of the boot program after the jump. Bootloader. Then the firmware version to be subsequently started can match the boot program.

以实际应用举例来说,当检测到第二存储路径中存在跳转标记位时,确定该跳转标记位中跳转后的引导程序的标识为引导程序3,此时可以启动引导程序3,进而根据标记位启动的固件也为与引导程序3匹配的固件3。Taking a practical application as an example, when it is detected that there is a jump flag in the second storage path, it is determined that the logo of the boot program after the jump in the jump flag is boot program 3, and boot program 3 can be started at this time. Furthermore, the firmware activated according to the flag bit is also firmware 3 that matches the boot program 3.

本实施例提供的固件启动方法,通过当所述第二存储路径中存在所述跳转标记位时,根据所述跳转后的引导程序的标识,确定所述当前启动的 引导程序,从而能够快速地对当前启动的引导程序进行确定,使引导程序与固件的版本相匹配,进而能够保证嵌入式系统正常运行。The firmware startup method provided in this embodiment determines the currently started boot program according to the identifier of the boot program after the jump when the jump flag bit exists in the second storage path, so that Quickly determine the boot program currently started to match the version of the boot program with the firmware, thereby ensuring the normal operation of the embedded system.

进一步地,在上述任一实施例的基础上,所述对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,包括:Further, on the basis of any of the foregoing embodiments, the switching the current flag bit or jumping the currently started boot program includes:

若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换,并清除所述跳转标记位。If the identifier of the currently started boot program is greater than the current flag bit, then switch the current flag bit and clear the jump flag bit.

在本实施例中,若检测到当前启动的引导程序的标识大于当前的标记位,则可能为其他的引导程序发生故障,无法启动,此时,为了保证引导程序与固件的版本相匹配,需要对当前的标记位进行切换。对标记位进行切换之后,还可以对当前的跳转标记位进行清除。从而能够在保证引导程序与固件的版本相匹配的基础上,避免存储空间的占用。In this embodiment, if it is detected that the logo of the currently started boot program is greater than the current flag bit, it may be that other boot programs have failed and cannot be started. At this time, in order to ensure that the boot program matches the firmware version, it is required Switch the current mark bit. After switching the mark bit, you can also clear the current jump mark bit. Therefore, it is possible to avoid the occupation of storage space on the basis of ensuring that the boot program and the firmware version match.

进一步地,在上述任一实施例的基础上,所述标记位与预设的固件相对应,所述方法还包括:Further, on the basis of any of the foregoing embodiments, the flag bit corresponds to a preset firmware, and the method further includes:

若当前的标记位和所述当前启动的引导程序匹配时,则根据所述标记位,引导与所述标记位对应的固件。If the current flag bit matches the currently started boot program, the firmware corresponding to the flag bit is booted according to the flag bit.

在本实施例中,若检测到当前标记位与当前启动的引导程序匹配时,其中,标记位与预设的固件相对应,从而当前启动的引导程序能够根据该标记位对对应的固件进行启动,进而引导程序与固件的版本相匹配。举例来说,若当前启动的引导程序为引导程序2,当前的标记位为固件2,此时可以直接引导固件2启动。In this embodiment, if it is detected that the current flag bit matches the currently started boot program, the flag bit corresponds to the preset firmware, so that the currently started boot program can start the corresponding firmware according to the flag bit , And then the boot program matches the firmware version. For example, if the currently started boot program is boot program 2, and the current flag bit is firmware 2, then firmware 2 can be directly booted to start.

本实施例提供的固件启动方法,通过在当前的标记位和所述当前启动的引导程序匹配时,则根据所述标记位,引导与所述标记位对应的固件,从而能够保证引导程序与固件的版本相匹配,进而嵌入式系统能够正常运行。In the firmware startup method provided by this embodiment, when the current flag bit matches the currently started boot program, the firmware corresponding to the flag bit is booted according to the flag bit, thereby ensuring that the boot program and the firmware Match the version of the embedded system, and then the embedded system can run normally.

图6为本发明实施例五提供的固件启动设备的结构示意图,如图5所示,所述固件启动设备包括:存储器61和处理器62;FIG. 6 is a schematic structural diagram of a firmware startup device provided by Embodiment 5 of the present invention. As shown in FIG. 5, the firmware startup device includes a memory 61 and a processor 62;

所述存储器61用于存储程序代码;The memory 61 is used to store program codes;

所述处理器62,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor 62 calls the program code, and when the program code is executed, is used to perform the following operations:

对N个预设的引导程序依次进行校验或对N个预设的引导程序中的 N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs to obtain the boot program currently started among the N boot programs; where N≥ 2;

若当前的标记位和所述当前启动的引导程序不匹配时,对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program The boot program matches.

进一步地,在上述任一实施例的基础上,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序时,用于:Further, on the basis of any one of the foregoing embodiments, the processor sequentially checks N preset boot programs or checks N-1 of the N preset boot programs sequentially, When obtaining the currently started boot program among the N boot programs, it is used to:

当对任意一个引导程序校验成功时,以当前校验成功的引动程序作为所述当前启动的引导程序,并停止对剩余引导程序进行校验。When the verification of any boot program is successful, the boot program that is currently successfully verified is used as the currently started boot program, and the verification of the remaining boot programs is stopped.

需要说明的是,所述固件启动设备可以为嵌入式设备。It should be noted that the firmware startup device may be an embedded device.

进一步地,在上述任一实施例的基础上,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序时,用于:Further, on the basis of any one of the foregoing embodiments, the processor sequentially checks N preset boot programs or checks N-1 of the N preset boot programs sequentially, When obtaining the currently started boot program among the N boot programs, it is used to:

当第N-1个引导程序校验不成功时,以第N个引导程序作为所述当前启动的引导程序。When the N-1th boot program is not successfully checked, the Nth boot program is used as the currently started boot program.

进一步地,在上述任一实施例的基础上,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还用于:Further, on the basis of any of the foregoing embodiments, before the processor sequentially verifies the N preset boot programs or sequentially verifies N-1 of the N preset boot programs , Also used for:

从预设的第一存储路径获取所述N个预设的引导程序。The N preset boot programs are obtained from the preset first storage path.

所述固件启动设备还包括FLASH,用于存储所述引导程序。The firmware startup device also includes FLASH, which is used to store the boot program.

进一步地,在上述任一实施例的基础上,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验时,用于:Further, on the basis of any of the foregoing embodiments, when the processor sequentially verifies N preset boot programs or sequentially verifies N-1 of the N preset boot programs For:

对所述N个预设的引导程序进行解密操作或对N个预设的引导程序中的N-1个进行解密操作,获得解密后的引导程序;Performing a decryption operation on the N preset boot programs or performing a decryption operation on N-1 of the N preset boot programs to obtain the decrypted boot program;

对所述解密后的引导程序的数字签名进行验证。The digital signature of the decrypted boot program is verified.

进一步地,在上述任一实施例的基础上,所述处理器在对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转时,用于:Further, on the basis of any of the foregoing embodiments, when the processor switches the current flag bit or jumps the currently started boot program, it is configured to:

若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述 当前的标记位进行切换。If the identifier of the currently started boot program is greater than the current flag bit, then the current flag bit is switched.

进一步地,在上述任一实施例的基础上,所述处理器在对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转时,用于:Further, on the basis of any of the foregoing embodiments, when the processor switches the current flag bit or jumps the currently started boot program, it is configured to:

若所述当前启动的引导程序的标识小于所述当前的标记位,则对所述当前启动的引导程序进行跳转。If the identifier of the currently started boot program is smaller than the current mark bit, then jump to the currently started boot program.

进一步地,在上述任一实施例的基础上,所述处理器在对所述当前启动的引导程序进行跳转时,用于:Further, on the basis of any of the foregoing embodiments, when the processor jumps the currently started boot program, it is configured to:

对所述当前的标记位相匹配的引导程序进行校验,当校验成功时,对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current mark bit is verified, and when the check succeeds, the currently started boot program is jumped to make the current mark bit match the currently started boot program.

进一步地,在上述任一实施例的基础上,所述处理器在对所述当前的标记位进行切换时,用于:Further, on the basis of any of the foregoing embodiments, when the processor switches the current flag bit, it is configured to:

控制所述引导程序将所述当前的标记位切换为与所述引导程序的标识匹配的标记位。Controlling the boot program to switch the current flag bit to a flag bit matching the logo of the boot program.

进一步地,在上述任一实施例的基础上,所述处理器在对所述当前启动的引导程序进行跳转时,用于:Further, on the basis of any of the foregoing embodiments, when the processor jumps the currently started boot program, it is configured to:

在预设的第二存储路径中写入跳转标记位。Write the jump flag bit in the preset second storage path.

所述固件启动设备还包括RAM,用于存储所述跳转标记位。The firmware startup device also includes RAM for storing the jump flag bit.

进一步地,在上述任一实施例的基础上,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还用于:Further, on the basis of any of the foregoing embodiments, before the processor sequentially verifies the N preset boot programs or sequentially verifies N-1 of the N preset boot programs , Also used for:

确定预设的第二存储路径中是否存在所述跳转标记位;Determining whether the jump flag bit exists in the preset second storage path;

若否,则对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验。If not, then check the N preset boot programs in turn or check N-1 of the N preset boot programs in turn.

进一步地,在上述任一实施例的基础上,当N=2,所述N个预设的引导程序包括第一引导程序和第二引导程序;Further, on the basis of any of the foregoing embodiments, when N=2, the N preset boot programs include a first boot program and a second boot program;

所述处理器还用于:The processor is also used for:

当所述第二存储路径中存在所述跳转标记位时,确定所述当前启动的引导程序为第二引导程序。When the jump flag bit exists in the second storage path, it is determined that the currently started boot program is the second boot program.

进一步地,在上述任一实施例的基础上,所述切换标记为中还包括跳 转后的引导程序的标识;Further, on the basis of any of the foregoing embodiments, the switching mark includes an identification of the boot program after the jump;

所述处理器还用于:The processor is also used for:

当所述第二存储路径中存在所述跳转标记位时,根据所述跳转后的引导程序的标识,确定所述当前启动的引导程序。When the jump flag bit exists in the second storage path, the currently started boot program is determined according to the identifier of the boot program after the jump.

进一步地,在上述任一实施例的基础上,所述处理器在对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转时,用于:Further, on the basis of any of the foregoing embodiments, when the processor switches the current flag bit or jumps the currently started boot program, it is configured to:

若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换,并清除所述跳转标记位。If the identifier of the currently started boot program is greater than the current flag bit, then switch the current flag bit and clear the jump flag bit.

进一步地,在上述任一实施例的基础上,所述标记位与预设的固件相对应,,所述处理器还用于:Further, on the basis of any of the foregoing embodiments, the flag bit corresponds to a preset firmware, and the processor is further configured to:

若当前的标记位和所述当前启动的引导程序匹配时,则根据所述标记位,引导与所述标记位对应的固件。If the current flag bit matches the currently started boot program, the firmware corresponding to the flag bit is booted according to the flag bit.

图7为本发明实施例六提供的可移动平台的结构示意图,如图7所示,所述可移动平台71包括:FIG. 7 is a schematic structural diagram of a movable platform provided by Embodiment 6 of the present invention. As shown in FIG. 7, the movable platform 71 includes:

机体72;Body 72;

动力系统73,设于所述机体72,所述动力系统73用于为所述可移动平台71提供动力;以及一个或多个处理器74,所述一个或多个处理器74,用于执行上述任一实施例所述的方法。The power system 73 is provided in the body 72, and the power system 73 is used to provide power to the movable platform 71; and one or more processors 74, the one or more processors 74 are used to execute The method described in any of the above embodiments.

所述可移动平台还包括FLASH,用于存储引导程序。The movable platform also includes FLASH, which is used to store the boot program.

所述可移动平台还包括RAM,用于存储跳转标记位。The mobile platform also includes RAM for storing jump flag bits.

本发明又一实施例还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行以实现如上述任一实施例所述的方法。Yet another embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method according to any of the foregoing embodiments.

另外,本实施例还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行以实现上述实施例所述的…方法。In addition, this embodiment also provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to implement the method described in the above-mentioned embodiment.

在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之 间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed device and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.

上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor execute the method described in the various embodiments of the present invention. Part of the steps. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

本领域技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, only the division of the above-mentioned functional modules is used as an example. In practical applications, the above-mentioned functions can be allocated by different functional modules as required, namely, the device The internal structure is divided into different functional modules to complete all or part of the functions described above. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not repeated here.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: It is still possible to modify the technical solutions described in the foregoing embodiments, or equivalently replace some or all of the technical features; these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention range.

Claims (34)

一种固件启动方法,其特征在于,包括:A method for starting firmware, characterized in that it comprises: 对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs, and obtain the boot program currently started among the N boot programs; where N≥ 2; 若当前的标记位和所述当前启动的引导程序不匹配时,对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program The boot program matches. 根据权利要求1所述的方法,其特征在于,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序包括:The method according to claim 1, wherein the N preset boot programs are checked sequentially or N-1 of the N preset boot programs are checked sequentially to obtain N The boot program currently started in the boot program includes: 当对任意一个引导程序校验成功时,以当前校验成功的引动程序作为所述当前启动的引导程序,并停止对剩余引导程序进行校验。When the verification of any boot program is successful, the boot program that is currently successfully verified is used as the currently started boot program, and the verification of the remaining boot programs is stopped. 根据权利要求1所述的方法,其特征在于,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序,包括:The method according to claim 1, wherein the N preset boot programs are checked sequentially or N-1 of the N preset boot programs are checked sequentially to obtain N The boot program currently started in the boot program includes: 当第N-1个引导程序校验不成功时,以第N个引导程序作为所述当前启动的引导程序。When the N-1th boot program is not successfully checked, the Nth boot program is used as the currently started boot program. 根据权利要求1所述的方法,其特征在于,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还包括:The method according to claim 1, characterized in that, before sequentially verifying the N preset boot programs or sequentially verifying N-1 of the N preset boot programs, the method further comprises : 从预设的第一存储路径获取所述N个预设的引导程序。The N preset boot programs are obtained from the preset first storage path. 根据权利要求1所述的方法,其特征在于,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,包括:The method according to claim 1, wherein the sequentially verifying the N preset boot programs or sequentially verifying N-1 of the N preset boot programs comprises: 对所述N个预设的引导程序进行解密操作或对N个预设的引导程序中的N-1个进行解密操作,获得解密后的引导程序;Performing a decryption operation on the N preset boot programs or performing a decryption operation on N-1 of the N preset boot programs to obtain the decrypted boot program; 对所述解密后的引导程序的数字签名进行验证。The digital signature of the decrypted boot program is verified. 根据权利要求1-5任一项所述的方法,其特征在于,所述对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,包括:The method according to any one of claims 1 to 5, wherein the switching the current flag bit or jumping the currently started boot program comprises: 若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换。If the identifier of the currently started boot program is greater than the current flag bit, the current flag bit is switched. 根据权利要求1-5任一项所述的方法,其特征在于,所述对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,包括:The method according to any one of claims 1 to 5, wherein the switching the current flag bit or jumping the currently started boot program comprises: 若所述当前启动的引导程序的标识小于所述当前的标记位,则对所述当前启动的引导程序进行跳转。If the identifier of the currently started boot program is smaller than the current mark bit, then jump to the currently started boot program. 根据权利要求7所述的方法,其特征在于,所述对所述当前启动的引导程序进行跳转,包括:8. The method according to claim 7, wherein the jump to the currently started boot program comprises: 对所述当前的标记位相匹配的引导程序进行校验,当校验成功时,对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current mark bit is verified, and when the check succeeds, the currently started boot program is jumped to make the current mark bit match the currently started boot program. 根据权利要求8所述的方法,其特征在于,所述对所述当前的标记位进行切换还包括:The method according to claim 8, wherein said switching the current flag bit further comprises: 对所述当前的标记位相匹配的引导程序进行校验,当校验不成功时,对所述当前的标记位进行切换,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current flag bit is checked, and when the check is unsuccessful, the current flag bit is switched to make the current flag bit match the boot program currently started. 根据权利要求6所述的方法,其特征在于,所述对所述当前的标记位进行切换,包括:The method according to claim 6, wherein said switching the current flag bit comprises: 控制所述引导程序将所述当前的标记位切换为与所述引导程序的标识匹配的标记位。Controlling the boot program to switch the current flag bit to a flag bit matching the logo of the boot program. 根据权利要求7所述的方法,其特征在于,所述对所述当前启动的引导程序进行跳转,包括:8. The method according to claim 7, wherein the jump to the currently started boot program comprises: 在预设的第二存储路径中写入跳转标记位。Write the jump flag bit in the preset second storage path. 根据权利要求11所述的方法,其特征在于,所述对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还包括:The method according to claim 11, characterized in that, before sequentially verifying the N preset boot programs or sequentially verifying N-1 of the N preset boot programs, the method further comprises : 确定预设的第二存储路径中是否存在所述跳转标记位;Determining whether the jump flag bit exists in the preset second storage path; 若否,则对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验。If not, then check the N preset boot programs in turn or check N-1 of the N preset boot programs in turn. 根据权利要求12所述的方法,其特征在于,当N=2,所述N个预 设的引导程序包括第一引导程序和第二引导程序;The method according to claim 12, wherein when N=2, the N preset boot programs include a first boot program and a second boot program; 所述方法还包括:The method also includes: 当所述第二存储路径中存在所述跳转标记位时,确定所述当前启动的引导程序为第二引导程序。When the jump flag bit exists in the second storage path, it is determined that the currently started boot program is the second boot program. 根据权利要求12所述的方法,其特征在于,所述切换标记为中还包括跳转后的引导程序的标识;The method according to claim 12, wherein the switch mark further includes an identification of the boot program after the jump; 所述方法还包括:The method also includes: 当所述第二存储路径中存在所述跳转标记位时,根据所述跳转后的引导程序的标识,确定所述当前启动的引导程序。When the jump flag bit exists in the second storage path, the currently started boot program is determined according to the identifier of the boot program after the jump. 根据权利要求14所述的方法,其特征在于,所述对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,包括:The method according to claim 14, wherein the switching the current flag bit or jumping the currently started boot program comprises: 若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换,并清除所述跳转标记位。If the identifier of the currently started boot program is greater than the current flag bit, then switch the current flag bit and clear the jump flag bit. 根据权利要求1-5、8-15任一项所述的方法,其特征在于,所述标记位与预设的固件相对应,所述方法还包括:The method according to any one of claims 1-5 and 8-15, wherein the flag bit corresponds to a preset firmware, and the method further comprises: 若当前的标记位和所述当前启动的引导程序匹配时,则根据所述标记位,引导与所述标记位对应的固件。If the current flag bit matches the currently started boot program, the firmware corresponding to the flag bit is booted according to the flag bit. 一种固件启动设备,其特征在于,包括:存储器和处理器;A firmware startup device, which is characterized by comprising: a memory and a processor; 所述存储器用于存储程序代码;The memory is used to store program codes; 所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations: 对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序;其中,N≥2;Perform verification sequentially on N preset boot programs or sequentially verify N-1 of the N preset boot programs, and obtain the boot program currently started among the N boot programs; where N≥ 2; 若当前的标记位和所述当前启动的引导程序不匹配时,对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。If the current flag bit does not match the currently started boot program, switch the current flag bit or jump to the currently started boot program, so that the current flag bit and the currently started boot program The boot program matches. 根据权利要求17所述的设备,其特征在于,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序时,用于:The device according to claim 17, wherein the processor is sequentially verifying N preset boot programs or sequentially verifying N-1 of the N preset boot programs, When obtaining the currently started boot program among the N boot programs, it is used to: 当对任意一个引导程序校验成功时,以当前校验成功的引动程序作为所述当前启动的引导程序,并停止对剩余引导程序进行校验。When the verification of any boot program is successful, the boot program that is currently successfully verified is used as the currently started boot program, and the verification of the remaining boot programs is stopped. 根据权利要求17所述的设备,其特征在于,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验,获取N个所述引导程序中当前启动的引导程序时,用于:The device according to claim 17, wherein the processor is sequentially verifying N preset boot programs or sequentially verifying N-1 of the N preset boot programs, When obtaining the currently started boot program among the N boot programs, it is used to: 当第N-1个引导程序校验不成功时,以第N个引导程序作为所述当前启动的引导程序。When the N-1th boot program is not successfully checked, the Nth boot program is used as the currently started boot program. 根据权利要求17所述的设备,其特征在于,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还用于:The device according to claim 17, characterized in that, before the processor sequentially checks the N preset boot programs or checks N-1 of the N preset boot programs sequentially , Also used for: 从预设的第一存储路径获取所述N个预设的引导程序。The N preset boot programs are obtained from the preset first storage path. 根据权利要求17所述的设备,其特征在于,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验时,用于:The device according to claim 17, characterized in that, when the processor sequentially checks N preset boot programs or sequentially checks N-1 of the N preset boot programs For: 对所述N个预设的引导程序进行解密操作或对N个预设的引导程序中的N-1个进行解密操作,获得解密后的引导程序;Performing a decryption operation on the N preset boot programs or performing a decryption operation on N-1 of the N preset boot programs to obtain the decrypted boot program; 对所述解密后的引导程序的数字签名进行验证。The digital signature of the decrypted boot program is verified. 根据权利要求17-21任一项所述的设备,其特征在于,所述处理器在对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转时,用于:The device according to any one of claims 17-21, wherein the processor is configured to: when switching the current flag bit or jumping to the currently started boot program: 若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换。If the identifier of the currently started boot program is greater than the current flag bit, the current flag bit is switched. 根据权利要求17-21任一项所述的设备,其特征在于,所述处理器在对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转时,用于:The device according to any one of claims 17-21, wherein the processor is configured to: when switching the current flag bit or jumping to the currently started boot program: 若所述当前启动的引导程序的标识小于所述当前的标记位,则对所述当前启动的引导程序进行跳转。If the identifier of the currently started boot program is smaller than the current mark bit, then jump to the currently started boot program. 根据权利要求23所述的设备,其特征在于,所述处理器在对所述当前启动的引导程序进行跳转时,用于:The device according to claim 23, wherein the processor is configured to: when jumping to the currently started boot program: 对所述当前的标记位相匹配的引导程序进行校验,当校验成功时,对 所述当前启动的引导程序进行跳转,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current mark bit is checked, and when the check succeeds, the currently started boot program is jumped to make the current mark bit match the currently started boot program. 根据权利要求24所述的设备,其特征在于,所述处理器在对所述当前的标记位进行切换时,用于:The device according to claim 24, wherein the processor is configured to: when switching the current flag bit: 对所述当前的标记位相匹配的引导程序进行校验,当校验不成功时,对所述当前的标记位进行切换,以使得所述当前的标记位和当前启动的引导程序匹配。The boot program that matches the current flag bit is checked, and when the check is unsuccessful, the current flag bit is switched to make the current flag bit match the boot program currently started. 根据权利要求23所述的设备,其特征在于,所述处理器在对所述当前的标记位进行切换时,用于:22. The device according to claim 23, wherein the processor is configured to: when switching the current flag bit: 控制所述引导程序将所述当前的标记位切换为与所述引导程序的标识匹配的标记位。Controlling the boot program to switch the current flag bit to a flag bit matching the logo of the boot program. 根据权利要求23所述的设备,其特征在于,所述处理器在对所述当前启动的引导程序进行跳转时,用于:The device according to claim 23, wherein the processor is configured to: when jumping to the currently started boot program: 在预设的第二存储路径中写入跳转标记位。Write the jump flag bit in the preset second storage path. 根据权利要求27所述的设备,其特征在于,所述处理器在对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验之前,还用于:The device according to claim 27, characterized in that, before the processor sequentially verifies the N preset boot programs or sequentially verifies N-1 of the N preset boot programs , Also used for: 确定预设的第二存储路径中是否存在所述跳转标记位;Determining whether the jump flag bit exists in the preset second storage path; 若否,则对N个预设的引导程序依次进行校验或对N个预设的引导程序中的N-1个依次进行校验。If not, then check the N preset boot programs in turn or check N-1 of the N preset boot programs in turn. 根据权利要求28所述的设备,其特征在于,当N=2,所述N个预设的引导程序包括第一引导程序和第二引导程序;The device according to claim 28, wherein when N=2, the N preset boot programs include a first boot program and a second boot program; 所述处理器还用于:The processor is also used for: 当所述第二存储路径中存在所述跳转标记位时,确定所述当前启动的引导程序为第二引导程序。When the jump flag bit exists in the second storage path, it is determined that the currently started boot program is the second boot program. 根据权利要求28所述的设备,其特征在于,所述切换标记为中还包括跳转后的引导程序的标识;The device according to claim 28, wherein the switch mark further includes an identifier of the boot program after the jump; 所述处理器还用于:The processor is also used for: 当所述第二存储路径中存在所述跳转标记位时,根据所述跳转后的引导程序的标识,确定所述当前启动的引导程序。When the jump flag bit exists in the second storage path, the currently started boot program is determined according to the identifier of the boot program after the jump. 根据权利要求30所述的设备,其特征在于,所述处理器在对所述当前的标记位进行切换或对所述当前启动的引导程序进行跳转时,用于:The device according to claim 30, wherein the processor is configured to: when switching the current flag bit or jumping to the currently started boot program: 若所述当前启动的引导程序的标识大于所述当前的标记位,则对所述当前的标记位进行切换,并清除所述跳转标记位。If the identifier of the currently started boot program is greater than the current flag bit, then switch the current flag bit and clear the jump flag bit. 根据权利要求17-21、24-31任一项所述的设备,其特征在于,所述标记位与预设的固件相对应,所述处理器还用于:The device according to any one of claims 17-21 and 24-31, wherein the flag bit corresponds to a preset firmware, and the processor is further configured to: 若当前的标记位和所述当前启动的引导程序匹配时,则根据所述标记位,引导与所述标记位对应的固件。If the current flag bit matches the currently started boot program, the firmware corresponding to the flag bit is booted according to the flag bit. 一种可移动平台,其特征在于,包括:A movable platform, characterized in that it comprises: 机体;Body 动力系统,设于所述机体,所述动力系统用于为所述可移动平台提供动力;以及一个或多个处理器,所述一个或多个处理器,用于执行上述权利要求1-16任一项所述的方法。A power system, which is provided in the body, and the power system is used to provide power to the movable platform; and one or more processors, and the one or more processors are used to execute claims 1-16 Any of the methods described. 一种计算机可读存储介质,其特征在于,其上存储有计算机程序,所述计算机程序被处理器执行以实现如权利要求1-16任一项所述的方法。A computer-readable storage medium, characterized in that a computer program is stored thereon, and the computer program is executed by a processor to implement the method according to any one of claims 1-16.
PCT/CN2019/097176 2019-07-23 2019-07-23 Firmware booting method and device, and computer-readable storage medium Ceased WO2021012170A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/097176 WO2021012170A1 (en) 2019-07-23 2019-07-23 Firmware booting method and device, and computer-readable storage medium
CN201980012440.XA CN111742297A (en) 2019-07-23 2019-07-23 Firmware booting method, device and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/097176 WO2021012170A1 (en) 2019-07-23 2019-07-23 Firmware booting method and device, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2021012170A1 true WO2021012170A1 (en) 2021-01-28

Family

ID=72646090

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/097176 Ceased WO2021012170A1 (en) 2019-07-23 2019-07-23 Firmware booting method and device, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN111742297A (en)
WO (1) WO2021012170A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112632562B (en) * 2020-12-28 2024-01-26 四川虹微技术有限公司 Device startup method, device management method and embedded device
CN114064143A (en) * 2021-11-08 2022-02-18 宁波波导软件有限公司 Compatible processing method of multi-chip software
CN118885225B (en) * 2024-07-05 2025-11-11 武汉精立电子技术有限公司 Program jump method and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102135927A (en) * 2011-04-29 2011-07-27 杭州华三通信技术有限公司 Method and device for system booting based on NAND FLASH
US20150169310A1 (en) * 2013-12-12 2015-06-18 Lenovo (Singapore) Pte, Ltd. Maintaining firmware
CN106227568A (en) * 2012-11-09 2016-12-14 青岛海信移动通信技术股份有限公司 Terminal unit start, upgrade method and equipment
CN106372538A (en) * 2016-08-30 2017-02-01 苏州国芯科技有限公司 Firmware protection method based on SoC (System on Chip)
CN106383692A (en) * 2016-08-25 2017-02-08 中山市天启智能科技有限公司 A kind of single-chip microcomputer embedded device OTA upgrade method

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100472442C (en) * 2006-03-02 2009-03-25 中兴通讯股份有限公司 A device and method for online upgrade of firmware program
CN101770383B (en) * 2010-01-22 2014-04-09 中兴通讯股份有限公司 Method and device for on-line upgrade of cross-platform version
CN103514399A (en) * 2012-06-19 2014-01-15 鸿富锦精密工业(深圳)有限公司 Firmware verification method and system
CN104166561B (en) * 2014-07-25 2017-11-07 深圳市大迈科技有限公司 Electronic equipment system starting method and electronic equipment
EP2993578A1 (en) * 2014-09-02 2016-03-09 Gemalto M2M GmbH Method for adapting firmware of a wireless communication device
CN104699500B (en) * 2015-01-06 2018-05-08 上海华测导航技术股份有限公司 The method that bootstrap upgrades automatically is realized in smart machine
CN104834542B (en) * 2015-04-20 2017-12-22 成都亿盟恒信科技有限公司 A kind of startup method based on embedded type Linux equipment dual system
CN109086086B (en) * 2018-08-06 2021-06-08 深圳忆联信息系统有限公司 Starting method and device of non-space-sharing multi-core CPU
CN109358910A (en) * 2018-09-05 2019-02-19 广州小鹏汽车科技有限公司 Firmware writing and starting method and system for realizing firmware writing and starting

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102135927A (en) * 2011-04-29 2011-07-27 杭州华三通信技术有限公司 Method and device for system booting based on NAND FLASH
CN106227568A (en) * 2012-11-09 2016-12-14 青岛海信移动通信技术股份有限公司 Terminal unit start, upgrade method and equipment
US20150169310A1 (en) * 2013-12-12 2015-06-18 Lenovo (Singapore) Pte, Ltd. Maintaining firmware
CN106383692A (en) * 2016-08-25 2017-02-08 中山市天启智能科技有限公司 A kind of single-chip microcomputer embedded device OTA upgrade method
CN106372538A (en) * 2016-08-30 2017-02-01 苏州国芯科技有限公司 Firmware protection method based on SoC (System on Chip)

Also Published As

Publication number Publication date
CN111742297A (en) 2020-10-02

Similar Documents

Publication Publication Date Title
US9471435B2 (en) Information processing device, information processing method, and computer program
CN105094927B (en) Equipment firmware upgrading method and device
US9507604B2 (en) Boot method and boot system
CN109032846A (en) Equipment remote backup upgrade method, device, computer storage medium and equipment
US20110283274A1 (en) Firmware image update and management
US20200394144A1 (en) Information processing system, information processing device, bios updating method for information processing device, and bios updating program for information processing device
US20100058314A1 (en) Computer System and Related Method of Logging BIOS Update Operation
CN106775610B (en) Electronic equipment starting method and electronic equipment
US10437580B2 (en) Software updating methods and systems
CN109542518A (en) The method of chip and bootrom
US20080270782A1 (en) Boot process
TW201706837A (en) A computer system
CN110874467B (en) Information processing method, device, system, processor, and storage medium
WO2018024198A1 (en) Application upgrade method and system for set-top box, and set-top box
US20170115982A1 (en) Multi-system terminal system updating method, updating device and terminal
WO2016206514A1 (en) Startup processing method and device
WO2021012170A1 (en) Firmware booting method and device, and computer-readable storage medium
CN106897166B (en) A kind of mobile terminal and its repairing method
WO2015154538A1 (en) Memory booting method and device
CN102880478B (en) Software update method
US20130080751A1 (en) Method and device for updating bios program for computer system
CN117130672A (en) Server startup process control method, system, terminal and storage medium
CN115827046A (en) Method and device for realizing OTA (over the air) upgrade of SPL (shortest Path first) partition, terminal equipment and chip
WO2015184732A1 (en) Bootstrap storage method, bootstrap fault recovery method and device, and computer storage medium
CN120179321B (en) Firmware loading method, device, electronic device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19938158

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19938158

Country of ref document: EP

Kind code of ref document: A1