Bootloader linking method, boot loader executing method, boot loader linking device, boot loader executing device, chip, network interface card, computer equipment, readable storage medium and program product

By splitting the bootloader into target program fragments and linking them to RAM units with continuous and different address spaces, the problem of space and time consumption in traditional Bootloader solutions is solved, and efficient system execution is achieved.

CN120335877APending Publication Date: 2025-07-18NANJING JAGUAR MICROSYSTEMS CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510487171.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

When the RAM space is limited by capacity, the traditional Bootloader solution leads to repeated consumption of space and time, reducing system efficiency.

Method used

The bootloader is split into target program fragments and linked to a continuous first RAM cell, and then distributed to a second RAM cell in different address spaces to form a complete Bootloader execution mirror.

Benefits of technology

Reduces repeated consumption in space and time, improves system efficiency, and realizes seamless switching and collaborative work of Bootloader between different RAM media.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335877A_ABST
    Figure CN120335877A_ABST
Patent Text Reader

Abstract

The invention relates to a boot loader linking method and device, an execution method and device, a chip, a network interface card, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: segmenting a boot loader to obtain target program fragments; all the target program fragments are linked to all first RAM units in a first RAM space, and the addresses of all the first RAM units in the first RAM space are continuous; and linking the target program fragments in the first RAM units to second RAM units which are distributed in different address spaces during operation. According to the method, the target program fragment in the second RAM unit belongs to one program, and a complete Bootloader execution mirror image is formed, so that only one infrastructure is needed during execution, the repeated consumption of space and time is reduced, and the system efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method and an apparatus for linking and executing a bootloader, a chip, a network interface card, a computer device, a computer-readable storage medium, and a computer program product. Background Art

[0002] In the Bootloader application, when the RAM space (the same continuous space / media) where the program runs is limited in capacity, a multi-stage Bootloader solution is usually adopted. According to tasks and logical relationships, the Bootloader is divided into different running stages, such as BL1, BL2, BL3, etc., and each stage runs in a different RAM space (media). After the previous stage finishes execution, the system jumps to the next stage to continue running.

[0003] In the traditional technology, each level of Bootloader needs to independently run the basic architecture of the Bootloader, resulting in repeated consumption of space and time and reducing the system efficiency. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a method and an apparatus for linking and executing a bootloader, a chip, a network interface card, a computer device, a computer-readable storage medium, and a computer program product that can avoid repeated consumption of space and time and improve the system efficiency.

[0005] In a first aspect, this application provides a method for linking a bootloader, and the method includes:

[0006] Dividing the bootloader to obtain each target program segment;

[0007] Linking each of the target program segments to each of the first RAM units in the first RAM space, where the addresses of the first RAM units in the first RAM space are consecutive;

[0008] Linking the target program segments in each of the first RAM units to the second RAM units that are distributed in different address spaces during runtime.

[0009] In one embodiment, the step of linking each of the target program segments to each of the first RAM units in the first RAM space includes:

[0010] Determining the correspondence between each of the target program segments and each of the first RAM units;

[0011] Based on the correspondence, linking each of the target program segments to each of the first RAM units in the first RAM space.

[0012] In one embodiment, the splitting of the bootloader to obtain each target program segment includes:

[0013] Determine each program module in the bootloader;

[0014] Based on each of the program modules, split the bootloader to obtain corresponding target program segments, where the size and position of the target program segments match the size and position of each of the first RAM units.

[0015] In one embodiment, the splitting of the bootloader based on each of the program modules to obtain corresponding target program segments includes:

[0016] Determine the position and size of each unpaired first RAM unit;

[0017] In the case where there are unprocessed program modules, determine each currently compiled program module in the order of the positions of the program modules, and determine the size of the current program segment based on each currently compiled program module;

[0018] Based on the size of the current program segment and the size of the existing program segments, determine the size of the currently to-be-split program segment;

[0019] In the case where the size of the currently to-be-split program segment is less than or equal to the size of each of the unpaired first RAM units, continue to execute the steps of determining each currently compiled program module in the order of the positions of the program modules and determining the size of the current program segment based on each currently compiled program module;

[0020] In the case where the size of the currently to-be-split program segment is greater than the size of at least one of the unpaired first RAM units, determine the target program segment based on the previous to-be-split program segment and the already split programs; where the previous to-be-split program segment is the program segment generated before the currently to-be-split program segment.

