Information recording method, device, equipment and medium

By recording register values ​​to the device tree during the kernel assembly startup stage, the complexity problem of obtaining register values ​​in the prior art is solved, and the troubleshooting efficiency and applicability of the kernel startup stage is improved.

CN119201264AActive Publication Date: 2024-12-27ZHEJIANG DAHUA TECH CO LTD +1
View PDF 6 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art is difficult to effectively obtain the values ​​stored in registers during the startup stage of computer kernel assembly, and requires an external emulator or a complex serial port printing design.

Method used

During the kernel assembly startup phase, the target value is stored in the target register by executing the logical code in the assembly file, and calling a pre-set function, the value in the register is recorded to the new node in the device tree.

Benefits of technology

This implements a method of simply obtaining register values ​​during the kernel startup stage, which improves the troubleshooting efficiency, and is suitable for various chip platforms due to the strong scalability of the device tree and has high portability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201264A_ABST
    Figure CN119201264A_ABST
Patent Text Reader

Abstract

The invention discloses an information recording method and device, equipment and a medium, which are used for recording values stored in a register in a newly added node in an equipment tree in a kernel assembly starting stage of the equipment. The method provided by the invention comprises the following steps: in a kernel assembly starting stage of equipment, executing a logic code used for storing a target value into a target register in an assembly file; when execution of a logic code used for storing a target value into a target register in the assembly file is completed, calling a target function which is set in a kernel file in advance and used for modifying a target node newly added in an equipment tree in advance, and storing the target value stored in the target register into the target register; the parameters serve as input parameters of the objective function; and recording the target value stored in the target register to the target node newly added in the equipment tree in advance 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 field of computer technology, and in particular to an information recording method, device, equipment and medium. Background Art

[0002] If you want to obtain the value stored in the register at a certain execution code during the startup phase of the computer kernel assembly, you need to use an external emulator, or use the serial port driver and print function. Among them, use the emulator to connect to the computer. When the emulator debugs the specified code, the host computer software on the computer will display the value stored in the register. The design of serial port printing will be more complicated. First, add the serial port peripheral driver of the corresponding chip 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 of the invention

[0003] The embodiments of the present application provide an information recording method, apparatus, device and medium, which are used to record the values ​​stored in the register in a newly added node in the device tree during the kernel assembly startup phase of the device. The implementation is simple, the scalability is strong, and it is easy to obtain the values ​​stored in the register, thereby helping to improve the efficiency of troubleshooting kernel startup problems in the assembly phase.

[0004] An information recording method provided in an embodiment of the present application includes:

[0005] During the kernel assembly startup phase of the device, the logic code in the assembly file for storing the target value into the target register is executed;

[0006] When the logic code in the assembly file for storing the target value in the target register is executed, calling the target function pre-set in the kernel file for modifying the target node pre-added in the device tree, and using the target value stored in the target register as an input parameter of the target function;

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

[0008] The embodiment of the present application uses the method to execute the logic code for storing the target value in the target register in the assembly file during the kernel assembly startup phase of the device, so that when the logic code for storing the target value in the target register in the assembly file is executed, the target function pre-set in the kernel file for modifying the target node pre-added 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, and then by executing the target function, the target value stored in the target register is recorded to the target node pre-added in the device tree, so that the value stored in the register is recorded in the newly added node in the device tree during the kernel assembly startup phase of the device. The method is simple to implement, and because the device tree is large enough, the register values ​​that can be recorded are sufficient, the expansibility is strong, and it is easy to obtain the value stored in the register, which helps to improve the troubleshooting efficiency of the kernel startup problem in the assembly phase, and has strong practicality. In addition, the method provided by the embodiment of the present application is applicable to various chip platforms, so it is highly portable.

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

[0010] 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.

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

[0012] The obtaining of the target value comprises:

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

[0014] In some embodiments, during the kernel assembly startup phase of the device, executing logic code in the assembly file for storing the target value in the target register includes:

