Data processing method and device, data loading method, and boot firmware
By sorting and optimizing the parameters of the boot firmware compatible with the target device, ensuring that each firmware only loads the necessary parameters, the problem of excessive hardware resource consumption during the boot process is solved, and the operating system can be started quickly.
Patent Information
- Application Number
- CN202310834845.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-07-07
AI Technical Summary
Existing boot firmware causes a large amount of hardware resources, such as the CPU, of the target device to be occupied when loading a large number of parameters, resulting in a slow operating system startup.
The boot firmware compatible with the target device is sorted to determine the order in which parameters need to be loaded for each firmware, and a termination loading flag is added to the target data to ensure that each firmware only loads the parameters it needs.
This reduces the amount of hardware resources the parameters consume on the target device and improves the operating system's startup speed.
Smart Images

Figure CN116880912B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method and apparatus, a data loading method, and a boot firmware. Background Technology
[0002] Target devices, such as physical devices and analog devices, typically deploy an operating system. This operating system usually requires boot firmware to start and boot. The boot firmware is primarily used to load boot-related parameters after the target device boots. These loaded parameters configure the target device's software and hardware environment to a suitable state for the operating system's boot graph, and then guide the operating system to start.
[0003] Currently, the boot firmware that the target device is currently running loads a large number of parameters when booting the operating system. The loading of a large number of parameters causes the target device's CPU and other hardware resources to be heavily occupied, resulting in a slow operating system boot. Summary of the Invention
[0004] In view of this, this application proposes a data processing method and apparatus, a data loading method, and a boot firmware, the main purpose of which is to reduce the hardware resource consumption of boot boot, so as to improve the boot speed of the operating system.
[0005] To achieve the above objectives, this application mainly provides the following technical solutions:
[0006] Firstly, this application provides a data processing method, which includes:
[0007] The target device is compatible with at least two boot firmwares, which are sorted to obtain a first order; wherein, the parameters that each boot firmware needs to load include the parameters that all boot firmwares preceding it in the first order need to load.
[0008] Based on the first order, all parameters that the at least two boot firmwares need to load are processed to obtain target data for booting of various boot firmwares, so that each boot firmware loads the parameters it needs to load from the target data when booting.
[0009] In some embodiments of this application, based on the first order, all parameters that the at least two boot firmwares need to load are processed to obtain target data for booting various boot firmwares, including: based on the first order, sequentially sorting all parameters that the at least two boot firmwares need to load to obtain a second order; determining the target parameter corresponding to each boot firmware; wherein the target parameter is the last parameter that the boot firmware needs to load in the second order; based on the correspondence between the boot firmware and the target parameter, adding a matching termination loading identifier to each target parameter in the second order to obtain the target data.
[0010] In some embodiments of this application, based on the first order, all parameters that the at least two boot firmwares need to load are sequentially sorted to obtain a second order, including: determining all first parameter groups corresponding to each of the at least two boot firmwares; wherein, parameters of the same type are recorded in the same first parameter group; determining the sorting position corresponding to each first parameter group based on the first order; and continuously sorting the parameters included in each first parameter group at the sorting position corresponding to each first parameter group to obtain the second order.
[0011] In some embodiments of this application, the data processing method further includes: re-dividing the parameters included in the target data into at least one second parameter group arranged in sequence according to the order of the parameters in the second sequence; wherein the number of the second parameter groups is less than the number of the first parameter groups, and some of the second parameter groups consist of multiple parameters that are adjacent in the second sequence and originate from at least two first parameter groups; in response to the startup of the target device, allocating a corresponding register for each second parameter group involved in the target data; and writing the parameters included in each second parameter group into the corresponding register according to the order of the parameters in the second sequence.
[0012] In some embodiments of this application, according to the order of the parameters in the second order, the parameters included in the target data are re-divided into at least one second parameter group arranged in sequence, including: obtaining a combination command; wherein the combination command is used to specify a first parameter group that needs to be divided into the same group; continuously sorting the parameters of the first parameter group that needs to be divided into the same group specified by the combination command in the second order to divide them into corresponding second parameter groups; and dividing each first parameter group not specified by the combination command into a corresponding second parameter group separately.
[0013] In some embodiments of this application, the parameters are arranged according to their order in the second order.
[0014] The target data includes parameters that are reclassified into at least one second parameter group arranged in a sequential order, comprising: based on a first quantity, dividing the parameters included in the target data into at least one second parameter group arranged in a sequential order according to the order of the parameters in the second order; wherein the first data quantity is used to limit the number of parameters included in the second parameter group.
[0015] In some embodiments of this application, the parameters included in the target data are re-divided into at least one second parameter group arranged in order according to the order of the parameters in the second order, including: based on a second quantity, the parameters included in the target data are equally divided into a second number of second parameter groups arranged in order according to the sorting of the parameters in the second order.
[0016] Secondly, this application provides a data loading method, which includes:
[0017] The currently enabled boot firmware in the target device determines target data in response to the startup of the target device; wherein the target data is obtained by processing using the data processing method described above;
[0018] The boot firmware loads the parameters it needs from the target data during boot.
[0019] In some embodiments of this application, the target data includes multiple parameters arranged in sequence, and the last parameter that the currently enabled boot firmware needs to load in the target data has a matching termination loading identifier added to it. Then, when the boot firmware performs booting, it loads the parameters it needs from the target data, including: the boot firmware loads the parameters based on the order of the parameters in the target data, and detects whether the loaded parameters have a matching termination loading identifier added to them; the boot firmware determines whether to stop loading parameters based on the detection result of the termination loading identifier.
[0020] Thirdly, this application provides a data processing apparatus, which includes:
[0021] The first processing module is used to sort at least two boot firmwares compatible with the target device to obtain a first order; wherein, the parameters that each boot firmware needs to load include the parameters that all boot firmwares preceding it in the first order need to load;
[0022] The second processing module is used to process all parameters that the at least two boot firmwares need to load based on the first order, and obtain target data for booting of various boot firmwares, so that each boot firmware loads the parameters it needs to load from the target data when booting.
[0023] Fourthly, this application provides a bootable firmware, which includes:
[0024] A determination module is used to determine target data in response to the startup of the target device; wherein the target data is obtained by processing using the data processing method described above;
[0025] A loading module is used by the boot firmware to load the parameters it needs to load from the target data during boot.
[0026] Fifthly, this application provides a computer-readable storage medium comprising a stored program, wherein, when the program is executed, it controls the device on which the storage medium is located to perform at least one of the following methods: a data processing method of the first aspect and a data loading method of the second aspect.
[0027] The data processing method and apparatus, data loading method, and boot firmware provided in this application sort the boot firmware compatible with the target device based on the intersection of parameters required to be loaded by the boot firmware compatible with the target device. Then, based on the first order obtained from the sorting, all parameters required to be loaded by all boot firmwares are processed to obtain target data for booting various boot firmwares. Thus, after the target data is provided to the currently enabled boot firmware of the target device, the boot firmware loads the parameters it needs from the target data, without loading parameters it does not need, thereby reducing the occupation of hardware resources such as the CPU of the target device by the parameters, and thus speeding up the boot speed of the operating system.
[0028] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 A flowchart of a data processing method provided in one embodiment of this application is shown;
[0031] Figure 2A schematic diagram of a parameter combination provided in one embodiment of this application is shown;
[0032] Figure 3 A flowchart of a data loading method provided in one embodiment of this application is shown;
[0033] Figure 4 This illustration shows a schematic diagram of the structure of a data processing apparatus according to an embodiment of this application;
[0034] Figure 5 A schematic diagram of the structure of a data processing apparatus according to another embodiment of this application is shown;
[0035] Figure 6 A schematic diagram of the structure of a boot firmware provided in one embodiment of this application is shown. Detailed Implementation
[0036] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0037] Currently, target devices such as physical devices and analog devices, regardless of the type of boot firmware currently in use, provide all parameters required by all compatible boot firmware to the currently used boot firmware for loading. However, the currently used boot firmware loads all the parameters provided by the target device. This results in the loading of many parameters that are not of its own use. The loading of these useless parameters consumes additional hardware resources such as the CPU of the target device, wasting hardware resources. Excessive CPU and other hardware resource consumption leads to slow operating system startup.
[0038] The inventors discovered through research that all parameters required to be loaded by all boot firmware compatible with the target device can be optimized. The optimized target data for booting various boot firmwares is then provided to the currently booting boot firmware for loading. This ensures that the currently enabled boot firmware only loads the parameters it needs from the target data, avoiding the loading of unnecessary parameters. Based on this discovery, this application provides a data processing solution: At least two boot firmwares compatible with the target device are sorted to obtain a first order. The parameters required to be loaded by each boot firmware include those required by all boot firmwares preceding it in the first order. Based on the first order, all parameters required to be loaded by the at least two boot firmwares are processed to obtain target data for booting various boot firmwares, enabling each boot firmware to load its required parameters from the target data during booting.
[0039] Based on the above-described data processing technical solution, this application embodiment also provides a data loading technical solution. Specifically, the data loading technical solution involves the currently enabled boot firmware in the target device determining target data in response to the device's startup. This target data is obtained using the aforementioned data processing method. During booting, the boot firmware loads the parameters it needs from the target data. In this way, the currently enabled boot firmware only loads the parameters it needs from the target data, avoiding loading unnecessary parameters that would consume CPU and other hardware resources, thereby improving the operating system's startup speed.
[0040] Based on the above-mentioned data processing and data loading technical solutions, this application provides a data processing method and apparatus, a data loading method, and a boot firmware. The following is a detailed description of the data processing method and apparatus, the data loading method, and the boot firmware provided in this application.
[0041] Figure 1 A flowchart of a data processing method provided in one embodiment of this application is shown, as follows: Figure 1 As shown, this data processing method mainly includes the following steps 101 to 102:
[0042] 101. Sort at least two boot firmwares compatible with the target device to obtain the first order.
[0043] The parameters that each boot firmware needs to load consist of the parameters that all boot firmwares preceding it in the first order need to load.
[0044] The target device can be a physical device or a simulated device, and the specific type of the target device is not limited in this application embodiment. For example, the target device is a simulated device that deploys Qemu. Qemu is an open-source processor simulation software that supports multiple architectures, such as the mainstream x86, ARM, and RISC-V. It features portability, fast simulation speed, and, in the absence of a hardware platform, Qemu is a convenient alternative to hardware simulators, facilitating developers' development needs.
[0045] Target devices typically deploy operating systems such as Unix and utilize these systems to perform various functions. These operating systems usually require boot firmware to start. The boot firmware loads boot-related parameters after the target device boots, configuring the target device's software and hardware environment to a suitable state for operating system startup, and then booting the operating system. To improve versatility, target devices are typically compatible with two or more boot firmwares, allowing for flexible selection of the appropriate firmware based on business needs to boot the operating system.
[0046] The type of boot firmware compatible with the target device can be flexibly selected based on business needs, and this application embodiment does not impose specific limitations. For example, the boot firmware compatible with the target device may include at least two of the following: The first type is boot firmware that specifies the jump address for the next boot stage but does not directly contain the binary code for the next stage. This type of boot firmware can be defined as fw_jump firmware. This type of boot firmware mainly boots the operating system based on the jump address corresponding to the operating system. The second type is binary code containing the payload of the next boot stage, typically a bootloader or operating system image. This type of boot firmware can be defined as fw_payload firmware. This type of boot firmware mainly boots the operating system based on the payload. The third type is boot firmware that does not contain the jump address for the next boot stage, nor does it directly contain the binary code for the next stage, but it contains dynamic information. This dynamic information is the basis for determining the jump address for the next boot stage. This type of boot firmware can be defined as fw_dynamic firmware. This type of boot firmware mainly parses the jump address corresponding to the operating system based on the dynamic information and boots the operating system based on the parsed jump address.
[0047] After determining the compatible boot firmware for the target device, at least two compatible boot firmwares are sorted. The specific process of sorting the at least two compatible boot firmwares may include the following steps: determining the parameters that each boot firmware needs to load; and sorting the boot firmwares based on the intersection of the parameters required by each boot firmware to obtain a first order. The parameters that each boot firmware needs to load include the parameters required by all boot firmwares preceding it in the first order.
[0048] For example, the target device is compatible with the following three boot firmwares: fw_jump firmware, fw_payload firmware, and fw_dynamic firmware. The fw_jump firmware requires loading parameters 1 and 2, the fw_payload firmware requires loading parameters 1 and 2, and the fw_dynamic firmware requires loading parameters 3 through 8 in addition to parameters 1 and 2. Based on the intersection of the parameters required by these three boot firmwares, the first order is set as: fw_jump firmware, fw_payload firmware, and fw_dynamic firmware. It can be seen that for a boot firmware not at the very beginning of the first order, the parameters it needs to load include those required by all boot firmwares preceding it in the first order. For example, the fw_payload firmware requires loading parameters including parameters 1 and 2 required by the fw_jump firmware preceding it, but excludes parameters 3 through 8 required by the fw_dynamic firmware following it.
[0049] 102. Based on the first order, process all parameters that the at least two boot firmwares need to load to obtain target data for booting of various boot firmwares, so that each boot firmware loads the parameters it needs to load from the target data when booting.
[0050] The target data is used to limit each boot firmware to only load the parameters it needs during boot, and not to load parameters it does not need.
[0051] Based on the first order, the specific process of processing all parameters that the at least two boot firmwares need to load to obtain the target data for booting of various boot firmwares includes the following steps 102A to 102C:
[0052] 102A. Based on the first order, sort all the parameters that the at least two boot firmwares need to load in sequence to obtain the second order.
[0053] Based on the first order, the specific process of sequentially sorting all the parameters that the at least two boot firmwares need to load may include the following steps: determining all the parameters that each boot firmware needs to load; considering that different boot firmwares may have the same parameters, the determined parameters are deduplicated. Then, according to the order of the boot firmwares in the first order, the parameters that each boot firmware needs to load are sorted to obtain the second order.
[0054] For example, the target device is compatible with the following three boot firmwares: fw_jump firmware, fw_payload firmware, and fw_dynamic firmware. The fw_jump firmware requires loading parameters 1 and 2, the fw_payload firmware requires loading parameters 1 and 2, and the fw_dynamic firmware requires loading parameters 3 through 8 in addition to parameters 1 and 2. The first order of configuration is: fw_jump firmware, fw_payload firmware, and fw_dynamic firmware. Therefore, according to the order of the boot firmwares in the first order, it is first determined that the parameters required by the fw_jump firmware are "parameters 1 and 2", then the parameters required by the fw_payload firmware are "parameters 1 and 2", and the parameters required by the fw_dynamic firmware are "parameters 1 through 8". Therefore, the second order of configuration is: parameter 1, parameter 2, parameter 3, parameter 4, parameter 5, parameter 6, parameter 7, and parameter 8.
[0055] The second order setting is to ensure that, for any boot firmware compatible with the target device, the boot firmware can load all the parameters it needs in the second order, while not loading any parameters it does not need.
[0056] 102B. Determine the target parameters for each type of boot firmware.
[0057] For each boot firmware, the target parameter is the last parameter that the boot firmware needs to load in the second order.
[0058] For each boot firmware, the parameters that the boot firmware needs to load are ordered sequentially in the second order. In order to determine which parameter the boot firmware loads according to the second order and then stops loading subsequent parameters, it is necessary to determine the last parameter that the boot firmware needs to load in the second order. This last parameter is the target parameter corresponding to the boot firmware.
[0059] For example, the second order is: parameter 1, parameter 2, parameter 3, parameter 4, parameter 5, parameter 6, parameter 7, parameter 8. For the bootloader firmware "fw_jump firmware", the target parameter corresponding to this bootloader firmware is "parameter 2"; for the bootloader firmware "fw_payload firmware", the target parameter corresponding to this bootloader firmware is "parameter 2"; and for the bootloader firmware "fw_dynamic firmware", the target parameter corresponding to this bootloader firmware is "parameter 8".
[0060] 102C. Based on the correspondence between the boot firmware and the target parameters, a matching termination loading identifier is added to each target parameter in the second sequence to obtain the target data.
[0061] After determining the target parameters for each bootloader, to facilitate identification of these parameters by each bootloader, a matching termination loading identifier is added to each target parameter in the second order based on the correspondence between the bootloader and the target parameters. In other words, the termination loading identifier needs to correspond to the bootloader so that the bootloader can clearly understand which parameter is its corresponding target parameter.
[0062] For a bootloader, the termination loading flag is used to indicate that the parameter to which the bootloader adds the termination loading flag is the last parameter that the bootloader needs to record in the second sequence, thereby preventing the bootloader from loading parameters that it does not need to load.
[0063] The specific form of the termination loading identifier is not limited in this application embodiment, and it can be flexibly selected based on business needs. For example, for the bootloader firmware "fw_jump firmware", the target parameter corresponding to the bootloader firmware is "parameter 2", and the matching termination loading identifier "zhz01" is added to parameter 2. For the bootloader firmware "fw_payload firmware", the target parameter corresponding to the bootloader firmware is "parameter 2", and the matching termination loading identifier "zhz02" is added to parameter 2. For the bootloader firmware "fw_dynamic firmware", the target parameter corresponding to the bootloader firmware is "parameter 8", and the matching termination loading identifier "zhz03" is added to parameter 8.
[0064] After adding a matching termination loading flag to each target parameter in the second sequence, target data for various boot firmwares to use during boot is formed. This target data is then provided to the currently enabled boot firmware during the target device's startup. The currently enabled boot firmware only loads the parameters it needs from the target data during boot, avoiding loading unnecessary parameters and thus preventing the currently enabled boot firmware from loading many useless parameters.
[0065] The data processing method provided in this application sorts the boot firmware compatible with the target device based on the intersection of parameters required by the boot firmware. Then, based on the first order obtained from the sorting, it processes all parameters required by all boot firmware to obtain target data for booting various boot firmwares. In this way, after the target data is provided to the currently enabled boot firmware of the target device, the boot firmware loads the parameters it needs from the target data, without loading parameters it does not need, thereby reducing the occupation of hardware resources such as the CPU of the target device and thus accelerating the boot speed of the operating system.
[0066] In some embodiments of this application, in order to facilitate the maintenance of the parameters that need to be loaded by the boot firmware, the parameters are all in the form of parameter groups. Therefore, the specific process of step 102A above, "based on the first order, sort all the parameters that need to be loaded by the at least two boot firmwares in sequence to obtain the second order", may also include the following steps 102A1 to 102A3:
[0067] 102A1. Determine all first parameter groups corresponding to each of the at least two boot firmware.
[0068] In practical applications, to facilitate the maintenance of the parameters that the boot firmware needs to load, the parameters are all stored in the form of a first parameter group, and parameters of the same type are recorded in the same first parameter group. Therefore, when determining the second order, it is necessary to determine all the first parameter groups corresponding to the at least two boot firmwares. Specifically, this involves determining all the first parameter groups corresponding to each boot firmware; since different boot firmwares may have the same first parameter groups, the determined first parameter groups are deduplicated.
[0069] For example, the target device is compatible with the following three boot firmwares: fw_jump firmware, fw_payload firmware, and fw_dynamic firmware. Specifically, fw_jump firmware corresponds to first parameter group 1 and first parameter group 2. fw_payload firmware also corresponds to first parameter group 1 and first parameter group 2. First parameter group 1 includes the kernel identifier, therefore parameter 1 of first parameter group 1 is "kernel identifier (HARTID)". First parameter group 2 includes the device tree address, therefore parameter 2 of first parameter group 2 is "device tree address". In addition to corresponding to first parameter group 1 and first parameter group 2, fw_dynamic firmware also corresponds to first parameter group 3. First parameter group 3 includes the address of the dynamically loaded information structure, and parameters 3 to 8 of first parameter group 3 are all related to the address of the dynamically loaded information structure. Therefore, all first parameter groups corresponding to the above three boot firmwares are: first parameter group 1, first parameter group 2, and first parameter group 3.
[0070] 102A2. Determine the sorting position corresponding to each first parameter group based on the first order.
[0071] After determining the first parameter group, the sorting position of each boot firmware is determined based on the sorting of each boot firmware in the first order.
[0072] For example, the first parameter groups corresponding to the three boot firmwares mentioned above include: first parameter group 1, first parameter group 2, and first parameter group 3. Based on the first order, the sorting position of each first parameter group is determined as follows: first parameter group 1 is sorted in the first position, first parameter group 2 is sorted in the second position, and first parameter group 3 is sorted in the third position.
[0073] 102A3. At the sorting position corresponding to each first parameter group, sort the parameters included in each first parameter group consecutively to obtain the second order.
[0074] For each first parameter group, the parameters included in that first parameter group are sorted consecutively at their corresponding sorting positions. It should be noted that when consecutively sorting parameters within the same parameter group, the order of the parameters is based on their order within the first parameter group.
[0075] For example, based on the first order, the sorting position corresponding to each first parameter group is determined as follows: first parameter group 1 is sorted in the first position, first parameter group 2 is sorted in the second position, and first parameter group 3 is sorted in the third position. At the sorting position corresponding to each first parameter group, the parameters included in each first parameter group are sorted consecutively to obtain the following second order: parameter 1, parameter 2, parameter 3, parameter 4, parameter 5, parameter 6, parameter 7, parameter 8.
[0076] In some embodiments of this application, the data processing method may further include the following steps 103 to 105:
[0077] 103. According to the order of the parameters in the second order, the parameters included in the target data are re-divided into at least one second parameter group arranged in sequence.
[0078] The number of second parameter groups is less than the number of first parameter groups. Some second parameter groups consist of multiple parameters that are adjacent in a second sequence and originate from at least two first parameter groups. The reason for having fewer second parameter groups than first parameter groups is to reduce the number of parameter groups passed to the boot firmware. Parameter groups are typically provided to the boot firmware via registers; therefore, reducing the number of parameter groups passed to the boot firmware reduces the number of registers occupied and thus reduces register consumption.
[0079] The method of reclassifying the parameters included in the target data into at least one second parameter group arranged in a second order according to the order of the parameters in the second order can include the following three methods:
[0080] Method 1, which involves re-dividing the parameters of the target data into at least one sequentially arranged second parameter group according to their order in the second order, may include the following steps: obtaining a combination command; wherein the combination command specifies the first parameter group to be grouped together; sequentially sorting the parameters of the first parameter group specified by the combination command in the second order to form corresponding second parameter groups; and separately grouping each first parameter group not specified by the combination command into its corresponding second parameter group.
[0081] The parameter groups are reorganized by combining and merging them into groups. The `combine` command specifies the first parameter group to be grouped together, which can be set based on specific business requirements. The parameters in the first parameter group specified by the `combine` command are then grouped into corresponding second parameter groups. Each first parameter group not specified by the `combine` command is then separately grouped into its corresponding second parameter group.
[0082] For example, in the second order, the parameters of the first parameter group 2 and the first parameter group 3 are ordered consecutively. Figure 2As shown, the first parameter group 2 includes parameter 2 "target_long fdt". The first parameter group 3 includes parameters 3 to 8, which are: target_long_magic, target_long_version, target_longnext_addr, target_long next_mode, target_long options, and target_long boot_hard, respectively. The combined command specifies that the first parameter group 2 and the first parameter group 3 are divided into the same second parameter group, resulting in the second parameter group as follows: Figure 2 As shown, the parameters in the second parameter group are arranged in the second order.
[0083] Method 2, the specific process of reclassifying the parameters included in the target data into at least one second parameter group in a sequential order according to the order of the parameters in the second order, may include the following steps: based on a first quantity, the parameters included in the target data are divided into at least one second parameter group in a sequential order according to the order of the parameters in the second order; wherein, the first data quantity is used to limit the number of parameters included in the second parameter group.
[0084] To balance the number of parameters in each second parameter group, a first limit is set on the number of parameters included in each second parameter group. Based on the parameters' order in the second sequence, the first number of parameters are sequentially extracted, and these extracted parameters are divided into corresponding second parameter groups.
[0085] Method 3, the specific process of re-dividing the parameters included in the target data into at least one second parameter group in order of the parameters in the second order, may include the following steps: based on the second quantity, dividing the parameters included in the target data into a second number of second parameter groups in order of the parameters in the second order.
[0086] Since registers are used to provide target data to the boot firmware, a second quantity is set to limit the number of second parameter groups in order to reduce register usage. Based on the second quantity, the parameters in the second order are evenly distributed according to their order in the second sequence, and each evenly distributed group is set as the corresponding second parameter group.
[0087] 104. In response to the startup of the target device, allocate a corresponding register for each second parameter group involved in the target data.
[0088] The target device booting indicates that a boot firmware is needed to boot the target device's operating system. Therefore, in response to the target device booting, a corresponding register is allocated for each second parameter group to provide parameters to the boot firmware for loading.
[0089] 105. According to the order of the parameters in the second order, write the parameters included in each second parameter group into the corresponding register.
[0090] Each parameter group in the second parameter group is written into its corresponding register so that the currently enabled boot firmware in the target device can load the parameters in each register in the second order during boot.
[0091] To prevent the boot firmware from loading parameters it doesn't need, the parameters in each parameter group are written to their corresponding registers according to their order in the second sequence. During booting, the currently enabled boot firmware on the target device loads the parameters from each register in the second sequence until it loads the last parameter it needs in that sequence—the target parameter. In this way, the currently enabled boot firmware only loads the parameters it needs, and avoids loading unnecessary parameters.
[0092] Furthermore, Figure 3 A flowchart of a data loading method according to an embodiment of this application is shown, as follows: Figure 3 As shown, this data loading method mainly includes the following steps 201 to 202:
[0093] 201. The currently enabled boot firmware in the target device determines the target data in response to the startup of the target device.
[0094] Currently, devices typically support two or more boot firmwares. When the target device starts up, only one boot firmware that meets the business requirements is usually enabled to boot the target device's operating system.
[0095] When the target device boots, it provides the target data for booting to the currently enabled boot firmware, which then loads the necessary parameters. In response to the target device's boot, the currently enabled boot firmware determines the target data and loads the required parameters from it. These parameters configure the target device's software and hardware environment to a state suitable for operating system boot, and then boot the operating system. The target data is processed using the aforementioned data processing method, ensuring that the currently enabled boot firmware only loads the parameters it needs during boot, and avoids loading unnecessary parameters.
[0096] 202. The currently enabled boot firmware loads the parameters it needs to load from the target data during the boot process.
[0097] To ensure that the currently enabled boot firmware only loads the parameters it needs and not the parameters it does not need, the target data includes multiple parameters arranged in sequence. The last parameter that the currently enabled boot firmware needs to load in the target data is marked with a matching termination loading flag, so that after the currently enabled boot firmware loads the parameter marked with the matching termination loading flag, it will not continue to load parameters from the target data.
[0098] The specific process by which the boot firmware loads the required parameters from the target data during boot can include the following steps: The boot firmware loads parameters based on their order in the target data and checks whether the loaded parameters have a matching termination loading flag. Based on the detection result of the termination loading flag, the boot firmware determines whether to stop loading parameters.
[0099] The parameters in the target data are ordered sequentially. To avoid the bootloader loading unnecessary parameters, it loads parameters based on the parameter order corresponding to the target data. Each time the bootloader loads a parameter from the target data, it checks if a matching termination record identifier has been added to the currently loaded parameter and obtains the corresponding detection result. Based on the detection result of the termination loading identifier, the bootloader determines whether to stop loading parameters.
[0100] If the detection result indicates that a matching stop-load flag has been added to the currently loaded parameter, it means that all the parameters it needs to load have been loaded. To avoid loading parameters that it doesn't need, the loading operation stops after the currently loaded parameter is completed, thus stopping the loading of parameters in the target parameters. If the detection result indicates that a matching stop-load flag has not been added to the currently loaded parameter, it means that not all the parameters it needs to load have been completed. In this case, after the currently loaded parameter is completed, the loading of the parameter located after the currently loaded parameter in the target data continues until a parameter with a matching stop-load flag is loaded.
[0101] In this embodiment of the application, the parameters included in the target data are divided into at least one second parameter group arranged in sequence, and in response to the startup of the target device, the parameters included in each second parameter group are written into the corresponding register. The specific process of the above-mentioned step "continuing to load the parameter located after the currently loaded parameter in the target data" may include the following steps 202A to 203B:
[0102] 202A. If the boot firmware determines that the currently loaded parameter is not the last bit in the corresponding register, then the target address is obtained by offsetting the address of the currently loaded parameter in the corresponding register based on the offset value, and the parameter located one bit after the currently loaded parameter is loaded in the corresponding register based on the target address.
[0103] For a second parameter group, the parameters included in the second parameter group are written to their corresponding registers sequentially according to the order in the second sequence. After being written to the register, the first parameter of the second parameter group becomes the first parameter in the corresponding register, and the address of the first parameter becomes the address of the corresponding register. The boot firmware can then load the first parameter from the register based on its address. The addresses of the parameters following the first parameter in the register can be determined based on their order relationship with the first parameter and their offset values. For example, if the address of the first parameter is address 1 and the offset value is A, the address obtained by offsetting address 1 by the preset offset value A is the address of the next parameter in the register. The boot firmware can then load the parameter located one position after the first parameter from the register based on the obtained address. The size of the offset value can be determined based on business requirements; for example, the offset value is 8 bytes.
[0104] If the boot firmware determines that the currently loaded parameter is not the last parameter in the corresponding register, it means that there are still parameters in the corresponding register that the boot firmware has not loaded. Therefore, based on the offset value, the address of the currently loaded parameter in the corresponding register is shifted larger to obtain the target address of the next parameter adjacent to the currently loaded parameter in the corresponding register. Based on the target address, the parameter located one position after the currently loaded parameter is loaded into the corresponding register.
[0105] 203B. If the boot firmware determines that the currently loaded parameter is the last parameter in the corresponding register, then determine the register located one position after the corresponding register, and load the parameter located one position after the currently loaded parameter based on the address of the determined register; wherein, the address of the determined register is the address of the first parameter in the determined register.
[0106] If the boot firmware determines that the currently loaded parameter is the last parameter in the corresponding register, it means that all parameters in the corresponding register have been loaded. Then, based on the second order, it determines the register located one position after the corresponding register. Based on the address of the determined register, it loads the first parameter from that register; this first parameter is the parameter located one position after the currently loaded parameter in the second order.
[0107] The data loading method provided in this application embodiment allows the currently enabled boot firmware in the target device to load only the parameters it needs from the target data during booting, without loading parameters it does not need. This avoids the currently enabled boot firmware loading many useless parameters, thereby reducing the load of loaded parameters on the target device's CPU and other hardware resources, and thus speeding up the boot speed of the operating system.
[0108] Furthermore, one embodiment of this application also provides a data processing apparatus, such as... Figure 4 As shown, the data processing apparatus includes:
[0109] The first processing module 31 is used to sort at least two boot firmwares compatible with the target device to obtain a first order; wherein, the parameters that each boot firmware needs to load include the parameters that all boot firmwares preceding it in the first order need to load.
[0110] The second processing module 32 is used to process all parameters that the at least two boot firmwares need to load based on the first order, and obtain target data for booting of various boot firmwares, so that each boot firmware loads only the parameters it needs to load from the target data when booting.
[0111] The data processing apparatus provided in this application sorts at least two boot firmwares compatible with the target device to obtain a first order. The parameters that each boot firmware needs to load include those required by all boot firmwares preceding it in the first order, but exclude those required by boot firmwares following it. Based on the first order, all parameters required by the at least two boot firmwares are processed to obtain target data for booting, so that each boot firmware only loads its required parameters from the target data during booting. In this way, the currently enabled boot firmware of the target device only loads its required parameters from the target data, and does not load parameters it does not need, thereby avoiding the loading of many useless parameters by the currently enabled boot firmware. This reduces the occupation of CPU and other hardware resources of the target device by loaded useless parameters, and speeds up the startup of the operating system.
[0112] In some embodiments of this application, such as Figure 5 As shown, the second processing module 32 includes:
[0113] Sorting unit 321 is used to sort all the parameters that the at least two boot firmwares need to load according to the first order to obtain a second order;
[0114] The determining unit 322 is used to determine the target parameters corresponding to each type of boot firmware; wherein, the target parameter is the last parameter that the boot firmware needs to load in the second order;
[0115] Processing unit 323 is used to add a matching termination loading identifier to each of the target parameters in the second sequence based on the correspondence between the boot firmware and the target parameters, thereby obtaining the target data.
[0116] In some embodiments of this application, such as Figure 5 As shown, the sorting unit 321 is specifically used to determine all first parameter groups corresponding to each of the at least two boot firmwares; wherein, parameters of the same type are recorded in the same first parameter group; the sorting position corresponding to each first parameter group is determined based on the first order; and the parameters included in each first parameter group are sorted continuously at the sorting position corresponding to each first parameter group to obtain the second order.
[0117] In some embodiments of this application, such as Figure 5 As shown, the data processing device also includes:
[0118] The partitioning module 33 is used to re-divide the parameters included in the target data into at least one second parameter group arranged in order according to the order of the parameters in the second order; wherein the number of the second parameter groups is less than the number of the first parameter groups, and some of the second parameter groups are composed of multiple parameters that are adjacent in the second order and originate from at least two first parameter groups;
[0119] Allocation module 34 is configured to allocate a corresponding register for each second parameter group involved in the target data in response to the startup of the target device;
[0120] Module 35 is provided for writing the parameters included in each second parameter group into the corresponding register according to the order of the parameters in the second order.
[0121] In some embodiments of this application, such as Figure 5 As shown, the partitioning module 33 includes:
[0122] The first division unit 331 is used to obtain a combination command; wherein the combination command is used to specify a first parameter group that needs to be divided into the same group; the parameters of the first parameter group that needs to be divided into the same group specified by the combination command are continuously sorted in the second order to divide into corresponding second parameter groups; each first parameter group not specified by the combination command is separately divided into a corresponding second parameter group.
[0123] In some embodiments of this application, such as Figure 5 As shown, the partitioning module 33 includes:
[0124] The second partitioning unit 332 is used to divide the parameters included in the target data into at least one second parameter group arranged in sequence based on the first quantity and the order of the parameters in the second order; wherein the first data quantity is used to limit the number of parameters included in the second parameter group.
[0125] In some embodiments of this application, such as Figure 5 As shown, the partitioning module 33 includes:
[0126] The third division unit 333 is used to divide the parameters included in the target data into a second parameter group with a second number of parameters arranged in a second order, based on the second quantity and the order of the parameters in the second order.
[0127] The detailed explanations of the various functional modules used in the operation of the data processing apparatus provided in this application embodiment can be found in the corresponding detailed explanations of the above data processing method embodiments, and will not be repeated here.
[0128] Furthermore, one embodiment of this application also provides boot firmware, such as... Figure 6 As shown, the boot firmware includes:
[0129] The determination module 41 is used to determine target data in response to the startup of the target device; wherein the target data is obtained by processing using the data processing method described above;
[0130] The loading module 42 is used to load the parameters that the boot firmware needs to load from the target data when booting.
[0131] The boot firmware provided in this application embodiment loads only the parameters it needs from the target data during booting, and does not load parameters it does not need. This avoids the boot firmware loading many useless parameters, thereby reducing the load of loaded parameters on the CPU and other hardware resources of the target device, and thus speeding up the boot speed of the operating system.
[0132] In some embodiments of this application, such as Figure 6 As shown, the target data includes multiple parameters arranged in order, and the last parameter that the currently enabled boot firmware needs to load in the target data has a matching termination loading identifier added. Then, the loading module 42 is specifically used for the boot firmware to load parameters based on the order of parameters in the target data, and to detect whether the loaded parameters have a matching termination loading identifier added; the boot firmware determines whether to stop loading parameters based on the detection result of the termination loading identifier.
[0133] For a detailed explanation of the various functional modules used in the boot firmware provided in this application, please refer to the corresponding detailed explanation of the above data loading method embodiment, which will not be repeated here.
[0134] Furthermore, one embodiment of this application also provides a computer-readable storage medium, the storage medium including a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to perform the above-described data processing method.
[0135] Furthermore, one embodiment of this application also provides a computer-readable storage medium, the storage medium including a stored program, wherein, when the program is executed, it controls the device where the storage medium is located to perform the above-described data loading method.
[0136] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0137] It is understood that the relevant features in the above methods and apparatus can be referenced interchangeably. Furthermore, the terms "first," "second," etc., in the above embodiments are used to distinguish between embodiments and do not represent the superiority or inferiority of any particular embodiment.
[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0139] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this application is not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing preferred embodiments of this application.
[0140] In addition, the memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0141] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0142] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data cutover device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data cutover device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0143] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data cutover device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0144] These computer program instructions can also be loaded onto a computer or other programmable data cutover device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0145] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0146] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0147] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0148] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0149] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0150] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A data processing method, characterized in that, The method includes: The target device is compatible with at least two boot firmwares, which are sorted to obtain a first order; wherein, the parameters that each boot firmware needs to load include the parameters that all boot firmwares preceding it in the first order need to load. Based on the first order, all parameters that the at least two boot firmwares need to load are processed to obtain target data for booting of various boot firmwares, so that each boot firmware loads the parameters it needs to load from the target data when booting. Based on the first order, all parameters that the at least two boot firmwares need to load are processed to obtain target data for booting various boot firmwares, including: Based on the first order, all parameters that the at least two boot firmwares need to load are ordered sequentially to obtain the second order; Determine the target parameters corresponding to each of the aforementioned boot firmware; wherein, the target parameter is the last parameter that the boot firmware needs to load in the second order; Based on the correspondence between the boot firmware and the target parameters, a matching termination loading identifier is added to each of the target parameters in the second sequence to obtain the target data.
2. The method according to claim 1, characterized in that, Based on the first order, all parameters that the at least two boot firmwares need to load are sequentially ordered to obtain a second order, including: Determine all first parameter groups corresponding to each of the at least two boot firmwares; wherein, parameters of the same type are recorded in the same first parameter group; The sorting position corresponding to each of the first parameter groups is determined based on the first order; At each sorting position corresponding to the first parameter group, the parameters included in each first parameter group are sorted consecutively to obtain the second order.
3. The method according to claim 2, characterized in that, The method further includes: According to the order of the parameters in the second order, the parameters included in the target data are re-divided into at least one second parameter group arranged in sequence; wherein, the number of the second parameter groups is less than the number of the first parameter groups, and some of the second parameter groups consist of multiple parameters that are adjacent in the second order and originate from at least two first parameter groups; In response to the startup of the target device, a corresponding register is allocated for each second parameter group involved in the target data; According to the order of the parameters in the second order, the parameters included in each second parameter group are written into the corresponding registers.
4. The method according to claim 3, characterized in that, According to the order of the parameters in the second order, the parameters included in the target data are re-divided into at least one second parameter group arranged in sequence, including: Obtain a combination command; wherein the combination command is used to specify the first parameter group that needs to be divided into the same group; The parameters of the first parameter group that need to be divided into the same group, as specified by the combination command, are sequentially sorted in the second order to divide them into the corresponding second parameter groups; Each first parameter group that is not specified in the combined command is separately divided into a corresponding second parameter group.
5. The method according to claim 3, characterized in that, According to the order of the parameters in the second order, the parameters included in the target data are re-divided into at least one second parameter group arranged in sequence, including: Based on a first quantity, and according to the order of the parameters in the second order, the parameters included in the target data are divided into at least one second parameter group arranged in sequence; wherein, the first quantity is used to limit the number of parameters included in the second parameter group; or, Based on the second quantity, and according to the order of the parameters in the second order, the parameters included in the target data are evenly divided into a second parameter group with a second quantity arranged in order.
6. A data loading method, characterized in that, The method includes: The currently enabled boot firmware in the target device determines target data in response to the startup of the target device; wherein the target data is obtained by processing the data processing method as described in any one of claims 1-5; The boot firmware loads the parameters it needs from the target data during boot.
7. The method according to claim 6, characterized in that, The target data includes multiple parameters arranged in sequence, and the last parameter that the currently enabled boot firmware needs to load in the target data has a matching termination loading identifier added to it. Therefore, when the boot firmware performs booting, it loads the parameters it needs to load from the target data, including: The boot firmware loads parameters based on the sorting of parameters in the target data, and detects whether the loaded parameters have a matching termination loading identifier. The boot firmware determines whether to stop loading parameters based on the detection result of the termination loading flag.
8. A data processing apparatus, characterized in that, The device includes: The first processing module is used to sort at least two boot firmwares compatible with the target device to obtain a first order; wherein, the parameters that each boot firmware needs to load include the parameters that all boot firmwares preceding it in the first order need to load; The second processing module is used to process all parameters that the at least two boot firmwares need to load based on the first order, and obtain target data for booting of various boot firmwares, so that each boot firmware loads the parameters it needs to load from the target data when booting. The second processing module includes: A sorting unit is used to sort all the parameters that the at least two boot firmwares need to load according to the first order to obtain a second order; A determining unit is configured to determine the target parameters corresponding to each type of boot firmware; wherein the target parameter is the last parameter that the boot firmware needs to load in the second order; The processing unit is configured to add a matching termination loading identifier to each of the target parameters in the second sequence based on the correspondence between the boot firmware and the target parameters, thereby obtaining the target data.
9. A boot firmware, characterized in that, The boot firmware includes: A determination module is configured to determine target data in response to the activation of the target device; wherein the target data is obtained by processing the data processing method as described in any one of claims 1-5; A loading module is used by the boot firmware to load the parameters it needs to load from the target data during boot.
10. A computer-readable storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the storage medium to perform at least one of the following methods: the data processing method according to any one of claims 1 to 5, and the data loading method according to any one of claims 6 to 7.
Citation Information
Patent Citations
Firmware booting method based on booting program, medium and equipment
CN111045739A
Baseboard management controller firmware fault recovery method, system, device and medium
CN115576747A