[0021] In one embodiment, the determination of the correspondence between each of the target program segments and each of the first RAM units includes:

[0022] Determine a target first RAM unit from the at least one unpaired first RAM unit;

[0023] Establish the correspondence between the target program segment and the target first RAM unit.

[0024] In a second aspect, the present application further provides a method for executing a bootloader, the method including:

[0025] When the system is started, a target second RAM unit is determined, and the target second RAM unit is screened and determined from the second RAM units.

[0026] Execute the target program segment in the target second RAM unit. The target program segment is used to initialize the hardware device and load the target program segments in other second RAM units according to the configuration information. The target program segment is linked to each first RAM unit based on the boot loader linking method in any one of the above embodiments, and the target program segments in each of the first RAM units are linked to the second RAM units distributed in different address spaces at runtime.

[0027] In a third aspect, the present application further provides a boot loader linking device, which includes:

[0028] A splitting module, configured to split the boot loader to obtain each target program segment;

[0029] A first linking module, configured to link each of the target program segments to each first RAM unit in the first RAM space, where the addresses of the first RAM units in the first RAM space are continuous;

[0030] A second linking module, configured to link the target program segments in each of the first RAM units to the second RAM units distributed in different address spaces at runtime.

[0031] In a fourth aspect, the present application further provides a boot loader execution device, which includes:

[0032] The above-mentioned target second RAM unit determination module is configured to determine a target second RAM unit when the system is started, and the target second RAM unit is screened and determined from the second RAM units;

[0033] An execution module, configured to execute the target boot loader target program segment in the target second RAM unit. The target boot loader target program segment is used to initialize the hardware device and load the boot loader target program segments in other second RAM units according to the configuration information. The target program segment is linked to each first RAM unit based on the boot loader linking device in any one of the above embodiments, and the target program segments in each of the first RAM units are linked to the second RAM units distributed in different address spaces at runtime.

[0034] In a fifth aspect, the present application further provides a chip, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the method in any one of the above embodiments are implemented.

[0035] In a sixth aspect, the present application further provides a network interface card, including a chip and multiple interfaces in any one of the above embodiments, where the chip processes data or communicates externally through the interfaces.

[0036] In a seventh aspect, the present application further provides a computer device, including the network interface card in any one of the above embodiments, where the network interface card is used to process data or communicate externally.

[0037] In an eighth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.

[0038] In a ninth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.

[0039] The above-mentioned bootloader linking method, execution method, device, chip, network interface card, computer device, computer-readable storage medium, and computer program product split the bootloader to obtain each target program segment, but these target program segments still belong to one program. Link each of the target program segments to each first RAM unit in the first RAM space, where the addresses of the first RAM units in the first RAM space are continuous; link each of the first RAM units to the second RAM units distributed in different address spaces during runtime, so that the target program segments in the second RAM units belong to one program, forming a complete Bootloader execution image. Therefore, only one infrastructure is required during execution, reducing duplicate consumption in space and time and improving system efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0041] Figure 1 It is a schematic flowchart of the bootloader linking method in an embodiment;

[0042] Figure 2 It is a schematic diagram of a bootloader connected to a multi-RAM medium in an embodiment;

[0043] Figure 3Schematic flowchart of the bootloader segmentation method in an embodiment;

[0044] Figure 4 Schematic flowchart of the bootloader execution method in an embodiment;

[0045] Figure 5 Schematic flowchart of the bootloader execution method in another embodiment;

[0046] Figure 6 Structural block diagram of the bootloader linking device in an embodiment;

[0047] Figure 7 Structural block diagram of the bootloader execution device in an embodiment;

[0048] Figure 8 Internal structural diagram of a computer device in an embodiment. Detailed implementation manners

[0049] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] In one embodiment, as Figure 1 shown, a bootloader linking method is provided. In this embodiment, the method is exemplified by being applied to a terminal. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0051] S102: Segment the bootloader to obtain each target program segment.

[0052] Among them, the bootloader is a small program that runs before the operating system starts, and is responsible for initializing the hardware and loading the operating system kernel into memory.

[0053] Among them, the bootloader may include multiple modules, and the multiple modules are determined when the bootloader is generated, or determined by the user based on different classification methods later.