[0015] Start executing the bootloader of the device;

[0016] Jump to execute the start function in the kernel head.S file of the device, and start executing the assembly code, wherein the assembly code includes the logic code for storing the target value in the target register.

[0017] In some embodiments, a target function pre-set in a kernel file for modifying a target node pre-added in a device tree is called through a BL instruction in an assembly instruction.

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

[0019] In some embodiments, at least one function is added to the kernel file in advance, and the target function is a function in the added function;

[0020] Among them, the newly added nodes correspond one to one with the newly added functions.

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

[0022] The first unit is used for executing logic code in the assembly file for storing the target value into the target register during the kernel assembly startup phase of the device;

[0023] The second unit is used for calling a target function pre-set in the kernel file for modifying a target node pre-added in the device tree when the logic code for storing the target value in the target register in the assembly file is executed, and using the target value stored in the target register as an input parameter of the target function;

[0024] The third unit is used to record the target value stored in the target register to the target node pre-added in the device tree by executing the target function.

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

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

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 A schematic diagram of the overall process of the information recording method provided in the embodiment of the present application;

[0029] Figure 2A schematic diagram of a specific process of the information recording method provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0031] Figure 4 A schematic diagram of the structure of an information recording device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0033] The embodiments of the present application provide an information recording method, apparatus, device and medium, which are used to record the values ​​stored in the register in a newly added node in the device tree during the kernel assembly startup phase of the device. The implementation is simple, the scalability is strong, and it is easy to obtain the values ​​stored in the register, thereby helping to improve the efficiency of troubleshooting kernel startup problems in the assembly phase.

[0034] Among them, the method and the device, equipment, and medium are based on the same application concept. Since the principles of solving problems by the method and the device, equipment, and medium are similar, the implementation of the device, equipment, medium, and method can refer to each other, and the repeated parts will not be repeated.

[0035] The terms "first", "second", etc. (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 are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than the content illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0036] The following examples and embodiments are to be understood as illustrative examples only. Although this specification may refer to "one", "an" or "some" examples or embodiments in several places, this does not mean that each such reference relates to the same example or embodiment, nor does it mean that the feature applies only to a single example or embodiment. Individual features of different embodiments may also be combined to provide other embodiments. In addition, terms such as "including" and "comprising" should be understood as not limiting the described embodiments to only those features that have been mentioned; such examples and embodiments may also include features, structures, units, modules, etc. that are not specifically mentioned.

[0037] The following is a detailed description of each embodiment of the present application in conjunction with the accompanying drawings. It should be noted that the display order 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, let us introduce the technical terms involved in the embodiments of this application:

[0039] Device tree: Keeps information about devices present in the system. When the machine boots, the operating system (OS) builds this tree by using information obtained from drivers and other components, and updates this tree when devices are added or removed. Each node of the device tree is a device node (devnode).

[0040] The boot program of the device's operating system: includes the following three assembly programs: bootsect.S, setup.S and head.s.

[0041] Kernel assembly startup phase: The kernel startup of the device does not start directly from the C function (start_kernel). Before this function, a section of code written in assembly language must be executed. The assembly code is stored in the head.s file. Among them, the process of executing this assembly code in the head.s file is the kernel assembly startup phase. In the kernel assembly startup phase, the embodiment of the present application pre-sets a function for modifying the device tree node. Therefore, the value of the node in the device tree can be modified as needed, thereby realizing the recording of the value stored in the chip register to the newly added node in the device tree in the kernel assembly startup phase.

[0042] Embodiment 1:

[0043] See also Figure 1 , an information recording method provided by an embodiment of the present application includes:

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

[0045] The assembly file, for example, the head.S file.

[0046] The target value is, for example, the kernel image relocation end address.

[0047] The target register is, for example, the R9 register inside the Advanced RISC Machine (ARM) platform.

[0048] S102, when the logic code in the assembly file for storing the target value in the target register is executed, calling the target function pre-set in the kernel file for modifying the target node pre-added in the device tree, and using the target value stored in the target register as an input parameter of the target function;

