An information recording method, apparatus, device and medium

By recording register values ​​to a new node in the device tree during the kernel assembly startup phase, the problem of inconvenience in obtaining register values ​​during the computer kernel assembly startup phase in existing technologies is solved. This achieves simple and highly scalable value acquisition and improves the efficiency of troubleshooting kernel startup problems.

CN119201264BActive Publication Date: 2025-12-16ZHEJIANG DAHUA TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411095004.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2025-12-16
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

Existing technologies require the use of external emulators or complex serial port printing designs to obtain the values ​​stored in the registers during the computer kernel assembly startup phase, resulting in cumbersome operations and making it inconvenient to efficiently troubleshoot kernel startup problems.

Method used

During the kernel assembly startup phase, the values ​​stored in the registers are recorded into a new node in the device tree. By executing the logic code in the assembly file and calling the pre-set target function, the target value is recorded into the device tree, which is simple to implement and highly scalable.

Benefits of technology

It simplifies the process of obtaining register values, improves the efficiency of troubleshooting kernel boot problems, and supports portability to various chip platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201264B_ABST
    Figure CN119201264B_ABST
Patent Text Reader

Abstract

The application discloses an information recording method, device, equipment and medium, which records the value stored in the register in the newly-added node in the device tree during the kernel assembly startup stage of the equipment. The method provided by the application comprises the following steps: during the kernel assembly startup stage of the equipment, executing the logic code for storing the target value into the target register in the assembly file; when the execution of the logic code for storing the target value into the target register in the assembly file is completed, calling the target function for modifying the target node newly added in the device tree which is previously set in the kernel file, and taking the target value stored in the target register as the input parameter of the target function; and recording the target value stored in the target register into the target node newly added in the device tree by executing the target function.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to an information recording method and device, equipment and medium. BACKGROUND

[0002] If the value stored in the register at a certain execution code in the computer kernel assembly startup stage is to be obtained, an external emulator needs to be used, or a serial port driver and a print function are used. When the emulator is connected to the computer and the emulator is debugging the specified code, the value stored in the register is displayed on the host computer software of the computer. The design of serial port printing is more complex. The serial port peripheral driver of the corresponding chip is added to the kernel assembly code, including the serial port hardware driver and the screen terminal driver. When the specified code is executed, the terminal outputs the value stored in the register to the screen through the serial port. SUMMARY

[0003] The embodiments of the present application provide an information recording method, device, equipment and medium, which record the value stored in the register in a newly added node in the device tree in the kernel assembly startup stage of the device, are simple to implement, have strong expansibility, facilitate obtaining the value stored in the register, and thus help to improve the troubleshooting efficiency of the kernel startup problem in the assembly stage.

[0004] The information recording method provided by the embodiments of the present application comprises:

[0005] In the kernel assembly startup stage of the device, the logical code for storing the target value into the target register in the assembly file is executed;

[0006] When the logical code for storing the target value into the target register in the assembly file is executed, the target function for modifying the target node newly added in the device tree is called in advance in the kernel file, and the target value stored in the target register is taken as the input parameter of the target function;

[0007] By executing the target function, the target value stored in the target register is recorded to the target node newly added in the device tree in advance.

[0008] The embodiment of the present application is characterized in that, in the kernel assembly start-up phase of the device, the logic code for storing the target value into the target register in the assembly file is executed, so that when the execution of the logic code for storing the target value into the target register in the assembly file is completed, the target function for modifying the target node newly added in the device tree previously set in the kernel file is called, and the target value stored in the target register is taken as the input parameter of the target function, and then the target value stored in the target register is recorded to the target node newly added in the device tree by executing the target function, thereby achieving the recording of the value stored in the register to the newly added node in the device tree in the kernel assembly start-up phase of the device. The method is simple to implement, and since the device tree is large enough, the values of the registers that can be recorded are sufficient, and the method has strong expansibility, facilitating the acquisition of the values stored in the registers, thereby helping to improve the troubleshooting efficiency of the kernel start-up problem in the assembly phase, and has strong practicability. Moreover, the method provided by the embodiment of the present application is applicable to various chip platforms, and therefore has high portability.