[0054] The target program segment is segmented based on the multiple modules included in the bootloader. The target program segment may include a code segment, a data segment, etc. Optionally, the target program segment may be further segmented downward to obtain segments at different levels. That is to say, the bootloader may include target program segments at multiple levels.

[0055] In this embodiment, the bootloader is segmented based on multiple modules included in the bootloader to obtain each target program segment. On the one hand, the bootloader is divided into multiple small segments, and on the other hand, the integrity of each small target program segment in the bootloader is ensured.

[0056] S104: Link each target program segment to each first RAM unit in the first RAM space, where the addresses of the first RAM units in the first RAM space are continuous.

[0057] Among them, combined with Figure 2 as shown Figure 2 is a schematic diagram of a bootloader connected to a multi-RAM medium in an embodiment. The first RAM (Random Access Memory, which can run the Boot (Bootloader, responsible for preparing the necessary environment for the loading and running of the operating system)) space includes multiple first RAM units (i.e., the storage space in the RAM). The addresses of the first RAM units in the first RAM space are continuous, and each first RAM unit is used to store each target program segment. Combined with Figure 2 as shown, the first RAM units in the first RAM space are continuous and there is no break in the middle. Linking each target program segment to this first RAM space can ensure that each target program segment is stored in a complete first RAM space, thus ensuring the integrity of the BIN file.

[0058] Among them, the first RAM space corresponds to the physical address in the first link script. The first link script is used to link the target program segments to different first RAM units.

[0059] In this application, each target program segment is linked to each first RAM unit in the first RAM space. The first RAM unit and the target program segment are in one-to-one correspondence, and the size of the target program segment is smaller than the size of the first RAM unit, and the size during the runtime of the target program segment is also smaller than the size of the first RAM unit.

[0060] Among them, the first RAM space (used to generate the BIN file) and the second RAM units (RAM1, RAM2, etc.) corresponding to various RAM media with different addresses in the second RAM space. This correspondence is also reflected in the size matching of the first RAM units in the first RAM space and the second RAM units of the second RAM media in the second RAM space (less than or equal to the size of the second RAM units of each second RAM media).

[0061] S106: Link the target program segments in each first RAM unit to the second RAM units that are distributed in different address spaces at runtime.

[0062] Continue to combine Figure 2 As shown Figure 2 It also includes second RAM units with discontinuous addresses (i.e., the storage space in the RAM), the second RAM units that the bootloader is distributed in different address spaces at runtime, and the correspondence between each target program segment of the bootloader and each second RAM unit is preset. The size of the first RAM unit to which the target program segment is linked is smaller than that of the second RAM unit, so that the target program segment can run in the second RAM unit. The second RAM unit corresponds to the virtual address in the second link script (where although it is called a virtual address here, it still refers to the address of the real physical storage space. It's just that in this field, the loading address at loading time is called a virtual address).

[0063] The second link script is used to link the target program segments in each first RAM unit to the second RAM units that are distributed in different address spaces at runtime. Optionally, the second link script can be a conversion instruction, such as an AT instruction, used to link the second RAM units that are distributed in different address spaces at runtime to the first RAM units in the first RAM space with continuous addresses. In this way, the generated Bootloader image is a BIN file with a controllable size and no gaps (The BIN file (binary file) is a file format for storing raw binary data, usually used in scenarios such as embedded systems, firmware updates, and Bootloaders. Different from the ELF file, the BIN file does not contain metadata (such as symbol tables, section header tables, etc.), but directly stores the binary code and data of the program and can usually be directly loaded into memory for execution).

[0064] Among them, in this application, the linker tool is used to link the segmented target program segments to the address spaces of multiple second RAM units to form a complete Bootloader execution image (i.e., the BIN file in the following text).

[0065] One point that needs to be explained here is that the generated Bootloader image in this application is one. When linking, in addition to linking the sections corresponding to each segmented program module to different second RAM units in different second RAM spaces (runaddress region), the AT command (the role of AT is to explicitly specify the LMA, and if omitted, the default is LMA = VMA) is used to specify different sub-first RAM units in the first RAM space (link address region) for linking, so as to generate a continuous BIN file with a controllable size.

[0066] The above-mentioned bootloader linking method divides the bootloader to obtain each target program segment. However, these target program segments still belong to one program. Each target program segment is linked to each first RAM unit in the first RAM space, where the addresses of the first RAM units in the first RAM space are continuous. Each first RAM unit is linked to a second RAM unit that is distributed in different address spaces during runtime. In this way, the target program segments in the second RAM unit belong to one program, forming a complete Bootloader execution image. Therefore, only one infrastructure is required during execution, reducing the repetitive consumption in terms of space and time and improving the system efficiency.

[0067] In one optional embodiment, linking each target program segment to each first RAM unit in the first RAM space includes: determining the correspondence between each target program segment and each first RAM unit; and linking each target program segment to each first RAM unit in the first RAM space based on the correspondence.

[0068] The correspondence is the relationship between each target program segment and each first RAM unit, and this correspondence is a one-to-one correspondence. Each first RAM unit is continuous in the first RAM space, that is, each first RAM unit is arranged in ascending order of address. Therefore, each first RAM unit is ordered. The target program segment is generated based on the bootloader. Since the bootloader is also ordered, the target program segment is also ordered. However, the one-to-one correspondence between the target program segment and the first RAM unit in this application is not necessarily ordered. That is, the first target program segment can correspond to the first first RAM unit, and the second target program segment can correspond to the second first RAM unit. Or the one-to-one correspondence between the target program segment and the first RAM unit is ordered, which is not specifically limited here.

[0069] The correspondence is determined based on the size and position of the target program segment and the size and position of each first RAM unit. After determining the correspondence, a first link script can be generated based on the correspondence to link each target program segment to each first RAM unit in the first RAM space.

[0070] The first link script (Linker Script) is used to control how to link the input bootloader into the final executable file or binary file, that is, the BIN file. The first link script can include memory area definitions (such as the first RAM unit) and segment allocations (that is, each target program segment). In other embodiments, the first link script can also include other global symbols, etc., for the program to use.

[0071] In the above embodiments, based on the corresponding relationship, the target program segment is linked to the corresponding first RAM unit, and the generated Bootloader image is a gapless and size-controllable BIN file.

[0072] In one alternative embodiment, the bootloader is segmented to obtain each target program segment, including: determining each program module in the bootloader; segmenting the bootloader based on each program module to obtain the corresponding target program segment, where the size and position of the target program segment match the size and position of each first RAM unit.

[0073] The bootloader itself has hierarchical blocks, and each block can be called a program module. The bootloader is segmented based on the program module to obtain each target program segment. The target program segment can include at least one program module, and the size and position of the target program segment match the size and position of each first RAM unit. That is, the size of the target program segment is smaller than the size of the corresponding first RAM unit, and the position of the target program segment corresponds one-to-one with the position of the first RAM unit.

[0074] For example, if the size of the first RAM unit RAM1 is 256KB, then the size of the target program segment section1 must be smaller than 256KB, and it is also necessary to ensure that the target program segment section1 does not exceed 256KB when running. The same applies to other target program segments section. This step corresponds to Figure 2 the "link script" part.

[0075] In one alternative embodiment, segmenting the bootloader based on each program module to obtain the corresponding target program segment includes: determining the position and size of each unpaired first RAM unit; in the case where there are unprocessed program modules, determining each currently compiled program module in the order of the positions of the program modules, and determining the size of the current program segment based on each currently compiled program module; determining the size of the currently to-be-segmented program segment based on the size of the current program segment and the size of the existing program segments; in the case where the size of the currently to-be-segmented program segment is less than or equal to the size of each unpaired first RAM unit, continuing to execute the step of determining each currently compiled program module in the order of the positions of the program modules and determining the size of the current program segment based on each currently compiled program module; in the case where the size of the currently to-be-segmented program segment is greater than the size of at least one unpaired first RAM unit, determining the target program segment based on the previous to-be-segmented program segment and the segmented programs; where the previous to-be-segmented program segment is the program segment generated before the currently to-be-segmented program segment.

[0076] In one optional embodiment, determining the correspondence between each target program segment and each first RAM unit includes: determining a target first RAM unit from at least one unpaired first RAM unit; and establishing the correspondence between the target program segment and the target first RAM unit.

[0077] Combined Figure 3 shown Figure 3 As shown, it is a flowchart of a method for splitting a bootloader in an embodiment. In this embodiment, the bootloader includes different program modules, and the bootloader can be split based on these program modules. In this application, the bootloader is compiled according to the program modules to obtain the corresponding ELF file (Executable and Linkable Format, a standard file format for storing executable programs, object code, shared libraries, and core dumps). ELF files are widely used in Unix-like systems (such as Linux, BSD) and many embedded systems, and then the corresponding BIN file is obtained by converting the ELF file through tools. This BIN file is the target program segment.

[0078] In order to implement the splitting of the bootloader, based on different program modules of the bootloader, a part of the bootloader can be compiled and converted to obtain the corresponding BIN file. The determination method of the part of the bootloader is determined according to the position order of the program modules, that is, each program module in the bootloader is processed in sequence, so that a part of the program modules of the bootloader can be compiled to obtain the corresponding BIN file, that is, the current program segment. The size of the current program segment and the size of the existing program segments are used to determine the size of the current program segment to be split. The existing program segments are the target program segments that have been split, and the corresponding first RAM units have been allocated to these target program segments. The current program segment includes these allocated target program segments. Therefore, based on the size of the current program segment and the size of the existing program segments, the size of the current program segment to be split can be determined, that is, the size of the current program segment to be split is equal to the size of the current program segment minus the size of the existing program segments.

[0079] When the size of the current program segment to be split is less than or equal to the size of each unpaired first RAM unit, at least one program module can be added, so as to compile some program modules of the bootloader with at least one program module added, and obtain the corresponding BIN file. Then continue to determine the size of the current program segment to be split based on the size of the obtained current program segment and the existing program segment, and compare the size of the current program segment to be split with the size of each unpaired first RAM unit. If there is a situation where the size of the current program segment to be split is greater than the size of at least one unpaired first RAM unit, one of the first RAM units can be selected from at least one unpaired first RAM unit whose size is less than the size of the current program segment to be split as the target first RAM unit, and then a corresponding relationship between the target program segment and the target first RAM unit is established, where the target program segment here is determined based on the previous program segment to be split and the already split program; the previous program segment to be split is the program segment generated before the current program segment to be split, that is, the target program segment is equal to the previous program segment to be split minus the already split program.

[0080] In the above embodiment, each target program segment of the bootloader is linked to each first RAM unit. By reasonably configuring the address space of multiple first RAM units, the storage capacity of the system is fully utilized, and the capacity limitation of a single RAM medium is avoided. Moreover, the bootloader Bootloader is split into multiple segments and linked into multiple first RAM units respectively, reducing the complexity of the linking process. And it is applicable to RAM media of different specifications and types, improving the flexibility and scalability of the system.

[0081] In one embodiment, as Figure 4 shown, a method for executing a bootloader is provided. In this embodiment, an example is given where this method is applied to a terminal. It can be understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0082] S402: When the system starts up, determine the target second RAM unit, and the target second RAM unit is screened and determined from the second RAM units.

