Processor boot control method for embedded mainboard
By reserving a memory area and generating a target memory mapping table during the boot process of the embedded motherboard, and combining this with hardware binding checksums, the independence and security issues of runtime service modules during operating system operation are resolved, achieving high reliability and compatibility of the embedded system.
Patent Information
- Application Number
- CN202611525929.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-29
- Publication Date
- 2026-11-24
AI Technical Summary
In embedded systems, the independence and security of runtime service modules are difficult to maintain during operating system operation, especially under complex security threats and high reliability requirements. Existing technologies are unable to form an independent root of trust or security monitoring plane, and the strong dependence on the operating system makes it vulnerable to attacks.
By reserving a contiguous physical memory segment at the high address end of the main memory as a reserved memory area during the boot process, a target memory mapping table is generated, and the access permissions of the physical memory controller are configured. The exit boot service function call is intercepted, and a hardware binding verification value is generated by combining the hardware unique identifier code. A cryptographic binding relationship between the software and the hardware is established, and the boot process is started using a non-standard boot protocol to build a target system table that conforms to the standard firmware interface specification.
It achieves the independence and integrity of runtime service modules, reduces the risk of being tampered with by kernel layer code, improves system compatibility and portability, reduces the impact of operating system driver failures or security vulnerabilities, and ensures system reliability and security.
Smart Images

