Safe startup method for dual-core relay protection system
By measuring and verifying the secondary Boot and activating the second core, the potential safety hazards in the traditional dual-core relay protection system startup method are solved and the security of the system is improved.
Patent Information
- Application Number
- CN202111007007.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-08-30
AI Technical Summary
The startup method of the traditional dual-core relay protection system has security risks and cannot ensure the legality and integrity of the boot loader.
By measuring and verifying the secondary Boot during the startup process to ensure its legality and integrity, and after passing the verification, copy and load the operating system image file, activate the second kernel, and complete the startup of the dual-core relay protection system.
It reduces potential safety hazards during the startup process of the dual-core relay protection system and improves the safety of the system startup process.
Smart Images

Figure CN113642006B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of relay protection, and in particular to a method for safely starting a dual-core relay protection system. Background Art
[0002] Relay protection devices are commonly used in power systems. The working status of relay protection devices directly affects the entire power system, and they are responsible for the important mission of protecting the safe and stable operation of the power system. With the continuous improvement of the functions and performance requirements of relay protection devices, the resources of single-core processors have become increasingly scarce, and relay protection devices with dual-core processors and matching dual-core relay protection systems have emerged.
[0003] The traditional dual-core relay protection system startup method realizes the kernel startup by executing the boot loader. Since the security of the boot loader itself cannot be ensured, the startup process of the dual-core relay protection system also has great safety risks. Therefore, the traditional dual-core relay protection system startup method has the disadvantage of poor safety. Summary of the invention
[0004] Based on this, it is necessary to provide a safe starting method for a dual-core relay protection system with good operating safety in response to the above technical problems.
[0005] A dual-core relay protection system safe starting method, comprising:
[0006] Execute the first level Boot in the first kernel;
[0007] Copying the secondary Boot to the memory, and performing measurement verification on the secondary Boot to obtain the secondary Boot measurement verification result;
[0008] If the secondary Boot measurement verification result is passed, execute the secondary Boot to complete the copying and loading of the first kernel operating system image file and the second kernel operating system image file, and activate the second kernel;
[0009] Executing the first kernel operating system image file and the second kernel operating system image file respectively to complete the initialization of the corresponding operating system and the loading of the corresponding application program;
[0010] According to the startup script, execute the corresponding application to complete the startup of the dual-core relay protection system.
[0011] In one embodiment, the copying of the secondary Boot to the memory and the measurement verification of the secondary Boot to obtain the secondary Boot measurement verification result include:
[0012] The secondary Boot is copied to the memory, and the hash value of the secondary Boot is calculated and compared with the preset hash value whitelist to obtain the secondary Boot measurement verification result.
[0013] In one of the embodiments, when the secondary Boot measurement verification result is passed, executing the secondary Boot to complete the copying and loading of the first kernel operating system image file and the second kernel operating system image file, and activating the second kernel, includes:
[0014] If the secondary Boot measurement verification result is passed, executing the first copy script of the secondary Boot to copy and load the first kernel operating system image file in the external storage device into the memory;
[0015] Execute the first measurement script of the secondary Boot, perform measurement verification on the first kernel operating system image file, and obtain a first operating system measurement verification result;
[0016] If the first operating system metric verification result is passed, executing the second copy script of the secondary Boot to copy and load the second kernel operating system image file in the external storage device into the memory;
[0017] Execute the second measurement script of the secondary Boot, perform measurement verification on the second kernel operating system image file, and obtain a second operating system measurement verification result;
[0018] When the measurement verification result of the second operating system is passed, the activation script of the secondary Boot is executed to activate the second kernel.
[0019] In one of the embodiments, the initialization of the operating system includes peripheral initialization, interrupt initialization, network initialization and NFS initialization.
[0020] In one embodiment, after respectively executing the first kernel operating system image file and the second kernel operating system image file to complete the initialization of the corresponding operating system and the loading of the corresponding application program, before executing the corresponding application program according to the startup script to complete the startup of the dual-core relay protection system, the method further includes:
[0021] The first kernel application and the second kernel application are respectively measured and verified.
[0022] In one embodiment, both the first core and the second core are CK810 chips.
[0023] In one embodiment, before executing the first level Boot in the first kernel, the method further includes:
[0024] Performing physical memory management on the first core and the second core;
[0025] Establish a mapping relationship between physical memory and virtual memory;
[0026] A communication mechanism between the first kernel and the second kernel is established.
[0027] In one embodiment, performing physical memory management on the first kernel and the second kernel includes:
[0028] The arbiter sorts the access priorities of the first core and the second core to the shared physical memory;
[0029] Use the board support package configuration function to partition the exclusive physical memory.
[0030] In one embodiment, the virtual memory includes a NOR Flash connected to the first core and the second core, and an eMMC connected to the first core.
[0031] In one of the embodiments, the communication mechanism is a mailbox mechanism.
[0032] The above dual-core relay protection system safe startup method performs measurement verification on the secondary Boot before executing the secondary Boot, which can ensure the legitimacy and integrity of the boot loader during the startup process, that is, the secondary Boot, thereby reducing the safety hazards during the startup process of the dual-core relay protection system, which is conducive to improving the safety of the system startup process. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 Flow chart of a method for safely starting a dual-core relay protection system in one embodiment;
[0034] Figure 2 A flowchart of executing the secondary Boot to complete the copying and loading of the first kernel operating system image file and the second kernel operating system image file and activate the second kernel in an embodiment when the secondary Boot measurement verification result is passed;
[0035] Figure 3 It is a flow chart of a method for safely starting a dual-core relay protection system in another embodiment;
[0036] Figure 4 A schematic diagram of the application storage layout of a dual-core relay protection system in one embodiment;
[0037] Figure 5 A schematic diagram of the virtual memory and physical memory layout of a dual-core relay protection system in one embodiment;
[0038] Figure 6 A schematic diagram of NOR Flash storage space layout in one embodiment;
[0039] Figure 7 Schematic diagram of a communication mechanism based on Mailbox in one embodiment;
[0040] Figure 8 Schematic diagram of the initialization process of the first kernel and the second kernel application in one embodiment. DETAILED DESCRIPTION
[0041] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0043] It should be noted that when an element is considered to be "connected" to another element, it can be directly connected to the other element, or connected to the other element through an intermediate element. In addition, the "connection" in the following embodiments should be understood as "electrical connection", "communication connection", etc. if there is transmission of electrical signals or data between the connected objects.
[0044] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" etc. specify the presence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof.
[0045] The present application provides a dual-core relay protection system safety startup method, which is used to start the dual-core relay protection system carried by a relay protection device. The relay protection device is a relay protection SOC (System on Chip) chip containing two cores. Among them, the two cores are used to implement different functions respectively. For example, in a high-voltage protection device, the two cores are used to perform different relay protection tasks respectively; in a low-voltage protection and measurement and control device, the first core is used to run a protection program, and the second core is used to run a human-machine interface (HMI) program.
[0046] In one embodiment, Figure 1 As shown, the dual-core relay protection system safe startup method includes steps S400 to S900.
[0047] Step S400: Execute the first-level Boot in the first kernel.
[0048] Among them, the first kernel and the second kernel are both computing kernels on the processor of the relay protection device. The types of the first kernel and the second kernel are not unique, for example, they can be CK610 chips or CK810 chips. Specifically, during the startup process, one kernel activates the other kernel to complete the startup of the entire dual-core relay protection system. For ease of understanding, the second kernel is defined as the activated kernel in this application, and the second kernel is activated by the first kernel during the system startup process. Furthermore, the first-level Boot in the first kernel is a startup program solidified in the first kernel, and is the first code executed when power is turned on or reset.
[0049] Step S500: copy the secondary Boot to the memory, and perform measurement verification on the secondary Boot to obtain the measurement verification result of the secondary Boot.
[0050] Among them, the secondary Boot is a boot loader. The memory can be an on-chip memory or an external memory. The on-chip memory is a memory built into the dual-core processor. The types of the on-chip memory and the external memory are not unique, for example, they can be RAM (Random Access Memory) or DDR (Double Data Rate). Further, the measurement verification of the secondary Boot refers to the verification process of the secondary Boot in terms of data integrity, data format, etc. by certain means to ensure the legitimacy and integrity of the program files in the secondary Boot. The specific method for measurement verification is not unique, for example, the program file can be measured and verified by at least one of a digital signature, a hash value, and a hash value. In one embodiment, by calculating the hash value of the secondary Boot and comparing it with the preset hash value whitelist in the on-chip memory, a verification result of passing the measurement verification of the secondary Boot is obtained on the premise that the comparison is consistent, otherwise the verification fails.
[0051] Specifically, the secondary Boot can be copied from an external storage device to an on-chip memory through a bootrom (diskless boot read-only memory interface) to obtain a secondary Boot image. In the process of forming the secondary Boot image, the secondary Boot is measured and verified to obtain a result of passing or failing the secondary Boot measurement verification. Furthermore, the external storage device can be a NOR Flash (non-volatile flash memory) or an eMMC (Embedded Multi Media Card).
[0052] Step S600: When the secondary Boot measurement verification result is passed, the secondary Boot is executed to complete the copying and loading of the first kernel operating system image file and the second kernel operating system image file, and activate the second kernel.
[0053] Among them, the operating system image file is a clone file of all the data on the operating system installation CD. Specifically, execute the corresponding program of the secondary Boot in the memory, read the first kernel operating system image file and the second kernel operating system image file from the external storage device respectively, copy and load the corresponding files to the memory, and activate the second kernel. Further, in step S500, the secondary Boot can be copied to the on-chip RAM and the external DDR at the same time, the secondary Boot is measured on the on-chip RAM, and the secondary Boot is executed on the external DDR to improve the operation efficiency.
[0054] It can be understood that when the secondary Boot metric verification result obtained in step S500 is not passed, the startup process of the dual-core relay protection system is terminated and a warning message is output.
[0055] Step S700: executing the first kernel operating system image file and the second kernel operating system image file respectively, completing the initialization of the corresponding operating system and the loading of the corresponding application program.
[0056] Among them, the application refers to a computer program for completing one or more specific tasks. It runs in user mode, can interact with users, and has a visual user interface. Specifically, first jump to the first kernel operating system image to perform the initialization of the first kernel operating system image file. After the initialization of the first kernel operating system image file is completed, the first kernel application in the external storage device is loaded into the memory, and the NFS (Network File System) of the second kernel is initialized at the same time. When the second kernel completes the NFS initialization, the second kernel application in the external storage device is loaded into the memory through NFS. In one embodiment, the initialization of the operating system includes peripheral initialization, interrupt initialization, network initialization and NFS initialization to build a secure data operating environment. Among them, peripheral initialization refers to the initialization of an external storage device such as eMMC.
[0057] Step S900: Execute the corresponding application program according to the startup script to complete the startup of the dual-core relay protection system.
[0058] Specifically, the first core and the second core respectively execute the corresponding first core application and the second core application according to the corresponding startup script, and display the corresponding user interface, so that the user can perform the corresponding operation in the user interface to realize the required function. At this point, the startup of the dual-core relay protection system is completed, and the coordinated application of the dual-core operating system of the relay protection SOC chip is realized.
[0059] The above dual-core relay protection system safe startup method performs measurement verification on the secondary Boot before executing the secondary Boot, which can ensure the legitimacy and integrity of the boot loader during the startup process, that is, the secondary Boot, thereby reducing the safety hazards during the startup process of the dual-core relay protection system, which is conducive to improving the safety of the system startup process.
[0060] In one embodiment, Figure 2 As shown, step S600 includes steps S610 to S650.
[0061] Step S610: When the secondary Boot measurement verification result is passed, execute the first copy script of the secondary Boot to copy and load the first kernel operating system image file in the external storage device into the memory.
[0062] As mentioned above, the external storage device can be NOR Flash or eMMC; the memory can be the memory of the first core or an external memory, such as the first core DDR or external DDR. In one embodiment, the external storage device includes NOR Flash for storing operating system image files and secondary Boot, and eMMC for storing application programs.
[0063] Specifically, when the secondary Boot measurement verification result is passed, it means that the secondary Boot is legal and complete. At this time, the first copy script of the secondary Boot is executed to copy and load the first kernel operating system image file in the external storage device into the memory.
[0064] Step S620: Execute the first measurement script of the secondary Boot, perform measurement verification on the first kernel operating system image file, and obtain the first operating system measurement verification result.
[0065] The first measurement script is used to perform measurement verification on the first kernel operating system image file in terms of data integrity and data format to ensure the legitimacy and integrity of the first kernel operating system image file. Specifically, the program file can be measured and verified by at least one of a digital signature, a hash value, and a hash value. In one embodiment, the hash value of the first operating system image file is calculated and compared with a preset first operating system hash value whitelist. On the premise that the comparison is consistent, a verification result that the first operating system measurement passes is obtained, otherwise the verification fails.
[0066] Step S630: When the first operating system metric verification result is passed, execute the second copy script of the secondary Boot to copy and load the second kernel operating system image file in the external storage device into the memory.
[0067] Specifically, when the first operating system measurement verification result is passed, it means that the first operating system image file is legal and complete. At this time, continue the subsequent startup process, execute the first copy script of the secondary Boot, and copy the second kernel operating system image file in the external storage device and load it into the memory.
[0068] It can be understood that when the first operating system metric verification result obtained in step S620 is not passed, the startup process of the dual-core relay protection system is terminated and a warning message is output.
[0069] Step S640: Execute the second measurement script of the secondary Boot, perform measurement verification on the second kernel operating system image file, and obtain the second operating system measurement verification result.
[0070] Among them, the second measurement script is used to perform measurement verification on the second kernel operating system image file in terms of data integrity and data format, so as to ensure the legitimacy and integrity of the second kernel operating system image file. Similarly, the program file can be measured and verified by at least one of the digital signature, hash value and hash value. In one embodiment, by calculating the hash value of the second operating system image file and comparing it with the preset second operating system hash value whitelist, under the premise of consistency in the comparison, a verification result that the second operating system measurement passes is obtained, otherwise the verification fails.
[0071] Step S650: When the second operating system metric verification result is passed, execute the activation script of the secondary Boot to activate the second kernel.
[0072] Specifically, when the second operating system measurement verification result is passed, it means that the second operating system image file is legal and complete. At this time, the subsequent startup process continues, the activation script of the secondary Boot is executed, and the second kernel is activated.
[0073] In the above embodiment, during the copying and loading process of the operating system image file, a multi-level measurement verification method is adopted to ensure the legitimacy and integrity of the corresponding operating system image file, which is beneficial to further reduce the safety hazards during the startup process of the dual-core relay protection system and improve the safety of the system startup process.
[0074] In one embodiment, Figure 3 As shown, after step S700 and before step S900, step S800 is further included: performing measurement verification on the first kernel application and the second kernel application respectively.
[0075] Specifically, the program file can be measured and verified by at least one of a digital signature, a hash value, and a hash value. In one embodiment, by calculating the hash values of the first kernel application and the second kernel application, they are compared with the preset first application hash value whitelist and the preset second application hash value whitelist, respectively. If the comparison is consistent, the verification result that the first kernel application and the second kernel application pass the measurement is obtained, otherwise the verification fails.
[0076] It can be understood that only when the verification is passed, the subsequent startup steps are performed, otherwise the startup process of the dual-core relay protection system is terminated and an alarm message is output.
[0077] In one embodiment, please continue to refer to Figure 3 , before step S400, it also includes steps S100 to S300.
[0078] Step S100: performing physical memory management on the first core and the second core.
[0079] The physical memory includes shared physical memory and exclusive physical memory. Physical memory management is performed on the first core and the second core, including resource partitioning and access management of the two cores.
[0080] Specifically, there is not only one way to manage the physical memory of the first core and the second core. For example, different address spaces can be allocated to the two cores through physical memory partitioning, and then the MMU (Memory Management Unit) inside the kernel can be set to limit the master core CORE1 and the slave core CORE2 to only access their own address spaces.
[0081] In one embodiment, step S100 includes: the arbitrator sorts the access priorities of the first core and the second core to the shared physical memory; and partitions the exclusive physical memory through the configuration function of the board support package.
[0082] Among them, the shared physical memory is limited peripheral resources such as memory and interrupts. These peripheral resources have certain timing requirements when accessed, that is, to complete function A, operations A1, A2 and A3 need to be executed in sequence and uninterruptedly. Due to this timing requirement, when the peripheral resource is accessed by a certain operating subject, all other operating subjects must be prevented from accessing the peripheral resource in some way. For two operating systems running on two independent cores, if the same peripheral resource is accessed at the same time, the two operating systems will need to be mutually exclusive in resource access, which will cause the two cores to wait for each other, seriously affecting the operating efficiency of the two operating system images. Therefore, it is necessary to partition and manage the resources of the two operating system images running on the dual cores to avoid the mutual waiting of the two operating systems as much as possible, so as to effectively improve the operating efficiency of the two operating systems.
[0083] Specifically, since the operation of each core requires resources such as memory and interrupts, and these hardware resources are shared between the first core and the second core, by adding an arbitrator between the shared physical memory and the internal bus of the relay protection SOC chip, the shared memory access is prioritized or the access queue operation is performed, which can effectively avoid the access error caused by parallel physical access. Furthermore, in order to ensure the correctness of shared memory access, the memory usage area of the first core and the second core is divided into independent physical memory areas; at the same time, the first core and the second core are provided with a corresponding independent register through the interrupt controller. Since the first core and the second core access corresponding independent registers, and the arbitration and final operation are performed by the interrupt controller itself, therefore, as long as the first core and the second core configure their own interrupt sources and ensure that the first core and the second core do not use the same shared interrupt source, the problem of simultaneous access to registers can be effectively avoided.
[0084] In addition, inside the relay protection SOC chip, except for limited resources such as memory and interrupts, other peripheral resources can be partitioned as exclusive working modes, and these peripheral resources are exclusive physical memory. Since the memory is highly correlated with the operation of the corresponding operating system, the startup address and memory range macro definition of the two kernel operating systems are modified through the configuration function of the board support package (BSP), and the memory physical address range used by the link script and the kernel operating system image is modified to avoid the overlap of the physical application memory between the first kernel and the second kernel, and then two different device tree (DT) descriptions are designed for the two kernel operating system images to realize the memory partition of exclusive resources.
[0085] It can be understood that, since the interrupt controller has a strong correspondence with the peripherals, the partitioning of the interrupt controller is usually naturally brought about after the peripheral partitioning is completed, that is: by designing a device tree description for the operating system image corresponding to each core, and using the device tree compiler (DTC) to generate the device tree binary (devicetree blob, DTB), after the basic operating system service initialization is completed, the operating system corresponding to each core reads the device tree binary and determines the peripheral resources allocated to the operating system according to the device list inside the device tree, and initializes these peripheral resources one by one to realize the partitioning of peripherals and interrupt controllers. It should be noted that the device trees corresponding to the first core and the second core are different.
[0086] Step S200: Establishing a mapping relationship between physical memory and virtual memory.
[0087] Among them, virtual memory, also known as virtual storage, is a technology for computer system memory management. It makes the application think that it has continuous available memory (a continuous and complete address space), but in fact, it is usually divided into multiple physical memory fragments, and some are temporarily stored on external disk storage for data exchange when needed. Virtual memory can be a combination of RAM and some space on the hard disk.
[0088] In one embodiment, the virtual memory includes a NOR Flash connected to the first core and the second core, and an eMMC connected to the first core. The number of NOR Flashes can be one or two. The storage space sizes of NOR Flash and eMMC are not unique. For example, the storage space size of eMMC can be 1GB, 2GB or 3GB, and the storage space size of NOR Flash can be 16MB, 32MB or 64MB.
[0089] like Figure 4 As shown, NOR Flash includes a first NOR Flash interconnected with the first core Core0 and a second NOR Flash interconnected with the second core Core1, and different NOR Flashes are connected to the corresponding cores via Local Bus (local bus) or SPI (Serial Peripheral Interface). The first NOR Flash includes a first Yaffs file system (yet another flash file system, a log-type file system) for storing data, as well as a secondary Boot that does not use the Yaffs file system, a first core operating system image file Img0, and a second core operating system image file Img1. The second NOR Flash includes a second Yaffs file system for storing data. Both the first Yaffs file system and the second Yaffs file system are provided with tffs and set primary directories for program configuration storage and setting value storage.
[0090] The eMMC is interconnected with the first core Core0 via SDIO (Secure Digital Input and Output), and a third Yaffs file system is provided on the eMMC driver for the first core Core0 to directly access the eMMC. The third Yaffs file system has a data level directory for storing data information. The second core Core1 is interconnected with the first core Core0 via Virtual Eth, and the second core Core1 can access the third Yaffs file system via the first core Core0 using the NFS file system.
[0091] Furthermore, as shown in Table 1, based on the tffs, set and data first-level directories, application file systems can be independently created in the first and second cores to store program and version information, parameter and setting information, and data files respectively. At the same time, considering the reliability of files, files are divided into key files and non-key files from the perspective of their impact on application functions, and stored in different directories to prevent interference between file operations.
[0092] Table 1: Application file solution table for the first and second kernels
[0093]
[0094] Specifically, by mapping the physical addresses of different segments of the two kernels to the corresponding virtual addresses through the MMU, it is possible to ensure that the memory storage can be accessed through the memory operation function within the set virtual memory address space, without the need for storage division at the application level, such as Figure 5 As shown in the figure, the virtual addresses of different cores can be set to be exactly the same. This can not only avoid the illegal access to other program memory, but also reduce the memory fragmentation of the program, which is conducive to improving the performance of the dual-core relay protection system.
[0095] It should be noted that if Figure 6 As shown, if only one NOR Flash is used and shared by the first core and the second core, the second core operating system image file, ie, the Core1 operating system image, is also stored in the NOR Flash.
[0096] Step S300: constructing a communication mechanism between the first kernel and the second kernel.
[0097] The communication mechanism between the first kernel and the second kernel includes the communication protocol and the communication link adopted. Specifically, a buffer communication mechanism or a direct IO communication mechanism can be defined as the communication mechanism between the first kernel and the second kernel. After the communication mechanism is determined, it is equivalent to stipulating the rules for data exchange between the first kernel and the second kernel, which is conducive to the smooth progress of the subsequent startup process.
[0098] In one embodiment, the communication mechanism is a Mailbox (mail client) mechanism. The Mailbox is a shared storage area. Specifically, the data to be transmitted in one of the cores is first written into the Mailbox, and then the interrupt controller notifies the other core after the Mailbox receives the data, and the other core reads the data to be transmitted from the Mailbox, thereby realizing data transmission between the first core and the second core. Further, as Figure 7As shown, the data transmission between the first core Core0 and the second core Core1 completes the link layer data transmission and reception based on the Mailbox mechanism, realizes the communication between the transport layer and the application layer above the link layer, and then establishes reliable communication between the first core Core0 and the second core Core1.
[0099] Furthermore, the data to be transmitted between the first core and the second core can be prioritized at the transport layer, and data can be transmitted based on the priority of the data to be transmitted. Specifically, the division of high and low priorities of transmission data can be achieved by setting up different data packet buffer queues. As shown in Table 2, the priority may include high priority, medium priority and low priority. Among them, high priority refers to transmission data with a small amount of data and high real-time requirements, and low priority refers to transmission data with a large amount of data and low real-time requirements; data other than high priority and low priority are all medium priority. In addition, reliability assurance mechanisms such as feedback confirmation, retransmission and verification can also be processed at the transport layer to improve the reliability of data transmission between different cores.
[0100] Table 2 Classification of data transmitted between the first kernel and the second kernel
[0101]
[0102]
[0103] In the above embodiment, before executing the first-level Boot in the first kernel, the physical memory of the first kernel and the second kernel are partitioned to ensure the correctness of memory access; a mapping relationship between physical memory and virtual memory is established to realize that the physical addresses of different segments of the two kernels are mapped to the corresponding virtual addresses through the MMU, which can not only avoid the illegal access to the memory of other programs, but also reduce the memory fragmentation of the program, which is conducive to improving the performance of the dual-core relay protection system; a communication mechanism between the first kernel and the second kernel is established, which is conducive to the smooth progress of the subsequent startup process. The cooperation of the above technical solutions can further improve the safety of the startup process of the dual-core relay protection system.
[0104] For ease of understanding, the following Figure 8 , the startup process of the dual-core relay protection system is described in detail. Figure 8As shown, the dual-core processor integrates the first core Core0 and the second core Core1, and the peripheral storage device includes NOR Flash connected to the first core Core0 and the second core Core1, eMMC connected to the first core Core0, and DDR connected to the first core Core0 and the second core Core1. The dual-core processor is provided with on-chip RAM, NOR Flash is used to store the secondary Boot and the operating system images corresponding to different cores, and eMMC is used to store the application programs corresponding to different cores.
[0105] Specifically, the shared resources and exclusive resources are first functionally partitioned according to the functions of the first kernel and the second kernel; then a mapping relationship between physical memory and virtual memory is established at the physical level, so that the physical addresses of different segments of the two kernels can be mapped to the corresponding virtual addresses through the MMU; finally, the first kernel and the second kernel are started respectively and the corresponding first kernel application program and second kernel application program are executed in sequence, thereby realizing the coordinated application of the dual-core operating system of the relay protection SOC chip, which can avoid the situation where the two kernels wait for each other due to parallel physical access errors, and effectively improve the operation efficiency of the two kernel operating system images.
[0106] Furthermore, the relay protection device is also provided with a DDR to cooperate with the dual-core processor to realize the trusted loading of the dual-core relay protection system. Figure 8 As shown in the figure, the trusted loading process of the dual-core relay protection system is:
[0107] First level Boot execution;
[0108] Copy the secondary Boot to the on-chip RAM and DDR;
[0109] The first-level Boot runs the measurement script, calculates the second-level Boot hash value, and compares it with the whitelist stored in the on-chip RAM. If it passes, it proceeds to the next step;
[0110] The program jumps to the secondary Boot in DDR for execution. The secondary Boot reads the Core0 operating system image from the NOR Flash memory and copies it to DDR.
[0111] The secondary Boot runs the measurement script, calculates the hash value of the Core0 operating system image in DDR, and compares it with the whitelist stored in the on-chip RAM. If it passes, it proceeds to the next step;
[0112] The secondary Boot reads the Core1 operating system image from the NOR Flash memory and copies it to the DDR;
[0113] The secondary Boot runs the measurement script, calculates the hash value of the Core1 operating system image in DDR, and compares it with the whitelist stored in the on-chip RAM. If it passes, it proceeds to the next step;
[0114] Secondary Boot activates Core1;
[0115] Core1 initializes the operating system and waits for the Core0 operating system image to be initialized.
[0116] Core0 jumps to the Core0 operating system image in DDR for execution. During the execution, it completes the initialization of various peripherals such as eMMC, interrupt initialization, network initialization, NFS initialization, etc. Then, it loads the Core0 application from the eMMC file system to DDR;
[0117] The Core0 operating system loads the measurement program to measure the Core0 application in DDR;
[0118] Core1 completes NFS initialization and loads Core1 application from the eMMC file system to DDR through NFS;
[0119] The Core1 operating system loads the measurement program to measure the Core1 application in DDR;
[0120] Core0 executes the corresponding Core0 application in DDR according to the startup script;
[0121] Core1 executes the corresponding Core1 application in DDR according to the startup script; the entire startup process is completed.
[0122] In the above embodiment, a multi-level measurement verification method is adopted to ensure the legitimacy and integrity of the program files involved in the startup process of the dual-core relay protection system, which is beneficial to reducing the safety hazards during the startup process of the dual-core relay protection system and improving the safety of the system startup process.
[0123] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A dual-core relay protection system safe startup method, characterized in that: include: Execute the first level Boot in the first kernel; Copying the secondary Boot to the memory, and performing measurement verification on the secondary Boot to obtain the secondary Boot measurement verification result; The secondary Boot is a boot loader; If the secondary Boot measurement verification result is passed, executing the first copy script of the secondary Boot to copy and load the first kernel operating system image file in the external storage device into the memory; Execute the first measurement script of the secondary Boot, perform measurement verification on the first kernel operating system image file, and obtain a first operating system measurement verification result; If the first operating system metric verification result is passed, executing the second copy script of the secondary Boot to copy and load the second kernel operating system image file in the external storage device into the memory; Execute the second measurement script of the secondary Boot, perform measurement verification on the second kernel operating system image file, and obtain a second operating system measurement verification result; When the measurement verification result of the second operating system passes, executing the activation script of the secondary Boot to activate the second kernel; Executing the first kernel operating system image file and the second kernel operating system image file respectively to complete the initialization of the corresponding operating system and the loading of the corresponding application program; According to the startup script, execute the corresponding application to complete the startup of the dual-core relay protection system.
2. The dual-core relay protection system safe startup method according to claim 1, characterized in that: The copying of the secondary Boot to the memory and the measurement verification of the secondary Boot to obtain the secondary Boot measurement verification result include: The secondary Boot is copied to the memory, and the hash value of the secondary Boot is calculated and compared with the preset hash value whitelist to obtain the secondary Boot measurement verification result.
3. The dual-core relay protection system safe startup method according to claim 1, characterized in that: The first-level Boot in the first kernel is a boot program solidified in the first kernel.
4. The dual-core relay protection system safe startup method according to claim 1, characterized in that: The initialization of the operating system includes peripheral initialization, interrupt initialization, network initialization and NFS initialization.
5. The dual-core relay protection system safe startup method according to claim 1, characterized in that: After the first kernel operating system image file and the second kernel operating system image file are respectively executed to complete the initialization of the corresponding operating system and the loading of the corresponding application program, before the corresponding application program is executed according to the startup script to complete the startup of the dual-core relay protection system, the method further includes: The first kernel application and the second kernel application are respectively measured and verified.
6. The dual-core relay protection system safe startup method according to claim 1, characterized in that: The first core and the second core are both CK810 chips.
7. The dual-core relay protection system safe startup method according to any one of claims 1 to 6, characterized in that: Before executing the first level Boot in the first kernel, the process further includes: Performing physical memory management on the first core and the second core; Establish a mapping relationship between physical memory and virtual memory; A communication mechanism between the first kernel and the second kernel is established.
8. The dual-core relay protection system safe startup method according to claim 7, characterized in that: The performing physical memory management on the first kernel and the second kernel includes: The arbiter sorts the access priorities of the first core and the second core to the shared physical memory; Use the board support package configuration function to partition the exclusive physical memory.
9. The dual-core relay protection system safe startup method according to claim 7, characterized in that: The virtual memory includes a NOR Flash connected to the first core and the second core, and an eMMC connected to the first core.
10. The dual-core relay protection system safe startup method according to claim 7, characterized in that: The communication mechanism is a mailbox mechanism.
