Starting method and device of embedded equipment and storage medium

By performing hardware initialization and firmware header traversal before the embedded device starts, the configuration information of the system startup firmware is determined, which solves the problem of insufficient reliability and security of embedded device startup and achieves a more reliable and secure system startup.

CN120670038APending Publication Date: 2025-09-19SHENZHEN PANGO MICROSYST CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510556588.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

The existing startup method of embedded devices is too simple, resulting in insufficient reliability and security of the device startup guided by the Boot ROM code.

Method used

The embedded device performs hardware initialization before startup and traverses the external storage device to see if there is a valid firmware header, determines the startup configuration information of the system startup firmware, including extended startup firmware information, secure startup information, startup partition information, firmware execution mode, log level information, register configuration, etc., and then starts the system startup firmware according to the configuration information.

Benefits of technology

Improves the reliability and security of the boot program in guiding the system startup. By setting configuration information, the risk of system startup failure is reduced, and the success rate and security of system startup are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670038A_ABST
    Figure CN120670038A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a starting method and device of embedded equipment and a storage medium. The method comprises the following steps: initializing hardware required for starting the embedded equipment; traversing whether an effective firmware head exists in the external storage device or not; under the condition that the effective firmware header is traversed, starting configuration information of system starting firmware corresponding to the effective firmware header is determined, and the starting configuration information comprises at least one of extended starting firmware information, safe starting information, starting partition information, firmware execution mode information, firmware index information, log level information and register configuration information; and starting and operating the system startup firmware based on the startup configuration information of the system startup firmware. According to the technical scheme provided by the embodiment of the invention, the starting reliability and safety of the bootstrap program booting system can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of embedded devices, and more specifically, to a startup method, device, and storage medium for an embedded device. Background Art

[0002] After the system is powered on or reset, the embedded device first executes the Boot ROM (Boot Read-Only Memory) code, which is the lowest and most basic link in the boot chain.

[0003] In related technologies, after the Boot ROM is executed, it first initializes the hardware required for device startup, detects the current boot device (storage medium, such as flash memory), finds valid system startup firmware from the boot device based on keywords or identifiers, performs integrity check on the system startup firmware, and then loads and runs it.

[0004] The boot method provided by the related technology is too simple, resulting in insufficient reliability and security of booting the device using the Boot ROM code. Summary of the Invention

[0005] An embodiment of the present application provides a startup method, apparatus, and storage medium for an embedded device.

[0006] In a first aspect, an embodiment of the present application provides a method for starting an embedded device, which is applied to the embedded device, and the method includes: initializing the hardware required for starting the embedded device; traversing whether there is a valid firmware header in the external storage device; when a valid firmware header is traversed, determining the startup configuration information of the system startup firmware corresponding to the valid firmware header, the startup configuration information including at least one of the following: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, and register configuration information; based on the startup configuration information of the system startup firmware, starting the running system startup firmware.

[0007] In the first aspect, an embodiment of the present application provides a startup device for an embedded device, the device including: an initialization module for initializing the hardware required for starting the embedded device; a firmware header traversal module for traversing whether there is a valid firmware header in an external storage device; a configuration information determination module for determining the startup configuration information of the system startup firmware corresponding to the valid firmware header when a valid firmware header is traversed, the startup configuration information including at least one of the following: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, register configuration information; a firmware startup module for starting the running system startup firmware based on the startup configuration information of the system startup firmware.

[0008] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer program instructions are stored. The computer program instructions can be called by a processor to execute the method of the first aspect.

[0009] In a fourth aspect, an embodiment of the present application provides a computer program product, which, when executed, is used to implement the method of the first aspect.

[0010] Compared with the solutions existing in the related technologies, the technical solution provided by the embodiment of the present application is that the embedded device first initializes the hardware required for its own startup, and then after traversing the valid firmware header, first determines the startup configuration information of the system startup firmware to be started, so as to configure the system startup firmware to be started, whether the system startup firmware needs to be decrypted, whether the extended startup firmware needs to be started, the partition where the system startup firmware starts to run, the system startup firmware starts to run in a 32-bit operating system or a 64-bit operating system, the log information to be recorded during the process of starting and running the system startup firmware, the register configuration during the process of starting and running the system startup firmware, etc., and then starts and runs the system startup firmware according to the above startup configuration information, which can improve the reliability and security of the boot program guiding the system startup. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0012] Figure 1 This is a structural block diagram of an embedded device provided by an embodiment of the present application.

[0013] Figure 2 This is a flowchart of a method for starting an embedded device provided by an embodiment of the present application.

[0014] Figure 3 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0015] Figure 4 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0016] Figure 5 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0017] Figure 6 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0018] Figure 7 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0019] Figure 8 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0020] Figure 9 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0021] Figure 10 This is a flowchart of a method for starting an embedded device provided by another embodiment of the present application.