[0009] In some embodiments, the method further comprises:

[0010] When the device is started up, the target value is acquired by accessing a preset directory in an operating system of the device; wherein the preset directory is a directory for recording information of the device tree.

[0011] In some embodiments, the target value is a value in a file of the target node under the preset directory.

[0012] The acquisition of the target value comprises:

[0013] The value in the file of the target node is read by a hexdump command of the operating system of the device.

[0014] In some embodiments, in the kernel assembly start-up phase of the device, the execution of the logic code for storing the target value into the target register in the assembly file comprises:

[0015] The bootloader of the device is started to be executed;

[0016] The start function in the head.S file of the kernel of the device is jumped to be executed, so as to start the execution of the assembly code, and the assembly code comprises the logic code for storing the target value into the target register.

[0017] In some embodiments, the target function for modifying the target node newly added in the device tree previously set in the kernel file is called by a BL instruction in the assembly instruction.

[0018] In some embodiments, at least one node is added in advance in the device tree, the target node is one of the added nodes, and one added node is used to record one target value.

[0019] In some embodiments, at least one function is added in advance in the kernel file, the target function is one of the added functions.

[0020] The added node and the added function correspond to each other.

[0021] An information recording device provided by an embodiment of the present application includes:

[0022] The first unit is configured to execute, in a kernel assembly start phase of the device, logic code in an assembly file for storing a target value into a target register;

[0023] The second unit is configured to, when the execution of the logic code in the assembly file for storing the target value into the target register is completed, call a target function for modifying a target node added in advance in a device tree and set in a kernel file, and take the target value stored in the target register as an input parameter of the target function.

[0024] The third unit is configured to record the target value stored in the target register into the target node added in advance in the device tree by executing the target function.

[0025] Another embodiment of the present application provides an electronic device including a memory and a processor, wherein the memory is configured to store program instructions, and the processor is configured to call the program instructions stored in the memory to execute any of the above methods according to obtained program execution.

[0026] Another embodiment of the present application provides a computer readable storage medium storing computer executable instructions, and the computer executable instructions are used to make the computer execute any of the above methods. BRIEF DESCRIPTION OF DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0028] Figure 1 The general flowchart of the information recording method provided by the embodiments of the present application is shown in the figure.

[0029] Figure 2A specific flowchart of an information recording method provided by the embodiment of the present application is shown in the following table.

[0030] Figure 3 A structural diagram of an electronic device provided by the embodiment of the present application is shown in the following table.

[0031] Figure 4 A structural diagram of an information recording device provided by the embodiment of the present application is shown in the following table. DETAILED DESCRIPTION

[0032] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0033] The embodiments of the present application provide an information recording method, device, equipment and medium, which records the value stored in the register in the newly added node in the device tree in the kernel assembly start-up stage of the equipment, has simple implementation, strong expansibility, is convenient for obtaining the value stored in the register, and further helps to improve the troubleshooting efficiency of the kernel start-up problem in the assembly stage.

[0034] The method and the device, the equipment and the medium are based on the same application concept. Since the principles of the method and the device, the equipment and the medium for solving problems are similar, the implementation of the device, the equipment, the medium and the method can be mutually referred to, and the repeated parts will not be described again.

[0035] The terms "first", "second", and the like (if any) in the specification and claims of the embodiments of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.

[0036] The following examples and embodiments will be understood only as illustrative examples. Although the present description can refer to "an", "one", or "some" example or embodiment at several locations, this does not mean that each such reference is referring to the same example or embodiment, nor is this feature only applicable to a single example or embodiment. Individual features of different embodiments can also be combined to provide other embodiments. Furthermore, terms such as "comprising" and "including" should be understood as not limiting the described embodiments to only those consisting of the features mentioned; such examples and embodiments can also include features, structures, units, modules, etc. that are not specifically mentioned.