[0049] The kernel file, for example, atags_to_fdt.c file.

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

[0051] Accordingly, the target function set in the kernel file for modifying the target node pre-added in the device tree is named, for example, the recordRellocAddr function.

[0052] S103 . Record the target value stored in the target register to the target node pre-added in the device tree by executing the target function.

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

[0054] 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.

[0055] The preset directory, for example, is the / 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] The value in the file of the target node is read by using the hexdump command of the operating system of the device.

[0059] In some embodiments, during the kernel assembly startup phase of the device, executing logic code in the assembly file for storing the target value in the target register includes:

[0060] Start executing the bootloader of the device;

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

[0062] In some embodiments, a target function pre-set in a kernel file for modifying a target node pre-added in a device tree is called through a BL instruction in an assembly instruction.

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

[0064] In some embodiments, at least one node is added in advance to the device tree, 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 added to the kernel file in advance, and the target function is a function in the added function;

[0066] Among them, the newly added nodes correspond one to one with the newly added functions.

[0067] That is, in some embodiments, the newly added nodes in the device tree correspond to the target values ​​that need to be recorded. For example, if there are three target values ​​that need to be recorded, three nodes can be added to the device tree, and each node is used to record a target value. For example, one newly added node is used to record the kernel image relocation end address, another newly added node is used to record the kernel image relocation beginning address, and the third newly added node can be used to record other values ​​that need to be recorded, and so on.

[0068] In summary, the method provided by the embodiment of the present application involves few modules, and only requires adding nodes to the device tree as needed and modifying the node content in the assembly stage, which is easy to implement. The kernel supports the device tree mechanism, so the method provided by the embodiment of the present application is simple to implement.

[0069] Embodiment 2:

[0070] This embodiment is described by taking the example of establishing a new node in the device tree for recording the kernel image relocation end address.

[0071] This embodiment provides a specific process for recording the value stored in the register during the kernel assembly startup phase, such as Figure 2 As shown, including:

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

[0073] The newly added node is used to write the value of the R9 register, that is, to record the kernel image relocation end address.

[0074] The kernel image relocation is to move the kernel image to the correct location in the memory for execution; then, the terminal address is the tail address of the memory interval where the kernel image is stored after the movement is completed.

[0075] On an Advanced RISC Machine (ARM) platform, the kernel image relocation end address will eventually be stored in the R9 register inside the ARM platform. Therefore, in this embodiment, it is necessary to record the value stored in the R9 register in the newly added node in the device number.

[0076] The newly added node in the device tree of this embodiment is used to record the kernel image relocation end address, so the newly added node can be named rellocAddr.

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

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

[0079] The kernel file is used to add or modify nodes in the device tree. In the embodiment of the present application, after adding a node in the device tree, the newly added node has a default value. In this embodiment, by adding a function in the kernel file, the value stored in the R9 register is written into the newly added node, which is equivalent to modifying the value of the newly added node, that is, replacing the default value of the newly added node with the value stored in the R9 register.

[0080] In this embodiment, the newly added function may be named: recordRellocAddr.

[0081] The input parameter of the newly added function recordRellocAddr is the value stored in the R9 register;

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

[0083] It should be noted that the above steps S201 and S202 can be executed simultaneously or one after another, and the specific order is not limited.

[0084] S203, start executing the bootloader, and then jump to execute the kernel code. During the running of the kernel code, call the newly added function recordRellocAddr to store the value stored in the R9 register to the newly added node rellocAddr in the device tree;

[0085] The operation of the bootloader can complete the kernel image loading of the computer device and jump to execute the kernel code. The kernel code will use the start function in the head.S file as the startup 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 newly added function recordRellocAddr is called through the assembly command (linked program jump command, i.e. BL instruction), and the value stored in the R9 register is stored in the newly added node rellocAddr in the device tree.

