CN114647420A - File processing method and equipment - Google Patents

File processing method and equipment Download PDF

Info

Publication number
CN114647420A
CN114647420A CN202011508662.1A CN202011508662A CN114647420A CN 114647420 A CN114647420 A CN 114647420A CN 202011508662 A CN202011508662 A CN 202011508662A CN 114647420 A CN114647420 A CN 114647420A
Authority
CN
China
Prior art keywords
file
dtb
target
configuration file
files
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011508662.1A
Other languages
Chinese (zh)
Inventor
刘立超
袁俊卿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN202011508662.1A priority Critical patent/CN114647420A/en
Publication of CN114647420A publication Critical patent/CN114647420A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a file processing method and equipment, wherein the method comprises the following steps: acquiring a firmware configuration file and a plurality of DTB files; generating a configuration file to be programmed, which contains the firmware configuration file and a plurality of DTB files; and programming the configuration file to be programmed to a second device, so that the second device is started according to the firmware configuration file after being powered on, determining a target DTB file from the DTB files according to the acquired mainboard identification information, executing corresponding initialization operation according to the target DTB file, determining the DTB file required by the second device according to the model of the mainboard of the second device when the configuration file to be programmed is not generated, and generating the configuration file to be programmed according to the DTB file required by the second device, thereby avoiding the problems of low generation efficiency and low programming efficiency of the existing configuration file.

Description