[0083] The target second RAM unit is the storage location of the target program segment corresponding to the bootloader that is preferably loaded when the system starts up. Optionally, the priority of each second RAM unit can be set in advance. When the system starts up, the second RAM unit with the highest priority is determined as the target RAM medium.

[0084] S404: Execute the target program segment in the target second RAM unit. The target program segment is used to initialize the hardware device and load the target program segments in other second RAM units according to the configuration information. The target program segment is linked to each first RAM unit based on the boot loader linking method in any of the above embodiments, and the target program segments in each first RAM unit are linked to the second RAM units that are distributed in different address spaces at runtime.

[0085] After determining the target second RAM unit, execute the target program segment in the target second RAM unit. The target program segment is used to initialize the hardware device and load the target program segments in other second RAM units according to the configuration information.

[0086] Since the Bootloader is not split into different programs and is compiled together, that is, the Boot image (BIN file) is generated from the same ELF file, it is possible to achieve seamless switching, mutual calling, and collaborative work between the codes of the Bootloader in different loaded second RAM units (linked to the first RAM units with continuous corresponding address spaces) until the Bootloader task (such as the loading and startup of the operating system) is completed.

[0087] In the above embodiments, through multi-RAM medium linking, seamless switching, mutual calling, and collaborative work of the boot loader Bootloader between different RAM media are achieved, improving the overall execution efficiency of the system.

[0088] Among them, combined with Figure 5 as shown Figure 5 is a flowchart of the execution method of the boot loader in another embodiment. In this embodiment, when the system starts, load and execute the Bootloader segment in the second RAM unit with the highest priority (master RAM). This segment is responsible for initializing the necessary hardware devices and loading the Bootloader segments in other second RAM units according to the configuration information, so as to achieve hybrid execution, that is, the program runs in different address spaces of different second RAM units, and free jumping and mutual calling can be achieved.

