Device starting apparatus and method, device tree file generating apparatus and method
By storing the attribute parameters of the original nodes in the configuration nodes of the pre-generated device tree file, the parsing time problem in the startup phase of the vehicle-mounted driver assistance system is solved, and rapid device initialization and system startup are achieved.
Patent Information
- Application Number
- CN202611339195.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-24
AI Technical Summary
The onboard driver assistance system experiences excessively long parsing time during the startup phase due to the device tree file format, which affects the system startup speed.
By using a pre-generated device tree file, the binary structure data of the attribute parameters of the original node is pre-stored in the configuration node, reducing the parsing operation during device initialization, and quickly locating and obtaining the structure data of the target configuration node through the target configuration identifier.
It significantly shortens the parsing time during the device initialization and startup phase, thereby improving the overall system startup speed.
Smart Images

Figure CN123157274A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of vehicle-mounted assisted driving technology, specifically to a device startup apparatus and method, and a device tree file generation apparatus and method. Background Technology
[0002] In the field of automotive driver assistance systems, to improve driving safety and user experience, these systems are required to start up quickly. During the system startup phase, the device tree blob (DTB) needs to be parsed in real time to initialize the device drivers.
[0003] In related technologies, due to the limitations of the device tree file format, it is necessary to traverse all nodes when a specific type of attribute data needs to be found. The more nodes there are or the more complex the node hierarchy, the longer the parsing time will be, resulting in a slower system startup. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a device startup apparatus and method, and a device tree file generation apparatus and method, to improve system startup speed.
[0005] A first aspect of this disclosure provides a device startup apparatus, including at least one processor configured to: in response to a current startup image being a preset type image, load a pre-generated first device tree file corresponding to the current startup image; wherein the first device tree file includes: a plurality of original nodes, first attribute parameters corresponding to the plurality of original nodes, and configuration nodes corresponding to the original nodes, the configuration nodes being used to store structure data obtained by converting the first attribute parameters corresponding to the original nodes; determine a target configuration identifier corresponding to a target device to be started for initialization by the current startup image; determine a target configuration node corresponding to the target configuration identifier in the first device tree file, and obtain target structure data stored in the target configuration node; and perform an initialization operation on the target device to be started based on the target structure data to start the target device to be started.
[0006] A second aspect of this disclosure provides a device tree file generation apparatus, including at least one processor, the processor being configured to: compile a device tree source file including a plurality of original nodes to obtain a second device tree file; parse the second device tree file to obtain first attribute parameters of the original nodes; add configuration nodes corresponding to the original nodes to the second device tree file, and write structure data corresponding to the first attribute parameters into the corresponding configuration nodes to obtain a first device tree file.
[0007] A third aspect of this disclosure provides a device startup method, the method comprising: In response to the current boot image being a preset type image, a pre-generated first device tree file corresponding to the current boot image is loaded; wherein, the first device tree file includes: multiple original nodes, first attribute parameters corresponding to the multiple original nodes, and configuration nodes corresponding to the original nodes, wherein the configuration nodes are used to store structure data obtained after parsing the first attribute parameters corresponding to the original nodes; Determine the target configuration identifier corresponding to the target device to be booted for initialization using the current boot image; In the first device tree file, determine the target configuration node corresponding to the target configuration identifier, and obtain the target structure data stored in the target configuration node; Based on the target structure data, an initialization operation is performed on the target device to be started in order to start the target device to be started.
[0008] A fourth aspect of this disclosure provides a method for generating a device tree file, the method comprising: The device tree source file, which includes multiple original nodes, is compiled to obtain the second device tree file; The second device tree file is parsed to obtain the first attribute parameters of the original node; Add a configuration node corresponding to the original node to the second device tree file, and write the structure data corresponding to the first attribute parameter into the corresponding configuration node to obtain the first device tree file.
[0009] In a fifth aspect of this disclosure, a computer program product is provided, which, when executed by an instruction processor, performs either the device startup method proposed in the third aspect of this disclosure or the device tree file generation method proposed in the fourth aspect of this disclosure.
[0010] A sixth aspect of this disclosure provides a readable storage medium storing a computer program for executing the device startup method proposed in the third aspect embodiment of this disclosure, or executing the device tree file generation method proposed in the fourth aspect embodiment.
[0011] A seventh aspect of this disclosure provides an electronic device comprising: a processor; a memory for storing processor-executable instructions; and a processor for reading executable instructions from the memory and executing the instructions to implement the device startup method proposed in the third aspect embodiment or the device tree file generation method proposed in the fourth aspect embodiment.
[0012] The device startup apparatus provided in this disclosure utilizes configuration nodes in a pre-generated first device tree file to pre-store binary structure data corresponding to the attribute parameters of the original nodes. Therefore, pre-parsing of device initialization data is implemented during the compilation phase. Consequently, when loading the first device tree file to start the device, there is no need to perform parsing operations on the hardware attribute data of the original nodes in the first device tree file again. After quickly locating the target configuration node in the first device tree file based on the target configuration identifier corresponding to the current startup image, the target structure data stored within that target configuration node can be directly extracted, significantly reducing the parsing time during the device initialization startup phase. Thus, in embedded system scenarios, the hardware configuration parameters corresponding to the target device to be started can be accurately obtained based on the configuration nodes for initialization operations, effectively avoiding invalid node data traversal and parsing overhead, thereby significantly improving the overall system startup speed. Attached Figure Description
[0013] Figure 1 This is a schematic diagram of the structure of a device starting device provided in an exemplary embodiment of the present disclosure.
[0014] Figure 2 This is a schematic diagram of the structure of a device tree file generation apparatus provided in an exemplary embodiment of the present disclosure.
[0015] Figure 3 This is a schematic flowchart of a device startup method provided in an exemplary embodiment of this disclosure.
[0016] Figure 4 This is a schematic flowchart of a device tree file generation method provided in an exemplary embodiment of this disclosure.
[0017] Figure 5 This is a schematic diagram of the structure of a device starting apparatus provided in another exemplary embodiment of the present disclosure.
[0018] Figure 6 This is a schematic diagram of the structure of a device tree file generation apparatus provided in another exemplary embodiment of this disclosure.
[0019] Figure 7 This is a structural diagram of an electronic device provided in an exemplary embodiment of this disclosure. Detailed Implementation
[0020] To explain this disclosure, exemplary embodiments of the disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the disclosure, and not all of them. It should be understood that the disclosure is not limited to exemplary embodiments.
[0021] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of this disclosure.
[0022] Application Overview To improve driving safety and user experience, in-vehicle driver assistance systems are required to start quickly; for example, the cold start time from booting from the BootROM to the start of the first application process in the OS should not exceed 5 seconds. To ensure compatibility with other peripherals, in-vehicle embedded systems typically use multiple DTB device tree files to record various device data and perform real-time parsing and device driver initialization during the startup phase.
[0023] In traditional technologies, DTB, as a general binary format, cannot be directly called by C language drivers. During startup, the libfdt library must handle the entire process of node traversal, attribute matching, data reading, and format conversion, all of which consume the startup time window. Furthermore, the more nodes there are or the more complex the node hierarchy, the longer the parsing time, directly impacting the cold start performance of the vehicle system and leading to system startup delays.
[0024] To address the aforementioned technical issues, this disclosure provides a device startup apparatus, including at least one processor. The processor is configured to: in response to a current startup image being a preset type image, load a pre-generated first device tree file corresponding to the current startup image; determine a target configuration identifier corresponding to a target device to be started, which is initialized by the current startup image; determine a target configuration node corresponding to the target configuration identifier in the first device tree file, and obtain target structure data stored in the target configuration node; and perform an initialization operation on the target device to be started based on the target structure data to start the target device. This solution, by pre-storing the binary structure data corresponding to the attribute parameters of the original nodes in the configuration nodes of the pre-generated first device tree file, achieves pre-parsing of device initialization data during the compilation phase. Therefore, when loading the first device tree file to start the device, it is unnecessary to perform parsing operations on the hardware attribute data of the original nodes in the first device tree file again. After quickly locating the target configuration node in the first device tree file based on the target configuration identifier corresponding to the current startup image, the target structure data stored in the target configuration node can be directly extracted, thereby significantly reducing the parsing time during the device initialization startup phase. Thus, in embedded system scenarios, the hardware configuration parameters of the target device to be started can be accurately obtained based on the configuration node for initialization operations, effectively avoiding invalid node data traversal and parsing losses, thereby significantly improving the overall system startup speed.
[0025] Exemplary device Figure 1 This is a schematic diagram of the structure of a device startup apparatus provided in an exemplary embodiment of this disclosure. The device startup apparatus is a vehicle-mounted terminal or a hardware functional device on a vehicle-mounted terminal. Figure 1 As shown, the device startup device 100 includes at least one processor 101, which is configured to: In response to the current boot image being a preset type image, load the pre-generated first device tree file corresponding to the current boot image.
[0026] The first device tree file includes: multiple original nodes, multiple original node corresponding first attribute parameters, and configuration nodes corresponding to the original nodes. The configuration nodes are used to store the structure data obtained after parsing the first attribute parameters corresponding to the original nodes.
[0027] In some embodiments, since the in-vehicle embedded system adopts a multi-level boot architecture, the boot images at different stages have different requirements for the device tree. Therefore, it is necessary to first determine the type of the currently running boot image. One possible approach is to read its own stage identifier after the current boot image is powered on and run, and determine whether it belongs to a preset type image based on the stage identifier; another possible approach is to determine whether it is a preset type image through the image type information passed by the boot parameters. This disclosure does not limit the scope of the embodiments.
[0028] In some examples, the aforementioned preset image type is a boot stage image that requires hardware parameter reading and / or peripheral driver initialization via a device tree. This preset image type can specifically include, but is not limited to: BL31-level secure firmware (Arm Trusted Firmware, ATF), BL33-level bootloader (Universal Boot Loader, U-Boot), Linux operating system kernel, and Real-Time Operating System (RTOS). Different types of boot images correspond to different first device tree files; for example, the first device tree file for the ATF stage is bl31.dtb, the first device tree file for the U-Boot stage is u-boot.dtb, and the first device tree file for the kernel stage is kernel.dtb. It should be noted that each first device tree file can be uniformly packaged in a preset format file system image (ConfigImage / Context File Group, CFG) and stored in a separate partition of the storage medium when flashing the CFG image. This preset format can be ext4, FAT32, squashfs, or other file system formats.
[0029] In some embodiments, the current boot image refers to the boot firmware or system image currently running according to a preset multi-level boot sequence after the embedded system is powered on. The current boot image is determined by the chip's boot chain hierarchy and the preset multi-level boot sequence, following the general rules of hierarchical booting of the processor system architecture, which can be ARM architecture or other possible architectures. After the device is powered on, it loads from one image to the next according to the preset multi-level boot sequence, and the current boot image changes as the current running stage changes.
[0030] For example, consider an ARM-based automotive chip. The standard boot chain for an automotive chip includes, in order: BL1 level SBL boot image, BL2 level SPL secondary loading image, BL31 level ATF security firmware, BL32 level OP-TEE trusted execution environment image, and BL33 level U-Boot bootloader or Linux operating system kernel. During the system boot process, each image at each level serves as the current boot image.
[0031] In some embodiments, before loading the first device tree file, the current boot image needs to complete pre-initialization work to provide a basic environment for loading the first device tree file and running the code. This pre-initialization work may specifically include, but is not limited to: runtime environment initialization (e.g., C runtime environment initialization), interrupt vector table configuration, and memory initialization for the corresponding boot stage.
[0032] In some embodiments, the first device tree file is a device tree in DTB format. The first device tree may include: multiple raw nodes, which completely retain the node structure of the compiled original Device Tree Source (DTS) file; first attribute parameters corresponding to the multiple raw nodes, which are stored within the corresponding raw nodes and belong to the hardware description information of the peripheral device. This hardware description information may specifically include hardware parameters required for driver initialization, such as register base address and address range, interrupt number and interrupt trigger type, clock identifier, and device status; and configuration nodes corresponding one-to-one with the raw nodes. These configuration nodes are dedicated nodes added during the compilation stage, with each raw node corresponding to an independent configuration node. Each configuration node stores structure data obtained by converting the first attribute parameters of the corresponding raw node. This structure data can be C language structure data or structure data from other types of programming languages; this embodiment does not limit this. It should be noted that the configuration nodes are stored at the same level as the corresponding raw nodes, and the node name of the configuration node is bound one-to-one with the node name of the corresponding raw node, facilitating rapid location and reading during the startup phase.
[0033] In some embodiments, the current boot image invokes the driver of the storage medium to read a CFG image in a preset format (e.g., ext4 format) from the independent CFG partition of the vehicle storage medium, parses the file system structure of the CFG image, extracts the first device tree file corresponding to the current boot image from the CFG image, and loads the first device tree file into a pre-agreed specified address in memory; wherein, the driver may include an eMMC driver, a UFS driver, or an SPI Flash driver.
[0034] Determine the target configuration identifier corresponding to the target device to be booted for initialization of the current boot image.
[0035] In some embodiments, each device to be started corresponds to a unique configuration identifier, which is a unique index of the configuration node and is bound one-to-one with the configuration nodes in the first device tree file. The configuration node is used to represent the device to be started. The configuration identifier can be in the form of a pure integer or a string.
[0036] In some examples, the above configuration identifier can be the node name of the corresponding configuration node, the node path of the corresponding configuration node, or other possible identifiers, which are not specifically limited in this disclosure. During system startup, when it is necessary to initialize the driver for a target device to be started, the target configuration identifier pre-bound to the target device to be started can be called directly.
[0037] In some embodiments, the number of target devices to be started can be one or more. When the target devices to be started include one device to be started, the target configuration identifier is the configuration identifier corresponding to that one device to be started; when the target devices to be started include multiple devices to be started, each device to be started corresponds to an independent target configuration identifier.
[0038] In the first device tree file, identify the target configuration node corresponding to the target configuration identifier and obtain the target structure data stored in the target configuration node.
[0039] In some embodiments, the target structure data mentioned above is a configuration attribute value pre-generated and stored at the actual storage address of the target configuration node. This target structure data is C language structure binary data, and its data format, byte order, and memory alignment are completely consistent with the structure type pre-agreed upon by the driver, so it can be used directly without any format conversion. After obtaining the target configuration identifier, the node lookup interface of the libfdt library can be called, passing the target configuration identifier as an input parameter, to quickly locate the target configuration node corresponding to the target configuration identifier in the first device tree file. After locating the target configuration node, an interface (such as the fdt_getprop interface) can be called to directly read the target structure data stored in the target configuration node.
[0040] Compared to existing technologies, this approach involves several steps. First, the `fdt_node_offset_by_compatible` interface is called to traverse all nodes and match the target device. Then, multiple interfaces such as `fdt_read_uint64`, `fdt_get_reg_props_by_index`, and `fdt_read_uint32` are called sequentially to read different attributes. Finally, these attributes are assembled into a driver-usable parameter structure. This process requires multiple libfdt interface calls and memory accesses, increasing the time consumption with the number of nodes. In contrast, this solution requires only a single interface call to obtain all parameters of the device to be started. This reduces the number of interface calls and significantly decreases memory access overhead, eliminating the time-consuming DTB parsing during the startup phase.
[0041] Based on the target structure data, perform initialization operations on the target device to be started in order to start the target device to be started.
[0042] In some embodiments, the startup process of the target device to be started can be completed by the driver performing initialization configuration on the target device to be started based on all parameters included in the target structure data, such as register configuration, interrupt initialization, clock enabling and other series of initialization operations.
[0043] For example, taking the current boot image as a BL33-level Linux operating system kernel and the initialization of the UART0 serial port as an example. Assume the first device tree file contains the original node and configuration node corresponding to UART0, and the configuration node stores pre-generated UART configuration binary structure data (i.e., target structure data). When the Linux operating system kernel starts, the pre-generated first device tree file is loaded into a specified memory address, determining that the UART0 serial port (i.e., the target device to be booted) needs to be initialized, and the target configuration identifier corresponding to the UART0 serial port is obtained. The interface function of the libfdt library can be called to locate the UART configuration node corresponding to the target configuration identifier in the first device tree file, and read the complete target structure data from the UART configuration node. Then, the driver directly uses the register base address, interrupt number, clock ID, etc., included in the target structure data to complete the initialization of the UART0 serial port. The entire process does not require traversing all serial port nodes or repeatedly calling interface functions to read register, interrupt, clock, and other attribute values, significantly reducing the initialization time of the UART0 serial port.
[0044] In other embodiments, after the target device to be started has completed its initialization configuration, the status register of the target device to be started can be read to verify whether the initialization of the target device to be started was successful. If the verification is successful, it is confirmed that the target device to be started has completed the startup and entered the normal working state; if the verification fails, an error message is returned, which can trigger the exception handling process.
[0045] In some embodiments, after all devices to be initialized in the current boot image have been initialized, it can be determined whether there is a next-level boot image. If there is a next-level boot image, the memory base address of the first device tree file corresponding to the next-level boot image is passed to the next-level boot image, and then execution jumps to the memory base address of the next-level image; if there is no next-level image, for example, if the current boot image is a kernel boot image, the system boot process ends after the kernel boot image starts and enters the normal operating state, at which point there is no need to execute this scheme to initialize devices.
[0046] The device startup apparatus provided in this disclosure utilizes configuration nodes in a pre-generated first device tree file to pre-store binary structure data corresponding to the attribute parameters of the original nodes. Therefore, pre-parsing of device initialization data is implemented during the compilation phase. Consequently, when loading the first device tree file to start the device, there is no need to perform parsing operations on the hardware attribute data of the original nodes in the first device tree file again. After quickly locating the target configuration node in the first device tree file based on the target configuration identifier corresponding to the current startup image, the target structure data stored within that target configuration node can be directly extracted, significantly reducing the parsing time during the device initialization startup phase. Thus, in embedded system scenarios, the hardware configuration parameters corresponding to the target device to be started can be accurately obtained based on the configuration nodes for initialization operations, effectively avoiding invalid node data traversal and parsing overhead, thereby significantly improving the overall system startup speed.
[0047] In some embodiments, the first device tree file is stored at a specified memory address; such as Figure 1 As shown, processor 101 executes the process of obtaining target structure data stored in the target configuration node, specifically configured as follows: Determine the address offset of the target configuration node.
[0048] The first device tree file is stored at a specified address in memory.
[0049] In some embodiments, each boot image may include an offset table, which is generated synchronously with the first device tree file during the compilation phase and corresponds one-to-one with the first device tree file. Each record in the offset table may include: the configuration identifier of the configuration node, and the address offset of the corresponding configuration node's structure data in the first device tree file. The address offset represents the byte offset of the configuration node's structure data relative to the starting address (i.e., a specified memory address) of the first device tree file.
[0050] In some examples, the offset table can be queried based on the target configuration identifier corresponding to the target configuration node to obtain the address offset corresponding to the target configuration identifier. If the corresponding configuration node identifier is not found in the offset table, the target configuration node can be found through an interface function (such as the fdt_getprop interface), and the address offset of the target structure data in the target configuration node relative to the starting address of the first device tree file can be calculated. Alternatively, an interface function (such as fdt_path_offset) can be directly called, taking the target configuration identifier as an input parameter, to obtain the address offset of the target configuration node corresponding to the target configuration identifier.
[0051] In some examples, to avoid address conflicts, boot images for different boot stages correspond to different memory addresses. For example, the ATF image is loaded at SRAM address 0xFFFF0000, and the U-Boot image is loaded at DRAM address 0x48000000.
[0052] The actual storage address of the target configuration node is determined based on the specified memory address and the address offset of the target configuration node.
[0053] In some embodiments, the memory address specified above is the starting address for storing the first device tree file. This starting address is typically fixed. This fixed starting address can be pre-configured when compiling the startup image or allocated in real-time after the device powers on. The actual storage address of the target configuration node is obtained by adding the memory address specified in the first device tree file to the address offset of the target configuration node.
[0054] In other embodiments, after the actual storage address is calculated, an address validity check can be performed on the actual storage address to confirm that the calculated actual storage address is within the memory range of the first device tree file, thereby avoiding out-of-bounds access. After the check passes, the accurate actual storage address is obtained.
[0055] Retrieve the target structure data from the actual storage address.
[0056] In some embodiments, the calculated actual storage address can be directly accessed to obtain the complete target structure data. This target structure data is in binary format, which can be directly read, parsed, and used by the processor for device initialization configuration.
[0057] The technical solution provided in this disclosure determines the actual physical address for storing target structure data by specifying a memory address and an address offset. This method does not require parsing the node header and attribute structure of the device data file, but is only a simple memory read operation. Therefore, it completely avoids the parsing interface call and node lookup logic in the startup phase of related technologies, simplifies the acquisition of structure data to memory read, and further improves the startup speed.
[0058] In some embodiments, in the above Figure 1 Based on the embodiment shown, the processor 101 executes the process of determining the target configuration identifier corresponding to the target device to be started for initialization of the current boot image. Specifically, it is configured to: determine the target configuration identifier corresponding to the target device to be started based on the target device to be started and the preset correspondence.
[0059] The preset correspondence is used to indicate the one-to-one correspondence between the device to be started and the configuration identifier.
[0060] In some embodiments, the aforementioned preset correspondence can be fixed in the read-only code segment of the startup image in the form of a static structure array, thereby eliminating the need for dynamic generation and loading at runtime and resulting in extremely fast access speed.
[0061] In other embodiments, the aforementioned preset correspondence can be stored in the form of a mapping table. Each record in this mapping table can contain two fields: a unique device identifier for the device to be started and a corresponding configuration identifier for the device to be started. This mapping table can be generated synchronously with the first device tree file during the compilation phase to ensure a one-to-one correspondence between devices and configuration nodes, preventing matching errors. It should be noted that the mapping table corresponding to each startup phase can be an independent sub-table, or it can be merged into a complete mapping table. The specific method can be determined according to the actual situation, and this disclosure does not limit this.
[0062] In some examples, the unique device identifier (e.g., device name, number, etc.) of the target device to be started is used as an index to query a static mapping table. The table is then used to identify entries that match the target device, and the configuration identifier within those entries is read as the target configuration identifier. If no matching entry is found in the mapping table, a matching failure signal is returned. This can trigger the traditional raw node resolution process or skip the initialization process of the target device, ensuring the reliability of system startup.
[0063] The technical solution provided in this disclosure binds the device to be started and the configuration identifier through a preset correspondence. Therefore, it can match the target configuration identifier corresponding to the target device to be started based on the preset correspondence. The matching logic is simple and efficient, does not require dynamic calculation at runtime, and does not occupy CPU resources during the startup phase, thereby improving the stability of the startup process.
[0064] In some embodiments, in the above Figure 1 Based on the illustrated embodiment, the processor 101 is further configured to: Based on the type of the current boot image, determine a set of devices to be booted corresponding to the current boot image.
[0065] In some embodiments, all devices to be started can be divided into multiple device groups according to a multi-level startup phase, with each device group corresponding to the same type of startup image. The correspondence between the device groups to be started and the startup images can be pre-determined in the startup image as a static array or stored separately as a mapping table.
[0066] For example, taking the multi-level boot stage of an automotive chip as an example, the groups of devices to be booted corresponding to the boot images of each boot stage can be pre-divided as follows: (1) The basic hardware group corresponding to the BL31 level ATF image can specifically include: central processing unit (CPU), clock controller, storage controller, power management unit, debug serial port, security controller and other underlying hardware.
[0067] (2) The boot peripheral group corresponding to the U-Boot image of BL33 level may specifically include: Ethernet controller (ETH), flash memory controller (Flash), general purpose input output controller (GPIO), pin control (pinctrl) and other boot peripherals.
[0068] (3) The Linux operating system kernel of BL33 level corresponds to the system peripheral group, which may specifically include: a full range of system peripherals such as camera, Generic Interrupt Controller (GIC), Universal Asynchronous Receiver / Transmitter (UART) serial port, and Peripheral Component Interconnect Express (PCIe).
[0069] In some examples, after the current boot image runs, a group of devices to be booted corresponding to the current boot image can be determined based on the type and correspondence of the current boot image. For example, if the current boot image is an ATF image, a group of devices to be booted corresponding to that ATF image can be determined based on the type and correspondence of the current boot image.
[0070] Based on the preset boot logic of the current boot image, the target boot device is determined from a group of bootable devices.
[0071] In some embodiments, the above-mentioned preset startup logic refers to the hardware-dependent startup order of a group of devices to be started corresponding to the current startup image. The target device to be started that needs to be initialized can be determined sequentially in a group of devices to be started according to the preset startup logic.
[0072] For example, taking an ATF image as the current boot image, after identifying a group of bootable devices corresponding to this ATF image, the CPU and clock controller can be initialized first, followed by the power management unit, memory controller, and debug serial port, according to the preset boot logic of the ATF image. In other words, based on the preset boot logic, one bootable device from the group corresponding to the current boot image that needs to be initialized each time can be selected as the target bootable device, and the entire initialization process for this group of bootable devices can be completed sequentially.
[0073] The technical solution provided in this disclosure grouped the devices to be started by the type of the boot image, so that each startup stage only processes the devices that need to be initialized in the corresponding stage, without having to perform a full traversal and parsing of all device tree nodes. This effectively reduced the number of devices that need to be processed in each startup stage, reduced invalid calculations, further shortened the overall startup time, and simplified the startup logic of each startup stage, thereby improving the controllability and stability of the multi-level startup process.
[0074] Figure 2 This is a schematic diagram of a device tree file generation apparatus provided in an exemplary embodiment of this disclosure. The device tree file generation apparatus can be a mirror compilation server or a hardware functional module on a mirror compilation server. For example... Figure 3 As shown, the device 200 includes at least one processor, and the processor 201 is configured to: The device tree source file, which includes multiple original nodes, is compiled to obtain the second device tree file.
[0075] In some embodiments, the above-mentioned Device Tree Source (DTS) file is in text format and may include multiple raw nodes such as root node, bus node, and peripheral node. Each raw node can identify the device type through the compatible attribute and describe hardware parameters through attributes such as registers, interrupts, clocks, and status.
[0076] For example, taking the vehicle-mounted UART serial port node as an example, the device node (i.e., the original node) in the device tree source file can include the following attributes: (1) compatible attribute, used to identify the device type; (2) reg register attribute, used to describe the base address and address range of the peripheral register; (3) interrupts attribute, used to describe the interrupt type, interrupt number and triggering method of the device; (4) clocks attribute, used to identify the clock source corresponding to the device; (5) status attribute, used to identify whether the device is enabled. It should be noted that the attribute parameters of the above multiple attributes are used as the first attribute parameter.
[0077] In some embodiments, the Device Tree Compiler (DTC) is invoked to execute compilation commands to convert the text-formatted DTS source file into a binary-formatted DTB file, which is the second device tree file.
[0078] In other embodiments, the system may include multiple DTS source files, with different DTS source files corresponding to different startup stages, or different hardware boards corresponding to different DTS source files; each DTS source file can be compiled one by one to generate the corresponding second device tree file.
[0079] The second device tree file is parsed to obtain the first attribute parameters of the original nodes.
[0080] In some embodiments, each raw node in the second device tree file is traversed, and interface functions in the libfdt library are called to read all attribute data of each raw node. This attribute data is then used as the first attribute parameter for the corresponding raw node. The first attribute parameter includes all hardware description information of the raw node. For example, the first attribute parameter may specifically include: register base address and address range, interrupt number and interrupt trigger type, clock ID, and device status, as well as all parameters required for driver initialization.
[0081] Add a configuration node corresponding to the original node to the second device tree file, and write the structure data corresponding to the first attribute parameter into the corresponding configuration node to obtain the first device tree file.
[0082] In some embodiments, for each original node in the second device tree file, a dedicated configuration node is created in the same directory as that original node. The naming of the configuration nodes follows a uniform rule. For example, if the original node is a serial port device node, the configuration identifier of the configuration node corresponding to that original node can be a combination of a prefix and a device identifier.
[0083] In some examples, the first attribute parameter of the original node can be first converted into binary structure data according to a pre-defined C language structure type, and then this structure data can be written into the configuration node as an attribute value. This process is repeated until the configuration node corresponding to each original node has been written with binary structure data to generate the first device tree file. Each configuration node in the first device tree file contains only one core data attribute, the value of which is a complete binary structure data. The conversion of the first attribute parameter into binary structure data can be described in detail in the following embodiments, and will not be repeated here.
[0084] In some embodiments, based on the above execution steps, a first device tree file corresponding to different startup stages or a first device tree file corresponding to different hardware boards can be generated.
[0085] In other embodiments, after generating the first device tree file, it can be packaged into a CFG image file in ext4 file system format. This CFG image file can then be written to a designated partition of a storage medium (e.g., optical disc, hard disk). This method of packaging it as an independent CFG image facilitates production line burning and version management, decoupling it from the system image, and eliminating the need to repeatedly burn the designated partition of the device tree when upgrading the system. Of course, besides ext4 format, other file system formats such as FAT32 and squashfs can also be used to package the first device tree file, depending on the requirements of the storage medium. The specific format can be determined based on actual usage, and this disclosure does not limit this.
[0086] The device tree file generation apparatus provided in this disclosure pre-parses the attribute parameters of each original node in the initial device tree file during the compilation and generation stage, converts them into binary structure data, and writes them into newly added configuration nodes to generate a new device tree file. This allows the device to directly read the structure data from the new device tree file via address to initialize the device during startup. Compared to traditional technologies, this solution eliminates the need to perform node attribute parsing operations during startup, ensuring that the time spent on all parsing does not consume device startup time, thus fundamentally eliminating the parsing overhead during startup.
[0087] Furthermore, since the generated first device tree is fully compatible with the standard DTB format, it can support the fast startup process of this disclosure and is also backward compatible with the traditional parsing process, thus possessing extremely strong compatibility.
[0088] In some embodiments, such as Figure 2 As shown, processor 201 parses the second device tree file to obtain the first attribute parameters of the original nodes, which are specifically configured as follows: The second device tree file is parsed to obtain the node position and / or attribute identifier of the original node.
[0089] In some embodiments, the `fdt_node_offset_by_compatible` interface function of the libfdt library can be called, passing the string of the `compatible` attribute of the original node as an input parameter. This function iterates through the DTB file to match the corresponding original node and returns the node position of that original node in the second device tree file. For each original node, its corresponding node position can be obtained.
[0090] In some embodiments, after locating a certain original node, all attributes under the original node are traversed, and the attribute identifier (e.g., name string) of each attribute is read. For example, the attribute identifier may include device type attribute identifier (e.g., compatible), register attribute identifier (e.g., reg), interrupt attribute identifier (e.g., interrupts), clock attribute identifier (e.g., clocks), status attribute identifier (e.g., status), etc. All attribute identifiers constitute the attribute identifier list of the original node.
[0091] Based on the node location and / or attribute identifier of the original node, obtain the first attribute parameter of the original node from the second device tree file.
[0092] In some examples, based on the node location and attribute identifier of the original node, the corresponding libfdt interface functions can be called one by one, passing the node location and attribute identifier as input parameters. The values of the attributes corresponding to each attribute identifier are read, and all the read attribute values are summarized as the complete first attribute parameter of the original node. This first attribute parameter contains all the hardware configuration data required for driver initialization. For example, a dedicated register attribute interface function is called to obtain the attribute value for register attributes, a 64-bit numeric interface function is called to obtain the attribute value for 64-bit integer attributes, and a 32-bit numeric interface function is called to obtain the attribute value for 32-bit integer attributes.
[0093] In other examples, the aforementioned attribute identifiers may include the attribute identifiers of all attributes possessed by the corresponding original node. After obtaining the attribute identifiers of each original node, the fdt_getprop interface function can be called to traverse all attribute names included in the attribute identifier based on the attribute identifier of each original node, so as to obtain the attribute values of all attributes possessed by each original node.
[0094] In some examples, based on the node position of the original node, the property traversal interfaces in the libfdt library (such as fdt_first_property_offset and fdt_next_property_offset) can be called to sequentially obtain the offsets of all properties under the original node; then, combined with the fdt_getprop_by_offset interface, the corresponding property name and property value can be read according to the offset of each property. In this way, all property parameters of the original node can be completely extracted without prior knowledge of the specific property identifier, thus ensuring the integrity of the first property parameter.
[0095] The technical solution provided in this disclosure achieves node location and attribute reading by parsing the device tree file, thereby avoiding repeated traversal and improving the parsing efficiency during the compilation stage.
[0096] In some embodiments, such as Figure 2 As shown, the processor 201 executes the process of obtaining the first attribute parameter of the original node from the second device tree file based on the node location and / or attribute identifier of the original node, specifically configured as follows: Based on the target attribute identifier, determine the offset of the target original node, including the target node identifier, in the second device tree file.
[0097] The offset is used to indicate the node position of the original target node.
[0098] In some embodiments, the attribute identifier of the original node includes a target attribute identifier, which is the compatible attribute string of the original node. This compatible attribute string is a unique identifier for the original node of the device type, meaning that the target original node is a device type original node. This target attribute identifier can filter out original nodes of non-device type in the second device tree file, thereby avoiding traversing all original nodes and saving parsing time for the second device tree file. Furthermore, only the first attribute parameter of the target original node needs to be extracted subsequently, without needing to extract attribute parameters of other non-device type original nodes.
[0099] In some examples, the `fdt_node_offset_by_compatible` interface function can be called, taking three parameters: the DTB file handle, the parent node offset, and the `compatible` attribute string. Starting from the specified parent node, it traverses all child nodes, matching the original node whose `compatible` attribute matches the input parameter. If a match is successful, it returns the offset of that original node in the second device tree, which is used for addressing the second device tree file.
[0100] In some examples, if multiple original nodes share the same target attribute identifier, the `fdt_node_offset_by_compatible` interface function is repeatedly called for each original node to obtain the offsets of these multiple original nodes in the second device tree file. For instance, if the second device tree file includes four UART nodes, and these four UART nodes all use the same `compatible` attribute string (i.e., have the same target attribute identifier), the `fdt_node_offset_by_compatible` interface is called repeatedly to obtain the offsets corresponding to all UART nodes in turn, ensuring no omissions.
[0101] Based on the offset of the target original node in the second device tree file, obtain the first attribute parameter of the target original node from the second device tree file.
[0102] In some embodiments, based on the offset of the target original node in the second device tree file, the corresponding interface function is called to traverse all attributes under the target original node, reading the attribute name and attribute value of each attribute one by one, ensuring that the attribute values of all attributes are extracted without omission. After reading is complete, all attribute values are determined as the first attribute parameter of the target original node.
[0103] In some examples, all attributes under the target source node may include register attributes and interrupt attributes. For register attributes, a dedicated register attribute read interface function (e.g., `fdt_get_reg_props_by_index`) can be called, passing in the offset and register index corresponding to the target source node as input parameters, to read the register base address and address length at the corresponding index. For interrupt attributes, an array read interface function (e.g., `fdt_getprop`) can be called, passing in the offset and attribute name corresponding to the target source node, to read parameters such as interrupt type, interrupt number, and trigger type. Finally, these two types of parameters, along with other attribute values, are used as the first attribute parameter of the target source node.
[0104] The technical solution provided in this disclosure directly locates the target original node by means of the target attribute identifier, without having to traverse all original nodes layer by layer starting from the root node of the second device tree file. This significantly reduces the time spent on node search during the compilation stage, extracts only the attribute parameters of the target original node, reduces the amount of invalid data processed, and further improves the compilation efficiency.
[0105] In some embodiments, such as Figure 2 As shown, the processor 201 can also be configured to: after obtaining the first attribute parameter of the original node, convert the first attribute parameter into structure data according to the preset structure type of the original node.
[0106] In some embodiments, the aforementioned preset structure type may be a C language structure type or a structure type with a fixed memory layout as defined by other programming languages; this disclosure does not limit this. The preset structure type can be predefined according to the actual needs of the device driver or set by the user.
[0107] In some embodiments, a C language structure type is used as an example as the preset structure type. This preset structure type is a C language structure definition pre-agreed upon by the compiler (i.e., the compiler) and the startup process (i.e., the device driver). Different types of primitive nodes correspond to different structure types. Each member variable of the structure corresponds one-to-one with the attribute of the primitive node. The preset structure type defines the data type, byte length, and arrangement order of each member variable of the binary structure. Both the compiler and the startup process use the same memory alignment rules to ensure that the parsing results of the structure data at both ends are completely consistent. Each primitive node corresponds to independent structure data, and the data length is the byte size specified by the corresponding preset structure type.
[0108] For example, taking a UART node as the original node. The preset structure type corresponding to the UART node defines members for storing the register base address, register address range, interrupt number, trigger mode, clock ID, and status flag. After obtaining the first attribute parameter, the values of each attribute are assigned to the corresponding member variables sequentially according to the order of the structure members indicated by the preset structure type, thus completing the conversion from attribute parameters to complete structure data.
[0109] The technical solution provided in this disclosure realizes the conversion from attribute parameters to structured binary data by pre-defining a unified structure type. This eliminates the need to re-parse attribute data of different formats during the startup phase. Driver initialization can be completed by directly reading the structure data during startup, which greatly reduces the computational complexity of the startup phase and thus improves the system startup speed.
[0110] Exemplary methods Figure 3 This is a schematic flowchart of a device startup method provided in an exemplary embodiment of this disclosure. The method can be... Figure 1 At least one processor 101 in the electronic device 100 executes the commands. For example... Figure 3 As shown, the method may include the following steps 301 to 304.
[0111] Step 301: In response to the current boot image being a preset type image, load the pre-generated first device tree file corresponding to the current boot image.
[0112] The first device tree file includes: multiple original nodes, multiple first attribute parameters corresponding to the original nodes, and configuration nodes corresponding to the original nodes. The configuration nodes are used to store the structure data obtained after converting the first attribute parameters corresponding to the original nodes. Step 302: Determine the target configuration identifier corresponding to the target device to be booted for initialization of the current boot image.
[0113] Step 303: Determine the target configuration node corresponding to the target configuration identifier in the first device tree file, and obtain the target structure data stored in the target configuration node.
[0114] Step 304: Based on the target structure data, perform initialization operations on the target device to be started in order to start the target device to be started.
[0115] In some embodiments, the first device tree file is stored at a specified address in memory; in the above... Figure 3 Based on the illustrated embodiment, step 301 may include: determining the address offset of the target configuration node; determining the actual storage address of the target configuration node based on the specified memory address and the address offset of the target configuration node; and obtaining the target structure data from the actual storage address.
[0116] In some embodiments, step 302 may specifically include: determining the target configuration identifier corresponding to the target device to be started based on the target device to be started and the preset correspondence; wherein the preset correspondence is used to indicate the one-to-one correspondence between the device to be started and the configuration identifier.
[0117] In some embodiments, the device startup method provided in this disclosure may further include the following steps: determining a group of devices to be started corresponding to the current startup image based on the type of the current startup image; and determining a target device to be started from the group of devices to be started based on the preset startup logic of the current startup image.
[0118] Figure 4 This is a flowchart illustrating a device tree file generation method provided in an exemplary embodiment of this disclosure. The method can be... Figure 2At least one processor 201 in the electronic device 200 executes the commands. For example... Figure 3 As shown, the method may include the following steps 401 to 403.
[0119] Step 401: Compile the device tree source file, which includes multiple original nodes, to obtain the second device tree file.
[0120] Step 402: Parse the second device tree file to obtain the first attribute parameters of the original nodes.
[0121] Step 403: Add a configuration node corresponding to the original node to the second device tree file, and write the structure data corresponding to the first attribute parameter into the corresponding configuration node to obtain the first device tree file.
[0122] In some embodiments, step 402 may specifically include: parsing the second device tree file to obtain the node position and / or attribute identifier of the original node; and obtaining the first attribute parameter of the original node from the second device tree file based on the node position and / or attribute identifier of the original node.
[0123] In some embodiments, the step of obtaining the first attribute parameter of the original node from the second device tree file based on the node position and / or attribute identifier of the original node may specifically include: determining the offset of the target original node in the second device tree file, including the target node identifier, based on the target attribute identifier; wherein the offset is used to indicate the node position of the target original node; and obtaining the first attribute parameter of the target original node from the second device tree file based on the offset of the target original node in the second device tree file.
[0124] In some embodiments, the above-described device tree file generation method may further include the following steps: after obtaining the first attribute parameter of the original node, converting the first attribute parameter into structure data according to the preset structure type of the original node.
[0125] It is understood that the specific execution methods and corresponding beneficial effects of each step in the device startup method and device tree file generation method in the above embodiments have been described in detail in the corresponding embodiments of the exemplary device section above. Please refer to the corresponding execution methods and beneficial technical effects of the exemplary device section above, and they will not be repeated here.
[0126] Exemplary device Figure 5 This is a schematic diagram of a device starting apparatus provided in an embodiment of this disclosure. Figure 5As shown, the device startup device 500 includes: a first loading module 501, used to load a pre-generated first device tree file corresponding to the current startup image in response to the current startup image being a preset type image; wherein, the first device tree file includes: multiple original nodes, first attribute parameters corresponding to the multiple original nodes, and configuration nodes corresponding to the original nodes, the configuration nodes being used to store structure data obtained after parsing the first attribute parameters corresponding to the original nodes; a first determining module 502, used to determine a target configuration identifier corresponding to the target device to be started used for initialization by the current startup image; a second determining module 503, used to determine a target configuration node corresponding to the target configuration identifier in the first device tree file, and obtain target structure data stored in the target configuration node; and a first execution module 504, used to perform an initialization operation on the target device to be started based on the target structure data, so as to start the target device to be started.
[0127] In some embodiments, the first device tree file is stored at a specified address in memory; the second determining module 503 is specifically used to: determine the address offset of the target configuration node; determine the actual storage address of the target configuration node based on the specified address in memory and the address offset of the target configuration node; and obtain the target structure data from the actual storage address.
[0128] In some embodiments, the first determining module 502 is specifically used to: determine the target configuration identifier corresponding to the target device to be started based on the target device to be started and the preset correspondence; wherein the preset correspondence is used to indicate the one-to-one correspondence between the device to be started and the configuration identifier.
[0129] In some embodiments, the device startup apparatus 500 may further include: a third determining module, configured to determine a group of devices to be started corresponding to the current startup image based on the type of the current startup image; and to determine a target device to be started from the group of devices to be started based on the preset startup logic of the current startup image.
[0130] Figure 6 This is a schematic diagram of the structure of a device tree file generation apparatus provided in an exemplary embodiment of this disclosure. Figure 6 As shown, the device tree file generation device 600 includes: a first compilation module 601, used to compile a device tree source file including multiple original nodes to obtain a second device tree file; a first parsing module 602, used to parse the second device tree file to obtain the first attribute parameters of the original nodes; and a first processing module 603, used to add configuration nodes corresponding to the original nodes in the second device tree file and write the structure data corresponding to the first attribute parameters into the corresponding configuration nodes to obtain a first device tree file.
[0131] In some embodiments, the first parsing module 602 is specifically used to: parse the second device tree file to obtain the node position and / or attribute identifier of the original node; and obtain the first attribute parameter of the original node from the second device tree file based on the node position and / or attribute identifier of the original node.
[0132] In some embodiments, the first parsing module 602 is specifically configured to: determine, based on the target attribute identifier, the offset of the target original node including the target node identifier in the second device tree file; wherein the offset is used to indicate the node position of the target original node; and obtain the first attribute parameter of the target original node from the second device tree file based on the offset of the target original node in the second device tree file.
[0133] In some embodiments, the device tree file generation apparatus 600 may further include: a data conversion module, configured to convert the first attribute parameters of the original node into structure data according to a preset structure type of the original node after obtaining the first attribute parameters of the original node.
[0134] The beneficial technical effects corresponding to the exemplary embodiments of this device can be found in the corresponding beneficial technical effects of the exemplary device section above, and will not be repeated here.
[0135] Exemplary electronic devices Figure 7 A structural diagram of an electronic device provided in this disclosure includes at least one processor 111 and a memory 112. For example, the electronic device can be as follows: Figure 1 The device starter shown may be as follows: Figure 2 The device tree file generation device shown.
[0136] The processor 111 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
[0137] The memory 112 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 111 may execute one or more computer program instructions to implement the device startup method, device tree file generation method, and / or other desired functions of the various embodiments of this disclosure described above.
[0138] In one example, the electronic device 11 may also include an input device 113 and an output device 114, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0139] The input device 113 may also include, for example, a keyboard, a mouse, etc.
[0140] The output device 114 can output various information to the outside, including, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0141] Of course, for the sake of simplicity, Figure 7 Only some of the components of the electronic device 11 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 11 may include any other suitable components depending on the specific application.
[0142] Exemplary computer program products and computer-readable storage media In addition to the methods and devices described above, embodiments of this disclosure may also provide a computer program product, including computer program instructions, which, when executed by a processor, cause the processor to perform the steps of the device startup method and device tree file generation method of the various embodiments of this disclosure described in the "Exemplary Methods" section above.
[0143] Computer program products can be written in any combination of one or more programming languages to perform the operations of embodiments of this disclosure. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0144] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the device startup method and device tree file generation method of the various embodiments of this disclosure described in the "Exemplary Methods" section above.
[0145] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, but is not limited to, systems, apparatuses, or devices that are electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0146] The basic principles of this disclosure have been described above with reference to specific embodiments. However, the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0147] Various modifications and variations can be made to this disclosure without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, this disclosure is also intended to include such modifications and variations.
Claims
1. A device startup apparatus, comprising at least one processor, the processor being configured to: In response to the current boot image being a preset type image, a pre-generated first device tree file corresponding to the current boot image is loaded; wherein... The first device tree file includes: multiple original nodes, first attribute parameters corresponding to the multiple original nodes, and configuration nodes corresponding to the original nodes. The configuration nodes are used to store the structure data obtained after converting the first attribute parameters corresponding to the original nodes. Determine the target configuration identifier corresponding to the target device to be booted for initialization using the current boot image; In the first device tree file, determine the target configuration node corresponding to the target configuration identifier, and obtain the target structure data stored in the target configuration node; Based on the target structure data, an initialization operation is performed on the target device to be started in order to start the target device to be started.
2. The apparatus according to claim 1, wherein, The first device tree file is stored at a specified memory address; the processor executes the process of retrieving the target structure data stored in the target configuration node, specifically configured as follows: Determine the address offset of the target configuration node; Based on the specified memory address and the address offset of the target configuration node, determine the actual storage address of the target configuration node; The target structure data is obtained from the actual storage address.
3. The apparatus according to claim 1, wherein, The processor executes the process of determining the target configuration identifier corresponding to the target boot device used for initialization by the current boot image, specifically configured as follows: Based on the target device to be started and the preset correspondence, the target configuration identifier corresponding to the target device to be started is determined; wherein, the preset correspondence is used to indicate the one-to-one correspondence between the device to be started and the configuration identifier.
4. The apparatus according to any one of claims 1-3, wherein the processor is further configured to: Based on the type of the current boot image, determine a group of devices to be booted corresponding to the current boot image; Based on the preset startup logic of the current startup image, the target startup device is determined from the group of devices to be started.
5. A device tree file generation apparatus, comprising at least one processor, the processor being configured to: The device tree source file, which includes multiple original nodes, is compiled to obtain the second device tree file; The second device tree file is parsed to obtain the first attribute parameters of the original node; Add a configuration node corresponding to the original node to the second device tree file, and write the structure data corresponding to the first attribute parameter into the corresponding configuration node to obtain the first device tree file.
6. The apparatus according to claim 5, wherein, The processor parses the second device tree file to obtain the first attribute parameter of the original node, which is specifically configured as follows: The second device tree file is parsed to obtain the node position and attribute identifier of the original node; Based on the node location and / or attribute identifier of the original node, the first attribute parameter of the original node is obtained from the second device tree file.
7. The apparatus according to claim 6, wherein, The processor executes the process of retrieving the first attribute parameter of the original node from the second device tree file based on the node location and / or attribute identifier of the original node, specifically configured as follows: Based on the target attribute identifier, the offset of the target original node, including the target node identifier, in the second device tree file is determined; wherein, the offset is used to indicate the node position of the target original node; Based on the offset of the target original node in the second device tree file, the first attribute parameter of the target original node is obtained from the second device tree file.
8. The apparatus of claim 5, wherein the processor is further configured to: After obtaining the first attribute parameter of the original node, the first attribute parameter is converted into structure data according to the preset structure type of the original node.
9. A device startup method, the method comprising: In response to the current boot image being a preset type image, a pre-generated first device tree file corresponding to the current boot image is loaded; wherein, the first device tree file includes: multiple original nodes, first attribute parameters corresponding to the multiple original nodes, and configuration nodes corresponding to the original nodes, wherein the configuration nodes are used to store structure data obtained after parsing the first attribute parameters corresponding to the original nodes; Determine the target configuration identifier corresponding to the target device to be booted for initialization using the current boot image; In the first device tree file, determine the target configuration node corresponding to the target configuration identifier, and obtain the target structure data stored in the target configuration node; Based on the target structure data, an initialization operation is performed on the target device to be started in order to start the target device to be started.
10. A method for generating a device tree file, the method comprising: The device tree source file, which includes multiple original nodes, is compiled to obtain the second device tree file; The second device tree file is parsed to obtain the first attribute parameters of the original node; Add a configuration node corresponding to the original node to the second device tree file, and write the structure data corresponding to the first attribute parameter into the corresponding configuration node to obtain the first device tree file.
11. A device for starting up equipment, comprising: The first loading module is used to load a pre-generated first device tree file corresponding to the current boot image in response to the current boot image being a preset type image; wherein, the first device tree file includes: multiple original nodes, first attribute parameters corresponding to the multiple original nodes, and configuration nodes corresponding to the original nodes, wherein the configuration nodes are used to store structure data obtained after parsing the first attribute parameters corresponding to the original nodes; The first determining module is used to determine the target configuration identifier corresponding to the target device to be started for initialization by the current boot image; The second determining module is used to determine the target configuration node corresponding to the target configuration identifier in the first device tree file, and to obtain the target structure data stored in the target configuration node; The first execution module is used to perform an initialization operation on the target device to be started based on the target structure data, so as to start the target device to be started.
12. A device tree file generation apparatus, comprising: The first compilation module is used to compile the device tree source file, which includes multiple raw nodes, to obtain the second device tree file; The first parsing module is used to parse the second device tree file to obtain the first attribute parameters of the original node; The first processing module is used to add a configuration node corresponding to the original node in the second device tree file, and write the structure data corresponding to the first attribute parameter into the corresponding configuration node to obtain the first device tree file.
13. A computer-readable storage medium storing a computer program for executing the device startup method of claim 9, or executing the device tree file generation method of claim 10.
14. An electronic device, the electronic device comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the device startup method of claim 9, or to execute the device tree file generation method of claim 10.