[0037] The various embodiments of the present application will be described in detail below with reference to the accompanying drawings. It should be noted that the order of the display of the embodiments of the present application only represents the order of the embodiments, and does not represent the advantages and disadvantages of the technical solutions provided by the embodiments.

[0038] First, the technical terms involved in the embodiments of the present application are introduced:

[0039] Device tree: preserves the device information existing in the system, when the machine is booted, the operating system (OS) builds this tree by using the information obtained by the driver and other components, and updates this tree when a device is added or deleted. Each node of the device tree is a device node (devnode).

[0040] Boot startup program of the operating system of the device: includes the following 3 assemblers: bootsect.S, setup.S and head.s.

[0041] Kernel assembly startup phase: the kernel startup of the device is not directly executed from the c function (start_kernel), but a piece of code written in assembly language needs to be executed before the function, which is stored in the head.s file. The process of executing this piece of assembly code in the head.s file is the kernel assembly startup phase. The embodiments of the present application pre-set a function for modifying the device tree node in the kernel assembly startup phase, so that the value of the node in the device tree can be modified as needed, thereby recording the value stored in the chip register to the newly added node in the device tree in the kernel assembly startup phase.

[0042] Embodiment one:

[0043] Referring to Figure 1 The information recording method provided by the embodiments of the present application comprises:

[0044] S101, in the kernel assembly startup phase of the device, execute the logic code in the assembly file for storing the target value into the target register;

[0045] the assembly file, such as a head.S file.

[0046] the target value, such as a kernel image relocation end address.

[0047] the target register, such as a R9 register inside an Advanced RISC Machine (ARM) platform.

[0048] S102, when the execution of the logic code in the assembly file for storing the target value into the target register is completed, a target function for modifying a target node newly added in a device tree in advance is called, and the target value stored in the target register is taken as an input parameter of the target function, which is set in a kernel file in advance;

[0049] the kernel file, such as an atags_to_fdt.c file.

[0050] Taking the kernel image relocation end address as the target value, the target node newly added in the device tree can be named as a rellocAddr node, for example.

[0051] Correspondingly, the target function for modifying the target node newly added in the device tree in advance, which is set in the kernel file, is named as a recordRellocAddr function, for example.

[0052] S103, by executing the target function, the target value stored in the target register is recorded to the target node newly added in the device tree in advance.

[0053] In some embodiments, the method further comprises:

[0054] when the device is started, the target value is obtained by accessing a preset directory in an operating system of the device, wherein the preset directory is a directory for recording information of the device tree.

[0055] the preset directory, such as a / proc / device-tree directory.

[0056] In some embodiments, the target value is a value in a file of the target node under the preset directory.

[0057] the obtaining of the target value comprises:

[0058] reading the value in the file of the target node by a hexdump command of the operating system of the device.

[0059] In some embodiments, in the kernel assembly start phase of the device, the logic code in the assembly file for storing the target value into the target register is executed, including:

[0060] starting to execute the bootloader of the device;

[0061] jumping to execute the start function in the head.S file of the kernel of the device, starting to execute the assembly code, and the assembly code includes the logic code for storing the target value into the target register.

[0062] In some embodiments, the target function for modifying the target node newly added in the device tree is called in advance through the BL instruction in the assembly instruction.

[0063] That is, in some embodiments, after the target logic (logic for storing the target value into the target register) is executed in the kernel head.S assembly file, a new call assembly command, that is, the BL instruction, is added to call the newly added target function, and the target register is used as the input parameter of the newly added target function, so that the newly added target function writes the value stored in the target register into the newly added target node in the device tree.

[0064] In some embodiments, at least one node is newly added in the device tree, and the target node is one of the newly added nodes, and one newly added node is used to record one target value.

[0065] In some embodiments, at least one function is newly added in the kernel file, and the target function is one of the newly added functions.