[0089] It should be understood that although the steps in the flowcharts involved in the above embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0090] Based on the same inventive concept, the embodiments of the present application also provide a bootloader linking device and a bootloader execution device for implementing the above-mentioned bootloader linking method and bootloader execution method. The implementation solutions provided by this device to solve problems are similar to the implementation solutions described in the above methods. Therefore, the specific limitations in one or more embodiments of the following bootloader linking devices and bootloader execution devices can refer to the limitations on the bootloader linking method in the above text, and will not be repeated here.

[0091] In an exemplary embodiment, as Figure 6 shown, a bootloader linking device is provided, including: a splitting module 601, a first linking module 602, and a second linking module 603, where:

[0092] The splitting module 601 is configured to split the bootloader to obtain each target program segment;

[0093] The first linking module 602 is configured to link each target program segment to each first RAM unit in the first RAM space, where the addresses of the first RAM units in the first RAM space are continuous;

[0094] The second linking module 603 is configured to link the target program segments in each first RAM unit to the second RAM units distributed in different address spaces during runtime.

[0095] In one of the optional embodiments, the first linking module 602 is specifically configured to determine the correspondence between each target program segment and each first RAM unit; and link each target program segment to each first RAM unit in the first RAM space based on the correspondence.

[0096] In one alternative embodiment, the above-mentioned splitting module 601 is specifically configured to determine each program module in the bootloader; split the bootloader based on each program module to obtain corresponding target program segments, where the size and position of the target program segments match the size and position of each first RAM unit.

[0097] In one alternative embodiment, the above-mentioned splitting module 601 is specifically configured to determine the positions and sizes of each unpaired first RAM unit; in the case where there are unprocessed program modules, determine each currently compiled program module in the order of the positions of the program modules, and determine the size of the current program segment based on each currently compiled program module; determine the size of the currently to-be-split program segment based on the size of the current program segment and the size of the existing program segments; in the case where the size of the currently to-be-split program segment is less than or equal to the size of each unpaired first RAM unit, continue to execute the step of determining each currently compiled program module in the order of the positions of the program modules and determining the size of the current program segment based on each currently compiled program module; in the case where the size of the currently to-be-split program segment is greater than the size of at least one unpaired first RAM unit, determine the target program segment based on the previous to-be-split program segment and the already split programs; where the previous to-be-split program segment is the program segment generated before the currently to-be-split program segment.

[0098] In one alternative embodiment, the above-mentioned splitting module 601 is specifically configured to determine a target first RAM unit from at least one unpaired first RAM unit; establish a correspondence between the target program segment and the target first RAM unit.

[0099] In an exemplary embodiment, as Figure 7 shown, there is provided a bootloader execution device, including: a target second RAM unit determination module 701 and an execution module 702, where:

[0100] The target second RAM unit determination module 701 is configured to determine a target second RAM unit when the system starts, and the target second RAM unit is screened and determined from the second RAM units;

[0101] The execution module 702 is configured to execute the target bootloader target program segment in the target second RAM unit, and the target bootloader target program segment is used to initialize the hardware device and load the bootloader target program segments in other second RAM units according to the configuration information, where the target program segment is linked to each first RAM unit based on the bootloader linking device in any of the above embodiments, and the target program segments in each first RAM unit are linked to the second RAM units distributed in different address spaces at runtime.

[0102] Each module in the above-mentioned bootloader linking device and bootloader execution device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.

[0103] In an exemplary embodiment, a chip is provided, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the method described in any one of the above embodiments are implemented.

[0104] In an exemplary embodiment, a network interface card is provided, which includes the chip described in any one of the above embodiments and multiple interfaces. Among them, the interfaces include PCI / PCIE interfaces, UART interfaces, SPI interfaces, USB interfaces, network interfaces, etc. The chip processes data or communicates externally through the interfaces.

[0105] In an exemplary embodiment, a computer device is provided. The computer device can be a server terminal. The computer device includes the network interface card and the central processing unit described in the foregoing embodiments. The network interface card schedules or processes data, and the central processing unit processes the data scheduled by the network interface card. The internal structure diagram of the computer device can be as Figure 8As shown in the figure. The computer device includes a processor, a memory, an input / output interface, a network interface card, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the network interface card, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The network interface card of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a method for linking a boot loader. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0106] Those skilled in the art can understand that Figure 8 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0107] In one embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0108] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0109] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0110] 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 memory and volatile memory. 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, artificial intelligence (AI) processors, etc., without limitation.