File processing method and equipment
Technical Field
The embodiment of the invention relates to the technical field of computer communication, in particular to a file processing method and file processing equipment.
Background
The firmware is open source code software which has the functions of a Basic Input Output System (BIOS) and a boot loader (BootLoader). In order to enable a computer to start a firmware and initialize hardware on the device by using the firmware after powering on, a firmware configuration file and a DTB (device tree blob) file corresponding to a motherboard model of the computer need to be obtained in advance, the firmware configuration file and the DTB (device tree blob) file are packaged to generate a configuration file to be programmed, and the configuration file to be programmed is programmed into a Read-Only Memory (ROM) of the computer. And after the firmware is successfully started, sending the DTB file to a system kernel of the computer so that the system kernel initializes hardware on the mainboard according to the DTB file.
However, when generating a configuration file to be programmed, a relevant person needs to determine a motherboard model of a computer first, then can determine a DTB file required by the computer according to the motherboard model, and generate the configuration file to be programmed according to the DTB file, when the number of computers requiring the configuration file to be programmed is large, the motherboard model of each computer needs to be determined in sequence, then can determine the DTB file required by each computer according to the motherboard model of each computer, generate the corresponding configuration file to be programmed, and cause low generation efficiency of the configuration file, thereby causing low programming efficiency of the configuration file.
Disclosure of Invention
The embodiment of the invention provides a file processing method and device, and aims to solve the problems of low generation efficiency and low programming efficiency of configuration files in the prior art.
In a first aspect, an embodiment of the present invention provides a file processing method, which is applied to a first device, and the method includes:
acquiring a firmware configuration file and a plurality of DTB files;
generating a configuration file to be programmed, which contains the firmware configuration file and a plurality of DTB files;
and programming the configuration file to be programmed to second equipment so as to start the second equipment according to the firmware configuration file after the second equipment is powered on, determining a target DTB file from the plurality of DTB files according to the acquired mainboard identification information, and executing corresponding initialization operation according to the target DTB file.
In one possible design, the generating a configuration file to be programmed that includes the firmware configuration file and a plurality of DTB files includes:
if the header information of any DTB file in the DTB files does not contain the file description information corresponding to the DTB file, acquiring the file description information corresponding to the DTB file, and adding the file description information to the header information of the DTB file; wherein the file description information includes an access address of the arbitrary DTB file;
and packaging the firmware configuration file and a plurality of DTB files comprising file description information based on a preset packaging script to obtain the configuration file to be programmed.
In a second aspect, an embodiment of the present invention provides a file processing method, which is applied to a second device, and the method includes:
after the power-on is determined, acquiring a firmware configuration file in a configuration file to be programmed, and performing starting processing according to the firmware configuration file;
acquiring mainboard identification information, and determining a target DTB file corresponding to the mainboard identification information from a plurality of DTB files in the configuration file to be programmed according to the mainboard identification information;
and executing corresponding initialization operation according to the target DTB file.
In a possible design, if the motherboard identification information includes a target motherboard model, determining, according to the motherboard identification information, a target DTB file corresponding to the motherboard identification information from a plurality of DTB files in the configuration file to be programmed, includes:
judging whether a file management information table exists or not; the file management information table comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file;
when the file management information table is determined to exist, acquiring an access address corresponding to a DTB file corresponding to a mainboard model which is the same as the target mainboard model from the file management information table to determine the corresponding access address as a target access address;
and determining a DTB file corresponding to the target access address from a plurality of DTB files in the configuration file to be programmed, so as to determine that the corresponding DTB file is the target DTB file.
In one possible design, the method further includes:
when the file management information table is determined not to exist, sequentially reading the header information of each DTB file in the plurality of DTB files, wherein the header information comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file;
determining a DTB file corresponding to the mainboard model which is the same as the target mainboard model, and determining an access address in the header information of the corresponding DTB file as a target access address;
and determining a DTB file corresponding to the target access address from a plurality of DTB files in the configuration file to be programmed, so as to determine that the corresponding DTB file is the target DTB file.
In one possible design, the method further includes:
and if the mainboard model identical to the target mainboard model does not exist in the file management information table, outputting alarm information.
In a third aspect, an embodiment of the present invention provides a file processing apparatus, which is applied to a first apparatus, and includes:
the first file acquisition module is used for acquiring a firmware configuration file and a plurality of DTB files;
the first processing module is used for generating a configuration file to be programmed, which contains the firmware configuration file and a plurality of DTB files;
the first processing module is further configured to write the configuration file to be written to a second device, so that the second device is started according to the firmware configuration file after being powered on, and determine a target DTB file from the plurality of DTB files according to the acquired motherboard identification information, so as to execute a corresponding initialization operation according to the target DTB file.
In one possible design, the first processing module is further configured to:
if the header information of any DTB file in the DTB files does not contain the file description information corresponding to the DTB file, acquiring the file description information corresponding to the DTB file, and adding the file description information to the header information of the DTB file; wherein the file description information includes an access address of the arbitrary DTB file;
and packaging the firmware configuration file and a plurality of DTB files comprising file description information based on a preset packaging script to obtain the configuration file to be programmed.
In a fourth aspect, an embodiment of the present invention provides a file processing apparatus, which is applied to a second apparatus, and includes:
the second file acquisition module is used for acquiring a firmware configuration file in the configuration file to be programmed after the power-on is determined, and carrying out starting processing according to the firmware configuration file;
the second processing module is used for acquiring mainboard identification information and determining a target DTB file corresponding to the mainboard identification information from a plurality of DTB files in the configuration file to be programmed according to the mainboard identification information;
and the second processing module is further configured to execute a corresponding initialization operation according to the target DTB file.
In a possible design, if the motherboard identification information includes a target motherboard model, the second processing module is further configured to determine whether a file management information table exists; the file management information table comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file;
the second processing module is further configured to, when it is determined that the file management information table exists, obtain, from the file management information table, an access address corresponding to a DTB file corresponding to a motherboard model that is the same as the target motherboard model, so as to determine the corresponding access address as a target access address;
the second processing module is further configured to determine, from the multiple DTB files in the configuration file to be programmed, a DTB file corresponding to the target access address, so as to determine that the corresponding DTB file is the target DTB file.
In a possible design, the second processing module is further configured to, when it is determined that the file management information table does not exist, sequentially read header information of each DTB file in the plurality of DTB files, where the header information includes a motherboard model corresponding to the DTB file and an access address corresponding to the DTB file;
the second processing module is further configured to determine a DTB file corresponding to a motherboard model that is the same as the target motherboard model, and determine an access address in header information of the corresponding DTB file as a target access address;
the second processing module is further configured to determine, from the multiple DTB files in the configuration file to be programmed, a DTB file corresponding to the target access address, so as to determine that the corresponding DTB file is the target DTB file.
In a possible design, the second processing module is further configured to output alarm information if the file management information table does not have a motherboard model that is the same as the target motherboard model.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including: at least one processor and a memory.
The memory stores computer-executable instructions.
The at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the file processing method of any of the first aspects.
In a sixth aspect, an embodiment of the present invention provides an electronic device, including: at least one processor and a memory.
The memory stores computer-executable instructions.
The at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the file processing method of any of the second aspects.
In a seventh aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer executing instruction is stored in the computer-readable storage medium, and when a processor executes the computer executing instruction, the file processing method according to any one of the first aspect is implemented.
In an eighth aspect, the embodiment of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the file processing method according to any one of the second aspects is implemented.
According to the file processing method and the file processing equipment provided by the embodiment of the invention, the firmware configuration file and the DTB files are obtained; generating a configuration file to be programmed, which contains the firmware configuration file and a plurality of DTB files; and programming the configuration file to be programmed to second equipment so as to start the second equipment according to the firmware configuration file after the second equipment is powered on, determining a target DTB file from the plurality of DTB files according to the acquired mainboard identification information, and executing corresponding initialization operation according to the target DTB file. The method and the device directly generate the configuration file to be programmed, which comprises the acquired firmware configuration file and the plurality of DTB files, and then write the configuration file to be programmed to the second device, so that the second device determines the target DTB file from the plurality of DTB files in the configuration file to be programmed after being powered on, namely determines the required DTB file.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of a document processing system according to an embodiment of the present invention;
FIG. 2 is a first flowchart of a file processing method according to an embodiment of the present invention;
FIG. 3 is a flowchart II of a file processing method according to an embodiment of the present invention;
fig. 4 is a flowchart of a file processing method according to an embodiment of the present invention;
FIG. 5 is a fourth flowchart of a file processing method according to an embodiment of the present invention;
FIG. 6 is a first schematic structural diagram of a document processing apparatus according to an embodiment of the present invention;
FIG. 7 is a second schematic structural diagram of a document processing apparatus according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the prior art, when a configuration file to be programmed is generated, a motherboard model of a computer needs to be determined first, then a DTB file required by the computer can be determined according to the motherboard model, and the configuration file to be programmed is generated according to the DTB file.
Therefore, in order to solve the above problems, the technical idea of the present invention is that a first device generates a configuration file to be written to a second device, the configuration file to be written to the second device includes a PMON configuration file and a plurality of DTB files, each DTB file in the plurality of DTB files is applicable to a motherboard of a type, the configuration file to be written to the second device is written to the second device, so that the second device obtains a required target DTB file from the configuration file to be written to the second device according to the motherboard type of the second device, that is, when the configuration file to be written to the second device is not required to be generated, the motherboard type of the second device is determined, and then the corresponding DTB file of the second device is determined according to the motherboard type, so that when the number of the second devices to be written to the PMON configuration file is large, the DTB file corresponding to each second device is not required to be determined one by one-to-one according to the motherboard type of each second device, and then the configuration file corresponding to each second device is generated, the generating efficiency of the configuration file is improved, and therefore the programming efficiency of the configuration file is improved.
The following describes the technical solutions of the present disclosure and how to solve the above technical problems in detail by specific examples. Several of these specific examples may be combined with each other below, and some of the same or similar concepts or processes may not be repeated in some examples. Examples of the present disclosure will now be described with reference to the accompanying drawings.
Fig. 1 is a schematic architecture diagram of a file processing system according to an embodiment of the present invention, and as shown in fig. 1, the system includes a first device 101 and a plurality of second devices 102. The first device 101 generates a file to be configured, which contains a firmware configuration file and a DTB file, to be burned onto each second device.
The first device 101 is an electronic device with data processing capability and a programming function, or when the first device 101 does not have the programming function, an external programming device may be used to program the configuration file. The second device 102 is a terminal or server that needs to write a firmware configuration file.
Optionally, the firmware on the second device includes a PMON, and correspondingly, the firmware configuration file includes a PMON configuration file, although the firmware may also include other types of firmware, as long as after the firmware is started, the DTB file may be transferred to a system kernel of the second device, so that the system kernel knows the device topology of the motherboard, and thus the device registration driver is loaded, and correspondingly, the firmware configuration file may also include other types of firmware configuration files, where no limitation is further imposed on the firmware configuration files.
It should be noted that the number of the second devices may be any number, and the number of the second devices in fig. 1 is only an example, and the embodiment of the present invention is not limited thereto.
Fig. 2 is a first flowchart of a file processing method according to an embodiment of the present invention, where an execution subject in the method according to the embodiment may be the first device in fig. 1. As shown in fig. 2, the method of this embodiment may include:
s201, acquiring a firmware configuration file and a plurality of DTB files.
In this embodiment, when it is determined that the firmware configuration file needs to be burned onto at least one second device, the first device obtains the firmware configuration file, where the firmware configuration file is applicable to all the second devices, and obtains a plurality of DTB files, where each DTB file of the plurality of DTB files is applicable to a motherboard of one model, and thus the plurality of DTB files are applicable to motherboards of different models.
After the first device acquires the burning request sent by other devices, it is determined that the firmware configuration file needs to be burned onto the second device. Of course, the first device may also determine that the firmware configuration file needs to be burned onto the second device after acquiring other trigger behaviors, for example, after acquiring the firmware configuration file transmitted by other devices, and the user may set a corresponding trigger behavior according to the requirement, where the trigger behavior is not limited.
S202, generating a configuration file to be programmed, which comprises a firmware configuration file and a plurality of DTB files.
In this embodiment, after obtaining the firmware configuration file and the plurality of DTB files, a configuration file to be programmed is generated, where the configuration file to be programmed includes the firmware configuration file and the plurality of DTB files.
In this embodiment, when generating the configuration file to be programmed, it is not necessary to determine the DTB file required by the second device in advance according to the related information of the motherboard of the second device on which the firmware configuration file needs to be programmed, and then the configuration file to be programmed, which is suitable for the second device, is generated according to the required DTB file and the firmware configuration file, so that the generation efficiency of the configuration file to be programmed is improved.
And S203, programming the configuration file to be programmed to the second device so that the second device is started according to the firmware configuration file after being powered on, determining a target DTB file from the plurality of DTB files according to the acquired mainboard identification information, and executing corresponding initialization operation according to the target DTB file.
In this embodiment, after the configuration file to be programmed is programmed to the second device, the second device may be powered on to start according to the firmware configuration file in the configuration file to be programmed, that is, to realize the start of the firmware, and since the configuration file to be programmed includes a plurality of DTB files applicable to motherboards of different models, the second device further needs to obtain motherboard identification information, where the motherboard identification information is identification information of a motherboard on the second device, and according to the identification information, a target DTB file is determined from the plurality of DTB files, that is, a DTB file applicable to the motherboard on the second device is determined, so as to obtain the DTB file required by the second device.
After obtaining the required DTB file, the second device obtains a target DTB file, and then executes a corresponding initialization operation according to the target DTB file, for example, informing the system kernel of the device topology of the motherboard, so that the system kernel performs device registration driver loading.
After the second device is powered on, the process of starting the second device according to the firmware configuration file to start the firmware is an existing starting process, and details of the process are not described herein.
As can be seen from the above description, a firmware configuration file and a plurality of DTB files are obtained; generating a configuration file to be programmed, which contains the firmware configuration file and a plurality of DTB files; and programming the configuration file to be programmed to second equipment so as to start the second equipment according to the firmware configuration file after the second equipment is powered on, determining a target DTB file from the plurality of DTB files according to the acquired mainboard identification information, and executing corresponding initialization operation according to the target DTB file. The method and the device directly generate the configuration file to be programmed, which comprises the acquired firmware configuration file and the plurality of DTB files, and then write the configuration file to be programmed to the second device, so that the second device determines the target DTB file from the plurality of DTB files in the configuration file to be programmed after being powered on, namely determines the required DTB file.
Optionally, after the firmware configuration file and the plurality of DTB files are obtained, the firmware configuration file and the plurality of DTB files need to be packaged to obtain a configuration file to be programmed, and a process of obtaining the configuration file to be programmed is described in detail below with reference to a specific embodiment.
Fig. 3 is a second flowchart of a file processing method according to an embodiment of the present invention, and this embodiment describes in detail a specific implementation process of obtaining a configuration file to be programmed based on the embodiment of fig. 2. As shown in fig. 3, the method includes:
s301, acquiring a firmware configuration file and a plurality of DTB files.
In this embodiment, after obtaining the firmware configuration file and the plurality of DTB files, if the firmware configuration file and the plurality of DTB files are not compiled, the firmware configuration file and each DTB file in the plurality of DTB files need to be compiled to obtain a corresponding binary file.
S302, if the header information of any DTB file in the DTB files does not contain the file description information corresponding to the DTB file, the file description information corresponding to any DTB file is obtained and added to the header information of any DTB file, wherein the file description information comprises an access address of any DTB file.
In this embodiment, for each DTB file, it is determined whether file description information exists in the header information of the DTB file, and if not, file description information corresponding to the DTB file is acquired and added to the header information of the DTB file. If the DTB file exists, the file description information exists in the header information of the DTB file, and repeated acquisition is not needed.
Optionally, when the file description information corresponding to the DTB file is obtained, the file description information may be obtained from a specified location (e.g., a hard disk, a database, etc.).
The file description information includes a mainboard model corresponding to the corresponding DTB file, i.e., a model of a mainboard to which the DTB file is applicable, an offset address corresponding to the DTB file, i.e., an access address, and a serial number of the DTB file, where the serial number indicates that the DTB file is the fourth file of the plurality of DTB files, and the total number of the DTB files included in the plurality of DTB files. The format of the file description information is as follows:
Figure BDA0002845678110000101
where num is the total number of the DTB files, no indicates that the currently described DTB file is the first file of the multiple DTB files, board _ name is the main board model corresponding to the currently described DTB file, DTB _ data _ offset is the offset address corresponding to the currently described DTB file, the offset address is a file offset address, which is the address of the currently described DTB file in the configuration file to be programmed, and the corresponding DTB file can be found according to the offset address, that is, the access address.
In addition, optionally, when determining whether the header information of each DTB file has the file description information, the determination may be performed based on a preset packaging script, that is, a determination logic of the file description information is defined in the preset packaging script.
S303, packaging the firmware configuration file and the DTB files comprising the file description information based on a preset packaging script to obtain a configuration file to be programmed.
In this embodiment, when the firmware configuration file and the DTB file are burned onto the second device, in order to increase the burning speed, the firmware configuration file and the DTB file need to be packaged, and then a preset packaging script is used to package the firmware configuration file and the DTB files including the file description information, so as to achieve automatic packaging of the files.
In addition, the DTB file is attached to the rear of the firmware profile when packaging is performed, thereby facilitating the second device to read the firmware profile.
The packaging script used for packaging the file may be an existing packaging script, or a packaging script written by a relevant person according to actual requirements, and is not limited herein.
S304, the configuration file to be programmed is programmed to the second device, so that the second device is started according to the firmware configuration file after being powered on, and a target DTB file is determined from the plurality of DTB files according to the acquired mainboard identification information, so that corresponding initialization operation is executed according to the target DTB file.
In this embodiment, the specific implementation of S304 is similar to S203 in the above embodiment, and is not described here again.
In this embodiment, when a configuration file is generated, whether file description information exists in header information of each DTB file is respectively determined, and if no file description information exists in the header information of any DTB file, the file description information corresponding to the any DTB file is added to the header information of the any DTB file, so that the header information of each DTB file includes the file description information, and thus, when a second device acquires a required DTB file, the second device can determine according to the file description, and the DTB file can be accurately determined.
In this embodiment, the firmware configuration file and the DTB files are packaged by using the preset packaging script, so that the files are automatically packaged, and the packaged configuration file is programmed on the second device, which can improve the programming speed of the configuration file.
Fig. 4 is a flowchart of a file processing method according to an embodiment of the present invention, where an execution main body in the method according to the embodiment may be the second device in fig. 1. As shown in fig. 4, the method of this embodiment may include:
s401, after the power-on is determined, acquiring a firmware configuration file in the configuration file to be programmed, and performing starting processing according to the firmware configuration file.
In this embodiment, after the second device is powered on, the second device reads a firmware configuration file in the configuration file to be programmed, and performs a start-up process according to the firmware configuration file to start up the firmware.
S402, obtaining mainboard identification information, and determining a target DTB file corresponding to the mainboard identification information from a plurality of DTB files in the configuration file to be programmed according to the mainboard identification information.
In this embodiment, motherboard identification information is obtained, where the motherboard identification information is motherboard identification information corresponding to a motherboard on the second device, and a target DTB file corresponding to the motherboard identification information is determined from a plurality of DTB files in a configuration file to be programmed, where the target DTB file is a DTB file applicable to the motherboard on the second device, that is, a DTB file required by the second device is determined.
Optionally, the motherboard identification information includes a target motherboard model or other identifiers capable of uniquely identifying the motherboard on the second device, for example, a name of the motherboard. The target motherboard model is a model of a motherboard on the second device.
And S403, executing corresponding initialization operation according to the target DTB file.
In this embodiment, after determining the target DTB file, the second device executes a corresponding initialization operation according to the target DTB file, for example, register, drive and load the device according to the device topology of the motherboard described in the target DTB file, that is, the device existing on the motherboard.
Specifically, after the firmware on the second device is started, the target DTB file is transferred to the system kernel of the second device, so that the system kernel knows the device topology of the motherboard, and thus device registration driver loading is performed.
In this embodiment, after the second device is powered on, according to the corresponding motherboard identification information, a target DTB file corresponding to the motherboard identification information is determined from a plurality of DTB files in the configuration file to be programmed, that is, a DTB file required by the second device itself is determined, so that automatic determination of the DTB file is realized, and relevant initialization operations are performed according to the DTB file.
Specifically, when the motherboard identification information includes the target motherboard model, the second device may determine the target DTB file from the multiple DTB files according to the target motherboard model, and the process of determining the target DTB file from the multiple DTB files by the second device according to the target motherboard model is described in detail below with reference to a specific embodiment.
Fig. 5 is a fourth flowchart of a file processing method according to an embodiment of the present invention, and this embodiment describes, in detail, a specific implementation process of a process in which a second device determines a target DTB file from multiple DTB files according to a model of a target motherboard on the basis of the embodiment of fig. 4. As shown in fig. 5, the method includes:
s501, after the power-on is determined, acquiring a firmware configuration file in the configuration file to be programmed, and performing starting processing according to the firmware configuration file.
In this embodiment, the specific implementation of S501 is similar to S401 in the above embodiment, and is not described here again.
S502, obtaining mainboard identification information, wherein the mainboard identification information comprises a target mainboard model.
S503, judging whether a file management information table exists. The file management information table comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file.
In this embodiment, the second device determines whether a file management information table exists, that is, whether the file management information table exists is searched, where the file management information table includes a motherboard model corresponding to each DTB file in the plurality of DTB files and an access address corresponding to each DTB file.
S504, when the file management information table is determined to exist, the access address corresponding to the DTB file corresponding to the mainboard model identical to the target mainboard model is obtained from the file management information table, and the corresponding access address is determined to serve as the target access address.
In this embodiment, when the second device finds the file management information table, that is, when it is determined that the file management information table exists, it is determined whether a motherboard model identical to the target motherboard model exists in the file management information table, and if the file management information table exists, it indicates that a DTB file required by the second device exists in the written multiple DTB files, an access address corresponding to the DTB file corresponding to the motherboard model identical to the target motherboard model is obtained from the multiple DTB files, and the access address is used as a target access address, and the DTB file corresponding to the motherboard model identical to the target motherboard model, that is, the DTB file suitable for the target motherboard model, can be accessed through the target access address.
And if the mainboard model identical to the target mainboard model does not exist in the file management information table, the fact that the DTB files required by the second equipment do not exist in the plurality of the programmed DTB files is indicated, alarm information is output, so that related personnel can search the DTB files required by the second equipment and write the DTB files to the second equipment.
Optionally, if the file management information table does not have a motherboard model that is the same as the target motherboard model, it is indicated that the plurality of written DTB files do not have a DTB file required by the second device, the header information of each DTB file in the plurality of DTB files may also be sequentially read, so as to determine whether a DTB file required by the second device exists according to the header information of the DTB file, and if not, the alarm information is output.
The process of sequentially reading the header information of each of the plurality of DTB files to determine whether the DTB file required by the second device exists according to the header information of the DTB file is similar to the process of determining whether the DTB file required by the second device exists according to the header information of the DTB file in the following steps S506 to S507, and a description thereof will not be given first.
S505, determining a DTB file corresponding to the target access address from a plurality of DTB files in the configuration file to be programmed, and determining the corresponding DTB file as the target DTB file.
In this embodiment, a DTB file corresponding to the target access address is obtained from a plurality of DTB files, and the DTB file is used as a target DTB file, where the target DTB file is a DTB file applicable to a motherboard on the second device.
S506, when the file management information table does not exist, sequentially reading the head information of each DTB file in the plurality of DTB files, wherein the head information comprises the mainboard model corresponding to the DTB file and the access address corresponding to the DTB file.
In this embodiment, when the file management information table is not found, when it is determined that the file management information table does not exist, the header information of each DTB file in the plurality of DTB files needs to be sequentially read, where the header information includes a motherboard model corresponding to the DTB file and an access address corresponding to the DTB file.
S507, determining a DTB file corresponding to the mainboard model which is the same as the target mainboard model, and determining an access address in the head information of the corresponding DTB file as a target access address.
In this embodiment, in the process of reading the header information of the DTB file, if the motherboard model in the header information of the DTB file is the same as the target motherboard model, it is determined that the DTB file is the target DTB file, that is, the DTB file is the DTB file required by the second device, and the access address in the header information of the DTB file is used as the target access address.
In addition, after the main board model in the header information of a certain DTB file is determined to be the same as the target main board model, the header information of other DTB files does not need to be read, and the reading of the header information of other DTB files is stopped.
In this embodiment, the header information of each of the plurality of DTB files is sequentially read, and it is determined whether a target DTB file exists in the plurality of DTB files according to the header information of the DTB file, so as to implement preparation determination of the DTB file.
S508, determining a DTB file corresponding to the target access address from a plurality of DTB files in the configuration file to be programmed, and determining the corresponding DTB file as a target DTB file.
In this embodiment, a DTB file corresponding to the target access address is obtained from a plurality of DTB files, and the DTB file is used as a target DTB file, where the target DTB file is a DTB file applicable to a motherboard on the second device.
In addition, in the process of reading the header information of each of the plurality of DTB files, a file information management table may be generated according to the read header information, so that the target DTB file may be determined directly according to the file information management table in the following.
And S509, executing corresponding initialization operation according to the target DTB file.
In this embodiment, the specific implementation manner of S509 is similar to that of S403 in the foregoing embodiment, and is not described here again.
In this embodiment, when searching for a target DTB file from a plurality of DTB files in a configuration file to be programmed according to a target motherboard model, it is first determined whether a file management information table exists, if so, the target DTB file may be directly searched according to information in the file management information table, so as to improve the efficiency of obtaining the DTB file, and if not, the header information of each DTB file in the plurality of DTB files is sequentially read to search for the target DTB file, so as to achieve obtaining of the DTB file required by the second device, and improve the success rate of searching for the target DTB file.
Fig. 6 is a first schematic structural diagram of a file processing device according to an embodiment of the present invention, where the file processing device is applied to a first device, as shown in fig. 6, the file processing device 600 may include: a first file acquisition module 601 and a first processing module 602.
The first file obtaining module 601 is configured to obtain a firmware configuration file and a plurality of DTB files.
The first processing module 602 is configured to generate a configuration file to be written, where the configuration file includes a firmware configuration file and a plurality of DTB files.
The first processing module 602 is further configured to write the configuration file to be written to the second device, so that the second device is started according to the firmware configuration file after being powered on, and determine a target DTB file from the multiple DTB files according to the acquired motherboard identification information, so as to execute a corresponding initialization operation according to the target DTB file.
In one possible design, the first processing module 602 is further configured to:
if the header information of any DTB file in the DTB files does not contain the file description information corresponding to the DTB file, the file description information corresponding to any DTB file is obtained and added to the header information of any DTB file. Wherein, the file description information includes an access address of any DTB file.
And packaging the firmware configuration file and the DTB files comprising the file description information based on a preset packaging script to obtain the configuration file to be programmed.
The file processing device provided in the embodiment of the present invention may implement the file processing method in the embodiment of fig. 2 or fig. 3, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of a second document processing device according to an embodiment of the present invention, where the document processing device is applied to a second device, as shown in fig. 7, a document processing device 700 may include: a second file acquisition module 701 and a second processing module 702.
The second file obtaining module 701 is configured to obtain a firmware configuration file in the configuration file to be programmed after determining power-on, and perform start-up processing according to the firmware configuration file.
The second processing module 702 is configured to obtain motherboard identification information, and determine, according to the motherboard identification information, a target DTB file corresponding to the motherboard identification information from a plurality of DTB files in the configuration file to be programmed.
The second processing module 702 is further configured to execute a corresponding initialization operation according to the target DTB file.
In a possible design, if the motherboard identification information includes the target motherboard model, the second processing module 702 is further configured to determine whether a file management information table exists. The file management information table comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file.
The second processing module 702 is further configured to, when it is determined that the file management information table exists, obtain, from the file management information table, an access address corresponding to a DTB file corresponding to a motherboard model that is the same as the target motherboard model, so as to determine that the corresponding access address is used as the target access address.
The second processing module 702 is further configured to determine, from a plurality of DTB files in the configuration file to be programmed, a DTB file corresponding to the target access address, so as to determine that the corresponding DTB file is the target DTB file.
In a possible design, the second processing module 702 is further configured to, when it is determined that the file management information table does not exist, sequentially read header information of each DTB file in the multiple DTB files, where the header information includes a motherboard model corresponding to the DTB file and an access address corresponding to the DTB file.
The second processing module 702 is further configured to determine a DTB file corresponding to a motherboard model that is the same as the target motherboard model, and determine an access address in header information of the corresponding DTB file as a target access address.
The second processing module 702 is further configured to determine, from a plurality of DTB files in the configuration file to be programmed, a DTB file corresponding to the target access address, so as to determine that the corresponding DTB file is the target DTB file.
In a possible design, the second processing module 702 is further configured to output an alarm message if the file management information table does not have a motherboard model that is the same as the target motherboard model.
The file processing device provided in the embodiment of the present invention may implement the file processing method in the embodiment of fig. 4 or fig. 5, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 8, the electronic device 800 provided in the present embodiment includes: at least one processor 801 and a memory 802. The processor 801 and the memory 802 are connected by a bus 803.
In a specific implementation process, the at least one processor 801 executes the computer-executable instructions stored in the memory 802, so that the at least one processor 801 executes the file processing method in the above method embodiment.
For a specific implementation process of the processor 801, reference may be made to the above method embodiments, which have similar implementation principles and technical effects, and details of this embodiment are not described herein again.
In the embodiment shown in fig. 8, it should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
The memory may comprise high speed RAM memory and may also include non-volatile storage NVM, such as at least one disk memory.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The embodiment of the invention also provides a computer-readable storage medium, wherein a computer execution instruction is stored in the computer-readable storage medium, and when a processor executes the computer execution instruction, the file processing method of the embodiment of the method is realized.
The computer-readable storage medium may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. Readable storage media can be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary readable storage medium is coupled to the processor such the processor can read information from, and write information to, the readable storage medium. Of course, the readable storage medium may also be an integral part of the processor. The processor and the readable storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the readable storage medium may also reside as discrete components in the apparatus.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A file processing method applied to a first device, the method comprising:
acquiring a firmware configuration file and a plurality of DTB files;
generating a configuration file to be programmed, which contains the firmware configuration file and a plurality of DTB files;
and programming the configuration file to be programmed to second equipment so as to start the second equipment according to the firmware configuration file after the second equipment is powered on, determining a target DTB file from the plurality of DTB files according to the acquired mainboard identification information, and executing corresponding initialization operation according to the target DTB file.
2. The method of claim 1, wherein generating the configuration file to be programmed comprising the firmware configuration file and the plurality of DTB files comprises:
if the header information of any DTB file in the DTB files does not contain the file description information corresponding to the DTB file, acquiring the file description information corresponding to the DTB file, and adding the file description information to the header information of the DTB file; wherein the file description information includes an access address of the arbitrary DTB file;
and packaging the firmware configuration file and a plurality of DTB files comprising file description information based on a preset packaging script to obtain the configuration file to be programmed.
3. A file processing method, applied to a second device, the method comprising:
after the power-on is determined, acquiring a firmware configuration file in the configuration file to be programmed, and performing starting processing according to the firmware configuration file;
acquiring mainboard identification information, and determining a target DTB file corresponding to the mainboard identification information from a plurality of DTB files in the configuration file to be programmed according to the mainboard identification information;
and executing corresponding initialization operation according to the target DTB file.
4. The method according to claim 3, wherein the motherboard identification information includes a target motherboard model, and the determining, according to the motherboard identification information, a target DTB file corresponding to the motherboard identification information from a plurality of DTB files in the configuration file to be programmed, includes:
judging whether a file management information table exists or not; the file management information table comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file;
when the file management information table is determined to exist, acquiring an access address corresponding to a DTB file corresponding to a mainboard model which is the same as the target mainboard model from the file management information table to determine the corresponding access address as a target access address;
and determining a DTB file corresponding to the target access address from a plurality of DTB files in the configuration file to be programmed, so as to determine that the corresponding DTB file is the target DTB file.
5. The method of claim 4, further comprising:
when the file management information table is determined not to exist, sequentially reading the header information of each DTB file in the plurality of DTB files, wherein the header information comprises a mainboard model corresponding to the DTB file and an access address corresponding to the DTB file;
determining a DTB file corresponding to the mainboard model which is the same as the target mainboard model, and determining an access address in the header information of the corresponding DTB file as a target access address;
and determining a DTB file corresponding to the target access address from a plurality of DTB files in the configuration file to be programmed, so as to determine that the corresponding DTB file is the target DTB file.
6. The method according to claim 4 or 5, characterized in that the method further comprises:
and if the mainboard model identical to the target mainboard model does not exist in the file management information table, outputting alarm information.
7. An electronic device, comprising: at least one processor and memory;
the memory stores computer execution instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the document processing method of any of claims 1 to 2.
8. An electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the document processing method of any of claims 3 to 6.
9. A computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the document processing method according to any one of claims 1 to 2.
10. A computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the document processing method according to any one of claims 3 to 6.
CN202011508662.1A 2020-12-18 2020-12-18 File processing method and equipment Pending CN114647420A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011508662.1A CN114647420A (en) 2020-12-18 2020-12-18 File processing method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011508662.1A CN114647420A (en) 2020-12-18 2020-12-18 File processing method and equipment