[0066] The newly added node and the newly added function correspond to each other.

[0067] That is, in some embodiments, the newly added node in the device tree and the target value to be recorded are in a one-to-one correspondence, for example, there are three target values to be recorded, and three nodes can be newly added in the device tree, and each node is used to record one target value. For example, one newly added node is used to record the end address of the kernel image relocation, another newly added node is used to record the start address of the kernel image relocation, and the third newly added node can be used to record other values to be recorded.

[0068] In summary, the method provided in the embodiments of the present application involves few modules, only needs to newly add nodes in the device tree as needed, and can modify the node content in the assembly phase, which is easy to implement. Since the kernel supports the device tree mechanism, the method provided in the embodiments of the present application is simple to implement.

[0069] Embodiment two:

[0070] The embodiment takes establishing a new node in a device tree for recording a kernel image relocation end address as an example for illustration.

[0071] The embodiment provides a specific process of recording a value stored in a register in a kernel assembly start phase, as shown in the following table. Figure 2

[0072] S201, establishing a new node in a device tree for recording a kernel image relocation end address;

[0073] The new node is used for writing a value of an R9 register, that is, for recording the kernel image relocation end address.

[0074] The kernel image relocation is to carry the kernel image to a correct position in a memory for running, and the end address is a tail address of a memory interval where the kernel image is stored after the carrying is completed.

[0075] In an Advanced RISC Machine (ARM) platform, the kernel image relocation end address is finally stored in an R9 register in the ARM platform, and therefore, the value stored in the R9 register needs to be recorded in the new node in the device tree in the embodiment.

[0076] The new node in the device tree in the embodiment can be named as rellocAddr because it is used for recording the kernel image relocation end address.

[0077] S202, setting a new function in a kernel file for modifying the new node in the device tree;

[0078] The kernel file is an atags_to_fdt.c file.

[0079] The kernel file is used for adding or modifying a node in the device tree. After the node is added in the device tree in the embodiment, the added node has a default value, and in the embodiment, the value stored in the R9 register is written into the new node through the new function in the kernel file, which is equivalent to modifying the value of the new node, that is, replacing the default value of the new node with the value stored in the R9 register.

[0080] The new function in the embodiment can be named as recordRellocAddr.

[0081] An input parameter of the new function recordRellocAddr is a value stored in the R9 register.

[0082] ​The code logic executed by the new function is to write the value stored in the R9 register to the new node rellocAddr.

[0083] It should be noted that the steps S201 and S202 can be executed synchronously or sequentially, and the specific order is not limited.

[0084] S203, starting to execute the bootloader, and then jumping to execute the kernel code, in the running process of the kernel code, calling the new function recordRellocAddr, to store the value stored in the R9 register to the new node rellocAddr in the device tree;

[0085] The running of the bootloader can complete the kernel image loading of the computer device and jump to execute the kernel code. The running of the kernel code takes the start function in the head.S file as the start entry function to start executing the assembly code, so that at the end of the target assembly code execution, that is, when the logic code for storing the kernel image relocation end address in the R9 register is executed, the new function recordRellocAddr is called through the assembly command (program jump command with link, that is, the BL instruction) to store the value stored in the R9 register to the new node rellocAddr in the device tree.

[0086] The target assembly code can execute the following logic: storing the kernel image relocation end address in the R9 register. After the execution of the logic, the BL instruction in the assembly instruction is called to jump to execute the new function recordRellocAddr, so as to record the value stored in the R9 register to the new node rellocAddr.

[0087] S204, obtaining the value stored in the R9 register in the new node file of the device tree by accessing a preset directory in the operating system for recording device tree information.

[0088] In the operating system, a directory such as “ / proc / device-tree” is pre-set to record the information of the device tree. The structure of the preset directory can be provided by a device tree file system, which presents the content of the device tree in the form of a virtual file. Users can access these virtual files to obtain the information of the device tree. Therefore, in the embodiment, the new node file can be found in the preset directory.

