A method and apparatus for installing a system
Patent Information
- Application Number
- CN202511355570.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2045-09-22
AI Technical Summary
然而,受到驱动加载顺序和设备命名随机规则等因素的影响,安装操作系统时电子设备的硬盘标识和配置文件的硬盘标识可能不同,导致无法将操作系统安装在指定的硬盘中
Smart Images

Figure CN121187658B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of operating system technology, and in particular to a method and apparatus for installing a system. Background Technology
[0002] When installing an operating system on an electronic device, the installer can install the operating system to the corresponding hard drive of the electronic device based on the hard drive identifier specified in the configuration file. However, due to factors such as driver loading order and random device naming rules, the hard drive identifier of the electronic device and the hard drive identifier in the configuration file may differ during operating system installation, making it impossible to install the operating system on the specified hard drive. Summary of the Invention
[0003] Therefore, this application discloses the following technical solution:
[0004] The first aspect of this application provides a method for installing a system, comprising:
[0005] Read the first configuration file in the first operating system installer;
[0006] The target hard disk information is detected according to the first configuration file, wherein the target hard disk information is used to write the target hard disk identifier into the second configuration file;
[0007] After the first configuration file is executed, the first operating system installation program will terminate.
[0008] Start the second operating system installer and import the second configuration file;
[0009] Install the operating system on the target hard drive corresponding to the target hard drive identifier according to the second configuration file;
[0010] The first configuration file is a configuration file based on operating system interpreter technology and is used for pre-installation, while the second configuration file is a formal installation configuration file and is used for the operating system installer.
[0011] Optionally, the first configuration file can be compatible with command-line tools used to extract hardware configuration information.
[0012] Optionally, detecting the target hard disk information according to the first configuration file includes:
[0013] The pre-installation script contained in the first configuration file is used to detect whether each hard drive contains target hard drive information;
[0014] Obtain the hard drive identifier containing the target hard drive information as the target hard drive identifier;
[0015] The target hard drive identifier is written to the second configuration file according to the pre-installation script.
[0016] Optionally, writing the target hard disk identifier into the second configuration file according to the pre-installation script includes:
[0017] According to the pre-installation script, the target hard drive identifier is replaced with the preset initial hard drive identifier in the second configuration file.
[0018] Optional, also includes:
[0019] In response to receiving a hard disk selection command, the target hard disk information is written to the hard disk to which the hard disk selection command is directed.
[0020] Optionally, starting the second operating system installer and importing the second configuration file includes:
[0021] Install and start the second operating system installer according to the pre-installation script contained in the first configuration file;
[0022] After determining the process to which the first operating system installer belongs, the second configuration file is imported based on the second operating system installer.
[0023] Optional, also includes:
[0024] When installing the operating system on the target hard drive corresponding to the target hard drive identifier, the graphics display component is invoked to display the installation progress information.
[0025] Optionally, reading the first configuration file in the first operating system installer includes:
[0026] The startup parameters are obtained in the first operating system installation program, and the startup parameters represent the path of the first configuration file;
[0027] In the first operating system installer, the first configuration file is read from the storage module where the operating system installation package is located, according to the boot parameters.
[0028] Optionally, obtaining the startup parameters during the first operating system installation program includes:
[0029] Read the preset initial startup parameters from the first operating system installation program;
[0030] Alternatively, boot parameters can be obtained based on input operations during the first operating system installer.
[0031] A second aspect of this application provides an electronic device, including a memory and a processor;
[0032] The memory is used to store computer programs;
[0033] The processor is used to execute the computer program to perform:
[0034] Read the first configuration file in the first operating system installer;
[0035] The target hard disk information is detected according to the first configuration file, wherein the target hard disk information is used to write the target hard disk identifier into the second configuration file;
[0036] After the first configuration file is executed, the first operating system installation program will terminate.
[0037] After the second operating system installer starts, it imports the second configuration file;
[0038] Install the operating system on the target hard drive corresponding to the target hard drive identifier according to the second configuration file;
[0039] The first configuration file is a configuration file based on operating system interpreter technology and is used for pre-installation, while the second configuration file is a formal installation configuration file and is used for the operating system installer. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0041] Figure 1 This application provides a method for installing a system.
[0042] Figure 2 This is a flowchart of a method for detecting hard disk information provided in an embodiment of this application;
[0043] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0044] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0045] A system installation disk is a bootable storage device containing operating system installation files. Its form is not limited; it can be a USB flash drive, optical disc, external hard drive, or other device. Users can use the system installation disk to install the corresponding operating system on electronic devices.
[0046] Before installing the operating system, the system installation disk will pre-generate a configuration file, which may contain the hard drive identifier of the hard drive where the operating system needs to be installed. When the operating system installation begins, the system installation disk can install the operating system to the corresponding hard drive based on this configuration file.
[0047] However, due to factors such as driver loading order and random device naming rules, the hard drive identifier of the same hard drive in an electronic device may differ between the configuration file generation stage and the operating system installation stage. For example, when generating the configuration file, the hard drive identifier specified in the configuration file as " / dev / sda" might differ from the hard drive identifier specified in the configuration file when the operating system installation begins, which might be " / dev / sdb". This difference in hard drive identifier may prevent the operating system from being installed on the hard drive specified in the configuration file.
[0048] To address the aforementioned problems, this embodiment provides a method for installing a system to accurately install the operating system onto a designated hard drive of an electronic device. Please refer to [link to relevant documentation]. Figure 1 The method may include the following steps.
[0049] S101, read the first configuration file in the first operating system installer. The first configuration file is a configuration file based on operating system interpreter technology and is used for pre-installation.
[0050] The first operating system installer can be integrated into the system installation disk or system image file used to install the operating system. When the electronic device accesses the system installation disk or system image file, the first operating system installer starts and begins to execute step S101.
[0051] The operating system can be Linux or other types of operating systems. The first operating system installer can be the Agama installer or other installers.
[0052] The first configuration file is pre-stored in the storage module of the operating system installation package. This storage module can be a physical storage device, such as the aforementioned system installation disk, or a virtual file, such as a system image file. After the first operating system installer starts, it can read the first configuration file from the system installation disk or system image file.
[0053] Operating system interpreter technology is a method that enables an operating system to directly understand and execute high-level language code without pre-compiling it into machine code. It uses a program called an "interpreter" to read the source code line by line, convert it into machine instructions in real time, and execute them. Based on this characteristic, operating system interpreter technology can be used to achieve cross-platform compatibility, support system function extensions and dynamic module loading, serve as a Linux kernel module (LKM), and provide command-line interfaces and script support.
[0054] In this embodiment, the first configuration file can be a configuration file based on Shell, an operating system interpreter technology that provides a command-line interface and script support. Based on Shell, the first operating system installer can directly run complex scripts.
[0055] The file format of the first configuration file is not limited, as long as the file format can be used to store and transmit structured data. As an example, the first configuration file can be a text file in JSON format.
[0056] In this embodiment, pre-installation may include performing preparatory work before starting the installation of the operating system, such as preparing configuration files and installation programs needed when installing the operating system.
[0057] S102, detect the target hard disk information according to the first configuration file, wherein the target hard disk information is used to write the target hard disk identifier in the second configuration file.
[0058] Step S102 can be executed by the first operating system installer based on the first configuration file.
[0059] The first configuration file may include a script based on operating system interpreter technology, referred to as a pre-installation script. For example, the pre-installation script may be a shell script, which includes a series of commands to be executed. In S102, the first operating system installer can read and execute these commands to achieve the functions to be implemented by the first operating system installer in this embodiment.
[0060] Target hard drive information is specific information pre-stored on the target hard drive to identify it among the multiple hard drives in an electronic device; the target hard drive identifier is the hard drive identifier of the target hard drive, such as " / dev / sdb". The target hard drive is the pre-designated hard drive among the multiple hard drives in the electronic device used to install the operating system.
[0061] For example, an electronic device includes hard disk 1, hard disk 2 and hard disk 3. If it is necessary to install an operating system on hard disk 1, then hard disk 1 is the target hard disk.
[0062] S103, after the first configuration file finishes execution, the first operating system installation program ends.
[0063] The execution of the first configuration file has ended, which is equivalent to the first operating system installer executing all the commands in the script of the first configuration file, and the script contained in the first configuration file has been executed.
[0064] In this embodiment, the first operating system installer can determine that the execution of the first configuration file has ended after all commands of the script in the first configuration file have been executed. In this case, the first operating system installer can automatically terminate its own process, thereby terminating the first operating system installer.
[0065] Optionally, if the execution of the first configuration file is completed, the first operating system installer may also temporarily suspend its own process and wait for user input instructions, and determine whether to terminate its own process based on the user input instructions.
[0066] S104, Start the second operating system installer, import the second configuration file, which is the formal installation configuration file and is applied to the operating system installer.
[0067] In step S104, the second operating system installer can be started by the first operating system installer before the first operating system installer finishes.
[0068] Once started, the second operating system installer can execute a preset file import command to import the second configuration file. For example, the file import command executed could be "agama profile import".
[0069] It should be noted that since the target hard disk information used to write the target hard disk identifier was detected in S103, the second configuration file imported in S104 contains the target hard disk identifier that has been written, such as " / dev / sdb".
[0070] The second configuration file and the first configuration file can be files of the same or different formats. For example, the second configuration file can also be a JSON file. The second configuration file can also be pre-stored in the storage module belonging to the operating system's installation package.
[0071] The second configuration file contains the target hard drive identifier, as well as various other parameters and instructions required by the second operating system installer when actually installing the operating system. These may include parameters and instructions related to the installation source path, disk partition information, a list of packages to be installed, user account information, locale settings, network configuration, and post-installation scripts.
[0072] S105, Install the operating system on the target hard drive corresponding to the target hard drive identifier according to the second configuration file.
[0073] Step S105 can be executed by the second operating system installer. The second operating system can locate the target hard drive among the multiple hard drives of the electronic device based on the target hard drive identifier contained in the second configuration file, and then execute system installation commands, such as executing the `agama install` command, to install the operating system onto the target hard drive. For specific installation methods, please refer to relevant technologies, which will not be elaborated here.
[0074] The beneficial effects of this embodiment are as follows:
[0075] After the first operating system installation program starts, the target hard drive information is detected by the first configuration file and the target hard drive identifier is written into the second configuration file. This avoids the situation where the hard drive identifier when the configuration file is generated is different from the hard drive identifier when the operating system is installed, which would prevent the target hard drive from being accurately located. When the operating system is installed based on the second configuration file, the target hard drive is accurately located according to the target hard drive identifier contained in the second configuration file, and the operating system is then accurately installed on the specified target hard drive.
[0076] Optionally, the first configuration file can be read in the first operating system installer in the following ways:
[0077] The startup parameters are obtained from the first operating system installer. These startup parameters represent the path to the first configuration file.
[0078] In the first operating system installer, the first configuration file is read from the storage module where the operating system installation package is located, based on the boot parameters.
[0079] After the first operating system installer starts, it first obtains the startup parameters. These parameters represent the storage path of the first configuration file within the storage module containing the operating system's installation package. For example, a startup parameter could be `agama.auto=`. <url>The URL represents the storage path of the first configuration file.
[0080] After obtaining the boot parameters, the first operating system installer can execute a file reading command based on the boot parameters, and read the first configuration file stored on the storage path from the storage module where the operating system installation package is located.
[0081] One way to obtain boot parameters in the first operating system installer is to read the preset initial boot parameters in the first operating system installer.
[0082] Alternatively, it could be: obtaining boot parameters based on input operations during the first operating system installation program.
[0083] In the former method of obtaining the configuration file, the first configuration file can be stored on a fixed storage path in the storage module where the operating system installation package is located. Correspondingly, the first operating system installation program can have a fixed initial startup parameter set in advance. In this case, the initial startup parameter can be read directly, and then the first configuration file can be obtained from the storage path represented by the initial startup parameter.
[0084] In the latter method of obtaining the configuration file, the storage path of the first configuration file in the storage module where the operating system installation package is located may change. In this case, the first operating system installer can output a prompt message after startup, which prompts the user to enter the storage path of the first configuration file. Then, in response to the user's input, the user's input information is used as a startup parameter, and the first configuration file is read from the storage path entered by the user.
[0085] Optionally, the first configuration file can be compatible with command-line tools used to extract hardware configuration information. By ensuring compatibility with this command-line tool, the target hard drive identifier can be obtained by detecting the target hard drive information based on the first configuration file.
[0086] As an example, the command-line tool mentioned above could be a hardware list (lshw). lshw is a command-line tool used to extract and display detailed hardware configuration information of a Linux system. By calling this command-line tool, configuration information of various hardware components in electronic devices, including hard drives, can be obtained and the configuration information can be output in various output formats (including but not limited to HTML, XML, and JSON).
[0087] Therefore, when executing S102, lshw can be called to output the configuration information of the target hard disk, and then the configuration information of the target hard disk can be parsed to obtain the target hard disk identifier from the configuration information.
[0088] Optional, please see Figure 2 The target hard drive information can be detected based on the first configuration file, which may include:
[0089] S201, based on the pre-installation script contained in the first configuration file, detects whether each hard drive contains target hard drive information.
[0090] S202, Obtain the hard drive identifier of the hard drive containing the target hard drive information as the target hard drive identifier.
[0091] S203, writes the target hard disk identifier to the second configuration file according to the pre-installation script.
[0092] In step S201, the first operating system installer can read and execute the pre-installation script contained in the first configuration file, and detect whether the target hard disk information is stored in each hard disk of the electronic device based on the pre-installation script.
[0093] If any hard drive is detected to store target hard drive information, it indicates that the hard drive is the target hard drive. In this case, the first operating system installer can call the command-line tool to output the configuration information of the target hard drive based on the instructions of the pre-installation script, parse the output configuration information, and extract the target hard drive identifier of the target hard drive.
[0094] As examples, the configuration information for the output target hard drive may include the following information.
[0095] {
[0096] "id" : "disk:1",
[0097] "handle" : "SCSI:03:00:00:00",
[0098] "description": "ATA Disk"
[0099] "physid" : "0",
[0100] "businfo" : "scsi@3:0.0.0",
[0101] "logicalname" : " / dev / sdb",
[0102] "dev" : "8:0",
[0103] "size": 240057409536
[0104] }
[0105] The value " / dev / sdb" in the logicalname field is the target hard drive identifier.
[0106] Finally, in S203, the first operating system installer can write the target hard disk identifier into the second configuration file based on the instructions of the pre-installation script.
[0107] The second configuration file can contain a pre-defined initial hard drive identifier. In this case, the method for writing the target hard drive identifier into the second configuration file according to the pre-installation script can be as follows:
[0108] According to the pre-installation script, the target hard drive identifier is replaced with the preset initial hard drive identifier in the second configuration file.
[0109] In this writing method, the first operating system installer can detect the initial hard disk identifier in the second configuration file based on the pre-installation script, and replace the detected initial hard disk identifier with the target hard disk identifier obtained in S202.
[0110] The second configuration file may not contain the initial hard drive identifier; instead, it may only contain a placeholder in the field corresponding to the hard drive identifier. In this case, the method of writing the target hard drive identifier into the second configuration file according to the pre-installation script can also be as follows:
[0111] The first operating system installer uses pre-installation scripts to detect the corresponding hard drive identifier label in the second configuration file, for example, to detect... <device> and< / device> After detecting a tag corresponding to a hard drive identifier, the placeholder contained in the tag corresponding to the hard drive identifier is replaced with the target hard drive identifier obtained in S202. For example, the placeholder in the tag located in the second configuration file is replaced with the target hard drive identifier obtained in S202. <device> and< / device> Replace the placeholders between the two with the target hard disk identifier " / dev / sdb".
[0112] Optionally, before executing S101, the method of this embodiment may further include:
[0113] In response to receiving a hard disk selection command, the target hard disk information is written to the hard disk to which the hard disk selection command is directed.
[0114] The target hard drive information can be a preset string, a file, or other form of information, without limitation.
[0115] The first operating system installer can, after startup, display information about each hard drive in the electronic device and output a prompt message to guide the user to select a target hard drive from which to install the operating system;
[0116] Then, in response to a hard disk selection command for any hard disk, the first operating system installer writes target hard disk information to that hard disk, making that hard disk the target hard disk for storing the target hard disk information.
[0117] For example, assuming the electronic device includes hard disk 1, hard disk 2 and hard disk 3, after receiving the hard disk selection instruction to select hard disk 2, the first operating system installation program writes the target hard disk information to hard disk 2. Thus, when the target hard disk information is detected and the target hard disk identifier is obtained in the subsequent detection of the target hard disk information and the hard disk identifier of hard disk 2 obtained in the user-specified hard disk 2 can be used as the target hard disk identifier.
[0118] Optionally, launch the second operating system installer and import the second configuration file:
[0119] Install and start the second operating system installer according to the pre-installation script contained in the first configuration file;
[0120] After determining the process to which the first operating system installer belongs, the second configuration file is imported based on the second operating system installer.
[0121] In this embodiment, after the first operating system installer writes the target hard disk identifier to the second configuration file, it can install the second operating system installer according to the pre-installation script contained in the first configuration file. The data required for installing the second operating system installer can be pre-stored in the storage module where the operating system installation package is located. The first configuration file can contain the storage path of this data in the storage module. The first operating system installer reads this data based on the storage path and installs the second operating system installer based on the read data. After installation, the first operating system installer can execute a startup command to start the second operating system installer. After executing the startup command, it can be determined that the first configuration file has finished executing, at which point the first operating system installer begins to terminate its own processes.
[0122] On the other hand, after the second operating system installer starts, it can pause its operation and wait for the process to which the first operating system installer belongs to to finish. Only after the process to which the first operating system installer belongs to finishes and the second operating system installer receives the message that the process has finished will the second operating system installer begin to execute the aforementioned file import command in order to import the second configuration file into the second operating system installer.
[0123] The purpose of importing the second configuration file in the above manner is that the operating system installer does not support the simultaneous execution of multiple processes. If multiple processes are executed simultaneously, it may cause a crash or other failures. Therefore, the second operating system installer only starts importing the second configuration file after the process to which the first operating system installer belongs has ended, which can avoid failures caused by the simultaneous execution of two processes.
[0124] Optionally, after the process of the first operating system installer ends, the second operating system installer may temporarily not import the second configuration file, but instead remain in a waiting state, and import the second configuration file only after receiving a trigger command from the user to trigger the import of the second configuration file.
[0125] Optional, also includes:
[0126] When installing the operating system on the target hard drive corresponding to the target hard drive identifier, the graphical display component is invoked to display the installation progress information.
[0127] The graphics display component can be an xterm component, or it can be any other graphics display component.
[0128] In this embodiment, the second operating system installer can first call the graphics display component and then execute the system installation command to install the operating system. In this way, the graphics display component can continuously display the installation progress information on the screen of the electronic device during the installation process.
[0129] The form of installation progress information is not limited. For example, installation progress information can be a percentage representing the installation progress, where 0% indicates the start of installation and 100% indicates the completion of installation; or, installation progress information can be a progress bar representing the installation progress; or, installation progress information can be the estimated remaining time, indicating how long it is expected to take to complete the installation; or installation progress information can be any combination of the above information, without limitation.
[0130] This application also provides an installation system device, such as... Figure 3 As shown, it includes a memory 301 and a processor 302;
[0131] Memory 301 is used to store computer programs;
[0132] Processor 302 is used to execute computer programs to perform:
[0133] Read the first configuration file in the first operating system installer;
[0134] The target hard drive information is detected according to the first configuration file, wherein the target hard drive information is used to write the target hard drive identifier in the second configuration file;
[0135] After the first configuration file finishes execution, the first operating system installation program will terminate.
[0136] After the second operating system installer starts, it imports the second configuration file;
[0137] Install the operating system on the target hard drive corresponding to the target hard drive identifier according to the second configuration file;
[0138] The first configuration file is based on the operating system interpreter technology and is used for pre-installation, while the second configuration file is the formal installation configuration file and is used for the operating system installer.
[0139] Optionally, the first configuration file can be compatible with command-line tools used to extract hardware configuration information.
[0140] Optionally, the processor 302 detects target hard disk information according to the first configuration file, including:
[0141] The pre-installation script contained in the first configuration file is used to detect whether each hard drive contains the target hard drive information;
[0142] Obtain the hard drive identifier containing the target hard drive information and use it as the target hard drive identifier;
[0143] The target hard drive identifier is written to the second configuration file according to the pre-installation script.
[0144] Optionally, processor 302 writes the target hard disk identifier to a second configuration file according to a pre-installation script, including:
[0145] According to the pre-installation script, the target hard drive identifier is replaced with the preset initial hard drive identifier in the second configuration file.
[0146] Optionally, processor 302 is also used for:
[0147] In response to receiving a hard disk selection command, the target hard disk information is written to the hard disk to which the hard disk selection command is directed.
[0148] Optionally, processor 302 boots the second operating system installer and imports the second configuration file, including:
[0149] Install and start the second operating system installer according to the pre-installation script contained in the first configuration file;
[0150] After determining the process to which the first operating system installer belongs, the second configuration file is imported based on the second operating system installer.
[0151] Optionally, processor 302 is also used for:
[0152] When installing the operating system on the target hard drive corresponding to the target hard drive identifier, the graphical display component is invoked to display the installation progress information.
[0153] Optionally, processor 302 reads a first configuration file in the first operating system installer, including:
[0154] The startup parameters are obtained from the first operating system installer. These startup parameters represent the path to the first configuration file.
[0155] In the first operating system installer, the first configuration file is read from the storage module where the operating system installation package is located, based on the boot parameters.
[0156] Optionally, processor 302 obtains boot parameters from the first operating system installer, including:
[0157] Read the preset initial startup parameters from the first operating system installation program;
[0158] Alternatively, boot parameters can be obtained based on input operations during the first operating system installer.
[0159] The working principle of the installation system device in this embodiment can be found in the relevant steps of the installation system method in the foregoing embodiments, and will not be repeated here.
[0160] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0161] For ease of description, the above systems or devices are described separately by function, divided into various modules or units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0162] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0163] Finally, it should be noted that in this document, relational terms such as first, second, third, and fourth are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0164] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.< / url>
Claims
1. A method for installing a system, comprising: Read the first configuration file in the first operating system installer; The target hard disk information is detected according to the first configuration file, wherein the target hard disk information is used to write the target hard disk identifier into the second configuration file; After the first configuration file is executed, the first operating system installation program will terminate. Start the second operating system installer and import the second configuration file; Install the operating system on the target hard drive corresponding to the target hard drive identifier according to the second configuration file; The first configuration file is a configuration file based on operating system interpreter technology and is used for pre-installation, while the second configuration file is a formal installation configuration file and is used for the operating system installer.
2. The method according to claim 1, wherein the first configuration file is compatible with command-line tools used to extract hardware configuration information.
3. The method according to claim 1, wherein detecting the target hard disk information according to the first configuration file includes: The pre-installation script contained in the first configuration file is used to detect whether each hard drive contains target hard drive information; Obtain the hard drive identifier containing the target hard drive information as the target hard drive identifier; The target hard drive identifier is written to the second configuration file according to the pre-installation script.
4. The method according to claim 3, wherein writing the target hard disk identifier into the second configuration file according to the pre-installation script comprises: According to the pre-installation script, the target hard drive identifier is replaced with the preset initial hard drive identifier in the second configuration file.
5. The method according to claim 1, further comprising: In response to receiving a hard disk selection command, the target hard disk information is written to the hard disk to which the hard disk selection command is directed.
6. The method according to claim 1, wherein starting the second operating system installer and importing the second configuration file comprises: Install and start the second operating system installer according to the pre-installation script contained in the first configuration file; After determining the process to which the first operating system installer belongs, the second configuration file is imported based on the second operating system installer.
7. The method according to claim 1, further comprising: When installing the operating system on the target hard drive corresponding to the target hard drive identifier, the graphics display component is invoked to display the installation progress information.
8. The method according to claim 1, wherein reading the first configuration file in the first operating system installation program comprises: The startup parameters are obtained in the first operating system installation program, and the startup parameters represent the path of the first configuration file; In the first operating system installer, the first configuration file is read from the storage module where the operating system installation package is located, according to the boot parameters.
9. The method according to claim 8, wherein obtaining the startup parameters in the first operating system installation program includes: Read the preset initial startup parameters from the first operating system installation program; Alternatively, boot parameters can be obtained based on input operations during the first operating system installer.
10. An electronic device, comprising a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program to perform: Read the first configuration file in the first operating system installer; The target hard drive information is detected based on the first configuration file, wherein... The target hard drive information is used to write the target hard drive identifier in the second configuration file; After the first configuration file is executed, the first operating system installation program will terminate. After the second operating system installer starts, it imports the second configuration file; Install the operating system on the target hard drive corresponding to the target hard drive identifier according to the second configuration file; The first configuration file is a configuration file based on operating system interpreter technology and is used for pre-installation, while the second configuration file is a formal installation configuration file and is used for the operating system installer.
Citation Information
Patent Citations
Method for automatically mounting operating system
CN101763277A
Method and device for allocating logical DOS drives
CN101876885A