[0086] The target assembly code may execute the following logic: store the kernel image relocation end address in the R9 register. After the logic is executed, the BL instruction in the assembly instruction is called to jump to execute the newly added function recordRellocAddr, thereby recording the value stored in the R9 register in the newly added node rellocAddr.

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

[0088] In the operating system, for example, a directory " / 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, and the device tree file system presents the content of the device tree in the form of virtual files. Users can obtain the information of the device tree by accessing these virtual files. Therefore, in this embodiment, the newly added node file can be found in the preset directory.

[0089] Therefore, when the computer device is started, this embodiment uses the hexdump command of the operating system (a command for accessing files in the / proc / device-tree directory) to find the newly added node rellocAddr file and read the value recorded therein, thereby obtaining the value stored in the R9 register. The hexdump command displays the file content in hexadecimal form and supports multiple output formats and parameter options.

[0090] The following is an introduction to the equipment or device provided in the embodiments of the present application, in which the explanations or examples of technical features that are the same or corresponding to those described in the above method will not be repeated later.

[0091] An electronic device provided in an embodiment of the present application, see Figure 3 , for example:

[0092] The processor 600 is used to read the program in the memory 620 and execute the following process:

[0093] During the kernel assembly startup phase of the device, the logic code in the assembly file for storing the target value into the target register is executed;

[0094] When the logic code in the assembly file for storing the target value in the target register is executed, calling the target function pre-set in the kernel file for modifying the target node pre-added in the device tree, and using the target value stored in the target register as an input parameter of the target function;

[0095] By executing the target function, the target value stored in the target register is recorded in the target node pre-added in the device tree.

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

[0097] 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.

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

[0099] The obtaining of the target value comprises:

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

[0101] In some embodiments, during the kernel assembly startup phase of the device, executing logic code in the assembly file for storing the target value in the target register includes:

[0102] Start executing the bootloader of the device;

[0103] Jump to execute the start function in the kernel head.S file of the device, and start executing the assembly code, wherein the assembly code includes the logic code for storing the target value in the target register.

[0104] In some embodiments, a target function pre-set in a kernel file for modifying a target node pre-added in a device tree is called through a BL instruction in an assembly instruction.

[0105] In some embodiments, at least one node is added in advance to the device tree, 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 added to the kernel file in advance, and the target function is a function in the added function;

[0107] Among them, the newly added nodes correspond one to one with the newly added functions.

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

[0109] Among them, Figure 3 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 600 and various circuits of memory represented by memory 620 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 610 may be a plurality of components, namely, 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, and other transmission media. For different user devices, the user interface 630 may also be an interface capable of externally and internally connecting required devices, and the connected devices include but are not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.

[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 when performing operations.

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

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

[0113] It should be noted here that the above-mentioned device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.

[0114] See also Figure 4 , an information recording device provided by an embodiment of the present application includes:

[0115] The first unit 11 is used to execute the logic code in the assembly file for storing the target value in the target register during the kernel assembly startup phase of the device;

[0116] The second unit 12 is used for calling a target function pre-set in the kernel file for modifying a target node pre-added in the device tree when the logic code for storing the target value in the target register in the assembly file is executed, and using the target value stored in the target register as an input parameter of the target function;

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

[0118] In some embodiments, the information recording device further includes an access unit for:

[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 of the target value comprises:

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

[0123] In some embodiments, during the kernel assembly startup phase of the device, executing logic code in the assembly file for storing the target value in the target register includes:

[0124] Start executing the bootloader of the device;

[0125] Jump to execute the start function in the kernel head.S file of the device, and start executing the assembly code, wherein the assembly code includes the logic code for storing the target value in the target register.

[0126] In some embodiments, a target function pre-set in a kernel file for modifying a target node pre-added in a device tree is called through a BL instruction in an assembly instruction.

[0127] In some embodiments, at least one node is added in advance to the device tree, 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 added to the kernel file in advance, and the target function is a function in the added function;

[0129] Among them, the newly added nodes correspond one to one with the newly added functions.

[0130] It should be noted that the division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0131] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

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

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

[0134] The processor calls the program instructions stored in the memory, and 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 present application embodiment also provides a computer program product or computer program, which includes a computer instruction, which is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction so that the computer device executes any of the methods described in the above embodiments. The program product can use 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 can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0136] The embodiment of the present application provides a computer-readable storage medium for storing computer program instructions used by the apparatus provided in the embodiment of the present application, which includes a program for executing any of the methods provided in the embodiment of the present application. The computer-readable storage medium may 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 magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.

[0138] It should be understood that:

[0139] The access technology through which entities in the communication network transmit traffic 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.; in addition, the embodiments can also apply wired technology, for example, IP-based access technology, such as a wired network or a fixed line.

[0140] Embodiments suitable for being implemented as software code or a portion thereof and running using a processor or processing functionality are independent of the software code and may 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 machine language or assembler.

[0141] The implementation of the embodiments is hardware independent and may be implemented using any known or future developed hardware technology or any mixture thereof, such as a microprocessor or CPU (central processing unit), 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 may be implemented as separate devices, apparatuses, units, components, or functions, or in a distributed manner, for example, one or more processors or processing functions may be used or shared in a process, or one or more processing segments or processing portions may be used and shared in a process, wherein one physical processor or more than one physical processor may be used to implement one or more processing portions dedicated to a specific process as described.

[0143] The device may be implemented by a semiconductor chip, a chipset, or a (hardware) module including such a chip or chipset.

[0144] The embodiments may 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] The embodiments may also be implemented as a computer program product including a computer usable medium having computer readable program code embodied therein, the computer readable program code being adapted to perform the processes as described in the embodiments, wherein the computer usable medium may be a non-transitory medium.

[0146] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0147] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0148] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0149] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0150] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. An information recording method, characterized in that: The method comprises: During the kernel assembly startup phase of the device, the logic code in the assembly file for storing the target value into the target register is executed; When the logic code in the assembly file for storing the target value in the target register is executed, calling the target function pre-set in the kernel file for modifying the target node pre-added in the device tree, and using the target value stored in the target register as an input parameter of the target function; By executing the target function, the target value stored in the target register is recorded in the target node pre-added in the device tree.

2. The method according to claim 1, characterized in that The method further comprises: 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.

3. The method according to claim 2, characterized in that The target value is a value in a file of the target node in the preset directory; The obtaining of the target value comprises: The value in the file of the target node is read by using the hexdump command of the operating system of the device.

4. The method according to claim 1, characterized in that: During the kernel assembly startup phase of the device, the logic code in the assembly file for storing the target value in the target register is executed, including: Start executing the bootloader of the device; Jump to execute the start function in the kernel head.S file of the device, and start executing the assembly code, wherein the assembly code includes the logic code for storing the target value in the target register.

5. The method according to claim 1, characterized in that: The target function pre-set in the kernel file for modifying the target node pre-added in the device tree is called through the BL instruction in the assembly instruction.

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

7. The method according to claim 6, characterized in that At least one function is added in advance to the kernel file, and the target function is one of the newly added functions; Among them, the newly added nodes correspond one to one with the newly added functions.

8. An information recording device, characterized in that: The device comprises: The first unit is used for executing logic code in the assembly file for storing the target value into the target register during the kernel assembly startup phase of the device; The second unit is used for calling a target function pre-set in the kernel file for modifying a target node pre-added in the device tree when the logic code for storing the target value in the target register in the assembly file is executed, and using the target value stored in the target register as an input parameter of the target function; The third unit is used to record the target value stored in the target register to the target node pre-added in the device tree by executing the target function.

9. An electronic device, characterized in that: include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 7 according to the obtained program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable the computer to execute 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

  • Equipment tree configuration optimization method and device, computer equipment and storage medium

    CN113504918A

  • Kernel crash log storage method and device, medium and electronic equipment

    CN116150111A

  • Method for debugging Linux kernel

    CN116361195A