[0022] Figure 11 This is a block diagram of a startup device for an embedded device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0023] The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application and are not to be construed as limiting the present application.

[0024] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.

[0025] First, the technical terms involved in the embodiments of the present application are introduced.

[0026] Boot ROM: The first code executed by an embedded device when it is powered on or reset, responsible for initializing the hardware, loading firmware data, and the security verification process for the firmware data. Refer to Table 1 below, which shows the data format of the Boot ROM shown in one embodiment of the present application. The Boot ROM includes header information (BootHeader), primary partition information (PrimaryBootzone), secondary partition information (RecoveryBootzone), n system startup firmware in the primary partition, and n system startup firmware in the secondary partition.

[0027] BootHeader PrimaryBootzone RecoveryBootzone System startup firmware 1 (Primary) System boot firmware 2 (Primary) …… System startup firmware n (Primary) System startup firmware 1 (Recovery) System boot firmware 2 (Recovery) …… System boot firmware n (Recovery)

[0028] Table-1

[0029] Boot Header: This header describes the configuration and startup parameters of an embedded device during the boot process. It contains a series of important fields to ensure that the embedded device can correctly load and execute the firmware. Table 2 below shows the various parameters included in the Boot Header, their offsets, default values, and related descriptions. The parameter offset refers to the starting position of the parameter in the Boot Header.

[0030]

[0031] Table-2

[0032] Boot zone information: This contains the minimum level of software and configuration required to start an embedded device, ensuring that the device can correctly load the operating system and other necessary components. Table 2 below shows the various areas within the Boot zone, their parameters, their offsets, default values, and descriptions.

[0033]

[0034]

[0035] Table-3

[0036] Please refer to Figure 1 , which shows a structural diagram of an embedded device 10 provided in one embodiment of the present application. The embedded device 10 includes a processor 110, a bus 120, a read-only memory 130, a random access memory 140, a security module 150, and a memory interface controller 160.

[0037] The processor 110 is connected to the read-only memory 130 , the random access memory 140 , the security module 150 , and the memory interface controller 160 through the bus 120 .

[0038] The read-only memory 130 is used to store sensitive data in the embedded device 10, such as BootROM code.

[0039] The random access memory 140 is used to store firmware data. After the embedded device 10 is powered on and started, the firmware data is loaded into the random access memory 140 for execution.

[0040] Security module 150 is used to perform security verification processes, including signature authentication, firmware decryption, and firmware verification. The signature authentication process involves calculating signature information based on the signature algorithm type, public key information, and data output from partition information. The firmware decryption process involves decrypting the system boot firmware based on the firmware encryption algorithm type and the system boot firmware output. The firmware verification process involves calculating verification data based on the firmware verification algorithm type and the system boot firmware output.

[0041] The memory interface controller 160 is connected to an external storage device, which may include an embedded MultiMedia Card (eMMC), a non-volatile memory (NAND) flash memory chip, a non-volatile memory (NOR) read-only memory, a secure digital (SD) card, and the like.

[0042] Please refer to Figure 2 , which shows a flow chart of a method for starting an embedded device provided by an embodiment of the present application. The method includes the following process.

[0043] S201, initializing the hardware required for starting the embedded device.

[0044] The hardware required for embedded startup may include clocks, I / O pins, peripherals, etc. Initializing the above hardware may include setting clocks, resetting peripherals, configuring I / O pins, etc.

[0045] In some embodiments, after an embedded device is powered on or reset, it executes BootROM code, which initializes the hardware required for the embedded device to start up. The BootROM code is the first code executed by the embedded device upon power-up or reset. It is responsible for initializing the hardware, loading firmware data, and performing security verification of the firmware data.

[0046] S202, traverse the external storage device to see if there is a valid firmware header.

[0047] Optionally, the bootloader checks whether the value of the Image Magic field in the header information is valid. If the value of the Image Magic field is valid, the bootloader performs an integrity check on the header information. If the integrity check passes, it determines that a valid firmware header has been traversed. The integrity check involves calculating a checksum for the header information and then comparing the calculated checksum with the value of the BootHeader Checksum field in Table 2. If the two checksums are the same, the integrity check passes. If they are different, the integrity check fails and the next valid firmware header needs to be found.

[0048] S203: When a valid firmware header is found, determining the startup configuration information of the system startup firmware corresponding to the valid firmware header.

[0049] The startup configuration information includes at least one of the following: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, and register configuration information.

[0050] Extended boot firmware information indicates whether extended boot firmware exists. Secure boot information indicates whether security verification of the system boot firmware is required. Boot partition information indicates whether the system boot firmware is booted and run in the primary partition or the secondary partition. Firmware execution mode information indicates whether the system boot firmware is booted and run on a 32-bit or 64-bit operating system. Firmware index information indicates the number of the system boot firmware to be booted and run. Log level information indicates the minimum level of log information required to be recorded after the system boot firmware runs. Register configuration information is used to configure registers in the embedded device.

[0051] S204: Start the system startup firmware based on the startup configuration information of the system startup firmware.

[0052] The boot program starts the running system boot firmware according to the above startup configuration information, which can improve the reliability and security of the boot program in guiding the system startup.

[0053] To sum up, the technical solution provided by the embodiment of the present application is that the embedded device first initializes the hardware required for its own startup, and then after traversing to the valid firmware header, first determines the startup configuration information of the system startup firmware to configure the system startup firmware to be started, whether the system startup firmware needs to be decrypted, whether the extended startup firmware needs to be started, the partition where the system startup firmware starts to run, the system startup firmware starts to run in a 32-bit operating system or a 64-bit operating system, the log information to be recorded during the process of starting and running the system startup firmware, the register configuration during the process of starting and running the system startup firmware, etc., and then starts and runs the system startup firmware according to the above startup configuration information, which can improve the reliability and security of the boot program guiding the system startup.

[0054] Please refer to Figure 3 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S303, and S204 is replaced by S304. The method includes the following process.

[0055] S301, initializing the hardware required for starting the embedded device.

[0056] S303: Check whether there is a valid firmware header in the external storage device.

[0057] S303: When a valid firmware header is found, the value of the extended startup firmware field in the partition information of the boot program is set.

[0058] In an embodiment of the present application, the startup configuration information includes extended startup firmware information. The value of the extended startup firmware field is used to indicate whether the extended startup firmware exists. In conjunction with reference to Table-3, the partition information of the boot program includes an extended startup firmware field (the does_ext_img_exist field in Table-3). If there is a fault in the boot program that needs to be repaired, or if some additional user operation logic needs to be executed when the system startup firmware is running, the value of the above-mentioned extended startup firmware field can be set to a first specified value, such as 1. Otherwise, the value of the above-mentioned extended startup firmware field can be set to a second specified value, such as 0.

[0059] S304: When the value of the extended startup firmware field indicates that the extended startup firmware exists, start running the extended startup firmware.

[0060] The boot program obtains the value of the extended boot firmware field. When the value of the extended boot firmware field indicates that the extended boot firmware exists, the boot program finds the extended boot firmware from its own partition information and runs it. When the value of the extended boot firmware field indicates that the extended boot firmware does not exist, the boot program starts and runs the default system boot firmware or the system boot firmware indicated by the value of the firmware index field.

[0061] To sum up, the technical solution provided by the embodiment of the present application adds an extended boot firmware field in the partition information of the boot program to indicate whether there is extended boot firmware. If there is a fault in the boot program that needs to be repaired, or some additional user operation logic needs to be executed when the system boot firmware is running, the extended boot firmware can be set to exist, and the extended boot firmware can be subsequently started to repair the fault of the boot program, and some additional user operation logic can be executed when the system boot firmware is running.

[0062] Please refer to Figure 4 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S403, and S204 is replaced by S404-S407. The method includes the following process.

[0063] S401, initializing the hardware required for starting the embedded device.

[0064] S402: Check whether there is a valid firmware header in the external storage device.

[0065] S403: When a valid firmware header is found, a value of a secure boot field in the partition information of the boot program is set.

[0066] In an embodiment of the present application, the startup configuration information includes secure boot information. Optionally, the partition information of the boot program includes a secure boot field (the sec_boot_flag field in Table 3). The value of the secure boot field is used to indicate whether the system startup firmware needs to be decrypted. Therefore, the value of the secure boot field can be set to set the secure boot information.

[0067] If the system startup firmware needs to be decrypted, the value of the above-mentioned secure boot field can be set to the first specified value, such as 1. If the system startup firmware does not need to be decrypted, the value of the above-mentioned secure boot field can be set to the second specified value, such as 0.

[0068] S404: When the value of the secure boot field indicates that the system boot firmware needs to be decrypted, calculate signature information corresponding to the partition information of the boot program.

[0069] The partition information of the boot program includes a flag field. The boot program reads the signature algorithm type (sig_sch field in Table-4), public key information (public_key_info field in Table-4) and data in the partition information of the boot information (except the signature information (signature_info field in Table-4)) from the above flag field, and inputs the above signature algorithm type, public key information and data in the partition information of the boot information into the security engine module, and the security engine module outputs the calculated signature information.

[0070] S405: If the calculated signature information is the same as the signature information in the partition information of the boot program, the system startup firmware is decrypted to obtain the decrypted system startup firmware.

[0071] If the two are identical, the signature authentication succeeds and the bootloader continues to execute the subsequent steps. If the two are different, the signature authentication fails and the bootloader enters the exception handling process. The exception handling process will be described in the following examples.