[0089] Therefore, when the computer device is started, the embodiment finds the newly added node rellocAddr file by using a hexdump command of an operating system (a command for accessing a file in a / proc / device-tree directory), and reads the value recorded in the file, so as to obtain the value stored in the R9 register. The hexdump command displays file content in hexadecimal form, and supports multiple output formats and parameter options.

[0090] The following describes the device or apparatus provided by the embodiment of the application, and the same or corresponding technical features in the above method are not described again.

[0091] The electronic device provided by the embodiment of the application is described below with reference to Figure 3 , for example, including:

[0092] The processor 600 is configured to read a program in the memory 620, and perform the following process:

[0093] In a kernel assembly start phase of the device, logic code for storing a target value into a target register in an assembly file is executed;

[0094] When the execution of the logic code for storing the target value into the target register in the assembly file is completed, a target function for modifying a target node newly added in a device tree and previously set in a kernel file is called, and the target value stored in the target register is taken as an input parameter of the target function;

[0095] The target value stored in the target register is recorded to the target node newly added in the device tree by executing the target function.

[0096] In some embodiments, the processor 600 is further configured to read a program in the memory 620, and perform the following process:

[0097] When the device is started, the target value is obtained by accessing a preset directory in an operating system of the device; the preset directory is a directory for recording information of the device tree.

[0098] In some embodiments, the target value is a value in a file of the target node in the preset directory;

[0099] The obtaining of the target value includes:

[0100] The value in the file of the target node is read by using a hexdump command of the operating system of the device.

[0101] In some embodiments, in the kernel assembly start phase of the device, the logic code in the assembly file for storing the target value into the target register is executed, including:

[0102] starting to execute the bootloader of the device;

[0103] jumping to execute the start function in the head.S file of the kernel of the device, starting to execute the assembly code, and the logic code for storing the target value into the target register is included in the assembly code.

[0104] In some embodiments, the target function for modifying the target node newly added in the device tree is called in advance in the kernel file through the BL instruction in the assembly instruction.

[0105] In some embodiments, at least one node is newly added in the device tree in advance, and the target node is one of the newly added nodes, and one newly added node is used to record one target value.

[0106] In some embodiments, at least one function is newly added in the kernel file in advance, and the target function is one of the newly added functions.

[0107] Among them, the newly added nodes and the newly added functions are one-to-one corresponding.

[0108] The transceiver 610 is configured to receive and send data under the control of the processor 600.

[0109] Among them, Figure 3 The bus architecture can include any number of interconnecting buses and bridges, which are well known in the art and therefore, not further described herein, linking together various circuits such as one or more processors represented by the processor 600, and the memory represented by the memory 620. The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore, not further described herein. The bus interface provides an interface. The transceiver 610 can be a plurality of elements, i.e., including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium, including wireless channels, wired channels, optical cables, etc. The user interface 630 can also be an interface that can be externally connected to the required device for different user devices, including but not limited to a keypad, a display, a speaker, a microphone, a joystick, etc.

[0110] The processor 600 is responsible for managing the bus architecture and general processing, and the memory 620 can store data used by the processor 600 in executing operations.

[0111] In some embodiments, the processor 600 can be a CPU (Central Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or a CPLD (Complex Programmable Logic Device), and the processor can also adopt a multi-core architecture.

[0112] The processor executes any method provided by the embodiments of the present application according to the executable instructions obtained by calling the computer program stored in the memory. The processor and the memory can also be arranged physically separately.

[0113] It should be noted that the above device provided by the embodiments of the present application can realize all the method steps realized by the above method embodiments and achieve the same technical effects, and the same parts and beneficial effects of the method embodiments will not be described in detail herein.

[0114] Referring to Figure 4 The information recording device provided by the embodiments of the present application comprises:

[0115] The first unit 11 is configured to execute the logic code for storing the target value into the target register in the assembly file during the kernel assembly start-up stage of the device;

[0116] The second unit 12 is configured to call the target function for modifying the target node newly added in the device tree in advance in the kernel file when the execution of the logic code for storing the target value into the target register in the assembly file is completed, and store the target value in the target register as an input parameter of the target function.

[0117] The third unit 13 is configured to record the target value stored in the target register to the target node newly added in the device tree by executing the target function.

[0118] In some embodiments, the information recording device further comprises an access unit configured to:

[0119] When the device is started up, the target value is obtained by accessing a preset directory in the operating system of the device, wherein the preset directory is a directory for recording information of the device tree.

[0120] In some embodiments, the target value is a value in a file of the target node under the preset directory.

[0121] The obtaining the target value comprises:

[0122] The value in the file of the target node is read by a hexdump command of an operating system of the device.

[0123] In some embodiments, in a kernel assembly start phase of the device, the logic code in the assembly file for storing the target value into the target register is executed, comprising:

[0124] The bootloader of the device is started to be executed;

[0125] The start function in the head.S file of the kernel of the device is jumped to be executed, to start to execute the assembly code, and the logic code for storing the target value into the target register is included in the assembly code.

[0126] In some embodiments, the target function for modifying the target node newly added in the device tree is called in advance by a BL instruction in the assembly instruction, and the target function is set in advance in the kernel file.

[0127] In some embodiments, at least one node is newly added in the device tree in advance, the target node is one of the newly added nodes, and one newly added node is used to record one target value.

[0128] In some embodiments, at least one function is newly added in the kernel file in advance, and the target function is one of the newly added functions.

[0129] The newly added node and the newly added function correspond to each other.

[0130] It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division. In actual implementation, another division mode can be used. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0131] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0132] Any of the devices or apparatuses provided in the embodiments of the present application can specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. It can include a central processing unit (CPU), a memory, an input / output device, etc. The input device can include a keyboard, a mouse, a touch screen, etc. The output device can include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.

[0133] The memory can include a read-only memory (ROM) and a random access memory (RAM), and provide the processor with program instructions and data stored in the memory. In the embodiments of the present application, the memory can be used to store the programs of any of the methods provided in the embodiments of the present application.

[0134] The processor calls the program instructions stored in the memory. The processor is used to execute any of the methods provided in the embodiments of the present application according to the obtained program instructions.

[0135] The embodiments of the present application further provide a computer program product or computer program, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform any of the methods described in the above embodiments. The program product can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium may, for example, be but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0136] The embodiments of the present application provide a computer readable storage medium for storing computer program instructions for the apparatus provided in the above embodiments of the present application, which contains programs for executing any of the methods provided in the above embodiments of the present application. The computer readable storage medium can be a non-transitory computer readable medium.

[0137] The computer readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to a magnetic storage (such as a floppy disk, a hard disk, a magnetic tape, a magneto-optical disk (MO), etc.), an optical storage (such as a CD, a DVD, a BD, a HVD, etc.), and a semiconductor storage (such as a ROM, an EPROM, an EEPROM, a non-volatile memory (NAND FLASH), a solid state disk (SSD)), etc.

[0138] It should be understood that:

[0139] The access technology via which entities in a communication network communicate traffic to and from each other can be any suitable current or future technology, such as WLAN (Wireless Local Access Network), WiMAX (Worldwide Interoperability for Microwave Access), LTE, LTE-A, 5G, Bluetooth, infrared, etc. can be used; in addition, embodiments can also apply wired technologies, for example, IP-based access technologies, such as wired networks or fixed lines.

[0140] Embodiments suitable for being implemented as software code or parts thereof and being run using a processor or processing functionality are independent of the software code and can be specified using any known or future developed programming language, such as a high-level programming language, such as objective-C, C, C++, C#, Java, Python, Javascript, other scripting languages, etc., or a low-level programming language, such as a machine language or assembler.