[0111] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope recorded in the present application.

[0112] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. A bootloader linking method, characterized in that, The method includes: Splitting the bootloader to obtain respective target program segments; Linking the respective target program segments to respective first RAM units in a first RAM space, wherein addresses of the respective first RAM units in the first RAM space are consecutive; Linking the target program segments in the respective first RAM units to second RAM units that are distributed in different address spaces during runtime.

2. The method according to claim 1, wherein The linking the respective target program segments to respective first RAM units in the first RAM space includes: Determining a correspondence between the respective target program segments and the respective first RAM units; Linking the respective target program segments to respective first RAM units in the first RAM space based on the correspondence.

3. The method according to claim 2, wherein The splitting the bootloader to obtain respective target program segments includes: Determining respective program modules in the bootloader; Splitting the bootloader based on the respective program modules to obtain corresponding target program segments, wherein sizes and positions of the target program segments match sizes and positions of the respective first RAM units.

4. The method according to claim 3, characterized in that, The splitting the bootloader based on the respective program modules to obtain corresponding target program segments includes: Determining positions and sizes of respective unpaired first RAM units; When there are unprocessed program modules, determining respective currently compiled program modules in the order of positions of the program modules, and determining a size of a current program segment based on the respective currently compiled program modules; Determining a size of a currently to-be-split program segment based on the size of the current program segment and sizes of existing program segments; When the size of the currently to-be-split program segment is less than or equal to sizes of the respective unpaired first RAM units, continuing to execute the step of determining respective currently compiled program modules in the order of positions of the program modules and determining a size of a current program segment based on the respective currently compiled program modules; When the size of the currently to-be-split program segment is greater than sizes of at least one of the unpaired first RAM units, determining a target program segment based on a previous to-be-split program segment and split programs; wherein the previous to-be-split program segment is a program segment generated before the currently to-be-split program segment.

5. The method according to claim 4, wherein The determining a correspondence between the respective target program segments and the respective first RAM units includes: Determining a target first RAM unit from the at least one unpaired first RAM unit; Establishing a correspondence between the target program segment and the target first RAM unit.

6. A method for guiding a bootloader to execute, characterized in that, The method includes: When the system starts up, determining a target second RAM unit, the target second RAM unit being screened and determined from the second RAM units; Execute the target program segment in the target second RAM unit, where the target program segment is used to initialize the hardware device and load the target program segments in other second RAM units according to the configuration information. The target program segment is linked to each first RAM unit based on the bootloader linking method according to any one of claims 1 to 5, and the target program segments in each of the first RAM units are linked to the second RAM units distributed in different address spaces at runtime.

7. A bootloader linking device, characterized in that, The device includes: A splitting module, configured to split the bootloader to obtain each target program segment; A first linking module, configured to link each of the target program segments to each first RAM unit in the first RAM space, where the addresses of the first RAM units in the first RAM space are consecutive; A second linking module, configured to link the target program segments in each of the first RAM units to the second RAM units distributed in different address spaces at runtime.

8. A bootloader execution device, characterized in that, The device includes: A target second RAM unit determination module, configured to determine a target second RAM unit when the system starts, and the target second RAM unit is determined by screening from the second RAM units; An execution module, configured to execute the target bootloader target program segment in the target second RAM unit, where the target bootloader target program segment is used to initialize the hardware device and load the bootloader target program segments in other second RAM units according to the configuration information. The target program segment is linked to each first RAM unit based on the bootloader linking device according to claim 7, and the target program segments in each of the first RAM units are linked to the second RAM units distributed in different address spaces at runtime.

9. A chip, 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.

10. A network interface card, characterized in that, Includes the chip and a plurality of interfaces according to claim 9, and the chip processes data or communicates externally through the interfaces.

11. A computer device, characterized in that, Includes the network interface card according to claim 10, and the network interface card is used to process data or communicate externally.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.

13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Firmware loading method and device of processor, storage medium and program product

    CN121349563A

  • A processor firmware loading method, device, storage medium and program product

    CN121349563B