[0072] The boot program obtains the firmware encryption algorithm type from the partition information (the img_cipher_sch field in Table 4). The boot program inputs the above firmware encryption algorithm type and the system startup firmware into the security engine module. The security engine module decrypts the system startup firmware according to the above firmware encryption algorithm type to obtain the decrypted system startup firmware.

[0073] S406, calculating verification data corresponding to the decrypted system startup firmware.

[0074] The partition information of the boot program includes the firmware verification algorithm type, which is also input into the security engine module. The security engine module calculates the decrypted system startup firmware based on the firmware verification algorithm type (the img_dgst_sch field in Table 4) to obtain the verification data corresponding to the decrypted system startup firmware.

[0075] S407: If the calculated verification data is the same as the summary value of the system startup firmware in the partition information of the boot program, the system startup firmware is started.

[0076] The partition information of the boot program includes the digest value of the system startup firmware (the img_digest field in Table 4). The boot program compares the calculated verification data with the above digest value. If the two are consistent, the verification is successful and the boot program runs the system startup firmware. If the two are inconsistent, the boot program continues to search for the system startup firmware that can be started and run.

[0077] When the value of the secure boot field indicates that the system boot firmware does not need to be security checked, it means that the system boot firmware is non-encrypted firmware. At this time, the boot program does not need to decrypt it. It only needs to obtain the firmware verification algorithm type to calculate the verification data corresponding to the system boot firmware, and then compare the calculated verification data with the summary value of the system boot firmware in the partition information of the boot program to verify the integrity of the system boot firmware.

[0078] To sum up, the technical solution provided by the embodiment of the present application adds a secure boot field in the partition information to configure whether the system boot firmware needs to be decrypted. When the secure boot field indicates that the system boot firmware needs to be decrypted, the boot program needs to verify the partition information, as well as decrypt and verify the integrity of the system boot firmware, thereby improving the security of the boot.

[0079] Please refer to Figure 5 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S503, and S204 is replaced by S504-S505. The method includes the following process.

[0080] S501, initializing the hardware required for starting the embedded device.

[0081] S502: Check whether there is a valid firmware header in the external storage device.

[0082] S503: When a valid firmware header is found, the value of the boot partition field in the header information of the boot program is set to the first value or the second value.

[0083] In an embodiment of the present application, the startup configuration information includes startup partition information. Optionally, the header information of the boot program includes a startup partition field (Bootzone Select field in Table 2), and the value of the startup partition field is used to indicate whether to start the firmware in the main partition or the sub-partition. Therefore, the value of the startup partition field can be set to set the startup partition information. If it is necessary to start the firmware in the main partition, the startup partition field can be set to the first value, such as 1. If it is necessary to start the firmware in the sub-partition, the startup partition field can be set to the second value, such as 2.

[0084] S504: When the value of the boot partition field is the first value, start the operating system boot firmware in the primary partition.

[0085] The boot program reads the value of the boot partition field to decide whether to start the operating system startup firmware in the primary partition or the secondary partition. When the value of the boot partition field is the first value, the boot program starts the operating system startup firmware in the primary partition.

[0086] S505: When the value of the boot partition field is the second value, boot the firmware from the partition boot running system.

[0087] When the value of the boot partition field is the second value, the boot program starts the system boot firmware from the partition. When the value of the boot partition field is any value other than the first value and the second value (for example, 0), it indicates that the boot partition field is invalid. In this case, the boot program may select the default partition to start the system boot firmware, or may generate a first prompt message to prompt the technician to set the partition where the system starts running.

[0088] Due to the existence of the primary partition and the secondary partition, the boot program also provides a backup boot mechanism. If the system boot firmware fails to start in the secondary partition, the boot program can restart the system boot firmware in the primary partition. If the system boot firmware fails to start in the primary partition, the system boot firmware can be restarted in the secondary partition. Since the backup boot mechanism provides a second boot attempt opportunity, it can reduce the risk of boot failure.

[0089] In some embodiments, if the system startup firmware fails to start in the primary partition and fails to start in the secondary partition, an error message is generated to prompt that the system startup firmware fails to start. At this time, the boot program searches for the next bootable system startup firmware.

[0090] In summary, the technical solution provided by the embodiments of this application adds a boot partition field to the bootloader header information, allowing users to flexibly set the partition where the system boot firmware runs, reducing the frequency of system boot firmware upgrades. Furthermore, the bootloader provides a backup boot mechanism. If the system boot firmware fails to boot in one partition, the bootloader can restart the system boot firmware in another partition, enabling a secondary boot and reducing the risk of boot failure.

[0091] Please refer to Figure 6 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S603, and S204 is replaced by S604-S605. The method includes the following process.

[0092] S601, initializing the hardware required for starting the embedded device.

[0093] S602: Check whether there is a valid firmware header in the external storage device.

[0094] S603: When a valid firmware header is found, the value of the firmware index field in the header information of the boot program is set.

[0095] In an embodiment of the present application, the startup configuration information includes firmware index information. Optionally, the header information of the boot loader includes a firmware index field (the Firmware Index field in Table 2). The value of the firmware index field is used to indicate the number of the system startup firmware to be started. Therefore, the value of the firmware index field can be set to set the firmware index information.

[0096] If you need to start a specific system startup firmware, you can set the value of the firmware index field to the number of the specific system startup firmware. The default value of the firmware index field is 0, indicating that you need to start the first system startup firmware.

[0097] S604: Based on the value of the firmware index field, start running the corresponding system startup firmware.

[0098] The boot program can read the value of the firmware index field from the header information to determine the system startup firmware to be started and run, and then obtain the corresponding system startup firmware header information in the boot program's partition information, including firmware information, firmware version number, firmware storage address, firmware storage address in memory, firmware size, firmware running entry address, firmware summary information, etc., and then perform integrity verification on the system startup firmware based on the above-mentioned corresponding system startup firmware header information. After the verification passes, the corresponding system startup firmware is started and run.

[0099] In summary, the technical solution provided by the embodiment of the present application adds a firmware index field to the header information of the boot program, allowing users to flexibly set the system startup firmware to be started and reduce the frequency of upgrading and updating the system startup firmware.

[0100] Please refer to Figure 7 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S703, and S204 is replaced by S704. The method includes the following process.

[0101] S701: Initialize the hardware required for starting the embedded device.

[0102] S702: Check whether there is a valid firmware header in the external storage device.

[0103] S703: When a valid firmware header is found, the value of the firmware execution mode field in the header information of the boot program is set.

[0104] In an embodiment of the present application, the startup configuration information includes firmware execution mode information. Optionally, the header information of the boot program includes a firmware execution mode field (the Firmware Executing State field in Table 2). The value of the firmware execution mode field is used to indicate whether to start the system startup firmware on a 32-bit or 64-bit operating system. Therefore, the value of the firmware execution mode field can be set to set the firmware execution mode information.

[0105] If you need to start the running system startup firmware on a 32-bit operating system, you can set the firmware execution mode field to the third value, such as 1. If you need to start the running system startup firmware on a 64-bit operating system, you can set the firmware execution mode field to the fourth value, such as 2.

[0106] S704: After controlling the operating system of the embedded device to switch to the execution state corresponding to the value of the firmware execution mode field, start the operating system to start the firmware.

[0107] The bootloader reads the value of the "Firmware Execution Mode" field from the header information to determine whether to start the system boot firmware on a 32-bit or 64-bit operating system. If the value of the "Firmware Execution Mode" field is the third value, the bootloader controls the embedded device's operating system to switch to 32-bit and then starts the system boot firmware. If the value of the "Firmware Execution Mode" field is the fourth value, the bootloader controls the embedded device's operating system to switch to 64-bit and then starts the system boot firmware.

[0108] When the value of the firmware execution mode field is other than the third value and the fourth value (for example, 0), it means that the firmware execution mode field is illegal. At this time, a second prompt message can be generated to prompt the technician to set the firmware execution mode field.

[0109] To sum up, the technical solution provided in the embodiment of the present application adds a firmware execution mode field to the header information of the boot program to set the firmware execution mode information, which can avoid the problem that the execution status of the system startup firmware is inconsistent with the current execution mode of the operating system, and increase the startup success rate.

[0110] Please refer to Figure 8 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S803, and S204 is replaced by S804. The method includes the following process.

[0111] S801, initializing the hardware required to start the embedded device.

[0112] S802: Check whether there is a valid firmware header in the external storage device.

[0113] S803: When a valid firmware header is found, the value of the log level field in the header information of the boot program is set.

[0114] In an embodiment of the present application, the startup configuration information includes log level information. Optionally, the header information of the boot program includes a log level field (the LogGrade field in Table 2). The value of the log level field is used to indicate the minimum level of log information required to be recorded after the system startup firmware starts running. Therefore, the value of the log level field can be set to set the log level information.

[0115] The value of the Log Level field can be customized by the technician. The correspondence between the value of the Log Level field and the minimum level of log information to be recorded can be referred to in Table 4 below.

[0116] The value of the log level field The minimum level of log information that needs to be recorded 0 ERROR 1 WARN 2 INFO 3 DEBUG other Close log

[0117] Table-4

[0118] With reference to Table 4, if the value of the Log Level field is 2, the levels of log information that needs to be recorded after the system boot firmware starts running include: INFO, WARN, and ERROR.

[0119] S804: During the process of starting the system and booting the firmware, log information is recorded according to the value of the log level field.

[0120] After the boot program starts running the system startup firmware, the system startup firmware records log information according to the value of the log level field.

[0121] To sum up, the technical solution provided in the embodiment of the present application adds a log level field to the header information of the boot program to set the minimum level of log information required to be recorded after the system startup firmware starts running. By providing debugging functions such as log filtering function, the cause of the error can be quickly located after the embedded device fails to start, thereby improving the efficiency of solving the system startup failure problem.

[0122] Please refer to Figure 9 , which shows a flow chart of an embedded device startup method provided by an embodiment of the present application. In this embodiment, S203 is replaced by S903, and S204 is replaced by S904. The method includes the following process.

[0123] S901: Initialize the hardware required for starting the embedded device.

[0124] S902: Check whether there is a valid firmware header in the external storage device.

[0125] S903: When a valid firmware header is found, the content of the register initialization field in the header information of the boot program is set to configure the registers in the embedded device.

[0126] In an embodiment of the present application, the startup configuration information includes register configuration information. Optionally, the header information of the boot program includes a register initialization field (Register Initialization field in Table 2). The user can fill in the register address and data in the register initialization field to configure the register. For example, the user can fill in the phase-locked loop register address and data to multiply the entire system frequency, thereby increasing the system operating frequency.

[0127] S904 , in the process of starting the running system startup firmware, starting the running system startup firmware according to the content of the register initialization field.

[0128] To sum up, the technical solution provided in the embodiment of the present application adds a register initialization field in the header information of the boot program to configure the registers in the embedded device. Subsequently, in the process of starting the running system startup firmware, the running system startup firmware is started according to the content of the register initialization field to realize the pre-configuration that the system needs to perform during the startup phase.

[0129] It should be noted that during the startup process of the embedded device, the boot program can execute the above Figures 3 to 9 Any one embodiment or a combination of at least two embodiments.

[0130] Combined with reference Figure 10 , which shows a flow chart of a method for starting an embedded device provided by an embodiment of the present application. The method includes the following process.

[0131] S1001, initializing the hardware required to start the embedded device.

[0132] S1002, traverse the external storage device to see if there is a valid firmware header.

[0133] S1003: When a valid firmware header is found, the startup configuration information of the system startup firmware is determined.

[0134] In this embodiment, the system startup configuration information includes: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, and register configuration information.

[0135] S1004: Select a partition for the system startup firmware to start running according to the startup partition information.

[0136] S1005: Detect whether signature authentication is required based on the secure boot information.

[0137] If signature authentication is required, execute S1006-S1007; if signature authentication is not required, execute S1008.

[0138] S1006, perform signature authentication through the security engine module.

[0139] S1007: Check whether the signature authentication is successful.

[0140] If the result is passed, the process goes to S1008. If the result is not passed, the process goes to S1017.

[0141] S1008: Detect whether extended startup firmware exists according to the extended startup firmware information.

[0142] If it exists, execute S1009; if it does not exist, execute S1010.

[0143] S1009, running the extended startup firmware.

[0144] S1010: Obtain system startup firmware based on the firmware index information.

[0145] S1011: Detect whether the system startup firmware needs to be decrypted based on the secure startup information.

[0146] If necessary, execute S1012; if not necessary, execute S1013.

[0147] S1012: Decrypt the system startup firmware through the security engine module.

[0148] S1013: Verify the integrity of the system startup firmware through the security engine module.

[0149] S1014: Check whether the integrity check passes.

[0150] If passed, execute S1015; if not, execute S1017.

[0151] S1015: directly switch the operating system between 32-bit and 64-bit according to the firmware execution mode information.

[0152] S1016: Start the system startup firmware according to the register configuration information and the log level information.

[0153] S1017, backup startup process.

[0154] The backup boot process means: if the current booting of the running system boot firmware in the primary partition fails and the running system boot firmware is not started in the secondary partition, then switch to booting the running system boot firmware from the secondary partition; if the current booting of the running system boot firmware in the secondary partition fails and the running system boot firmware is not started in the primary partition, then switch to booting the running system boot firmware from the primary partition; if the current booting of the running system boot firmware in both the primary partition and the secondary partition fails, then the boot fails.

[0155] To sum up, the technical solution provided by the embodiment of the present application is that the embedded device first initializes the hardware required for its own startup, and then after traversing to the valid firmware header, first determines the startup configuration information of the system startup firmware to configure the system startup firmware to be started, whether the system startup firmware needs to be decrypted, whether the extended startup firmware needs to be started, the partition where the system startup firmware starts to run, the system startup firmware starts to run in a 32-bit operating system or a 64-bit operating system, the log information to be recorded during the process of starting and running the system startup firmware, the register configuration during the process of starting and running the system startup firmware, etc., and then starts and runs the system startup firmware according to the above startup configuration information, which can improve the reliability and security of the boot program guiding the system startup.

[0156] refer to Figure 11 , which shows a block diagram of a startup device for an embedded device provided by an embodiment of the present application. The device includes: an initialization module 1110, a firmware header traversal module 1120, a configuration information determination module 1130, and a firmware startup module 1140.

[0157] The initialization module 1110 is used to initialize the hardware required for starting the embedded device.

[0158] The firmware header traversal module 1120 is used to traverse the external storage device to see whether there is a valid firmware header.

[0159] The configuration information determination module 1130 is used to determine the startup configuration information of the system startup firmware corresponding to the valid firmware header when traversing to the valid firmware header. The startup configuration information includes at least one of the following: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, and register configuration information.

[0160] The firmware startup module 1140 is configured to start running the system startup firmware based on the startup configuration information of the system startup firmware.

[0161] In some embodiments, the startup configuration information includes extended startup firmware information, and the configuration information determination module 1130 is used to set the value of the extended startup firmware field in the partition information of the boot program, and the value of the extended startup firmware field is used to indicate whether extended startup firmware exists; the firmware startup module 1140 is used to start running the extended startup firmware when the value of the extended startup firmware field is used to indicate the existence of extended startup firmware.

[0162] In some embodiments, the startup configuration information includes secure startup information, and the configuration information determination module 1130 is used to set the value of the secure startup field in the partition information of the boot program, and the value of the secure startup field is used to indicate whether the system startup firmware needs to be decrypted; the firmware startup module 1140 is used to calculate the signature information corresponding to the partition information of the boot program when the value of the secure startup field indicates that the system startup firmware needs to be securely verified; if the calculated signature information is the same as the signature information in the partition information of the boot program, the system startup firmware is decrypted to obtain the decrypted system startup firmware; calculate the verification data corresponding to the decrypted system startup firmware; if the calculated verification data is the same as the summary value of the system startup firmware in the partition information of the boot program, the system startup firmware is started and run.

[0163] In some embodiments, the startup configuration information includes startup partition information; the configuration information determination module 1130 is used to set the value of the startup partition field in the header information of the boot program to the first value or the second value; the firmware startup module 1140 is used to start the firmware in the main partition startup system when the value of the startup partition field is the first value; and to start the firmware in the slave partition startup system when the value of the startup partition field is the second value.

[0164] In some embodiments, the firmware startup module 1140 is used to start the firmware in the slave partition if the firmware fails to be started by the running system when starting the main partition; if the firmware fails to be started by the running system when starting the slave partition, then start the firmware in the main partition; if the firmware fails to be started by the running system when starting the main partition and the firmware fails to be started by the running system when starting the slave partition, then generate an error message.

[0165] In some embodiments, the startup configuration information includes firmware index information, and the configuration information determination module 1130 is used to set the value of the firmware index field in the header information of the boot program, and the value of the firmware index field is used to indicate the number of the system startup firmware to be started and run; the firmware startup module 1140 is used to start and run the corresponding system startup firmware based on the value of the firmware index field.

[0166] In some embodiments, the startup configuration information includes firmware execution mode information. The configuration information determination module 1130 is used to set the value of the firmware execution mode field in the header information of the boot program. The value of the firmware execution mode field starts the running system startup firmware on a 32-bit or 64-bit operating system; the firmware startup module 1140 is used to control the operating system of the embedded device to switch to the execution state corresponding to the value of the firmware execution mode field, and then start the running system startup firmware.

[0167] In some embodiments, the startup configuration information includes log level information; the configuration information determination module 1130 is used to set the value of the log level field in the header information of the boot program, and the value of the log level field is used to indicate the minimum level of log information required to be recorded after the system startup firmware starts running; the firmware startup module 1140 is used to record log information according to the value of the log level field during the process of starting the running system startup firmware.

[0168] In some embodiments, the startup configuration information includes register configuration information; the configuration information determination module 1130 is used to set the content of the register initialization field in the header information of the boot program to configure the registers in the embedded device; the firmware startup module 1140 is used to start the running system startup firmware according to the content of the register initialization field during the process of starting the running system startup firmware.

[0169] To sum up, the technical solution provided by the embodiment of the present application is that the embedded device first initializes the hardware required for its own startup, and then after traversing to the valid firmware header, first determines the startup configuration information of the system startup firmware to configure the system startup firmware to be started, whether the system startup firmware needs to be decrypted, whether the extended startup firmware needs to be started, the partition where the system startup firmware starts to run, the system startup firmware starts to run in a 32-bit operating system or a 64-bit operating system, the log information to be recorded during the process of starting and running the system startup firmware, the register configuration during the process of starting and running the system startup firmware, etc., and then starts and runs the system startup firmware according to the above startup configuration information, which can improve the reliability and security of the boot program guiding the system startup.

[0170] An embodiment of the present application further provides a computer-readable storage medium, which stores computer program instructions. The computer program instructions can be called by a processor to execute the method described in the above embodiment.