[0141] Embodiments are independent of hardware and can be implemented using any known or future developed hardware technology or any hybrid of these, such as microprocessors or CPUs (Central Processing Units), MOS (Metal Oxide Semiconductor), CMOS (Complementary MOS), BiMOS (Bipolar MOS), BiCMOS (Bipolar CMOS), ECL (Emitter Coupled Logic), and / or TTL (Transistor-Transistor Logic).

[0142] Embodiments can be implemented as individual devices, apparatus, units, components, or functions, or in a distributed manner, e.g., using or sharing one or more processors or processing functionality in processing, or using and sharing one or more processing segments or processing portions, wherein one physical processor or more than one physical processor can be used for implementing one or more processing portions dedicated to specific processing as described.

[0143] An apparatus can be implemented by a semiconductor chip, a chipset, or a (hardware) module including such chip or chipset.

[0144] Embodiments can also be implemented as any combination of hardware and software, such as ASIC (Application Specific IC (Integrated Circuit)) components, FPGA (Field-programmable Gate Array) or CPLD (Complex Programmable Logic Device) components, or DSP (Digital Signal Processor) components.

[0145] Embodiments can also be implemented as a computer program product comprising a computer usable medium having a computer readable program code embodied therein, the computer readable program code adapted to be executed by a computer to perform processes as described in embodiments, wherein the computer usable medium can be a non-transitory medium.

[0146] Those skilled in the art will appreciate that embodiments of the present application can be supplied as a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer readable storage media (including, but not limited to, magnetic disks or optical storage) embodying computer readable program code, for example.

[0147] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks

[0148] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks

[0149] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks

[0150] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.

Claims

1. An information recording method, characterized in that, The method includes: During the device's kernel assembly startup phase, the logic code in the assembly file used to store the target value into the target register is executed; When the logic code in the assembly file that stores the target value in the target register is executed, the target function that was set in advance in the kernel file to modify the target node that was added in advance in the device tree is called, and the target value stored in the target register is used as the input parameter of the target function. By executing the target function, the target value stored in the target register is recorded into the target node that has been added to the device tree beforehand.

2. The method according to claim 1, characterized in that, The method further includes: When the device finishes booting up, the target value is obtained by accessing a preset directory in the device's operating system; wherein, the preset directory is a directory used to record information about the device tree.

3. The method according to claim 2, characterized in that, The target value is the value in the file of the target node under the preset directory; Obtaining the target value includes: The values ​​in the target node's file are read using the hexdump command of the device's operating system.

4. The method according to claim 1, characterized in that, During the device's kernel assembly startup phase, the logic code in the assembly file used to store the target value into the target register is executed, including: Start and execute the device's bootloader; The execution jumps to the start function in the kernel head.S file of the device to begin executing assembly code, which includes the logic code for storing the target value into the target register.

5. The method according to claim 1, characterized in that, The BL instruction in the assembly instructions calls the target function that was set in advance in the kernel file to modify the target node that was added in advance in the device tree.

6. The method according to claim 1, characterized in that, At least one node is added to the device tree beforehand, and the target node is one of the newly added nodes. Each newly added node is used to record a target value.

7. The method according to claim 6, characterized in that, At least one function is pre-added to the kernel file, and the target function is one of the newly added functions; Each newly added node corresponds to a newly added function.

8. An information recording device, characterized in that, The device includes: The first unit is used to execute the logic code in the assembly file that stores the target value into the target register during the kernel assembly startup phase of the device; The second unit is used to call the target function, which is pre-set in the kernel file to modify the target node pre-added in the device tree, when the logic code in the assembly file for storing the target value in the target register is executed and the target value stored in the target register is used as the input parameter of the target function. The third unit is used to record the target value stored in the target register into the target node that has been added in the device tree beforehand by executing the target function.

9. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing the computer to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multi-hardware adaptation method based on Linux

    CN111897585A

  • Server PSU information acquisition method and device, electronic equipment and medium

    CN112631874A