Method and device for acquiring starting system path, equipment, medium and program product
The method and device automate the retrieval of operating system path information from the boot program, addressing the complexity of manual path specification and ensuring secure startup by parsing user-selected system information.
Patent Information
- Application Number
- CN202411224312.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Manually specifying the path of the kernel file in the operating system boot process is difficult due to the need for a good understanding of the operating system and boot program, making it challenging to deploy.
A method and device that automatically obtain path information of the target operating system by parsing user-selected system information from the boot program, including path information of the kernel and initial root file systems, and perform trustworthy verification.
Simplifies the operation of obtaining the path information by automating the process, ensuring secure and efficient startup of the target operating system.
Smart Images

Figure CN119225826A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of operating systems, and in particular to a method, device, equipment, medium and program product for obtaining a startup system path. Background Art
[0002] The operating system boot loader, such as Figure 1 As shown in the figure, it is used to select the kernel file and initial root file system corresponding to the boot system in multiple operating systems. When booting the system, you can manually select to boot to a kernel file through the boot program.
[0003] In an environment with trusted verification, the kernel file needs to be trusted when the system is started. Currently, the kernel file needs to be manually specified. However, when manually specifying the path information of the kernel file, it is difficult to deploy the operation because it requires a good understanding of the operating system and boot program. Therefore, manually obtaining the path of the operating system is difficult. Summary of the invention
[0004] The technical solution of the present invention aims to provide a method, device, equipment, medium and program product for obtaining a startup system path, so as to solve the problem that it is difficult to manually obtain the path of the operating system in the prior art.
[0005] To achieve the above object, the present invention is achieved by:
[0006] In a first aspect, an embodiment of the present invention provides a method for obtaining a startup system path, comprising:
[0007] During the process of starting the target operating system, when loading the boot program, obtaining the user selected system information retrieved by the first instruction in the boot program;
[0008] According to the user selected system information, path information of the target operating system is obtained.
[0009] Optionally, in the method for obtaining a startup system path, the path information of the target operating system includes:
[0010] Path information of the kernel file corresponding to the target operating system; and / or,
[0011] Path information of the initial root file system corresponding to the target operating system.
[0012] Optionally, the method for obtaining a startup system path further comprises:
[0013] According to the path information of the target operating system, obtaining the kernel file and / or the initial root file system corresponding to the target operating system;
[0014] The kernel file and / or the initial root file system are / is authenticated as trustworthy.
[0015] Optionally, the method for obtaining the startup system path, wherein obtaining the user selected system information retrieved by the first instruction in the boot program, comprises:
[0016] Obtaining a user selected system information identifier retrieved by a first instruction in the boot program;
[0017] The user selected system information retrieved by the user selected system information identifier is obtained from the system information of all operating systems.
[0018] Optionally, in the method for obtaining a startup system path, the first instruction is used to indicate a target operating system selected by a user.
[0019] Optionally, the method for obtaining the startup system path, wherein obtaining the path information of the target operating system according to the user selected system information, includes:
[0020] Obtain path information of the target operating system called by the second instruction in the user-selected system information.
[0021] In a second aspect, an embodiment of the present invention further provides a device for obtaining a startup system path, comprising:
[0022] An acquisition module is used for obtaining the user selected system information retrieved by the first instruction in the boot program after loading the boot program during the startup of the target operating system;
[0023] The first acquisition module is used to acquire the path information of the target operating system according to the user selected system information.
[0024] In a third aspect, an embodiment of the present invention further provides a device for obtaining a startup system path, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the method for obtaining a startup system path as described in the first aspect is implemented.
[0025] In a fourth aspect, an embodiment of the present invention further provides a readable storage medium, on which a program is stored, and when the program is executed by a processor, the method for obtaining a startup system path as described in the first aspect is implemented.
[0026] In a fifth aspect, an embodiment of the present invention further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the method for obtaining a startup system path as described in the first aspect.
[0027] The beneficial effects of the above technical solution of the present invention are as follows:
[0028] In the embodiment of the present invention, during the process of starting the target operating system, when loading the boot program, the user selected system information retrieved by the first instruction in the boot program is obtained; and according to the user selected system information, the path information of the target operating system is obtained. Therefore, the path information of the target operating system can be automatically obtained through the user selected system information when the boot program is loaded, and the operation is simple. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of the operating system startup;
[0030] Figure 2 A schematic diagram of a flow chart of a method for obtaining a startup system path according to an embodiment of the present invention;
[0031] Figure 3 A schematic diagram of the structure of the device for obtaining a startup system path according to an embodiment of the present invention;
[0032] Figure 4 The figure is a schematic diagram of the hardware structure of the device for obtaining the startup system path according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0034] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0035] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0036] The embodiment of the present invention, as Figure 2 As shown, a method for obtaining a startup system path is provided, comprising the following steps:
[0037] S201, during the process of starting the target operating system, when loading a boot program, obtaining user selected system information retrieved by a first instruction in the boot program.
[0038] Optionally, the boot program is a multi-operating system boot manager, such as GRUB (Grand Unified Bootloader).
[0039] In the embodiment of the present invention, when loading the boot program, a first instruction is searched in the code of the boot program, and after the first instruction is found, the user selected system information called by the first instruction is obtained.
[0040] Optionally, the first instruction is used to indicate a target operating system selected by a user, for example, the first instruction is a grub_env_get("chosen") instruction.
[0041] It should be noted that if the target operating system is selected by the user, then in S201, during the process of starting the target operating system, when loading the boot program, the user selected system information retrieved by the first instruction in the boot program is obtained.
[0042] If the target operating system is selected by default, then in S201, during the startup of the target operating system, when loading the boot program, the default selected system information retrieved by the first instruction in the boot program is obtained.
[0043] S202: Acquire path information of the target operating system according to the user selected system information.
[0044] In the embodiment of the present invention, the path information of the target operating system in the user selected system information in the boot program is obtained.
[0045] Optionally, the path information of the target operating system includes:
[0046] Path information of the kernel file corresponding to the target operating system; and / or,
[0047] Path information of the initial root file system corresponding to the target operating system.
[0048] It should be noted that, taking the Linux system as an example, the target operating system selected by the user or by the system by default, the path information of the target operating system includes the path information of the Linux kernel file corresponding to the Linux system, and / or the path information of the initial root file system corresponding to the Linux system.
[0049] It should also be noted that the path information of the kernel file is used to indicate the file path and file name of the kernel file on the boot partition.
[0050] The path information of the initial root file system is used to indicate the file path and file name of the initial root file system on the boot partition.
[0051] In the embodiment of the present invention, optionally, the method further includes:
[0052] According to the path information of the target operating system, obtaining the kernel file and / or the initial root file system corresponding to the target operating system;
[0053] The kernel file and / or the initial root file system are / is authenticated as trustworthy.
[0054] It should be noted that after obtaining the path information of the target operating system, the kernel file and / or the initial root file system corresponding to the target operating system can be obtained according to the path information of the target operating system, so as to perform trustworthy verification on the kernel file and / or the initial root file system to ensure the security of the target operating system.
[0055] Furthermore, according to the trusted verification result of the kernel file and / or the initial root file system, the target operating system is loaded and started, thereby completing system startup.
[0056] Therefore, the path information of the target operating system can provide path input information for subsequent trusted verification.
[0057] In the embodiment of the present invention, optionally, S201, obtaining the user selected system information retrieved by the first instruction in the boot program, includes:
[0058] Obtaining a user selected system information identifier retrieved by a first instruction in the boot program;
[0059] The user selected system information retrieved by the user selected system information identifier is obtained from the system information of all operating systems.
[0060] The user selected system information identifier retrieved by the first instruction is obtained through the first instruction in the boot program. The user selected system information identifier can be understood as the information identifier of the target operating system selected by the user.
[0061] Furthermore, the user selected system information retrieved by the user selected system information identifier is obtained from the system information of all operating systems.
[0062] It should be noted that the user-selected system information identifier can be understood as the menu identifier of the system startup selected by the user; the user-selected system information can be understood as the menu of the system startup selected by the user; the system information of all operating systems can be understood as the menu of all operating systems.
[0063] In the embodiment of the present invention, optionally, S202, acquiring path information of the target operating system according to the user selected system information, includes:
[0064] Obtain path information of the target operating system called by the second instruction in the user-selected system information.
[0065] In an embodiment of the present invention, taking the target operating system selected by the user or selected by the system by default as the Linux system as an example, the second instruction includes a Linux instruction and / or an initrd instruction, wherein the Linux instruction is used to load the Linux kernel file corresponding to the Linux system, and the parameter following the Linux instruction is the path information of the Linux kernel file, such as / uImage-5.4.18-37-generic; the initrd instruction is used to load the initial root file system corresponding to the Linux system, and the parameter following the initrd instruction is the path information of the initial root file system, such as / initrd.img-5.4.18-37-generic.
[0066] Therefore, the user selected system information in the boot program is parsed to find the second instruction, and after finding the second instruction, the path information of the target operating system called by the second instruction is obtained.
[0067] It should be noted that the user selected system information includes instructions that need to be executed when the target operating system is started. In addition to the second instruction mentioned above, the instructions also include an insmod instruction for loading a part_gpt module or an ext2 module.
[0068] It should also be noted that the second instruction can be understood as a startup command keyword of the target operating system.
[0069] In summary, by using the method for obtaining the startup system path described in the embodiment of the present invention, the user selected system information called by the first instruction in the boot program can be automatically obtained when the boot system is loaded, and the user selected system information can be parsed to obtain the path information of the target operating system called by the second instruction, thereby providing path information for the subsequent trusted verification of the target operating system.
[0070] like Figure 3 As shown, an embodiment of the present invention further provides a device for obtaining a startup system path, comprising:
[0071] The obtaining module 301 is used to obtain the user selected system information retrieved by the first instruction in the boot program when loading the boot program during the startup of the target operating system;
[0072] The first acquisition module 302 is used to acquire the path information of the target operating system according to the user selected system information.
[0073] Optionally, in the device for obtaining a boot system path, the path information of the target operating system includes:
[0074] Path information of the kernel file corresponding to the target operating system; and / or,
[0075] Path information of the initial root file system corresponding to the target operating system.
[0076] Optionally, the device for obtaining a startup system path further comprises:
[0077] A second acquisition module, used to acquire a kernel file and / or an initial root file system corresponding to the target operating system according to the path information of the target operating system;
[0078] The verification module is used to perform trustworthy verification on the kernel file and / or the initial root file system.
[0079] Optionally, in the device for obtaining a startup system path, the obtaining module 301 is specifically configured to:
[0080] Obtaining a user selected system information identifier retrieved by a first instruction in the boot program;
[0081] The user selected system information retrieved by the user selected system information identifier is obtained from the system information of all operating systems.
[0082] Optionally, in the device for obtaining a startup system path, the first instruction is used to indicate a target operating system selected by a user.
[0083] Optionally, in the device for obtaining a startup system path, the first obtaining module 302 is specifically configured to:
[0084] Obtain path information of the target operating system called by the second instruction in the user-selected system information.
[0085] It should be noted that the device for obtaining the startup system path provided in the embodiment of the present invention is a device capable of executing the above-mentioned method for obtaining the startup system path. All embodiments of the above-mentioned method for obtaining the startup system path are applicable to the device and can achieve the same or similar technical effects.
[0086] like Figure 4 As shown, an embodiment of the present invention also provides a device for obtaining a startup system path, including: a processor 401; and a memory 402 connected to the processor 401 through a bus interface, the memory 402 is used to store programs and data used by the processor 401 when performing operations, and the processor 401 calls and executes the programs and data stored in the memory 402.
[0087] The processor 401 is used to read the program in the memory 402 and execute the following process:
[0088] During the process of starting the target operating system, when loading the boot program, obtaining the user selected system information retrieved by the first instruction in the boot program;
[0089] According to the user selected system information, path information of the target operating system is obtained.
[0090] The device for obtaining a startup system path further includes a transceiver 403 for receiving and sending data in the controller of the processor 401 .
[0091] Among them, Figure 4 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by processor 401 and various circuits of memory represented by memory 402 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The transceiver 403 may be a plurality of components, namely, a transmitter and a transceiver, providing a unit for communicating with various other devices on a transmission medium. For different user devices, the user interface 404 may also be an interface capable of externally and internally connecting required devices, and the connected devices include but are not limited to a keypad, a display, a speaker, a microphone, a joystick, and the like.
[0092] The processor 401 is responsible for managing the bus architecture and general processing, and the memory 402 can store data used by the processor 401 when performing operations.
[0093] Optionally, the path information of the target operating system includes:
[0094] Path information of the kernel file corresponding to the target operating system; and / or,
[0095] Path information of the initial root file system corresponding to the target operating system.
[0096] Optionally, the processor 401 is further configured to read the computer program and execute the following steps:
[0097] According to the path information of the target operating system, obtaining the kernel file and / or the initial root file system corresponding to the target operating system;
[0098] The kernel file and / or the initial root file system are / is authenticated as trustworthy.
[0099] Optionally, the processor 401 is specifically configured to read the computer program and execute the following steps:
[0100] Obtaining a user selected system information identifier retrieved by a first instruction in the boot program;
[0101] The user selected system information retrieved by the user selected system information identifier is obtained from the system information of all operating systems.
[0102] Optionally, the first instruction is used to indicate a target operating system selected by a user.
[0103] Optionally, the processor 401 is specifically configured to read the computer program and execute the following steps:
[0104] Obtain path information of the target operating system called by the second instruction in the user-selected system information.
[0105] A specific embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the above-mentioned method for obtaining the startup system path are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0106] In addition, an embodiment of the present invention further provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 2 The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0107] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0108] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0109] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the sending and receiving methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store program codes.
[0110] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for obtaining a startup system path, characterized in that: include: During the process of starting the target operating system, when loading the boot program, obtaining the user selected system information retrieved by the first instruction in the boot program; According to the user selected system information, path information of the target operating system is obtained.
2. The method for obtaining the startup system path according to claim 1, characterized in that: The path information of the target operating system includes: Path information of the kernel file corresponding to the target operating system; and / or, Path information of the initial root file system corresponding to the target operating system.
3. The method for obtaining the startup system path according to claim 2, characterized in that: The method further comprises: According to the path information of the target operating system, obtaining the kernel file and / or the initial root file system corresponding to the target operating system; The kernel file and / or the initial root file system are / is authenticated as trustworthy.
4. The method for obtaining a startup system path according to claim 1, characterized in that: Obtaining user selected system information retrieved by the first instruction in the boot program includes: Obtaining a user selected system information identifier retrieved by a first instruction in the boot program; The user selected system information retrieved by the user selected system information identifier is obtained from the system information of all operating systems.
5. The method for obtaining a startup system path according to claim 1 or 4, characterized in that: The first instruction is used to indicate a target operating system selected by a user.
6. The method for obtaining a startup system path according to claim 1, characterized in that: Acquiring path information of the target operating system according to the user selected system information, including: Obtain path information of the target operating system called by the second instruction in the user-selected system information.
7. A device for obtaining a startup system path, characterized in that: include: An acquisition module, used for obtaining the user selected system information retrieved by the first instruction in the boot program when loading the boot program during the startup of the target operating system; The first acquisition module is used to acquire the path information of the target operating system according to the user selected system information.
8. A device for obtaining a boot system path, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the method for obtaining a startup system path according to any one of claims 1 to 6 is implemented.
9. A readable storage medium, characterized in that: The readable storage medium stores a program, and when the program is executed by a processor, the method for obtaining a startup system path according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implements the method for obtaining a startup system path according to any one of claims 1 to 6.
Citation Information
Patent Citations
Computer system starting method and computer terminal
CN102830990A
Start control method of operating system, terminal equipment and readable storage medium
CN114995894A
System starting method and device of electronic equipment, electronic equipment and storage medium
CN117270993A