[0171] The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for computer program instructions for executing any of the method steps described above. These computer program instructions may be read from or written to one or more computer program products. The computer program instructions may be compressed in a suitable form.

[0172] The above is only a preferred embodiment of the present application and does not constitute any form of limitation to the present application. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any person skilled in the art can make some changes or modifications to equivalent embodiments using the technical contents disclosed above without departing from the scope of the technical solution of the present application. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of the technical solution of the present application.

Claims

1. A method for starting an embedded device, characterized in that: Applied to an embedded device, the method includes: Initializing the hardware required to start the embedded device; Check whether there is a valid firmware header in the external storage device; In the case of traversing to the valid firmware header, determining the startup configuration information of the system startup firmware corresponding to the valid firmware header, the startup configuration information including at least one of the following: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, and register configuration information; Based on the startup configuration information of the system startup firmware, the system startup firmware is started and executed.

2. The method according to claim 1, characterized in that The startup configuration information includes the extended startup firmware information, and determining the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Setting a value of an extended boot firmware field in the partition information of the boot program, where the value of the extended boot firmware field is used to indicate whether extended boot firmware exists; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: When the value of the extended startup firmware field indicates that the extended startup firmware exists, the extended startup firmware is started and executed.

3. The method according to claim 1, characterized in that The startup configuration information includes the secure startup information, and determining the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Setting a value of a secure boot field in partition information of a boot program, where the value of the secure boot field is used to indicate whether the system boot firmware needs to be decrypted; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: When the value of the secure boot field indicates that security verification of the system boot firmware is required, calculating signature information corresponding to the partition information of the boot program; If the calculated signature information is identical to the signature information in the partition information of the boot program, decrypting the system startup firmware to obtain the decrypted system startup firmware; Calculating verification data corresponding to the decrypted system startup firmware; If the calculated verification data is the same as the summary value of the system startup firmware in the partition information of the boot program, the system startup firmware is started and executed.

4. The method according to claim 1, wherein The startup configuration information includes the startup partition information; and determining the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Set the value of the boot partition field in the header information of the boot program to the first value or the second value; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: When the value of the boot partition field is the first value, starting and running the system boot firmware in the primary partition; When the value of the boot partition field is the second value, the system boot firmware is run in the slave partition boot.

5. The method according to claim 4, characterized in that The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: If the system startup firmware fails to be started in the primary partition, the system startup firmware is started in the secondary partition; If the system startup firmware fails to be started in the slave partition, the system startup firmware is started in the master partition; If the system startup firmware fails to be started in the primary partition and the system startup firmware fails to be started in the secondary partition, an error message is generated.

6. The method according to claim 1, characterized in that The startup configuration information includes the firmware index information, and determining the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Setting a value of a firmware index field in the header information of the boot program, where the value of the firmware index field is used to indicate the number of the system boot firmware to be started; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: Based on the value of the firmware index field, the corresponding system startup firmware is started and executed.

7. The method according to claim 1, characterized in that The startup configuration information includes the firmware execution mode information, and the determining of the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Setting a value of a firmware execution mode field in header information of a boot program, wherein the value of the firmware execution mode field starts running the system boot firmware on a 32-bit or 64-bit operating system; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: After controlling the operating system of the embedded device to switch to the execution state corresponding to the value of the firmware execution mode field, the operating system is started to start the firmware.

8. The method according to claim 1, characterized in that The startup configuration information includes the log level information; the determining the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Setting a value of a log level field in the header information of the boot program, wherein the value of the log level field is used to indicate the minimum level of log information required to be recorded after the system boot firmware starts running; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: During the process of starting and running the system startup firmware, log information is recorded according to the value of the log level field.

9. The method according to claim 1, characterized in that The startup configuration information includes the register configuration information; and determining the startup configuration information of the system startup firmware corresponding to the valid firmware header includes: Setting the content of the register initialization field in the header information of the boot program to configure the registers in the embedded device; The step of starting the system startup firmware based on the startup configuration information of the system startup firmware includes: During the process of starting and running the system startup firmware, the system startup firmware is started and run according to the content of the register initialization field.

10. A startup device for an embedded device, characterized in that: The device comprises: An initialization module, used for initializing the hardware required to start the embedded device; The firmware header traversal module is used to traverse the external storage device to see if there is a valid firmware header; a configuration information determination module, configured to, when traversing the valid firmware header, determine the startup configuration information of the system startup firmware corresponding to the valid firmware header, the startup configuration information including at least one of the following: extended startup firmware information, secure startup information, startup partition information, firmware execution mode information, firmware index information, log level information, and register configuration information; The firmware startup module is used to start running the system startup firmware based on the startup configuration information of the system startup firmware.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which can be called by a processor to execute the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Firmware loading method and device of processor, storage medium and program product

    CN121349563A