Mainboard starting method and device, electronic equipment and readable storage medium
By compiling the device tree source file into a binary device tree during motherboard startup and passing it to the system kernel, the problem that the system kernel can only run on a fixed hardware platform is solved, thus improving flexibility and portability.
Patent Information
- Application Number
- CN202511516791.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-02-27
AI Technical Summary
In existing technologies, the system kernel directly contains the device tree, which limits its operation to a fixed hardware platform and results in poor flexibility.
By obtaining the device tree source file and firmware configuration file, compiling them into a binary device tree, and passing it to the system kernel when the motherboard starts up, the binary device tree is avoided by setting it directly in the kernel. Instead, the firmware configuration file is used to generate a binary device tree that is adapted to different hardware platforms.
It improves the flexibility and portability of the system kernel, reduces the kernel size, supports hardware upgrades or changes without recompiling the kernel, and enhances the dynamics of the system.
Smart Images

Figure CN121579084A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, and in particular relates to a motherboard boot method, device, electronic device, and readable storage medium. Background Technology
[0002] In the field of computer technology, the motherboard is one of the important components of a computer. It contains various hardware resources that make up the computer. These hardware resources are usually described using a device tree. Correspondingly, the system kernel can initialize hardware resources through the device tree.
[0003] Currently, the device tree is often set directly in the system kernel, allowing the kernel to directly parse the device tree. However, this approach limits the kernel to running on fixed hardware platforms, resulting in poor flexibility. Summary of the Invention
[0004] This invention provides a motherboard boot method, apparatus, electronic device, and readable storage medium to address the problem of poor kernel flexibility.
[0005] To solve the above-mentioned technical problems, the present invention is implemented as follows: In a first aspect, the present invention provides a motherboard boot method, characterized in that the method includes: In response to the boot request from the motherboard to be booted, obtain the device tree source file and firmware configuration file; The device tree source file is compiled into a binary device tree corresponding to the firmware configuration file; Based on the executable firmware corresponding to the firmware configuration file, the motherboard to be booted is started, and the binary device tree is passed to the system kernel of the motherboard to be booted.
[0006] Optionally, compiling the device tree source file into a binary device tree corresponding to the firmware configuration file includes: Based on the configuration information of the hardware to be started contained in the firmware configuration file, the node corresponding to the hardware to be started is obtained from the device tree source file and used as the target node. Delete all nodes except the target node from the device tree source file to obtain an intermediate file; The intermediate file is compiled into a binary file to obtain a binary device tree.
[0007] Optionally, after obtaining the node corresponding to the hardware to be booted from the device tree source file based on the configuration information of the hardware to be booted contained in the firmware configuration file, and using it as the target node, the method further includes: Based on the compilation macros of each hardware to be started in the firmware configuration file, the target node corresponding to each hardware to be started is encapsulated, and the macro name of each encapsulated target node is set as the compilation macro of each hardware to be started. Optionally, after starting the motherboard to be started, the method further includes: The binary device tree is verified to obtain the verification result; If the verification result meets the requirements, the operation of passing the binary device tree to the system kernel of the motherboard to be booted is performed.
[0008] Optionally, passing the binary device tree to the system kernel of the motherboard to be booted includes: The storage address of the binary device tree is written to a preset register; the system kernel is used to access the preset register to obtain the binary device tree.
[0009] In a second aspect, the present invention provides a motherboard boot device, the device comprising: The first acquisition module is used to acquire the device tree source file and firmware configuration file in response to the boot request from the motherboard to be booted. The compilation module is used to compile the device tree source file into a binary device tree corresponding to the firmware configuration file; The transmission module is used to start the motherboard to be booted based on the executable firmware corresponding to the firmware configuration file, and to transmit the binary device tree to the system kernel of the motherboard to be booted.
[0010] Optionally, the compilation module includes: The second acquisition submodule is used to acquire, based on the configuration information of the hardware to be started contained in the firmware configuration file, the node corresponding to the hardware to be started from the device tree source file, as the target node; The deletion submodule is used to delete nodes other than the target node from the device tree source file to obtain an intermediate file; The compilation submodule is used to compile the intermediate files into binary files to obtain a binary device tree.
[0011] Optionally, the device further includes: The encapsulation module is used to encapsulate the target node corresponding to each of the hardware devices to be started based on the compilation macros of each of the hardware devices to be started in the firmware configuration file, and set the macro name of each of the encapsulated target nodes as the compilation macro of each of the hardware devices to be started.
[0012] Optionally, the device further includes: The verification module is used to verify the binary device tree and obtain the verification result; An execution module is used to perform the operation of passing the binary device tree to the system kernel of the motherboard to be booted, provided that the verification result meets the requirements.
[0013] Optionally, the transmission module is specifically used for: The storage address of the binary device tree is written to a preset register; the system kernel is used to access the preset register to obtain the binary device tree.
[0014] Thirdly, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the aforementioned motherboard boot method when executing the program.
[0015] Fourthly, the present invention provides a readable storage medium that, when the instructions in the storage medium are executed by the processor of an electronic device, enables the electronic device to execute the aforementioned motherboard boot method.
[0016] The motherboard boot method provided in this invention involves obtaining a device tree source file and a firmware configuration file in response to a boot request from the motherboard to be booted; compiling the device tree source file into a binary device tree corresponding to the firmware configuration file; booting the motherboard based on the executable firmware corresponding to the firmware configuration file; and transferring the binary device tree to the system kernel of the motherboard. This eliminates the need to directly write the binary device tree into the system kernel. Instead, the device tree source file is compiled in real-time based on the firmware configuration file to obtain the binary device tree, which is then transferred to the system kernel during the motherboard boot process. Since the binary device tree is compiled in real-time, there is no need to generate a dedicated device tree for the system kernel. Different binary device trees can be generated for different hardware platforms using the firmware configuration file for kernel use. This avoids directly setting the binary device tree in the system kernel, reducing the kernel size, and preventing the system kernel from only running on fixed hardware platforms, thus improving flexibility and kernel portability.
[0017] Furthermore, since a binary device tree corresponding to the firmware configuration file can be generated, there is no need to recompile the system kernel when upgrading or changing hardware resources. This allows the system kernel to still obtain the latest binary device tree, improving the dynamism of the system kernel. When maintaining the system, only the firmware configuration file needs to be updated; there is no need to modify or recompile the system kernel. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of a motherboard boot method provided in an embodiment of the present invention; Figure 2 This is a structural diagram of a motherboard boot device provided in an embodiment of the present invention; Figure 3 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In embodiments of this invention, the term "multiple" refers to two or more, and other quantifiers are similar.
[0022] Figure 1 This is a flowchart of a motherboard boot method provided in an embodiment of the present invention, as shown below. Figure 1 As shown, the method may include the following steps: Step 101: In response to the boot request from the motherboard to be booted, obtain the device tree source file and firmware configuration file.
[0023] Step 102: Compile the device tree source file into a binary device tree corresponding to the firmware configuration file.
[0024] Step 103: Based on the executable firmware corresponding to the firmware configuration file, start the motherboard to be booted and pass the binary device tree to the system kernel of the motherboard to be booted.
[0025] Regarding steps 101-103 above, this embodiment of the invention can be applied to any motherboard and operating system. The operating system can be an embedded system, such as a Loongson system using the Loongson architecture. The motherboard to be booted can be any motherboard that has boot requirements and relies on a device tree for boot initialization.
[0026] The aforementioned firmware configuration file, also known as the firmware project configuration file, refers to a configuration file (configuration file, config_file) used to configure the firmware. It allows for the configuration of parameters and initial settings for computer programs, and may include device drivers. Compiling the firmware configuration file yields executable firmware. This executable firmware refers to a binary firmware program (gzrom.bin), which, when run, can boot the operating system and initialize some hardware components.
[0027] Specifically, the aforementioned firmware configuration file can be pre-written, or it can be a file pre-written by relevant personnel based on the actual usage of the motherboard. It can include the hardware resource usage of the motherboard to be booted. For example, taking the non-volatile memory (NAND FLASH) included on the motherboard as an example, some motherboards use NAND FLASH while others do not. Therefore, the usage of NAND FLASH by the motherboard to be booted can be pre-configured in the firmware configuration file. In one case, a variable parameter can be set to represent the hardware resource usage; for example, 0 can represent no use, and 1 can represent use. Of course, other representation methods can also be used, and this embodiment of the invention does not limit this.
[0028] The aforementioned Device Tree Source (DTS) file refers to a source file containing information about all hardware resources on the motherboard, such as the number and type of processors, memory base addresses and sizes, buses and bridges, peripheral connections, interrupt controllers and interrupt usage, general-purpose input / output (GPIO) controllers and GPIO usage, clock controllers and clock usage, etc. It can be pre-written by relevant personnel and typically contains extensive comments and highly readable content. The device tree provides a standard method for describing hardware, allowing the kernel to obtain hardware configuration information by parsing the device tree on different hardware platforms without needing to write platform-specific hardware description code. However, because device tree source files are usually in text format and contain a lot of irrelevant information, their loading and parsing efficiency is relatively poor. Therefore, it is usually necessary to compile the device tree source file into a binary file (Device Tree Blob, DTB), i.e., the aforementioned binary device tree.
[0029] Specifically, the above compilation operation can be achieved by calling the Device Tree Compiler (DTC). DTC is a tool for compiling device trees, which can convert DTS files into binary DTB files. Specifically, the above compilation operation can be executed by calling the DTC command line. The DTC command line format is: dtc -O<output_format> -o<output_file><input_file> Among them, the above<output_format> This is used to specify the format of the output file. Common options include dtb (device tree binary file) and dts (device tree source file), etc.<output_file> Used to specify the path and name of the output file, the above<input_file> The path and name of the input DTS file.
[0030] Specifically, in this embodiment of the invention, the DTS file can be compiled into a corresponding DTB file based on the firmware configuration file, thereby obtaining a binary device tree corresponding to the firmware configuration file. Specifically, in this embodiment of the invention, the device tree source file can be selectively compiled based on the hardware configuration information in the firmware configuration file.
[0031] Furthermore, embodiments of the present invention can boot the motherboard to be booted by executing executable firmware. During this process, the executable firmware can initialize some hardware, such as memory and NAND flash. Furthermore, the binary device tree can also be passed to the system kernel. Here, the system kernel refers to the kernel of the operating system on the motherboard to be booted; it is the most fundamental part of the operating system and is a portion of software used to provide secure access to computer hardware for various applications.
[0032] Specifically, in this embodiment of the invention, the compiled binary device tree can be written into a preset register, and then the system kernel can obtain the binary device tree by reading the preset register, thus realizing the transfer of the binary device tree. Alternatively, in this embodiment of the invention, the memory address where the compiled binary device tree is located can be written into a preset register, and then the kernel can obtain the memory address by reading the preset register, and obtain the binary device tree by accessing the memory address.
[0033] In summary, in this embodiment of the invention, in response to the boot request of the motherboard to be booted, a device tree source file and a firmware configuration file are obtained; the device tree source file is compiled into a binary device tree corresponding to the firmware configuration file; based on the executable firmware corresponding to the firmware configuration file, the motherboard to be booted is started, and the binary device tree is passed to the system kernel of the motherboard to be booted. Thus, it is unnecessary to directly write the binary device tree into the system kernel; instead, the device tree source file is compiled in real-time based on the firmware configuration file to obtain the binary device tree, which is then passed to the system kernel during the motherboard boot process. Since the binary device tree is compiled in real-time, there is no need to generate a dedicated device tree for the system kernel. Different binary device trees can be generated for different hardware platforms using the firmware configuration file for kernel use, avoiding the direct setting of the binary device tree in the system kernel, reducing the size of the system kernel, and avoiding the problem that the system kernel can only run on a fixed hardware platform, thus improving flexibility and kernel portability.
[0034] Furthermore, since a binary device tree corresponding to the firmware configuration file can be generated, there is no need to recompile the system kernel when upgrading or changing hardware resources. This allows the system kernel to still obtain the latest binary device tree, improving the dynamism of the system kernel. When maintaining the system, only the firmware configuration file needs to be updated; there is no need to modify or recompile the system kernel.
[0035] Optionally, the operation of compiling the device tree source file into a binary device tree corresponding to the firmware configuration file may specifically include, in this embodiment of the invention: S21. Based on the configuration information of the hardware to be started contained in the firmware configuration file, obtain the node corresponding to the hardware to be started from the device tree source file as the target node.
[0036] S22. Delete all nodes except the target node from the device tree source file to obtain an intermediate file.
[0037] S23. Compile the intermediate file into a binary file to obtain a binary device tree.
[0038] The aforementioned hardware to be started refers to the hardware resources on the motherboard that need to be started and initialized, which may include memory, NAND flash, etc. The aforementioned device tree source file includes a series of nodes and attributes. Nodes represent hardware devices or functional units, and attributes describe the characteristics and configuration information of the nodes.
[0039] Specifically, the device tree source file can include all hardware resources on the motherboard. Based on this, embodiments of the present invention can selectively compile the device tree source file based on the configuration information of the hardware to be booted contained in the firmware configuration file. Specifically, the node corresponding to the hardware to be booted can be obtained from the device tree source file as the target node. Then, by deleting other nodes besides the target node, the intermediate file can retain only the hardware nodes corresponding to the firmware configuration file. Furthermore, by compiling the intermediate file into a binary file, real-time compilation based on the firmware configuration can be achieved.
[0040] Specifically, the above compilation operation can be implemented through DTC. Intermediate files can be input into DTC, and the binary device tree can be obtained by reading the output data of DTC.
[0041] In this embodiment of the invention, based on the configuration information of the hardware to be booted contained in the firmware configuration file, a node corresponding to the hardware to be booted is obtained from the device tree source file as the target node. Other nodes besides the target node are deleted from the device tree source file to obtain an intermediate file. The intermediate file is compiled into a binary file to obtain a binary device tree. This allows the intermediate file to retain only the hardware nodes corresponding to the firmware configuration file, and by compiling the intermediate file into a binary file, real-time compilation based on the firmware configuration can be achieved.
[0042] Optionally, after the above-mentioned operation of obtaining the node corresponding to the hardware to be started from the device tree source file based on the configuration information of the hardware to be started contained in the firmware configuration file, and using it as the target node, the embodiments of the present invention may further include: S31. Based on the compilation macros of each hardware to be started in the firmware configuration file, the target node corresponding to each hardware to be started is encapsulated, and the macro name of each encapsulated target node is set as the compilation macro of each hardware to be started.
[0043] The aforementioned compiler macros refer to text substitutions performed during the preprocessing stage before compilation. Compiler macros can simplify code and define the code that needs to be compiled. Firmware configuration files often contain compiler macros related to the required hardware resources.
[0044] Based on this, embodiments of the present invention can encapsulate target nodes based on the compiler macros of the hardware to be started, and set the macro names of the encapsulated target nodes as the compiler macros of each hardware to be started.
[0045] For example, taking a NAND FLASH device as an example, a NAND FLASH node can be encapsulated using the #ifdef NAND_FLASH macro. The format is as follows: #ifdef NAND_FLASH NAND Nodes and Attributes #endif.
[0046] Another example, taking a graphics processing unit (GPU) device as an example, is to use the `#ifdef GPU` macro to include the GPU node. It takes the following form: #ifdef GPU GPU node and attributes #endif.
[0047] As another example, if the motherboard uses NAND FLASH, then the NAND_FLASH macro is defined. It takes the following form: #define NAND_FLASH #ifdef NAND_FLASH NAND nodes and their attributes.
[0048] In this embodiment of the invention, based on the compiler macros of each hardware device to be booted in the firmware configuration file, the target nodes corresponding to each hardware device to be booted are encapsulated, and the macro names of the encapsulated target nodes are set as the compiler macros of each hardware device to be booted. This allows certain specific nodes in the device tree source file to be paired with compiler macros related to the firmware project configuration, facilitating the retention of only firmware configuration-related nodes in subsequent compilation operations. This also hides differences between hardware devices and unifies the compilation interface.
[0049] Optionally, after starting the motherboard to be started as described above, the embodiments of the present invention may further include: S41. Verify the binary device tree to obtain the verification result.
[0050] S42. If the verification result meets the requirements, perform the operation of passing the binary device tree to the system kernel of the motherboard to be booted.
[0051] Specifically, to ensure the accuracy and integrity of the binary device tree, this embodiment of the invention can perform verification after generating the binary device tree. The verification result can be the calculation of the checksum of the binary device tree. Specifically, the verification operation can be to divide the binary device tree into 4-byte blocks, add the 4-byte data values of each block sequentially, and then take the inverse code of the result as the checksum.
[0052] Specifically, the above requirements can be pre-set, and different requirements can be set according to different verification operations. This embodiment of the invention does not impose any limitations on this. Specifically, when the verification result is a checksum, the above requirement can be that the verification result is consistent with the initial verification result. The initial verification result can be generated through a verification operation after the binary device tree is generated.
[0053] Optionally, the above verification operation may also include checking whether the header of the binary device tree is complete. The header of a standard device tree binary file occupies 4 bytes, and these 4 bytes of data are often a fixed value of 0xedfe0dd0. Therefore, the completion of the device tree header can be determined by checking whether the header bytes are this fixed value.
[0054] Furthermore, if the verification result meets the requirements, it indicates that the device tree binary was not affected during the motherboard boot process, and the integrity and accuracy of the device tree binary can be determined. At this point, the operation of passing the binary device tree to the system kernel can be performed.
[0055] In this embodiment of the invention, the binary device tree is verified to obtain a verification result; if the verification result meets the requirements, the operation of transferring the binary device tree to the system kernel of the motherboard to be booted is executed. This ensures the accuracy and integrity of the binary device tree transferred to the system kernel.
[0056] Optionally, the operation of passing the binary device tree to the system kernel of the motherboard to be booted, as described above, may specifically include in this embodiment of the invention: S51. Write the storage address of the binary device tree into a preset register; the system kernel is used to access the preset register to obtain the binary device tree.
[0057] The aforementioned preset registers can be pre-configured, and different registers can be set as preset registers for computers with different architectures. For example, for a processor (Central Processing Unit, CPU) with a reduced instruction set architecture (Microprocessor without interlocked piped stages architecture, MIPS), when the firmware jumps to the kernel, register a0 can be used to store the number of parameters in the kernel command line (cmdline), register a1 can be used to store the data of the parameters in the cmdline, and register a2 can be used to store the address of the device tree data in the firmware.
[0058] Correspondingly, the kernel can also parse the a2 register. If the value of the a2 register is 0, it means the firmware has not passed the device tree to the kernel. If the value of the a2 register is non-zero, it means the firmware has passed the device tree to the kernel. The address of the device tree data can then be determined and accessed through the value in the a2 register.
[0059] Specifically, in this embodiment of the invention, the memory address of the binary device tree can be written to a preset register, and the binary device tree can then be transmitted through this preset register. Specifically, the system kernel can access the preset register, obtain the memory address of the binary device tree from the preset register, and parse the data of the binary device tree.
[0060] Accordingly, the kernel can further use the information parsed from the device tree binary file to initialize hardware, configure devices and drivers, etc. After loading the device tree, the kernel can learn about the configuration and status of the hardware platform by traversing and manipulating the device tree, thereby realizing device identification and management. Specifically, the kernel code can parse the nodes and node attributes in the binary device tree and store them in corresponding variables. The kernel code can then perform relevant device initialization operations based on the data values in these variables.
[0061] Optionally, the embodiments of the present invention can be executed by executable firmware. In this embodiment, the executable firmware and the binary device tree can be concatenated to obtain a target file (gzrom-dtb.bin). Thus, the offset address of the binary device tree in the target file relative to the executable firmware is fixed, which can ensure that the storage address of the binary device tree can be accurately found during the execution of the executable firmware.
[0062] In this embodiment of the invention, the storage address of the binary device tree is written into a preset register; the system kernel accesses the preset register to obtain the binary device tree. This allows the binary device tree to be passed to the system kernel via the preset register, improving transmission efficiency.
[0063] Figure 2 This is a structural diagram of a motherboard boot device provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the device 20 includes: The first acquisition module 201 is used to acquire the device tree source file and firmware configuration file in response to the boot request of the motherboard to be booted. Compilation module 202 is used to compile the device tree source file into a binary device tree corresponding to the firmware configuration file; The transmission module 203 is used to start the motherboard to be booted based on the executable firmware corresponding to the firmware configuration file, and to transmit the binary device tree to the system kernel of the motherboard to be booted.
[0064] Optionally, the compilation module includes: The second acquisition submodule is used to acquire, based on the configuration information of the hardware to be started contained in the firmware configuration file, the node corresponding to the hardware to be started from the device tree source file, as the target node; The deletion submodule is used to delete nodes other than the target node from the device tree source file to obtain an intermediate file; The compilation submodule is used to compile the intermediate files into binary files to obtain a binary device tree.
[0065] Optionally, the device further includes: The encapsulation module is used to encapsulate the target node corresponding to each of the hardware devices to be started based on the compilation macros of each of the hardware devices to be started in the firmware configuration file, and set the macro name of each of the encapsulated target nodes as the compilation macro of each of the hardware devices to be started.
[0066] Optionally, the device further includes: The verification module is used to verify the binary device tree and obtain the verification result; An execution module is used to perform the operation of passing the binary device tree to the system kernel of the motherboard to be booted, provided that the verification result meets the requirements.
[0067] Optionally, the transmission module is specifically used for: The storage address of the binary device tree is written to a preset register; the system kernel is used to access the preset register to obtain the binary device tree.
[0068] In summary, the motherboard boot device provided in this embodiment of the invention, in response to a boot request from a motherboard to be booted, obtains a device tree source file and a firmware configuration file; compiles the device tree source file into a binary device tree corresponding to the firmware configuration file; boots the motherboard to be booted based on the executable firmware corresponding to the firmware configuration file, and transmits the binary device tree to the system kernel of the motherboard to be booted. Thus, it is unnecessary to directly write the binary device tree into the system kernel; instead, the device tree source file is compiled in real-time based on the firmware configuration file to obtain the binary device tree, which is then transmitted to the system kernel during the motherboard boot process. Since the binary device tree is compiled in real-time, there is no need to generate a dedicated device tree for the system kernel. Different binary device trees can be generated for different hardware platforms using the firmware configuration file for kernel use, avoiding the direct setting of the binary device tree in the system kernel, reducing the size of the system kernel, and avoiding the problem that the system kernel can only run on a fixed hardware platform, thus improving flexibility and kernel portability.
[0069] Furthermore, since a binary device tree corresponding to the firmware configuration file can be generated, there is no need to recompile the system kernel when upgrading or changing hardware resources. This allows the system kernel to still obtain the latest binary device tree, improving the dynamism of the system kernel. When maintaining the system, only the firmware configuration file needs to be updated; there is no need to modify or recompile the system kernel.
[0070] The present invention also provides an electronic device, see [link to relevant documentation]. Figure 3 It includes: a processor 301, a memory 302, and a computer program 3021 stored in the memory and executable on the processor. When the processor executes the program, it implements the motherboard boot method of the foregoing embodiment.
[0071] The present invention also provides a readable storage medium, wherein when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device is able to execute the motherboard boot method of the foregoing embodiments.
[0072] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0073] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0074] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0075] Similarly, it should be understood that, in order to simplify the invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.
[0076] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0077] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention can also be implemented as a device or apparatus program for performing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0078] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0079] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0080] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0081] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A motherboard boot method, characterized in that, The method includes: In response to the boot request from the motherboard to be booted, obtain the device tree source file and firmware configuration file; The device tree source file is compiled into a binary device tree corresponding to the firmware configuration file; Based on the executable firmware corresponding to the firmware configuration file, the motherboard to be booted is started, and the binary device tree is passed to the system kernel of the motherboard to be booted.
2. The method according to claim 1, characterized in that, The step of compiling the device tree source file into a binary device tree corresponding to the firmware configuration file includes: Based on the configuration information of the hardware to be started contained in the firmware configuration file, the node corresponding to the hardware to be started is obtained from the device tree source file and used as the target node. Delete all nodes except the target node from the device tree source file to obtain an intermediate file; The intermediate file is compiled into a binary file to obtain a binary device tree.
3. The method according to claim 2, characterized in that, After obtaining the node corresponding to the hardware to be booted from the device tree source file based on the configuration information of the hardware to be booted contained in the firmware configuration file, and using it as the target node, the method further includes: Based on the compilation macros of each hardware to be started in the firmware configuration file, the target node corresponding to each hardware to be started is encapsulated, and the macro name of each encapsulated target node is set as the compilation macro of each hardware to be started.
4. The method according to claim 1, characterized in that, After starting the motherboard to be started, the method further includes: The binary device tree is verified to obtain the verification result; If the verification result meets the requirements, the operation of passing the binary device tree to the system kernel of the motherboard to be booted is performed.
5. The method according to any one of claims 1-4, characterized in that, The step of passing the binary device tree to the system kernel of the motherboard to be booted includes: The storage address of the binary device tree is written to a preset register; the system kernel is used to access the preset register to obtain the binary device tree.
6. A motherboard boot device, characterized in that, The device includes: The first acquisition module is used to acquire the device tree source file and firmware configuration file in response to the boot request from the motherboard to be booted. The compilation module is used to compile the device tree source file into a binary device tree corresponding to the firmware configuration file; The transmission module is used to start the motherboard to be booted based on the executable firmware corresponding to the firmware configuration file, and to transmit the binary device tree to the system kernel of the motherboard to be booted.
7. The apparatus according to claim 6, characterized in that, The compilation module includes: The second acquisition submodule is used to acquire, based on the configuration information of the hardware to be started contained in the firmware configuration file, the node corresponding to the hardware to be started from the device tree source file, as the target node; The deletion submodule is used to delete nodes other than the target node from the device tree source file to obtain an intermediate file; The compilation submodule is used to compile the intermediate files into binary files to obtain a binary device tree.
8. The apparatus according to claim 7, characterized in that, The device further includes: The encapsulation module is used to encapsulate the target node corresponding to each of the hardware devices to be started based on the compilation macros of each of the hardware devices to be started in the firmware configuration file, and set the macro name of each of the encapsulated target nodes as the compilation macro of each of the hardware devices to be started.
9. The apparatus according to claim 6, characterized in that, The device further includes: The verification module is used to verify the binary device tree and obtain the verification result; An execution module is used to perform the operation of passing the binary device tree to the system kernel of the motherboard to be booted, provided that the verification result meets the requirements.
10. The apparatus according to any one of claims 6-9, characterized in that, The transmission module is specifically used for: The storage address of the binary device tree is written to a preset register; the system kernel is used to access the preset register to obtain the binary device tree.
11. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the program, implements the method as described in any one of claims 1-5.
12. A readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the method of any one of claims 1-5.