Figure CN123157276A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of processor control, and relates to a processor boot control method for an embedded motherboard. Background Technology
[0002] With the convergence of the Internet of Things (IoT), industrial automation, and edge computing technologies, embedded systems are increasingly widely used in smart grids, high-end manufacturing, and critical infrastructure. These systems, while undertaking business logic processing tasks, also bear the responsibility of ensuring data security and operational reliability. Establishing a trusted execution environment during the system startup and boot phase, and providing underlying service channels for the upper-level operating system, is a core technical challenge. In practical applications, maintaining a security service module that is both independent of and collaborative with the operating system within an open operating system environment remains a technical challenge and a limitation.
[0003] Currently, the industry primarily employs two technical solutions to achieve such persistent firmware services. The first solution follows the UEFI specification to implement standard runtime services. This involves writing runtime service functions that conform to specific API specifications in the firmware and registering their addresses in the runtime service table during system startup. After the operating system completes booting and calls the function to exit the boot service, it retains the memory space for these services, which can then be called through predetermined interfaces to perform operations such as variable reading / writing and system reset. The second solution involves loading a high-privilege kernel driver module after the operating system kernel is loaded. This module runs as part of the operating system, utilizing kernel-mode privileges to access hardware resources, simulating low-level firmware behavior, and providing service interfaces to upper-layer applications. Furthermore, Chinese invention patent CN104794393A proposes an embedded partition image security authentication and trusted kernel booting method and device, which performs security authentication on the partition image during the boot phase and thereby achieves trusted kernel booting.
[0004] While the aforementioned solutions are effective in specific scenarios, they have shortcomings when dealing with complex security threats and high reliability requirements. For the first solution, since runtime service addresses are registered in the runtime service table, the operating system can enumerate these services by reading the system table. The predictability of service entry points increases the risk of being located and attacked by malware, resulting in relatively weak isolation. For the second solution, since the module runs as part of the operating system, its lifecycle and operational state are governed by the operating system kernel. In the event of an attack on the operating system or a kernel crash, the service module fails, making it difficult to continue providing fault recovery or system monitoring capabilities. Its strong dependence on the operating system makes it difficult to constitute an independent root of trust or security monitoring plane. The solutions focus on image authentication and trusted kernel booting during the boot phase. How the runtime service module can remain independent and continue providing services during operating system operation after booting remains to be further addressed. In security service scenarios requiring strong binding to the hardware platform and transparency to the operating system, existing technologies need improvement. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a processor boot control method for embedded motherboards.
[0006] A processor boot control method for an embedded motherboard includes the following steps: S1. Obtain the power-on activation signal from the underlying motherboard, load the boot file and physical hardware configuration file, and generate the boot process; S2. Parse the physical hardware configuration file and obtain the preset configuration information of the runtime service module to be loaded. Calculate the running memory size accordingly, and divide the main memory into contiguous physical memory segments according to the running memory size to obtain the reserved memory area. S3. Obtain the reserved memory area, overwrite the reserved service memory identifier to the attribute field corresponding to the reserved memory area, and generate the target memory mapping table; S4. Obtain the binary compilation file of the runtime service module, load the binary compilation file into the reserved memory area, map the service function execution pointer of the runtime service module, generate the physical entry address, associate and encapsulate the specific image startup macro function, and integrate the physical entry address to generate the target system table; S5. Obtain the unique hardware identifier and the preset device key, merge the unique hardware identifier and the preset device key, generate a hardware binding verification value, verify the target system image based on the hardware binding verification value, and output the comparison judgment result. S6. If the comparison result is valid, load the kernel image built into the target system image and boot it. S7. Intercept the exit boot service function call triggered by the kernel image and lock the physical memory isolation policy; when a runtime service call request initiated by the kernel image is received, lock the bus control and convert the runtime service call request into a low-level bus write operation.
[0007] A further aspect of the present invention, step S1, includes the following steps: It receives the power-on activation signal from the underlying motherboard and starts the first-stage boot loading program stored in the solidified storage medium. The first-stage bootloader completes the power-on initialization task of the system's main running memory and loads the boot file to the starting address of the system's main running memory. The physical hardware configuration file is mounted to a preset offset memory address, and control of the processor is transferred to the boot file to generate the boot process.
[0008] A further aspect of the present invention, step S2, includes the following steps: Extract the device tree information contained in the physical hardware configuration file, and traverse the main memory physical capacity recorded in the device tree information; Evaluate the size of the code segment, read-only data segment, data segment, uninitialized data segment, and reserved function call stack contained in the runtime service module, and extract the preset proportional coefficients; The code segment size, read-only data segment size, data segment size, uninitialized data segment size, and function call stack size are summed together and then the redundant buffer space generated based on a preset ratio coefficient and rounded down is added. Finally, the memory page is rounded up to generate the running memory size. Match the highest address of the continuous physical memory segment corresponding to the physical capacity of the main memory, divide the highest address of the continuous physical memory segment according to the size of the running memory, and generate a reserved memory area.
[0009] A further aspect of the present invention, step S3, includes the following steps: Declare an initial memory mapping table containing the start and end addresses of physical memory, initialize the initial memory mapping table according to the physical hardware configuration file, and assign it an available memory identifier; Probe the reserved memory area mapped and covered by the initial memory mapping table, and clear the currently associated available memory identifiers of the reserved memory area; Overwrite the reserved service memory identifier to the corresponding attribute field of the reserved memory area, merge the reserved memory area and the attribute field, and generate the target memory mapping table.
[0010] A further aspect of the present invention, step S4, includes the following steps: The underlying motherboard's storage medium is used to read the bus and copy the binary compiled file to the physical memory space covered by the reserved memory area; Analyze the execution pointers of the various service functions that the runtime service module provides for external calls, and map each service function execution pointer to its corresponding physical entry address; Allocate contiguous space within the reserved memory area and create a system table data structure defined by the standard firmware interface specification. Associate and encapsulate specific image startup macro functions and integrate the physical entry address into the system table data structure to generate the target system table.
[0011] A further aspect of the present invention, step S5, includes the following steps: Access the physical electronic fuse register integrated in the underlying motherboard microprocessor and extract the unique hardware identifier of the physical electronic fuse register hardwired through the hardwire. Perform a byte concatenation operation on the unique hardware identifier and the preset device key to obtain the concatenated data block; The cryptographic hash algorithm is invoked, and the concatenated data block is input into the cryptographic hash algorithm for one-way calculation to generate a hardware binding verification value.
[0012] A further aspect of this invention involves verifying the target system image based on hardware-bound checksums and outputting a comparison result, including the following steps: Obtain the target system image released from the mounted storage medium, and separate the image payload data and image hash signature contained in the target system image; The hardware binding check value is appended to the end of the image payload data to generate a temporary data block; A preset cryptographic hash algorithm is applied to the temporary data block to calculate and generate a new hash value; The new hash value is compared byte by byte with the mirror hash signature, and the comparison result containing the legal or illegal status is output.
[0013] A further aspect of the present invention, step S6, includes the following steps: When the verification and comparison result is found to be valid, the mirror startup macro function encapsulated in the target system table is triggered; Traverse the partition blocks where the kernel image associated with the target system image is located, and copy the kernel image to the free physical memory segment marked in the target memory mapping table; Rewrite the program counter of the system bus processor to the first address of the free physical memory segment, and write the memory pointer at the first address of the target system table to the system kernel boot parameter register.
[0014] A further aspect of the present invention, step S7, includes the following steps: By redirecting the function execution pointer in the target system table to the reserved memory area in advance, the exit boot service function call issued by the kernel image is intercepted, and the reserved service memory identifier recorded in the target memory mapping table is re-verified; By using the exit boot service function call to trigger and lock the underlying physical memory controller, a hard isolation strategy is adopted to reject the kernel mode's remapping request to grant write permission attributes to the reserved memory area, and only allow the reserved read-only and execute permission mappings. Maintain a background listening state to prepare to take over runtime service call requests initiated by the kernel image for subsequent online firmware upgrade tasks.
[0015] A further aspect of this invention involves, upon receiving a runtime service call request initiated by the kernel image, locking bus control and converting the runtime service call request into a low-level bus write operation, including the following steps: Activate the runtime service module that remains alive and listening within the reserved memory area; Receive runtime service call requests that have been taken over through the runtime service module; The system blocks the global interrupts of the operating system to obtain exclusive control of the bus. Then, according to the preset conversion rules, it translates the runtime service call request into an SPI bus read / write operation for the underlying non-volatile memory chip, and restores the global interrupt after the execution is completed.
[0016] In summary, the present invention has the following beneficial technical effects: 1. During the boot process, a contiguous physical memory segment at the high address end of main memory is reserved as a reserved memory area. A target memory mapping table is generated by overwriting the reserved service memory identifier, and the access permissions of the physical memory controller are configured, placing the runtime service module in a protected, isolated memory region. When the operating system initializes the memory manager, it identifies this region as a firmware-reserved area based on the target memory mapping table and does not allocate it. Interception of exit boot service function calls triggers and locks the isolation policy of the physical memory controller, preventing high-privilege code from remapping this physical memory region to a writable state. This reduces the risk of the runtime service module being tampered with by kernel-level code, helping to maintain the independence and integrity of the runtime service module.
[0017] 2. A hardware-bound verification value generated based on the hardware's unique identifier is introduced into the system image verification process to establish a cryptographic binding relationship between the software and the physical hardware. This mechanism uses the hardware's unique identifier, which is embedded in the electronic fuse register, as one of the inputs for the verification calculation. When the system image is distributed in production or deployed for the first time on a device, it needs to be combined with the unique identifier of the target hardware board to generate a corresponding hardware-bound signature. When the image is used on unauthorized hardware or the image content is modified, the verification value mismatch will lead to signature verification failure, thereby reducing the risk of physical replacement attacks, software piracy, and unauthorized deployment. This establishes a link between software-level security authentication and the physical chip layer, forming a hardware-based trust foundation.
[0018] 3. A non-standard boot protocol is used to start the boot process. This process dynamically constructs a target system table conforming to the standard firmware interface specification, and uses this table to boot the standard operating system kernel. The boot logic that needs to be hidden is encapsulated within the boot process, which provides an interface conforming to the standard firmware specification through the target system table. This allows general-purpose operating system kernels to boot without requiring customized modifications to this boot mechanism. This approach reduces the coupling between the underlying security architecture and the upper-level operating system, improving system compatibility and portability while retaining the ability to customize the underlying boot process.
[0019] 4. Runtime service call requests are transformed into SPI bus read / write operations for the underlying non-volatile memory chip, forming a control path that bypasses the operating system driver stack and acts directly on the hardware. After receiving service requests from the upper layer, the runtime service module residing in the reserved memory area sends a sequence of bus instructions conforming to timing specifications directly to the target hardware without going through the operating system's file system, drivers, or interfaces. Prior to executing bus operations, exclusive bus control is obtained by suspending a global interrupt, which helps avoid the impact of operating system driver failures or security vulnerabilities and reduces the risk of bus race conditions caused by concurrent access. This shortens the execution path and improves reliability for operations such as firmware updates and critical parameter writing, achieving out-of-band control capabilities that are independent of the operating system's regular management path. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. The drawings are used to provide a further understanding of the present invention.
[0021] Figure 1 A flowchart illustrating an embodiment of this application is disclosed.
[0022] Figure 2 This is a schematic diagram illustrating the composition of the running memory size and memory page alignment in an embodiment of this application.
[0023] Figure 3 This is a schematic diagram showing the comparison of the memory mapping table before and after the update in the embodiments of this application.
[0024] Figure 4 This is a schematic diagram illustrating hardware binding verification and image validity determination in an embodiment of this application.
[0025] Figure 5 Structural schematic diagrams of embodiments of this application are disclosed. Detailed Implementation
[0026] The following is in conjunction with the appendix Figures 1-5 A preferred description of the present invention is provided below.
[0027] See attached document Figure 1 This invention proposes a processor boot control method for an embedded motherboard, comprising the following steps: S1. Obtain the power-on activation signal from the underlying motherboard, load the boot file and physical hardware configuration file, and generate the boot process; S2. Parse the physical hardware configuration file and obtain the preset configuration information of the runtime service module to be loaded. Calculate the running memory size accordingly, and divide the main memory into contiguous physical memory segments according to the running memory size to obtain the reserved memory area. S3. Obtain the reserved memory area, overwrite the reserved service memory identifier to the attribute field corresponding to the reserved memory area, and generate the target memory mapping table; S4. Obtain the binary compilation file of the runtime service module, load the binary compilation file into the reserved memory area, map the service function execution pointer of the runtime service module, generate the physical entry address, associate and encapsulate the specific image startup macro function, and integrate the physical entry address to generate the target system table; S5. Obtain the unique hardware identifier and the preset device key, merge the unique hardware identifier and the preset device key, generate a hardware binding verification value, verify the target system image based on the hardware binding verification value, and output the comparison judgment result. S6. If the comparison result is valid, load the kernel image built into the target system image and boot it. S7. Intercept the exit boot service function call triggered by the kernel image and lock the physical memory isolation policy; when a runtime service call request initiated by the kernel image is received, lock the bus control and convert the runtime service call request into a low-level bus write operation.
[0028] In one embodiment of the present invention, step S1 includes the following steps: It receives the power-on activation signal from the underlying motherboard and starts the first-stage boot loading program stored in the solidified storage medium. The first-stage bootloader completes the power-on initialization task of the system's main running memory and loads the boot file to the starting address of the system's main running memory. The physical hardware configuration file is mounted to a preset offset memory address, and control of the processor is transferred to the boot file to generate the boot process.
[0029] Specifically, the central processing unit (CPU) integrated into the embedded motherboard executes the process in conjunction with a pre-installed firmware. First, when the CPU receives a power-on activation signal released by the underlying motherboard system bus, its internal program counter is forced to point to a preset physical address within the firmware, thereby starting the first-stage bootloader stored at that address. This first-stage bootloader is a streamlined, low-level startup code embedded in the chip's internal read-only memory or onboard SPI Flash chip. Its core function is to perform basic hardware initialization, such as configuring the processor clock and initializing the DRAM controller.
[0030] The first-stage bootloader is a piece of binary code that follows a non-standard firmware interface protocol and does not rely on common advanced firmware specifications. Furthermore, non-standard firmware interface protocols refer to proprietary boot specifications defined by specific processor manufacturers or motherboard designers, distinct from industry-standard UEFI or advanced configuration and power interfaces.
[0031] It should be noted that, regardless of the specific private boot specification followed by the first-stage bootloader, the operations performed in this method are the same as those described above: completing the most basic hardware initialization, loading the boot file and physical hardware configuration file, and transferring control of the processor. These operations and their implementation methods have been disclosed in detail above. The specific instruction encoding format of the private boot specification is not necessary information for implementing this method, nor is it part of the technical solution claimed by this method. Anyone skilled in the art can implement this step using any boot code capable of performing the above operations.
[0032] The central processing unit executes the instruction sequence of the first-stage bootloader, and completes the power-on initialization task of the system's main running memory by writing a series of timing and configuration parameters to the memory controller register on the motherboard, so that the system's main running memory changes from an unordered state to a stable working state that can be addressed and read and written.
[0033] After initialization, the first-stage bootloader calls its built-in storage media access driver to read a boot file from a non-volatile storage device and loads the complete binary data stream of that file into the physical starting address of the system's main memory. The boot file is a separately compiled binary executable program that can run directly in a bare-metal environment.
[0034] In the first stage, the bootloader accesses the non-volatile storage device again, reads the physical hardware configuration file, and mounts the file to a preset offset memory address. This address is chosen to avoid overlap with the previously loaded boot file in memory space. In this embodiment, the physical hardware configuration file is a data set file describing the non-plug-and-play hardware resources on the motherboard. It typically uses a device tree information format and contains key information such as the number of processor cores, the range of physical memory addresses, and the addresses of peripheral device registers.
[0035] Furthermore, the preset offset memory address is a fixed offset relative to the physical starting address of the system's main running memory. Its specific value is set according to the target system's memory layout strategy, with a typical value range of 16MB to 64MB, to ensure that its loading area is independent of the boot program itself and the loading area of the subsequent operating system kernel.
[0036] After confirming that the boot file and physical hardware configuration file have been correctly loaded into memory, the first-stage bootloader executes a program jump instruction, formally transferring control of the central processing unit to the starting execution address of the boot file. Thus, the static boot file is transformed into a dynamically running boot process, which begins to take over the subsequent boot process.
[0037] For example, suppose an embedded motherboard is configured with an ARM architecture processor and 1GB of DRAM, with a physical address space from 0x40000000 to 0x7FFFFFFF. Upon power-up, the processor executes the first-stage bootloader, 128KB in size, embedded in the onboard SPI Flash chip. This program first configures the memory controller, making the 1GB of DRAM available. Then, it reads a boot file named bpal.bin, 512KB in size, from the onboard eMMC storage and loads it into the physical starting address of the system's main memory, i.e., 0x40000000. Next, the program continues to read a physical hardware configuration file named platform.dtb, 32KB in size, from the eMMC and loads it into a preset offset memory address. If the set offset is 32MB, i.e., 0x02000000, then the target address for loading this configuration file is 0x42000000. After all loading operations are complete, the first-stage bootloader executes a jump instruction, redirecting the program execution flow to 0x40000000. At this point, processor control is successfully transferred to the boot file already in memory, which begins running as the boot process.
[0038] In one embodiment of the present invention, step S2 includes the following steps: Extract the device tree information contained in the physical hardware configuration file, and traverse the main memory physical capacity recorded in the device tree information; Evaluate the size of the code segment, read-only data segment, data segment, uninitialized data segment, and reserved function call stack contained in the runtime service module, and extract the preset proportional coefficients; The code segment size, read-only data segment size, data segment size, uninitialized data segment size, and function call stack size are summed together and then the redundant buffer space generated based on a preset ratio coefficient and rounded down is added. Finally, the memory page is rounded up to generate the running memory size. Match the highest address of the continuous physical memory segment corresponding to the physical capacity of the main memory, divide the highest address of the continuous physical memory segment according to the size of the running memory, and generate a reserved memory area.
[0039] Specifically, after the boot process gains control of the processor, it begins to perform preparatory work for building the subsequent system environment. The boot process calls the internally integrated device tree parsing function library, taking the mount address of the physical hardware configuration file in memory as input, and parses it node by node. Device tree information is a data structure describing hardware devices, organized in a tree structure, used to pass low-level hardware configuration information to the operating system kernel during the boot process; its binary format is usually stored in a .dtb file.
[0040] By traversing the device tree information encapsulated in the physical hardware configuration file, the process is guided to locate the memory node that describes the system memory layout, and reads the physical memory base address and size defined in its reg attribute, thereby obtaining the physical capacity of the main memory.
[0041] Next, in order to estimate the space occupied by runtime service modules that need to reside permanently in memory, the bootstrap process obtains the preset structure information of the runtime service modules to be loaded, and analyzes each binary segment that constitutes the runtime service module based on the preset structure information.
[0042] Furthermore, runtime service modules are software components designed to remain active in memory after the operating system starts, providing persistent, near-firmware-level services to the operating system, such as secure variable storage, system reset control, or firmware update interfaces.
[0043] Specifically, it evaluates the size of the code segment containing all executable instructions, the size of the read-only data segment used to store constants and strings, the size of the data segment containing all initialized global and static variables, and the size of the BSS segment used to store uninitialized variables, and extracts the preset scaling factor used to set the safety margin.
[0044] The runtime memory size is generated by summing the code segment size, read-only data segment size, data segment size, BSS segment size, function call stack size reserved for this module, and redundant buffer space after rounding down, and then rounding up using a specific memory page alignment function.
[0045] Based on the main memory physical capacity information previously obtained from the physical hardware configuration file, the boot process determines the highest address boundary of the physical memory. Using this highest address boundary as a reference, it divides a contiguous physical memory space equal in size to the running memory using reverse addressing, and designates this space as a reserved memory area. The start and end addresses of this area are recorded for later use. This contiguous physical memory space is specifically the contiguous physical memory segment at the highest address end, referring to an unoccupied contiguous address region located at the top of the system's main running memory physical address space. This region is chosen to reduce the probability of it being accidentally allocated and modified by other components during the initial system startup.
[0046] RAM size The calculation formula is: ; in, This represents the final calculated size of the running memory. , , , , and calculation results The units are all bytes, and the scaling factor is... It is a dimensionless pure number. This represents the size of the code segment (.text section) in the binary file of the runtime service module. This value can be obtained by reading the header information of the ELF format file or similar metadata. This represents the size of the read-only data segment of the runtime service module, specifically the .rodata segment. This represents the size of the initialized data segment of the runtime service module, i.e., the .data segment. This represents the size of the uninitialized data segment of the runtime service module, i.e., the .bss segment. This area needs to be zeroed out when the module is loaded.
[0047] This represents the size of the stack space allocated independently for the runtime service module. This is a default value, set based on a worst-case assessment of the module's runtime function call depth and local variable usage, and is typically set between 64KB and 256KB to prevent stack overflow. This represents a preset ratio coefficient used to provide a safety margin. The buffer space calculated based on this ratio can cope with future module function expansion or dynamic memory allocation needs, and is usually taken as 10% to 20%. This represents the floor function, used to eliminate decimal places in floating-point numbers; This represents the memory page alignment function, which rounds the internal summation result up to the page size. Integer multiples of, This represents the page size in bytes, typically set to 4096 or 8192, which corresponds to 4KB or 8KB.
[0048] For example, see Figure 2 The boot process has started running at address 0x40000000. It first accesses the physical hardware configuration file platform.dtb located at address 0x42000000. Through parsing, it confirms that the physical capacity of main memory is 1GB, with an address range from 0x40000000 to 0x7FFFFFFF. Next, the process begins calculating the runtime memory size. Assume the estimated sizes of the various parts of the runtime service module are as follows: code segment size... The read-only data segment size is 114,688 bytes, or 112KB. The data segment size is 8192 bytes, or 8KB. The BSS segment size is 32768 bytes, or 32KB. The stack size is 16384 bytes, or 16KB. The process allocates a relatively generous stack size for this module. It is 65,536 bytes, or 64KB, and is based on a preset scaling factor of 20%. The additional redundant buffer space required is calculated, and the value is obtained after processing with a floor function. Bytes. Therefore, the sum of the code segment, read-only data segment, data segment, BSS segment, stack, and redundant buffer space is . Bytes. Assuming the system's page size The memory size is 4096 bytes, calculated by rounding up using the memory page alignment function. The final value was confirmed to be 286,720 bytes, which equals 280KB, or 0x46000 in hexadecimal. Finally, based on the 1GB physical capacity of main memory, the process determined the top address of the reserved memory region to be 0x80000000. From this address, 280KB of space was allocated backwards, and the starting address of the reserved memory area was calculated to be 0x80000000 - 0x46000 = 0x7FFBA000. Therefore, the reserved memory area was ultimately determined to be the memory region with physical addresses ranging from 0x7FFBA000 to 0x7FFFFFFF.
[0049] In one embodiment of the present invention, step S3 includes the following steps: Declare an initial memory mapping table containing the start and end addresses of physical memory, initialize the initial memory mapping table according to the physical hardware configuration file, and assign it an available memory identifier; Probe the reserved memory area mapped and covered by the initial memory mapping table, and clear the currently associated available memory identifiers of the reserved memory area; Overwrite the reserved service memory identifier to the corresponding attribute field of the reserved memory area, merge the reserved memory area and the attribute field, and generate the target memory mapping table.
[0050] Specifically, after allocating the reserved memory area, the boot process begins to logically reconstruct the physical memory topology of the underlying motherboard in order to generate a target memory mapping table that can be recognized by the upper-level operating system but contains specific lies.
[0051] The boot process declares and creates an initial memory mapping table in its own temporary working memory. This mapping table is essentially an array of data structures used to describe the distribution and attributes of all physical memory blocks in the system.
[0052] Furthermore, the initial memory mapping table is a collection of memory descriptors defined in accordance with a specific firmware interface specification. In an implementation that conforms to the UEFI specification, this instance corresponds to a memory mapping table, where each descriptor is a data structure that contains at least fields such as memory type, physical starting address, page number, and memory attributes.
[0053] Based on the memory node information parsed from the physical hardware configuration file in the previous steps, an initial memory mapping table is initialized. All physically existing memory segments on the motherboard, such as main DRAM, are filled into this instance as independent entries, and each entry is assigned an initial available memory identifier, indicating that this memory can be freely allocated by the operating system. The available memory identifier is a specific enumeration value or macro definition used to identify that the memory region is ordinary memory that can be used by the operating system's loader, kernel, drivers, and applications.
[0054] The process begins searching the initial memory mapping table, which has been preliminarily established, with the goal of locating a memory entry whose address range completely covers or partially contains reserved memory areas.
[0055] Once the target entry is detected, the process will perform memory block splitting and attribute modification operations. This involves stripping the address range occupied by the reserved memory area, separating it from the original memory entry, and forming a new, independent memory description entry.
[0056] Simultaneously, for this newly created entry, the process clears its previously inherited available memory markers. Next, the boot process overwrites the attribute fields of this new entry representing the reserved memory area, writing a predefined reserved service memory identifier. This identifier, as an attribute reservation identifier, informs the subsequent operating system kernel that although the memory block physically exists, it is occupied by firmware-level persistent services and cannot be used as ordinary memory. The reserved service memory identifier is another specific enumeration value that declares the corresponding memory region storing service code that needs to remain active during operating system operation, such as functions used to handle system restarts, firmware variable read / write operations, or power management events. After the operating system completes booting and calls the exit boot service, it retains the contents of these regions without clearing them.
[0057] The reserved memory area entry with modified attributes is merged with all other entries representing actual available memory in the initial memory mapping table to form the final target memory mapping table. This table will be fixed in a specified location in memory, waiting to be handed over to the operating system.
[0058] In this embodiment, the target memory map is a memory layout view generated by the boot process and ultimately provided to the operating system kernel. Although it is based on real physical memory, it achieves a kind of logical hiding by strategically modifying the attributes of the reserved memory area. At the same time, combined with the access permission firewall configured on the underlying memory controller, it restricts the operating system kernel from directly reading and writing to this specific physical address segment, thereby achieving the purpose of protecting this area from being covered by the regular operating system mechanism or rewritten by privileged malicious code.
[0059] See Figure 3For example, given that the physical capacity of main memory is determined to be 1GB, with an address range of 0x40000000 to 0x7FFFFFFF, and the reserved memory area is located in the address range of 0x7FFBA000 to 0x7FFFFFFF, the boot process first generates an initial memory mapping table based on the physical hardware configuration file. This table contains an entry describing main memory: {Type: Available memory, Start address: 0x40000000, End address: 0x7FFFFFFF}. Next, the process detects that the reserved memory area 0x7FFBA000-0x7FFFFFFF is located at the end of this entry. Therefore, the process splits the original entry in two and modifies the type attribute of the second entry. After this operation, the initial memory mapping table is updated with two entries: Entry 1: {Type: Available memory, Start address: 0x40000000, End address: 0x7FFB9FFF}; Entry 2: {Type: Reserved service memory, Start address: 0x7FFBA000, End address: 0x7FFFFFFF}. These two entries together constitute the final generated target memory mapping table. This table clearly defines the vast majority of memory as available, while marking the top 280KB memory area for use by firmware runtime services, thus laying the foundation for subsequent loading of runtime service modules and ensuring their long-term survival in the operating system environment.
[0060] In one embodiment of the present invention, step S4 includes the following steps: The underlying motherboard's storage medium is used to read the bus and copy the binary compiled file to the physical memory space covered by the reserved memory area; Analyze the execution pointers of the various service functions that the runtime service module provides for external calls, and map each service function execution pointer to its corresponding physical entry address; Allocate contiguous space within the reserved memory area and create a system table data structure defined by the standard firmware interface specification. Associate and encapsulate specific image startup macro functions and integrate the physical entry address into the system table data structure to generate the target system table.
[0061] Specifically, after generating the target memory mapping table, the boot process continues to build a functional virtual firmware working environment. To this end, the process first performs storage medium access operations, calling the underlying motherboard's built-in storage medium read bus controller driver and sending instructions to the controller to read the binary compiled file of the runtime service module from a non-volatile storage device, such as eMMC. The binary compiled file of the runtime service module is an object file compiled according to a specific executable file format, such as ELF format, containing program code and data that can continue to provide services after the operating system starts.
[0062] The read binary data stream is copied as a whole to the physical memory space covered by the previously designated reserved memory area via direct memory access. After completing the block copy operation without relocation, this process also includes zeroing the BSS segment address range within the reserved memory area and mounting the stack pointer required for service operation to complete the initialization of the runtime environment.
[0063] After loading is complete, the boot process needs to obtain the entry addresses of each service function within the module. It analyzes the binary image of the runtime service module loaded into memory, and based on a predefined file header or symbol table structure, identifies the service functions that the module plans to provide for external calls, such as the names of functions for getting variables, setting variables, or resetting the system, and their relative offset addresses within the module.
[0064] The physical starting address of the reserved memory area is added to the relative offset address obtained for each function to calculate the physical entry address of each service function in the current physical memory space. The physical entry address is an absolute physical address that points to the location in physical memory where the first instruction of a function in the runtime service module is stored. The processor can directly jump to this address to execute the corresponding function.
[0065] After obtaining the entry addresses of all necessary functions, the boot process allocates contiguous space in the reserved memory area and creates a blank system table data structure in accordance with a data structure standard defined by a standard firmware interface specification.
[0066] Furthermore, in this embodiment, the standard firmware interface specification specifically refers to the UEFI protocol, which defines in detail the interfaces, services, and data structures for interaction between the operating system and the firmware. Based on this, the system table data structure is the system table structure defined according to the UEFI protocol standard, mainly including a top-level system table, which contains pointers to the boot service table and the runtime service table.
[0067] The process fills the previously calculated set of physical entry addresses into the corresponding function pointer fields in the system table data structure one by one. At the same time, it encapsulates the predefined image startup macro function and integrates the address of the previously generated target memory mapping table, thereby assembling and generating a complete target system table. This table, as a core data structure, forms the cornerstone of the virtual firmware working environment.
[0068] Furthermore, the target system table is the final product of the system table data structure being specifically instantiated and filled with all valid data, including the physical entry address and the target memory mapping table address. It will serve as the core parameter for booting the next stage of the operating system.
[0069] For example, the reserved memory area has an address range from 0x7FFBA000 to 0x7FFFFFFF. The boot process first reads the binary compiled file of the runtime service module named rsm.bin from the eMMC, which is 160KB in size. The process copies the entire contents of this file to physical memory address 0x7FFBA000. Next, the process analyzes the rsm.bin image located in memory. Suppose that by parsing its internal symbol table, it is found that the GetVariable function is located at an offset of 0x1000 relative to the beginning of the file, the SetVariable function is located at an offset of 0x1500, and the ResetSystem function is located at an offset of 0x2050. Therefore, the process calculates the physical entry address of the GetVariable function as 0x7FFBA000 + 0x1000 = 0x7FFBB000, the SetVariable function as 0x7FFBA000 + 0x1500 = 0x7FFBB500, and the ResetSystem function as 0x7FFBA000 + 0x2050 = 0x7FFBC050. Subsequently, the process allocates contiguous space in the reserved memory area, for example, physical address 0x7FFE2000, creates a system table structure according to the UEFI protocol definition, and populates it with a runtime service table. It writes the calculated address 0x7FFBB000 into the field containing the GetVariable function pointer in the runtime service table, 0x7FFBB500 into the field containing the SetVariable function pointer, and 0x7FFBC050 into the field containing the ResetSystem function pointer. Simultaneously, it also fills the starting address of the target memory mapping table generated in the previous stage into the corresponding configuration table pointer in the system table. Once this series of filling operations is completed, a target system table containing real function pointers and a deceptive memory layout is built, marking that the virtual firmware working environment is ready.
[0070] In one embodiment of the present invention, step S5 includes the following steps: Access the physical electronic fuse register integrated in the underlying motherboard microprocessor and extract the unique hardware identifier of the physical electronic fuse register hardwired through the hardwire. Perform a byte concatenation operation on the unique hardware identifier and the preset device key to obtain the concatenated data block; The encrypted hash algorithm is invoked, and the concatenated data block is input into the encrypted hash algorithm for one-way calculation to generate a hardware-bound verification value; Obtain the target system image released from the mounted storage medium, and separate the image payload data and image hash signature contained in the target system image; The hardware binding check value is appended to the end of the image payload data to generate a temporary data block; A preset cryptographic hash algorithm is applied to the temporary data block to calculate and generate a new hash value; The new hash value is compared byte by byte with the mirror hash signature, and the comparison result containing the legal or illegal status is output.
[0071] Specifically, after the virtual firmware working environment is built, the boot process enters a security verification phase to ensure that the operating system image to be loaded is authorized and has not been tampered with. First, the process performs low-level hardware addressing operations, accessing one or more physical electronic fuse registers integrated within the underlying motherboard microprocessor by directly reading and writing memory-mapped input / output addresses. These physical electronic fuse registers are a set of non-volatile memory units within the chip that can only be programmed once, used to permanently store the chip's or circuit board's unique identifier, security configuration, or calibration data. These registers pre-fuse a string of binary data reflecting the underlying hardwired status using fusing or anti-fusing technology; the process extracts this data to obtain the hardware's unique identifier.
[0072] Furthermore, the hardware unique identifier is a fixed-length binary sequence, such as a 16-byte UUID, which ensures the traceability and uniqueness of each hardware board.
[0073] Subsequently, the process invokes an internally embedded cryptographic hash algorithm. This algorithm is a publicly available, security-verified cryptographic hash function that ensures that even minor changes in the input data will cause an avalanche effect in the output hash value. The algorithm is based on a preset device key pre-injected into the boot process code segment. In this embodiment, the preset device key is a constant byte string set and kept secret by the device manufacturer and hard-coded into the boot process's binary file to increase the difficulty for attackers to forge signatures offline.
[0074] The extracted hardware unique identifier is then fused and transformed. Specifically, the hardware unique identifier is concatenated with a preset device key, and the concatenated data block is used as input to a cryptographic hash algorithm for one-way calculation, ultimately generating a fixed-length hardware binding verification value that is strongly correlated with the current hardware physical layer.
[0075] After obtaining this checksum, the process switches to the mounted storage medium to retrieve the target system image to be loaded. Further, the target system image is the software to be booted in the next stage, typically the operating system's bootloader or the kernel itself. Structurally, this image file contains two parts: the actual image payload data and a separately stored, associated image hash signature. The process first reads the entire image payload data of the target system image into memory, then appends the previously calculated hardware binding checksum to the end of the image payload data, forming a temporary data block. The process then performs another cryptographic hash algorithm on this temporary data block to calculate a new hash value. Finally, the process compares this newly calculated hash value byte-by-byte with the image hash signature read from the image file.
[0076] If the two are completely identical, a valid comparison result is generated. Conversely, if any inconsistency exists, an invalid comparison result is generated.
[0077] Hardware binding verification value and comparison and judgment results The generation process can be described by the following logical formula: ; ; in, This represents the hardware binding verification value generated by the calculation. This represents a cryptographic hash algorithm, such as the SHA-256 algorithm or the Chinese national cryptographic algorithm SM3. This represents a unique hardware identifier extracted from the physical electronic fuse register. This represents a pre-injected preset device key. This represents a byte concatenation operation.
[0078] The final comparison result is represented by a Boolean value. This represents the image payload data separated from the target system image. This represents the image hash signature read from the associated portion of the target system image. "" represents a comparison operation for bitwise equality.
[0079] Among these, image hash signing is performed by an authorized platform or trusted edge deployment tool using the target hardware during image distribution or initial controlled deployment of a device. and the same The same logic is followed to calculate and attach verification values to specific locations on the image, thus balancing the requirements for preventing physical cloning with the engineering feasibility of large-scale online upgrades.
[0080] See Figure 4 For example, the boot process reads a 16-byte hardware unique identifier, 0x112233445566778899AABBCCDDEEFF00, from the physical electronic fuse register of the motherboard processor. The preset device key stored internally by the process is another 16-byte constant, 0x0A1B2C3D4E5F67899876543210FEDCBA. The process concatenates these two into a 32-byte data block and uses the SHA-256 algorithm to calculate a 32-byte hardware binding checksum, denoted as 0x5E884898DA28047151D0E56F8DC6292773603D0D6AAB4D87B8E7D5F31EA48649. Subsequently, the process reads the target system image boot.img from the eMMC. Its image payload is 16MB in size, and its accompanying image hash signature is stored as 0xC342E2F0A341495A233379E6F40A5B1884B3F935705C63B7A35398335D23A7CF. The process concatenates the 16MB image payload with the previously calculated 32-byte checksum 0x5E88...8649, and then performs the SHA-256 algorithm again on this 16,777,248-byte data block. The calculated new hash value is 0xC342E2F0A341495A233379E6F40A5B1884B3F935705C63B7A35398335D23A7CF. Since the calculated value is exactly the same as the stored signature value, the final comparison result output by the bootstrapping process is true, which corresponds to a valid state.
[0081] In one embodiment of the present invention, step S6 includes the following steps: When the verification and comparison result is found to be valid, the mirror startup macro function encapsulated in the target system table is triggered; Traverse the partition blocks where the kernel image associated with the target system image is located, and copy the kernel image to the free physical memory segment marked in the target memory mapping table; Rewrite the program counter of the system bus processor to the first address of the free physical memory segment, and write the memory pointer at the first address of the target system table to the system kernel boot parameter register.
[0082] Specifically, after the image hash signature comparison determines it to be in a valid state, the boot process begins to simulate the standard firmware service startup process to boot the target system image. The boot process verifies the comparison result generated in the previous step, confirming it as a security verification flag indicating a valid state. This security verification flag is an internal Boolean variable; when its value is true, the program flow is allowed to continue executing subsequent boot steps; otherwise, an error handling process is triggered, such as a shutdown or entering recovery mode. Once confirmed, the process immediately triggers the predefined image boot macro function contained within the target system table. This image boot macro function is a piece of code logic within the boot process that simulates the combined behavior of boot services such as LoadImage and StartImage in the UEFI specification, implementing the complete chain from image file location and loading to execution. This macro function is actually a wrapper call to a series of standardized firmware boot services; its execution redirects the boot process to loading upper-layer system components.
[0083] Next, the image startup macro function begins execution, which first parses the internal structure of the target system image, which typically follows a specific partition or file system format.
[0084] By traversing the partition blocks where the kernel image associated with the target system image is located, such as searching for a specific boot file path in the EFI system partition, the macro function locates the actual kernel image file.
[0085] Furthermore, a kernel image refers to the binary representation of the core functions of an operating system. For example, in Unix-like systems, it is usually a file named vmlinuz or Image, which contains modules such as the operating system's core scheduler, memory manager, and file system. Once located, the macro function reads the complete binary content of the file and copies it byte by byte into a free physical memory segment marked as available by the target memory mapping table.
[0086] In this embodiment, the free physical memory segment is any contiguous region marked as available memory in the previously generated target memory map table. When selecting this region, it must be ensured that its size is sufficient to accommodate the entire kernel image. This loading process ensures that the operating system kernel is placed in a safe, contiguous address space that does not conflict with reserved memory areas.
[0087] After the kernel is loaded, in order to seamlessly transfer the processor's execution control to the kernel's entry point, the boot process rewrites the value of the system bus processor's program counter to the starting address of a free physical memory segment by directly writing to registers.
[0088] Before executing the final jump instruction, the process needs to pass crucial boot parameters to the kernel about to start. To do this, it uses a register write instruction to write the memory pointer to the starting address of the previously constructed target system table into the system kernel boot parameter register. The memory pointer to the starting address of the target system table is a 32-bit or 64-bit unsigned integer, its value equal to the starting address of the target system table in physical memory. This register is typically a specific general-purpose register specified in the target system's boot protocol, for initial kernel read during startup.
[0089] With all preparations complete, the processor will continue execution from the kernel's starting address and will be able to access the complete target system table, which contains runtime services and memory layout, through the received pointer.
[0090] For example, after the boot process confirms that the comparison result is true, indicating a legitimate status, it begins executing subsequent processes. It calls its internal image startup macro function, using boot.img as the target system image. This macro function finds that boot.img is a file system image containing the EFI system partition and locates the kernel image at the path \EFI\BOOT\BOOTAA64.EFI. Assuming this kernel file is 8MB in size, the macro function consults the target memory mapping table and finds a sufficiently large free physical memory segment starting at physical address 0x48000000. Therefore, it copies the entire contents of the BOOTAA64.EFI file from the storage medium to the 8MB memory space starting at address 0x48000000. After the copy is complete, the process sets the program counter to 0x48000000. Before executing the jump, assuming the previously constructed target system table is located at the protected physical address 0x7FFE2000, the process writes the value 0x7FFE2000 into the processor's R0 register. This register is used as a kernel boot parameter to pass the system table pointer in the target system's boot convention. Finally, a jump instruction is executed, and the processor begins executing the first instruction of the operating system kernel from address 0x48000000, thus initializing a completely new and fully functional operating system environment.
[0091] In one embodiment of the present invention, step S7 includes the following steps: By redirecting the function execution pointer in the target system table to the reserved memory area in advance, the exit boot service function call issued by the kernel image is intercepted, and the reserved service memory identifier recorded in the target memory mapping table is re-verified; By using the exit boot service function call to trigger and lock the underlying physical memory controller, a hard isolation strategy is adopted to reject the kernel mode's remapping request to grant write permission attributes to the reserved memory area, and only allow the reserved read-only and execute permission mappings. Maintain a background listening state to prepare to take over runtime service call requests initiated by the kernel image for subsequent online firmware upgrade tasks; Activate the runtime service module that remains alive and listening within the reserved memory area; Receive runtime service call requests that have been taken over through the runtime service module; The system blocks the global interrupts of the operating system to obtain exclusive control of the bus. Then, according to the preset conversion rules, it translates the runtime service call request into an SPI bus read / write operation for the underlying non-volatile memory chip, and restores the global interrupt after the execution is completed.
[0092] Specifically, once the kernel image starts running and gradually completes system initialization, it may attempt to perform operations that are destructive to the underlying firmware environment or require special privileges. During this stage, the boot process initiates monitoring and interception logic.
[0093] A pre-deployed call interception module in the boot process redirects the execution pointer of the exit boot service function to a pre-defined interception function loaded in the reserved memory area by replacing the pointer in the target system table, thereby effectively intercepting the exit boot service function call issued by the kernel image.
[0094] Furthermore, the exit boot service function call corresponds to the `ExitBootServices()` function call in the UEFI specification. The operating system must call this function after completing its own initialization to inform the firmware that all memory and services used during the boot phase can be released. Once this call is intercepted, the interception module does not immediately allow it; instead, it re-verifies the reserved service memory identifier associated with the reserved memory area in the target memory mapping table. This re-verification of the reserved service memory identifier is a security measure to prevent accidental or malicious tampering during the boot process, ensuring that subsequent protection actions are based on correct state judgments. Only when the identifier still exists and is valid will the subsequent blocking and takeover logic be triggered.
[0095] After confirming that the identifier is correct, the boot process actively intervenes and uses this triggering opportunity to lock the access permission policy of the underlying physical memory controller through register operations. It rejects any subsequent illegal requests to remap physical to virtual addresses to grant write permissions to the reserved memory area, and only allows the establishment of strict read-only and execute mappings. This not only follows the standard system specification of not reclaiming reserved memory, but also ensures at the hardware level that the area and the runtime service modules therein will not be tampered with or destroyed even in the face of kernel attacks after privilege escalation.
[0096] Meanwhile, the core logic of the boot process continues to listen in the background. When upper-layer applications of the operating system, such as online firmware upgrade tools, initiate runtime service call requests that require interaction with the underlying firmware—for example, writing to boot variables or updating the firmware image—these runtime service call requests refer to system-level operation requests that go beyond standard file read / write and network communication and require direct interaction with the platform firmware. These requests are ultimately directed by the kernel to runtime service function pointers in the target system table previously passed in. Since these pointers point to runtime service modules, the boot process successfully takes over these call requests.
[0097] The boot process activates the runtime service module, which resides in a reserved memory area and remains constantly monitoring. Upon receiving a runtime service call request to be taken over, this module analyzes its intent and first secures exclusive control of the hardware bus by sending a spinlock request to the system's concurrency control register or temporarily disabling global interrupts from the operating system.
[0098] Subsequently, based on preset conversion rules, it is translated into a series of SPI bus read / write operations for the underlying non-volatile memory chip, conforming to specific hardware timings. The SPI bus is a widely used interface in embedded systems for low-speed serial data communication between microcontrollers and peripheral devices such as flash memory and sensors. Directly writing to its bus means that read, write, and erase operations can be performed on the chip at a very low hardware abstraction level.
[0099] Furthermore, in one embodiment of the present invention, the preset conversion rule includes three stages: request type parsing, command code mapping, and address mapping. The runtime service module determines the request type based on the function identifier carried in the runtime service call request and maps the request type to the corresponding flash memory command code sequence: for variable read requests, such as a GetVariable request, it is mapped to a read operation sequence of "read data command code - target storage address - read status register verification response"; for variable write requests, such as a SetVariable request, it is mapped to a write operation sequence of "write enable command code - page programming command code - target storage address - write data"; for system reset requests, such as a ResetSystem request, it is mapped to a register write operation to the watchdog timer or reset control register without occupying the SPI bus. The address mapping rule is as follows: the variable name and its namespace identifier carried in the runtime service call request are mapped to the physical storage address in the storage partition reserved for firmware variables in the underlying non-volatile memory chip through a preset hash index or by looking up a pre-built variable address mapping table. The command code is selected based on the device standard SPI instruction set of the underlying non-volatile memory chip, such as read data command code 0x03, write enable command code 0x06, page programming command code 0x02, and sector erase command code 0xD8. The runtime service module selects the corresponding command code from the above standard instruction set according to the nature of the requested operation (read, write, erase) and frames and sends it according to the timing requirements specified in the device manual.
[0100] In this embodiment, the runtime service module transforms these abstract software requests, such as setting the next boot entry to network boot, into specific hardware instruction sequences, such as writing the byte sequence 0x01, 0x04 to address 0x1F0000 of the flash memory chip, thus bridging the software requests to the underlying hardware execution. Therefore, this method directly achieves secure control over the underlying hardware without relying on operating system drivers and avoiding bus race conditions caused by concurrent operations. After the operation is completed, the operating system's driver context and interrupt response are restored, forming a complete low-level bus write loop.
[0101] For example, after the operating system completes device driver loading and user environment initialization, it calls the `ExitBootServices()` function, which is essentially a call to a redirected function pointer. The boot process's call interception module captures this function call and checks the target memory mapping table in memory to confirm that the memory entry type for the address range 0x7FFBA000 to 0x7FFFFFFF is still "reserved service memory". After confirming this, it uses this function call as a trigger signal to lock the memory controller's isolation policy by writing to specific underlying hardware registers, rejecting remapping requests that grant write permissions to that physical address range. Afterward, the system runs normally. Some time later, the user starts a firmware update program in the operating system, which attempts to set a UEFI variable named `NextBoot` to point to a recovery partition. This operation eventually calls the `SetVariable` runtime service function provided by the target system table, whose pointer points to physical address 0x7FFBB500. The runtime service module located in the reserved memory area is activated, receiving the `SetVariable` call request and its parameters ("NextBoot", &guid, attributes, dataSize, data). After parsing the parameters, the module translates them into a series of operations targeting the SPI Flash chip on the motherboard: first, it sends the "write enable" command code 0x06, then the "page programming" command code 0x02, followed by the target memory address 0x1F0000, and finally the byte sequence representing the recovery partition boot entry. Before sending the instructions, the module masks the operating system's interrupt responses to prevent bus conflicts. Subsequently, this series of read and write instructions on the SPI bus directly modifies the contents of the flash chip. After the modification is complete, the interrupt masking is lifted, thus achieving a secure closed-loop conversion from runtime service call requests to underlying bus instructions.
[0102] See appendix Figure 5 The present invention also proposes a processor boot control system for an embedded motherboard, comprising the following modules: The initial boot module is used to obtain the power-on activation electrical signal of the underlying motherboard, load the boot file and physical hardware configuration file, and generate the boot process; The isolated memory allocation module is used to parse the physical hardware configuration file and obtain the preset configuration information of the runtime service module to be loaded. Based on this, it calculates the running memory size and divides the main memory into contiguous physical memory segments according to the running memory size to obtain the reserved memory area. The memory topology reconstruction module is used to obtain the reserved memory area, overwrite the reserved service memory identifier to the attribute field corresponding to the reserved memory area, and generate the target memory mapping table; The virtual environment building module is used to obtain the binary compilation file of the runtime service module, load the binary compilation file into the reserved memory area, map the execution pointer of the service function of the runtime service module, generate the physical entry address, associate and encapsulate the specific image startup macro function, and integrate the physical entry address to generate the target system table; The security verification module is used to obtain the hardware unique identifier and the preset device key, merge the hardware unique identifier and the preset device key to generate a hardware binding verification value, verify the target system image based on the hardware binding verification value, and output the comparison and judgment result. The kernel injection module is used to load the kernel image built into the target system image and boot it when the comparison result is valid. The interrupt interception module is used to intercept the exit boot service function call triggered by the kernel image and lock the physical memory isolation policy; The request conversion module is used to lock bus control and convert the runtime service call request into an underlying bus write operation when it receives a runtime service call request initiated by the kernel image.
[0103] Each of the modules can be implemented in whole or in part through software, hardware, or a combination thereof. It supports hardware embedded in or independent of the processor in the computer device, and also supports software stored in the memory of the computer device, so that the processor can call and execute the operations corresponding to each of the above modules.
[0104] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for processor boot control of an embedded motherboard, characterized by, Includes the following steps: S1. Obtain the power-on activation signal from the underlying motherboard, load the boot file and physical hardware configuration file, and generate the boot process; S2. Parse the physical hardware configuration file and obtain the preset configuration information of the runtime service module to be loaded. Calculate the running memory size accordingly, and divide the main memory into contiguous physical memory segments according to the running memory size to obtain the reserved memory area. S3. Obtain the reserved memory area, overwrite the reserved service memory identifier to the attribute field corresponding to the reserved memory area, and generate the target memory mapping table; S4. Obtain the binary compilation file of the runtime service module, load the binary compilation file into the reserved memory area, map the service function execution pointer of the runtime service module, generate the physical entry address, associate and encapsulate the specific image startup macro function, and integrate the physical entry address to generate the target system table; S5. Obtain the unique hardware identifier and the preset device key, merge the unique hardware identifier and the preset device key, generate a hardware binding verification value, verify the target system image based on the hardware binding verification value, and output the comparison judgment result. S6. If the comparison result is valid, load the kernel image built into the target system image and boot it. S7. Intercept the exit boot service function call triggered by the kernel image and lock the physical memory isolation policy; when a runtime service call request initiated by the kernel image is received, lock the bus control and convert the runtime service call request into a low-level bus write operation.
2. The processor boot control method of the embedded mainboard according to claim 1, wherein, Step S1 includes the following steps: It receives the power-on activation signal from the underlying motherboard and starts the first-stage boot loading program stored in the solidified storage medium. The first-stage bootloader completes the power-on initialization task of the system's main running memory and loads the boot file to the starting address of the system's main running memory. The physical hardware configuration file is mounted to a preset offset memory address, and control of the processor is transferred to the boot file to generate the boot process.
3. The processor boot control method of claim 1, wherein, Step S2 includes the following steps: Extract the device tree information contained in the physical hardware configuration file, and traverse the main memory physical capacity recorded in the device tree information; Evaluate the size of the code segment, read-only data segment, data segment, uninitialized data segment, and reserved function call stack contained in the runtime service module, and extract the preset proportional coefficients; The code segment size, read-only data segment size, data segment size, uninitialized data segment size, and function call stack size are summed together and then the redundant buffer space generated based on a preset ratio coefficient and rounded down is added. Finally, the memory page is rounded up to generate the running memory size. Match the highest address of the continuous physical memory segment corresponding to the physical capacity of the main memory, divide the highest address of the continuous physical memory segment according to the size of the running memory, and generate a reserved memory area.
4. The processor boot control method of claim 1, wherein, Step S3 includes the following steps: Declare an initial memory mapping table containing the start and end addresses of physical memory, initialize the initial memory mapping table according to the physical hardware configuration file, and assign it an available memory identifier; Probe the reserved memory area mapped and covered by the initial memory mapping table, and clear the currently associated available memory identifiers of the reserved memory area; Overwrite the reserved service memory identifier to the corresponding attribute field of the reserved memory area, merge the reserved memory area and the attribute field, and generate the target memory mapping table.
5. The processor boot control method of the embedded mainboard according to claim 1, wherein, Step S4 includes the following steps: The underlying motherboard's storage medium is used to read the bus and copy the binary compiled file to the physical memory space covered by the reserved memory area; Analyze the execution pointers of the various service functions that the runtime service module provides for external calls, and map each service function execution pointer to its corresponding physical entry address; Allocate contiguous space within the reserved memory area and create a system table data structure defined by the standard firmware interface specification. Associate and encapsulate specific image startup macro functions and integrate the physical entry address into the system table data structure to generate the target system table.
6. The processor boot control method of the embedded mainboard according to claim 1, wherein, Step S5 includes the following steps: Access the physical electronic fuse register integrated in the underlying motherboard microprocessor and extract the unique hardware identifier of the physical electronic fuse register hardwired through the hardwire. Perform a byte concatenation operation on the unique hardware identifier and the preset device key to obtain the concatenated data block; The cryptographic hash algorithm is invoked, and the concatenated data block is input into the cryptographic hash algorithm for one-way calculation to generate a hardware binding verification value.
7. The processor boot control method of the embedded mainboard according to claim 1, wherein, The target system image is verified based on the hardware-bound checksum, and the comparison and judgment results are output, including the following steps: Obtain the target system image released from the mounted storage medium, and separate the image payload data and image hash signature contained in the target system image; The hardware binding check value is appended to the end of the image payload data to generate a temporary data block; A preset cryptographic hash algorithm is applied to the temporary data block to calculate and generate a new hash value; The new hash value is compared byte by byte with the mirror hash signature, and the comparison result containing the legal or illegal status is output.
8. The processor boot control method of the embedded mainboard according to claim 1, wherein, Step S6 includes the following steps: When the verification and comparison result is found to be valid, the mirror startup macro function encapsulated in the target system table is triggered; Traverse the partition blocks where the kernel image associated with the target system image is located, and copy the kernel image to the free physical memory segment marked in the target memory mapping table; Rewrite the program counter of the system bus processor to the first address of the free physical memory segment, and write the memory pointer at the first address of the target system table to the system kernel boot parameter register.
9. The processor boot control method of the embedded mainboard according to claim 1, wherein, Step S7 includes the following steps: By redirecting the function execution pointer in the target system table to the reserved memory area in advance, the exit boot service function call issued by the kernel image is intercepted, and the reserved service memory identifier recorded in the target memory mapping table is re-verified; By using the exit boot service function call to trigger and lock the underlying physical memory controller, a hard isolation strategy is adopted to reject the kernel mode's remapping request to grant write permission attributes to the reserved memory area, and only allow the reserved read-only and execute permission mappings. Maintain a background listening state to prepare to take over runtime service call requests initiated by the kernel image for subsequent online firmware upgrade tasks.
10. The method of claim 1, wherein the processor boot control method of the embedded mainboard is characterized in that, Upon receiving a runtime service call request from the kernel image, control of the bus is locked, and the runtime service call request is translated into a low-level bus write operation, including the following steps: Activate the runtime service module that remains alive and listening within the reserved memory area; Receive runtime service call requests that have been taken over through the runtime service module; The system blocks the global interrupts of the operating system to obtain exclusive control of the bus. Then, according to the preset conversion rules, it translates the runtime service call request into an SPI bus read / write operation for the underlying non-volatile memory chip, and restores the global interrupt after the execution is completed.
Citation Information
Patent Citations
Embedded type partition image security certification and kernel trusted boot method and equipment thereof
CN104794393A