Publications (1)

Publication Number Publication Date
CN114647420A true CN114647420A (en) 2022-06-21

Family

ID=81989763

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011508662.1A Pending CN114647420A (en) 2020-12-18 2020-12-18 File processing method and equipment

Country Status (1)

Country Link
CN (1) CN114647420A (en)

Similar Documents

Publication Publication Date Title
US9256744B2 (en) System-on-chip and booting method thereof
US20120191960A1 (en) Booting computing devices
CN114003538B (en) Identification method of intelligent network card and intelligent network card
US12008171B2 (en) Program download method for intelligent terminal with memory card identifier and intelligent terminal with memory card identifier
US10866881B1 (en) Firmware debug trace capture
CN102073514A (en) Method for updating basic input/output system
CN108694052B (en) Firmware upgrading method, firmware upgrading device and firmware upgrading system
CN113867743A (en) Network operating system loading burning method and device, electronic equipment and storage medium
CN110297726B (en) Computer system with serial presence detection data and memory module control method
US11366800B2 (en) System and method to automate validating media redirection in testing process
US20180081550A1 (en) System and method for detecting redundant array of independent disks (raid) controller state from baseboard management controller (bmc)
CN114253619A (en) SSD multi-level Boot method and device, computer equipment and storage medium
CN114385251A (en) Operating system booting method, system, terminal and storage medium based on memory
CN104484211A (en) Method and device for sharing mirror image document
CN111381905B (en) Program processing method, device and equipment
CN102184115B (en) Method for updating system software and terminal device
CN109408265B (en) IOS abnormal operation protection method and device, terminal equipment and storage medium
CN114647420A (en) File processing method and equipment
CN111857785A (en) MCU starting method and device and terminal equipment
CN108052337A (en) A kind of firmware upgrade method and device of eMMC production tools
US10866922B1 (en) Firmware debug trace capture using serial peripheral interface
CN110442387B (en) Parameter self-adaption method and device of vehicle-mounted system and vehicle
CN113760810A (en) Information processing method, information processing device, equipment and storage medium
CN111158733A (en) BMC upgrading method, device, equipment and computer readable storage medium
CN106502863B (en) software version prompting method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination