System starting method and device, equipment, storage medium and program product
By generating device tree files compatible with multiple boards and using the boot loader to load common files and sub-files, the problem of low development efficiency of each board in the existing technology is solved, and efficient system startup and board compatibility is achieved.
Patent Information
- Application Number
- CN202510542799.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the development efficiency of the device tree file of each board is low, resulting in an increase in development costs.
By generating device tree files compatible with multiple board cards, including public files and sub-files, the public files contain basic hardware information, and the sub-files contain board-specific hardware information. The boot loader uses the bootloader to load the public files to start the operating system kernel, and load the sub-files according to the board-start instructions to achieve the startup of the target board.
It improves the development efficiency of device tree files, reduces the repetitive work of hardware information development for each board, and improves the flexibility and efficiency of system startup.
Smart Images

Figure CN120407031A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a system startup method, apparatus, device, storage medium, and program product. Background Art
[0002] The device tree is a data structure used to describe device hardware information. The device tree file is a file in the operating system that describes the relevant hardware information of board-level devices in a tree structure, that is, the relevant information of the hardware on a board. The device tree file separates the system's driver code from the device information, so that when the relevant device information of the system changes, there is no need to rewrite the driver code.
[0003] Due to different hardware settings such as processors, buses, and interfaces for different boards, the corresponding device tree files are also different. Therefore, it is necessary to develop corresponding device tree files for different board products.
[0004] However, some boards have some identical hardware information due to using the same or the same series of central processors. Therefore, developing corresponding device tree files for each board has the problem of low development efficiency. Summary of the Invention
[0005] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a system startup method, apparatus, device, storage medium, and program product that can achieve a device tree file compatible with the hardware information of multiple boards, avoid the problem of low development efficiency caused by developing device tree files for the hardware information of each board, and improve the development efficiency of the device tree files of the boards.
[0006] In a first aspect, this application provides a system startup method. The method includes: Obtain a device tree file; the device tree file includes a common file and sub-files corresponding to each board among multiple boards; the sub-files include all the hardware information of the board corresponding to the sub-files; the common file includes the basic hardware information related to the startup of the operating system in the hardware information of each board, and each basic hardware information is compatible with the startup requirements of the operating system; Load the common file, and start the kernel of the operating system according to the hardware information in the common file; In response to a board startup instruction, determine the target board corresponding to the board startup instruction; Load the sub-file corresponding to the target board from the device tree file, and start the operating system and the target board according to the sub-file of the target board.
[0007] In combination with the first aspect, in a possible implementation, the compilation format of the common file is an executable file of the bootloader. Loading the common file includes: in response to the bootloader, identifying and loading the common file.
[0008] In combination with the first aspect, in a possible implementation, loading the sub-file corresponding to the target board from the device tree file includes: generating a link between the common file path and the sub-file path of the target board; after the board startup instruction triggers the bootloader, based on the link, jumping the loading address of the bootloader to the sub-file path of the target board to load the sub-file of the target board.
[0009] In combination with the first aspect, in a possible implementation, the construction process of the device tree file includes: generating a common source file according to the basic hardware information in the hardware information of each board; the basic hardware information is related to the startup of the operating system; generating sub-source files corresponding to each board according to the hardware information in the hardware information of each board except the basic hardware information; compiling the common source file to obtain a common file, and respectively compiling the sub-source files corresponding to each board and the common source file to obtain the sub-files corresponding to each board; constructing the device tree file according to the common file and each sub-file.
[0010] In combination with the first aspect, in a possible implementation, the generation process of the board startup instruction includes: displaying an operation interface, determining the target board according to the configuration operation of the user on the operation interface, and generating a board startup instruction based on the target board; the operation interface includes a command input window and / or a board selection window, the command input window is used to receive a link instruction pointing to the target board, and the board selection window includes configuration items of multiple boards.
[0011] In combination with the first aspect, in a possible implementation, the generation process of the board startup instruction includes: detecting the parameters of multiple adjustable devices, determining the target adjustable device among the multiple adjustable devices whose parameters meet the preset conditions; determining the target board corresponding to the target adjustable device according to the target adjustable device and the preset hardware relationship, and generating a board startup instruction based on the target board; the preset hardware relationship includes the corresponding relationship between different adjustable devices and boards.
[0012] In the second aspect, the present application also provides a system startup device. The device includes: An acquisition module, configured to acquire a device tree file; the device tree file includes a common file and sub-files corresponding to each board among multiple boards; the sub-files include all the hardware information of the board corresponding to the sub-files; the common file includes the basic hardware information related to the startup of the operating system in the hardware information of each board, and each basic hardware information is compatible with the startup requirements of the operating system; A first startup module, configured to load the common file and start the kernel of the operating system according to the hardware information in the common file; A determination module, configured to determine the target board corresponding to the board startup instruction in response to the board startup instruction; The second startup module is used to load the sub-file corresponding to the target board from the device tree file, and start the operating system and the target board according to the sub-file of the target board.
[0013] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0014] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0015] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0016] The embodiments of the present application provide a system startup method, device, equipment, storage medium and program product to obtain a device tree file, then load the common file in the device tree file, and start the kernel of the operating system according to the hardware information in the common file. Then, when the operating system kernel is started, determine the target board to be started. Finally, load the sub-file corresponding to the target board in the device tree file, and start the operating system and the target board based on the hardware information in the sub-file. The embodiments of the present application can be compatible with the hardware information of multiple boards with consistent startup requirements of the operating system through a device tree file, and realize the functions of the target board among the compatible multiple boards through two startups of the operating system during the actual startup process. That is, when starting for the first time, start the operating system kernel to determine the target board to be started, and when starting for the second time, complete the startup of the operating system and the target board. The method provided by the embodiments of the present application can be compatible with the hardware information of multiple boards through one device tree file, avoid the problem of low development efficiency caused by developing device tree files for the hardware information of each board, and improve the development efficiency of the device tree files of the boards. Description of the Drawings
[0017] By reading the detailed description of the non-restrictive embodiments with reference to the following drawings, other features, objects and advantages of the present application will become more obvious: Figure 1 It is a schematic flowchart of the system startup method in an embodiment; Figure 2 It is a schematic flowchart of the startup process of the Linux operating system; Figure 3 It is a schematic flowchart of the startup process of the Android operating system; Figure 4 Another flowchart of the system startup method in an embodiment; Figure 5 Another flowchart of the system startup method in an embodiment; Figure 6 Schematic diagram of a user operation interface in an embodiment; Figure 7 Schematic diagram of another user operation interface in an embodiment; Figure 8 Another flowchart of the system startup method in an embodiment; Figure 9 Block diagram of the structure of a system startup device in an embodiment; Figure 10 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0018] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related invention, rather than limiting the invention. Additionally, it should be noted that for the sake of description, only the parts related to the invention are shown in the drawings.
[0019] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and embodiments. Additionally, the term "and / or" in this article is only used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects, rather than to describe the specific order of the objects.
[0020] The device tree is a data structure used to describe the hardware information of devices. The device tree file is used in the operating system to describe the relevant hardware information of board-level devices by adopting a tree structure, that is, the relevant information of the hardware on a board. For example, the number and type of the Central Processing Unit (CPU), the base address and size of the memory, the Inter-Integrated Circuit (IIC) interface, the Serial Peripheral Interface (SPI), the Universal Asynchronous Receiver / Transmitter (UART) interface, the interrupt controller and interrupt usage, the General-Purpose Input / Output (GPIO) controller and GPIO usage, the clock signal Clock controller and Clock usage, etc.
[0021] The device tree file separates the system's driver code from the device information. When the relevant device information of the system changes, there is no need to rewrite the driver code. Since different boards have different hardware settings such as processors, buses, and interfaces, the corresponding device tree files are also different. Therefore, it is necessary to develop corresponding device tree files for different board products. However, some boards have some identical hardware information because they use the same or the same series of central processors. Therefore, developing corresponding device tree files for each board has the problem of low development efficiency.
[0022] In one embodiment, as Figure 1 shown, a system startup method is provided, which is applied to an independent server or a server cluster composed of multiple servers. The method includes the following steps: Step 101, obtain the device tree file.
[0023] In the embodiment of the present application, the device tree file can be pre-configured and stored in the memory of the operating system by users such as the administrator of the operating system. When the server where the operating system is located starts up, the pre-configured device tree file can be loaded from the memory, and the operating system can be started based on the hardware information in the device tree file.
[0024] The device tree file in the embodiment of the present application can be compatible with the hardware information of multiple boards, specifically including a common file and sub-files corresponding to each board among multiple boards. Among them, the sub-file includes all the hardware information of the board corresponding to the sub-file, so as to facilitate starting the corresponding board function according to each sub-file.
[0025] In the embodiments of this application, the prerequisite for the device tree file to be compatible with the hardware information of multiple boards is that the operating systems supported by the multiple boards are the same, and the multiple boards can be compatible with the startup requirements of the operating system. Based on this prerequisite, a common file needs to be set in the device tree file, and the common file includes the basic hardware information related to the startup of the operating system in the hardware information of each board, where each piece of basic hardware information is compatible with the startup requirements of the operating system.
[0026] In a possible implementation manner, whether multiple boards can be compatible with the startup requirements of the operating system can be determined by whether the hardware information corresponding to each board in the multiple boards is the same as the hardware information required for the startup of the operating system. Specifically, if the hardware information corresponding to each board in the multiple boards is the same as the hardware information required for the startup of the operating system, then the multiple boards can be compatible with the startup requirements of the operating system. Among them, the hardware information required for the startup of the operating system may include a CPU, a graphics processing unit (GPU), a neural network processing unit (NPU), a power chip and the power-on timing sequence, a memory controller, a hardware accelerator, a video encoder, an IIC, a gigabit media access control interface (GMAC), a universal serial bus (USB) interface, a UART interface, an Ethernet interface, a high-definition multimedia interface (HDMI), etc.
[0027] In a possible implementation manner, when the multiple boards use the same or the same series of CPU chips, the hardware information corresponding to each board in the multiple boards is the same as the hardware information required for the startup of the operating system. Therefore, it is possible to determine whether a device tree file can be compatible with the hardware information of multiple boards by judging the CPU chip types of each board in the multiple boards. Specifically, if the CPU chips of each board in the multiple boards are the same or the CPU chip types of each board indicate that the CPU chips of each board are a series of chips, it is determined that a device tree file can be compatible with the hardware information of the above multiple boards. For example, for an AI anti-phototaping board with an interactive security function and a 4K screen mirroring board with an interactive connection function in artificial intelligence (AI) switching technology, both boards support the debian 11 operating system and use RK3588 chips as the CPU chips. Even if the functions of the two boards and the peripheral hardware circuits of the CPU chips are inconsistent, a device tree file can still be used to be compatible with the hardware information of the above two boards.
[0028] Step 102: Load the common file and start the kernel of the operating system according to the hardware information in the common file.
[0029] As Figure 2 shown in the startup process of the Linux operating system, and Figure 3 shown in the startup process of the Android operating system, after the hardware of the operating system is powered on and initialized, it is necessary to use the bootloader to read the device tree file of the operating system and load it into the operating system memory, and then pass the address of the device tree file in the memory to the operating system kernel, so that the operating system kernel can find and parse the hardware information in the device tree file based on this memory address, and configure and initialize the corresponding hardware of the operating system based on this hardware information to achieve the startup of the operating system kernel.
[0030] After the operating system kernel starts, the respective corresponding application startup processes are executed. For example, for the Linux system, after the Linux kernel starts, it first initializes the user space and then performs user login management to verify the user identity; after the user identity verification is completed, system services are provided to achieve the startup of the application program. For the Android system, after the Linux kernel starts (it can be understood that the underlying layer of the Android system is the Linux system, so the kernel startup processes of the two systems are the same), it parses the init.rc file to achieve the initialization settings at system startup; creates and starts the init process, that is, creates the user space process of the system; then creates and starts the zygote process to facilitate the subsequent incubation of other application processes; then creates and starts the System_Server process to start and run the system services to facilitate the subsequent startup of the application program and display the application interface to the user.
[0031] In the embodiment of the present application, when the operating system starts, the common file in the device tree file is first loaded, that is, the basic hardware information required for the startup of the operating system is loaded, and the normal startup of the operating system kernel is first achieved. Specifically, after receiving the operating system startup instruction, the bootloader is triggered, and in response to the bootloader, the common file is identified and loaded.
[0032] Considering that the bootloader has certain loading conditions when loading objects, it is necessary to configure the compilation format of the common file as an executable file of the bootloader. Specifically, during compilation, the file name of the common file can be configured as a file name that the bootloader can recognize and load. For example, in the Linux system, the file name of the device tree file that the bootloader can recognize and load is rk-kernel.dtb. Therefore, in this application, the file name of the common file in the device tree file should be configured as rk-kernel.dtb, so that the bootloader can load the common file by recognizing this file name and start the kernel of the Linux operating system according to the hardware information in the common file.
[0033] Step 103: In response to the board startup instruction, determine the target board corresponding to the board startup instruction.
[0034] In the embodiment of this application, after the operating system kernel starts, it is further possible to determine the target board to be started and start the target board to further implement the board function on the basis of the operating system. Specifically, after the operating system kernel starts, a board startup instruction can be generated, and in response to the board startup instruction, determine the target board corresponding to the board startup instruction.
[0035] In a possible implementation manner, after the system kernel starts, a user operation can be received, the target board configured by the user can be recognized, and a board startup instruction can be generated based on the target board configured by the user. At this time, the board startup instruction includes information about the target board. The operating system can load the sub-file corresponding to the target board from the device tree file in response to the board startup instruction.
[0036] In a possible implementation manner, the target board that needs to be further loaded after the operating system kernel starts can be preset. After the operating system kernel starts on the server, a board startup instruction is generated, and in response to the board startup instruction, first determine the information about the preset target board to be started, and then load the sub-file corresponding to the target board from the device tree file.
[0037] Step 104: Load the sub-file corresponding to the target board from the device tree file, and start the operating system and the target board according to the sub-file of the target board.
[0038] In the embodiment of this application, after determining the target board to be started in response to the board startup instruction, the operating system is started for the second time. During this startup process, the bootloader is used to load the sub-file corresponding to the target board in the device tree file to parse all the hardware information in the sub-file corresponding to the target board, that is, the hardware information required for system startup and other hardware information of the target board. Furthermore, the operating system and the target board can be started according to all the hardware information corresponding to the target board, and the function of the target board can be implemented on the basis of the operating system.
[0039] In a possible implementation, since the bootloader can only load the device tree file of an executable file whose compilation format conforms to the bootloader, that is, it can only load the device tree file with a file name recognizable by the bootloader. Therefore, in the embodiments of the present application, when the operating system is started for the second time in response to the board startup instruction, before the bootloader loads the sub-file of the target board, it is necessary to establish a jump relationship between the common file in the device tree file and the sub-file of the target board, so that the bootloader can jump from the common file to the sub-file of the loaded target board according to the jump relationship, and finally complete the startup of the operating system and the target board.
[0040] The system startup method provided by the embodiments of the present application can obtain the device tree file, then load the common file in the device tree file, and start the kernel of the operating system according to the hardware information in the common file. Then, when the operating system kernel is started, determine the target board to be started. Finally, load the sub-file corresponding to the target board in the device tree file, and start the operating system and the target board based on the hardware information in the sub-file. The embodiments of the present application can be compatible with the hardware information of multiple boards with consistent startup requirements of the operating system through a device tree file, and realize the functions of the target board in multiple compatible boards during the actual startup process through two startups of the operating system. That is, when starting for the first time, start the operating system kernel to determine the target board to be started, and when starting for the second time, complete the startup of the operating system and the target board. The method provided by the embodiments of the present application can be compatible with the hardware information of multiple boards through one device tree file, avoid the problem of low development efficiency caused by developing the device tree file for the hardware information of each board, and improve the development efficiency of the device tree file of the board.
[0041] The foregoing embodiments introduced the solution of the bootloader loading the sub-file of the target board in the device tree file. In another embodiment of the present application, the accurate loading of the sub-file of the target board by the bootloader can be realized by constructing a jump link between the common file and the sub-file of the target board. For example, the "loading the sub-file corresponding to the target board from the device tree file" involved above specifically includes the following steps Figure 4 as shown: Step 201: Generate a link between the path of the common file and the path of the sub-file of the target board.
[0042] In the embodiments of the present application, a link between the public file path and the sub-file path of the target board can be generated by means of a user input instruction. For example, after the operating system kernel starts up, a command input interface can be provided to the user. When the user wants to use the function of a certain board (target board) according to their own needs, they can directly input a jump instruction for the target board on this interface. This jump instruction can represent the link between the public file path and the sub-file path of the target board. For example, the user can directly input the instruction "ln -sf dtb / rk3588-ai-box.dtb / boot / rk-kernel.dtb", so that the server can determine that the target board is rk3588-ai-box (i.e., the AI anti-peeping board), and determine that the loading address of the bootloader needs to jump from / boot / rk-kernel.dtb to dtb / rk3588-ai-box.dtb. Among them, rk3588-ai-box.dtb is the device tree file of the rk3588-ai-box board (i.e., the sub-file of the target board), dtb / rk3588-ai-box.dtb is the path of the sub-file of the target board, rk-kernel.dtb is the public file, and / boot / rk-kernel.dtb is the path of the public file.
[0043] In a possible implementation manner, it can also be that after the server determines the target board, it determines the path of the public file and the path of the sub-file of the target board, and automatically constructs a link between the public file path and the sub-file path of the target board, so that the public file points to the sub-file of the target board.
[0044] Step 202: After the board startup instruction triggers the bootloader, based on the link, jump the loading address of the bootloader to the sub-file path of the target board and load the sub-file of the target board.
[0045] In the embodiments of the present application, the board startup instruction is used on the one hand to instruct the server to determine the target board, and on the other hand to trigger the bootloader to perform the second startup of the operating system. After the board startup instruction triggers the bootloader, the loading address of the bootloader jumps from the public file path to the sub-file path of the target board based on the pre-constructed link, and the loading of the sub-file of the target board is completed.
[0046] The method provided by the embodiments of the present application can generate a link between the public file path and the sub-file path of the target board when the operating system is started up for the second time, so that the loading address of the bootloader jumps to the sub-file path of the target board based on this link, and the accurate loading of the sub-file of the target board is realized.
[0047] The foregoing embodiments introduced the device tree file compatible with multiple boards. The embodiments of the present application provide the construction process of the device tree file, which specifically includes the steps as Figure 5 shown: Step 301, generate a common source file according to the basic hardware information in the hardware information of each board.
[0048] Among them, the basic hardware information is related to the startup of the operating system.
[0049] In the embodiments of the present application, an initial common source file and initial sub-source files corresponding to each board among multiple boards can be created in the directory used to store the device tree source file (Device Tree Source, DTS) in the operating system kernel.
[0050] Specifically, the file names of each source file can be defined in the configuration file of the device tree file first. For example, the file name of the common source file is defined as rk3588-basic.dts by the instruction export RK_KERNEL_DTS=rk3588-basic in device / rockchip / rk3588 / BoardConfig-BOE-3588.mk first. Then, create the initial common source file rk3588-basic.dts, the initial sub-source file rk3588-ai-box.dts corresponding to the board with the AI anti-peeping function, and the initial sub-source file rk3588-screen-projector.dts corresponding to the board with the screen projection function under kernel / arch / arm64 / boot / dts / rockchip / .
[0051] Among them, the creation of the source file can be implemented by an instruction. For example, the creation instruction of the rk3588-basic.dts file can be export RK_KERNEL_DTS=rk3588-basic.
[0052] Then, determine the basic hardware information related to the startup of the operating system in all the hardware information of each board, and write the basic hardware information into the initial common source file to obtain the common source file. For example, write the basic hardware information in the hardware information of the AI anti-peeping board and the screen projection board into rk3588-basic.dts.
[0053] Exemplarily, the hardware description information related to the 12V and 5V power supplies in the basic hardware information of each board can be as follows: vcc12v_dcin: vcc12v-dcin { compatible = "regulator-fixed"; regulator-name = "vcc12v_dcin"; regulator-always-on; regulator-boot-on; regulator-min-microvolt = <1200000>0> ; regulator-max-microvolt = <1200000>0> ; }; vcc5v0_sys: vcc5v0-sys { compatible = "regulator-fixed"; regulator-name = "vcc5v0_sys"; regulator-always-on; regulator-boot-on; regulator-min-microvolt = <5000000> ; regulator-max-microvolt = <5000000> ; vin-supply =<&vcc12v_dcin>; }; vcc5v0_usbdcin: vcc5v0-usbdcin { compatible = "regulator-fixed"; regulator-name = "vcc5v0_usbdcin"; regulator-always-on; regulator-boot-on; regulator-min-microvolt = <5000000> ; regulator-max-microvolt = <5000000> ; vin-supply =<&vcc12v_dcin>; }; vcc5v0_usb: vcc5v0-usb { compatible = "regulator-fixed"; regulator-name = "vcc5v0_usb"; regulator-always-on; regulator-boot-on; regulator-min-microvolt =<5000000>; regulator-max-microvolt =<5000000>; vin-supply =<&vcc5v0_usbdcin>; }; The above hardware information describes the type of voltage regulator corresponding to each power supply, the on state, the startup state when the system starts up, the maximum voltage, the minimum voltage, the power supply side, etc.
[0054] Step 302: Generate sub-source files corresponding to each board according to the hardware information of each board except the basic hardware information.
[0055] In the embodiment of the present application, for the remaining hardware information in all the hardware information of each board except the basic hardware information, the remaining hardware information is written into the initial sub-source file corresponding to each board to obtain the sub-source file corresponding to each board. For example, the hardware information of the AI anti-peeping board except the basic hardware information is written into rk3588-ai-box.dts, and the hardware information of the screen projection board except the basic hardware information is written into rk3588-screen-projector.dts.
[0056] In a possible implementation manner, for the same hardware information in the remaining hardware information of all the hardware information of each board except the basic hardware information, the above same hardware information can be written into the common source file or into the sub-source file corresponding to each board, and the present application does not limit this.
[0057] Step 303: Compile the common source file to obtain a common file, and respectively compile the sub-source file corresponding to each board and the common source file to obtain the sub-file corresponding to each board.
[0058] Step 304: Construct a device tree file according to the common file and each sub-file.
[0059] In the embodiments of the present application, after the hardware information of each source file (the common source file and the sub-source files corresponding to each board) is written, the device tree compiler (DTC) can be used to encode each source file to obtain an executable file (Device Tree Blob, DTB) corresponding to each source file.
[0060] Specifically, the common source file is directly compiled to obtain the common file in the device tree file. The sub-source files corresponding to each board and the common source file are respectively compiled to obtain the sub-files corresponding to each board, so that the sub-files corresponding to each board contain all the hardware information of the board. For example, compiling rk3588-basic.dts yields rk3588-basic.dtb, compiling rk3588-basic.dts and rk3588-ai-box.dts yields rk3588-ai-box.dtb, and compiling rk3588-basic.dts and rk3588-screen-projector.dts yields rk3588-screen-projector.dtb. After all source files are compiled, the device tree file is constructed.
[0061] It should be noted that when compiling the common source file, the compilation format of the obtained common file needs to conform to the executable file of the bootloader. Therefore, after compiling the common source file, the file name of the common file needs to be modified to a file name that the bootloader can recognize and load. For example, compiling rk3588-basic.dts yields rk-kernel.dtb.
[0062] The method provided by the embodiments of the present application can generate a common source file according to the basic hardware information related to the operating system startup in the hardware information of each board, and generate sub-source files corresponding to each board based on the hardware information of each board except the basic hardware information. Then, the common source file is compiled to obtain a common file, and the sub-source files corresponding to each board and the common source file are respectively compiled to obtain the sub-files corresponding to each board. Finally, the device tree file is constructed based on the compiled files. The method provided by the embodiments of the present application can construct the common file in the device tree file based on the basic hardware information related to the operating system startup in all the hardware information of multiple boards, and construct sub-files based on the remaining hardware information of each board, so that the device tree file can be compatible with multiple boards, avoiding the problem of low development efficiency caused by developing the device tree file for the hardware information of each board, and improving the development efficiency of the device tree file of the board.
[0063] The foregoing embodiments introduced a solution for generating a board startup instruction based on a user-configured target board. In another embodiment of the present application, user configuration can be specifically implemented in software or hardware. For example, the process of implementing user configuration of the target board through software can be as follows: Display an operation interface, determine the target board according to the configuration operation of the user on the operation interface, and generate a board startup instruction based on the target board.
[0064] In the embodiments of the present application, as Figure 6 shown, the operation interface may include a command input window, and the command input window is used to receive a link instruction pointing to the target board. The server can detect the input operation of the user in the command input window, receive the link instruction input by the user pointing to the target board, such as the above ln -sf dtb / rk3588-ai-box.dtb / boot / rk-kernel.dtb. Then analyze the user instruction and determine the target board to be started specified by the user, and further generate a board startup instruction containing the target board information to trigger the bootloader to load the sub-files of the target board.
[0065] As Figure 7 shown, the operation interface may include a board selection window, and the board selection window includes configuration items of multiple boards. The server can detect the board name input by the user or the board information selected in the board selection window, determine the target board to be started specified by the user based on the detected board information, and further generate a board startup instruction containing the target board information to trigger the bootloader to load the sub-files of the target board.
[0066] In a possible implementation, the operation interface may include both a command input window and a board selection window, so that the user can configure the target board to be started in multiple ways.
[0067] The process of implementing user configuration of the target board through hardware can include the steps as Figure 8 shown: Step 401: Detect the parameters of multiple adjustable devices, and determine the target adjustable device among the multiple adjustable devices whose parameters meet the preset conditions.
[0068] Step 402: Determine the target board corresponding to the target adjustable device according to the target adjustable device and the preset hardware relationship, and generate a board startup instruction based on the target board.
[0069] Among them, the preset hardware relationship includes the corresponding relationship between different adjustable devices and boards.
[0070] In the embodiments of the present application, multiple adjustable devices can be preset, and the corresponding relationship between each adjustable device and each board (i.e., the preset hardware relationship) can be configured. Then, a preset condition is set, and the preset condition represents the parameter range of the adjustable device corresponding to the target board. During the process of the user configuring the target board through multiple adjustable devices, the parameters of each adjustable device can be detected in real time. When the parameters of the adjustable device meet the preset condition, the board corresponding to the target adjustable device that meets the preset condition is determined as the target board specified by the user. Furthermore, a board startup instruction including the target board information is generated to trigger the bootloader to load the sub-files of the target board.
[0071] In a possible implementation, the adjustable device can be a DIP switch. The one-to-one correspondence between multiple DIP switches and multiple boards can be preconfigured, and at the same time, the preset condition is set as parameter 1. When the user toggles the DIP switch, the values of multiple DIP switches are detected, and the DIP switch with a value of 1 is determined as the target DIP switch, and the board corresponding to the target DIP switch is the target board.
[0072] In a possible implementation, the adjustable device can be a load circuit including a resistor. The resistance values of the resistors in different load circuits are different, so the current or voltage in different load circuits is different. The one-to-one correspondence between multiple load circuits and multiple boards can be preconfigured, and at the same time, the preset condition is set as a certain current range or a certain voltage range. Then, when the user adjusts the load circuit, the current value or voltage value of multiple load circuits is detected, and the load circuit with the current value within the preset current range or the voltage value within the preset voltage range is determined as the target load circuit, and the board corresponding to the target load circuit is the target board.
[0073] In the method provided by the embodiments of the present application, the user can configure the target board in a software or hardware manner, so that the server generates a board startup instruction based on the target board. The method provided by the embodiments of the present application can pre-start the board configured by the user, making the function of the operating system more in line with the user's needs.
[0074] It should be noted that although the operations of the method of the present invention are described in a specific order in the drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowchart can be changed in the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.
[0075] In one embodiment, as Figure 9 shown, a system startup device is provided, including: an acquisition module 501, a first startup module 502, a determination module 503, and a second startup module 504, where: An acquisition module 501, configured to acquire a device tree file; the device tree file includes a common file and sub-files corresponding to each of multiple boards; the sub-files include all hardware information of the board corresponding to the sub-files; the common file includes the hardware information of each board that is related to the startup of the operating system and the startup requirements of the basic hardware information compatible with the operating system.
[0076] A first startup module 502, configured to load the common file and start the kernel of the operating system according to the hardware information in the common file.
[0077] A determination module 503, configured to determine a target board corresponding to the board startup instruction in response to the board startup instruction.
[0078] A second startup module 504, configured to load the sub-file corresponding to the target board from the device tree file and start the operating system and the target board according to the sub-file of the target board.
[0079] In one embodiment, the compilation format of the common file is an executable file of the bootloader. The first startup module 502 is specifically configured to identify and load the common file in response to the bootloader.
[0080] In one embodiment, the second startup module 504 is specifically configured to generate a link between the path of the common file and the path of the sub-file of the target board; after the board startup instruction triggers the bootloader, based on the link, jump the loading address of the bootloader to the path of the sub-file of the target board to load the sub-file of the target board.
[0081] In one embodiment, the system startup device further includes a construction module, configured to generate a common source file according to the basic hardware information in the hardware information of each board; the basic hardware information is related to the startup of the operating system; generate sub-source files corresponding to each board according to the hardware information of each board except the basic hardware information; compile the common source file to obtain the common file, and respectively compile the sub-source files corresponding to each board and the common source file to obtain the sub-files corresponding to each board; construct the device tree file according to the common file and each sub-file.
[0082] In one embodiment, the system startup device further includes a first generation module, configured to display an operation interface, determine the target board according to the configuration operation of the user on the operation interface, and generate a board startup instruction based on the target board; the operation interface includes a command input window and / or a board selection window, the command input window is used to receive a link instruction pointing to the target board, and the board selection window includes configuration items of multiple boards.
[0083] In one embodiment, the system startup device further includes a second generation module, configured to detect parameters of multiple adjustable devices, determine target adjustable devices among the multiple adjustable devices whose parameters meet preset conditions; determine a target board corresponding to the target adjustable device according to the target adjustable device and a preset hardware relationship, and generate a board startup instruction based on the target board; the preset hardware relationship includes the corresponding relationships between different adjustable devices and boards.
[0084] It should be understood that the various units or modules described in the system startup device correspond to the respective steps in the method described with reference to Figure 1 Therefore, the operations and features described above for the method are equally applicable to the system startup device and the units included therein, and will not be elaborated herein. The system startup device may be pre-implemented in a browser or other security application of an electronic device, or may be loaded into the browser or its security application of the electronic device by means of downloading or the like. The corresponding units in the system startup device may cooperate with the units in the electronic device to implement the solutions of the embodiments of the present application.
[0085] Next, with reference to Figure 10 , which shows a schematic structural diagram of a computer system 600 suitable for use in implementing the terminal device or server of the embodiments of the present application.
[0086] As Figure 10 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0087] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as required. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as required, so that a computer program read from it can be installed into the storage section 608 as required.
[0088] In particular, according to the embodiments of the present disclosure, with reference to the aboveFigure 1 The described process can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product that includes a computer program tangibly embodied on a machine-readable medium, the computer program including program code for performing Figure 1 the method. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 509, and / or installed from the removable medium 511.
[0089] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in this application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.
[0090] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that, in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0091] The units or modules involved in the embodiments described in this application can be implemented in software or in hardware. The described units or modules can also be provided in a processor. Among them, the names of these units or modules do not, in some cases, constitute a limitation on the units or modules themselves.
[0092] As another aspect, this application also provides a computer-readable storage medium, which may be included in the computer device described in the above embodiments, or may exist separately without being assembled into the computer device. The above computer-readable storage medium stores one or more programs, and when the above programs are executed by one or more processors, the methods described in this application are performed. For example, the steps of the method shown Figure 1 can be executed.
[0093] The embodiments of this application provide a computer program product that includes instructions, and when the instructions are run, the methods described in the embodiments of this application are executed. For example, the steps of the method shown Figure 1 can be executed.
[0094] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0095] The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the technical solutions formed by mutually replacing the above features with (but not limited to) technical features with similar functions disclosed in the present application.
Claims
1. A system startup method, characterized in that, The method includes: Obtaining a device tree file; the device tree file includes a common file and sub-files corresponding to each of multiple boards; the sub-files include all hardware information of the boards corresponding to the sub-files; the common file includes basic hardware information related to the startup of the operating system among the hardware information of each board, and each piece of the basic hardware information is compatible with the startup requirements of the operating system; Loading the common file and starting the kernel of the operating system according to the hardware information in the common file; In response to a board startup instruction, determining the target board corresponding to the board startup instruction; Loading the sub-file corresponding to the target board from the device tree file and starting the operating system and the target board according to the sub-file of the target board.
2. The method according to claim 1, characterized in that, The compilation format of the common file is an executable file of a bootloader, and the loading of the common file includes: In response to the bootloader, identifying and loading the common file.
3. The method according to claim 1, wherein The loading of the sub-file corresponding to the target board from the device tree file includes: Generating a link between the path of the common file and the path of the sub-file of the target board; After the board startup instruction triggers the bootloader, based on the link, jumping the loading address of the bootloader to the path of the sub-file of the target board to load the sub-file of the target board.
4. The method according to claim 1, wherein The construction process of the device tree file includes: Generating a common source file according to the basic hardware information in the hardware information of each board; the basic hardware information is related to the startup of the operating system; Generating sub-source files corresponding to each board according to the hardware information of each board except the basic hardware information; Compiling the common source file to obtain the common file, and respectively compiling the sub-source files corresponding to each board and the common source file to obtain the sub-files corresponding to each board; Constructing the device tree file according to the common file and each sub-file.
5. The method according to claim 1, wherein The generation process of the board startup instruction includes: Displaying an operation interface, determining the target board according to the configuration operation of the user on the operation interface, and generating the board startup instruction based on the target board; the operation interface includes a command input window and / or a board selection window, the command input window is used to receive a link instruction pointing to the target board, and the board selection window includes configuration items of multiple boards.
6. The method according to claim 1, wherein The generation process of the board startup instruction includes: Detecting the parameters of multiple adjustable devices, and determining the target adjustable device among the multiple adjustable devices whose parameters meet the preset conditions; Determining the target board corresponding to the target adjustable device according to the target adjustable device and the preset hardware relationship, and generating the board startup instruction based on the target board; the preset hardware relationship includes the corresponding relationship between different adjustable devices and boards.
7. A system startup device, characterized in that, The device includes: An acquisition module, configured to acquire a device tree file; the device tree file includes a common file and sub-files corresponding to each of multiple boards; the sub-files include all hardware information of the board corresponding to the sub-files; the common file includes basic hardware information related to the startup of the operating system in the hardware information of each board, and each of the basic hardware information is compatible with the startup requirements of the operating system; A first startup module, configured to load the common file and start the kernel of the operating system according to the hardware information in the common file; A determination module, configured to determine a target board corresponding to the board startup instruction in response to the board startup instruction; A second startup module, configured to load the sub-file corresponding to the target board from the device tree file and start the operating system and the target board according to the sub-file of the target board.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Multi-board-card interconnection computing system and firmware management method of multi-board-card interconnection equipment
CN120848968A