Method for realizing quick start of Linux system, electronic equipment and storage medium
By optimizing the UEFI startup mode and driver loading order, using EFI stub features and systemd services, the storage space limitation and complexity problems during fast startup of Linux are solved, rapid startup is achieved, data corruption risk is reduced, and system performance is improved. User experience.
Patent Information
- Application Number
- CN202411276357.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-27
AI Technical Summary
The prior art requires additional storage space to save the operating system's image files when implementing Linux fast boot, resulting in increased system complexity with limited storage capacity and the risk of data corruption or loss.
By reading the parameters of the UEFI startup item of the system BIOS, enter the fast startup mode, load the optimized driver and system services, optimize the dependencies and startup sequence of the system services, and use the EFI stub features and UEFI environment variables to reduce the storage space Depend on, and delay loading of non-essential drivers through the systemd service.
Reduces requirements for system storage capacity, simplifies startup process, reduces configuration and management complexity, and reduces the risk of data corruption or loss, improving system startup speed and user experience.
Smart Images

Figure CN119201274A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of operating systems, and in particular to a method for implementing Linux quick startup, an electronic device and a storage medium. Background Art
[0002] With the rapid development of information technology, the performance and efficiency of computer systems have become key indicators to measure their competitiveness. Quickly starting a computer system can save users' effective use of time and improve user experience. Therefore, developing a technology for quickly starting a computer system, especially an operating system, has always been the focus of computer system research and development.
[0003] The prior art generally adopts adding a specific fast startup flag to the startup parameters of the operating system, and combining the hibernation function of the Linux operating system to implement "fake shutdown" to achieve the fast startup of the operating system. The specific implementation method is to save the image file of the operating system to the backup Swap partition when shutting down, and then restore the image file according to the first fast startup flag when starting up.
[0004] The prior art solution requires additional storage space to save the operating system image file, which poses a challenge to systems with limited storage capacity, thereby increasing the complexity of the system and requiring additional configuration and management to ensure the smooth implementation of the fast startup function. More importantly, if the system is accidentally shut down during the process of saving the image file, data may be damaged or lost. Summary of the invention
[0005] One of the purposes of the embodiments of the present invention is to provide a method, electronic device and storage medium for realizing Linux fast startup, which solves the storage space limitation problem in the prior art and avoids the need for additional storage space to save the image file of the operating system when realizing fast startup in the prior art, thereby posing a challenge to the system with limited storage capacity. At the same time, the system complexity problem in the prior art is avoided, and the need for additional configuration and management is avoided. By reducing the reliance on the sleep function, the step of saving the image file during the shutdown process is avoided, thereby reducing the risk of data damage or loss.
[0006] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a method for realizing fast startup of a Linux system, the method comprising:
[0007] Read the parameters of the UEFI boot item of the system BIOS and enter the fast boot mode according to the parameters of the UEFI boot item;
[0008] In the fast boot mode, the Linux kernel is loaded through a specified path, and the UEFI boot parameters of the kernel are passed to the Linux kernel;
[0009] Load the optimized driver according to the blacklist information set by the optimization policy;
[0010] Optimize system services and load the optimized system services;
[0011] Display the Linux system login interface.
[0012] Furthermore, the method further comprises:
[0013] Obtaining blacklist information set according to the optimization strategy, wherein the blacklist includes drivers that are delayed in loading;
[0014] The loading of the optimized driver includes loading a driver outside the blacklist.
[0015] Preferably, the optimization strategy specifically includes analyzing the kernel startup log and adding the driver whose occupancy time exceeds a threshold and does not affect the normal startup of the kernel to a blacklist.
[0016] Furthermore, the method further comprises:
[0017] Integrate the blacklisted driver into the systemd service to create a new systemd service, load the new systemd service.
[0018] Preferably, the optimizing of system services specifically includes:
[0019] Analyze the dependencies and running time of all services, and adjust the startup order of each service based on the analysis results.
[0020] Preferably, the analysis of the dependencies and running time of all services specifically includes:
[0021] Use the systemd-analyze and systemctl tools provided by the operating system to give the time required for each system service to start and their interdependencies;
[0022] Clean up the dependent services of the lightdm service, and remove the dependencies for services that may not have dependencies;
[0023] For services that lightdm must depend on, the service is loaded through a parallel mechanism.
[0024] Furthermore, the method further comprises:
[0025] Use the boot item command in the UEFI boot parameters to prioritize the fast boot mode.
[0026] On the other hand, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method as described above.
[0027] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the method as described above.
[0028] Compared with the prior art, the method, electronic device and storage medium for implementing Linux fast startup provided by the embodiments of the present invention have at least the following beneficial effects:
[0029] The embodiment of the present invention reduces the dependence on additional storage space by using a kernel with EFI stub characteristics and optimizing UEFI environment variables, thereby reducing the requirement for system storage capacity, and simplifies the startup process and reduces the complexity of configuration and management by optimizing the startup of the driver program and adjusting the startup sequence of system services. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The preferred implementation modes will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present invention.
[0031] Figure 1 A flowchart of a method for realizing fast startup of a Linux system according to an embodiment of the present invention;
[0032] Figure 2 This is a flow chart of another method for realizing fast startup of a Linux system according to an embodiment of the present invention;
[0033] Figure 3 This is a flowchart of another method for realizing fast startup of a Linux system according to an embodiment of the present invention;
[0034] Figure 4 The present invention is a structural block diagram of an electronic device for realizing fast startup of a Linux system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.
[0036] In order to simplify the drawings, only the parts related to the invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".
[0037] The following mainly takes some specific embodiments as examples to describe in detail the implementation of the technical solution of the present invention.
[0038] like Figure 1 As shown, an embodiment of the present invention provides a method for realizing fast startup of a Linux system, the method comprising:
[0039] S1. Read the parameters of the UEFI startup item of the system BIOS, and enter the fast startup mode according to the parameters of the UEFI startup item;
[0040] S2. In the fast boot mode, load the Linux kernel through a specified path, and pass the UEFI boot parameters of the kernel to the Linux kernel;
[0041] S3, loading the optimized driver according to the blacklist information set by the optimization strategy;
[0042] S4. Optimize system services and load the optimized system services;
[0043] S5. Display the Linux system login interface.
[0044] The general PC startup time usually consists of four parts:
[0045] UEFI (Unified Extensible Firmware Interface) boot time: When the computer system starts, UEFI self-checks and is responsible for initializing hardware devices, identifying and selecting boot devices, enhancing the scalability and usability of the computer, and ensuring that all components work properly. This stage usually takes only a few seconds. The UEFI boot process first performs a power-on self-check on the system hardware, then initializes the UEFI firmware and loads the boot manager, selects the boot device according to the configuration, parses and loads the operating system's boot loader, displays the boot menu for the user to select, loads the operating system kernel and drivers, and finally boots to the user login interface, completing the boot and providing complete system functions.
[0046] GRUB (GRand Unified Bootloader) boot time: GRUB is an open source multi-system boot manager that is responsible for booting the Linux kernel. During GRUB boot, the user can select the system to boot by selecting the operating system in the menu. The default value of GRUB boot time is 5 seconds.
[0047] The embodiment of the present invention skips the GRUB booting step and enters the fast booting mode without performing system selection, thereby saving booting time.
[0048] Linux kernel boot time: This stage involves the loading process of the Linux kernel and kernel modules. The Linux kernel is a core component that provides functions such as system scheduling, memory management, and process management. The time taken for this stage usually depends on the hardware performance and system configuration.
[0049] System service / process startup time: After the kernel is started, various system services and processes start to start, including network services, sound services, security services, etc. The time taken in this stage usually depends on factors such as the configuration of the computer and the types and number of services that need to be started.
[0050] The above are the four time periods that a PC needs to go through when starting up.
[0051] Preferably, an embodiment of the present invention adds a UEFI startup item parameter in the UEFI environment variable area of the system BIOS, and the UEFI startup item parameter includes the priority information of the startup mode. When UEFI is started, the UEFI startup item is read. Since the fast startup mode is given the first priority, the fast startup mode is entered according to the UEFI startup item parameter.
[0052] The UEFI environment variable area is a part of the UEFI firmware, which stores various UEFI startup item parameters and startup options.
[0053] During the boot process, you need to add the corresponding boot items in the UEFI environment variable area in advance, including parameters such as kernel image file path and file system type. During boot, the UEFI firmware will read these parameters in the UEFI environment variables, load the kernel and file system through the specified path, and start the operating system.
[0054] like Figure 2 Furthermore, in one embodiment of the present invention, the method further includes:
[0055] S0. Prioritize the fast boot mode first through the boot item command in the UEFI boot parameters.
[0056] In the embodiment of the present invention, a UEFI boot item can be added by installing the efibootmgr command of the system, and the UEFI boot item includes:
[0057] root=$(df-h / |awk-F""'{print$1}'|tail-n 1)
[0058] disk=$(df-h / boot / efi|awk-F""'{print$1}'|tail-n 1)
[0059] efibootmgr-cgL"EFI Stub"-l'\EFI\BOOT\vmlinuz.efi'-u"root=$root rovideo=efifb:nobgrt splash quiet console= / dev / tty1 module_name.blacklist=1ipv6.disable=1selinux=0ima_appraise=offlibahci.ignore_sss=1"--disk$disk
[0060] The following describes the meaning of each parameter of the startup item:
[0061] root=: specifies the root file system, the kernel needs to know where to load the system;
[0062] ro: mount the root file system in read-only mode, which can improve boot speed in some cases;
[0063] efibootmgr-cgL "EFI Stub" -l: put the priority of fast boot mode in the first place;
[0064] video=efifb:nobgrt: Set the video output to use the EFI frame buffer device and disable BGRT (Boot Graphics Resource Table), which can speed up booting;
[0065] splash: Displays a splash screen, which can sometimes improve the user experience;
[0066] quiet: Quiet mode, reducing console output at startup.
[0067] console=: specifies the console device.
[0068] module_name.blacklist=1: Add the specified driver module to the disabled blacklist and do not load these disabled driver modules.
[0069] ipv6.disable=1: Disable IPv6, which can reduce startup time in some network environments.
[0070] selinux=0: Disable SELinux, which can reduce the time of security checks.
[0071] ima_appraise=off: Disables IMA (Integrity Measurement Architecture) evaluation, which can speed up startup.
[0072] libahci.ignore_sss=1: SATA controller specific setting to ignore secure boot state.
[0073] In addition, the embodiment of the present invention loads the kernel through the Linux stub startup item and transfers the kernel startup parameters, that is, the functions implemented by GRUB are rewritten through the UEFI stub.
[0074] This is because, in the prior art, GRUB has other additional functions in addition to the function of selecting an operating system, so it consumes more resources and is relatively slow; while UEFI is relatively lightweight and can be started quickly.
[0075] When using a kernel that supports the EFI stub feature, the kernel will be disguised as an application in the PECOFF format that can be recognized by the UEFI environment. The specific disguise method is to replace the ELF header of the kernel file with the PECOFF header and add a 64-bit PECOFF header to the end of the file. Since only executable PECOFF files are supported in the EFI environment, this method can make the Linux kernel more universal on the UEFI platform, making it easier to boot with UEFI.
[0076] At the same time, using the EFI stub feature of the kernel can make the system no longer need to intervene through the boot manager such as GRUB, but directly use the boot function of the UEFI firmware to directly boot the kernel, thereby speeding up the system startup speed. Once the new kernel is installed and fixed in the system, it will be automatically loaded at each startup.
[0077] The embodiment of the present invention can run the fast startup mode by default, and in certain specific environments, can also manually intervene to select the GRUB boot mode to run a non-fast startup mode.
[0078] The startup process in the non-fast startup mode is the same as that in the prior art, and will not be described in detail here.
[0079] The embodiment of the present invention realizes the flexibility of executing the fast startup strategy by setting the UEFI startup item and selecting whether to bypass the GRUB boot. By replacing the original kernel with a kernel that supports the EFI stub feature, the GRUB boot time of the prior art can be shortened. Because the kernel is disguised as a PECOFF format recognizable by UEFI, it can bypass the traditional boot loader GRUB and be directly booted by the UEFI firmware, thereby reducing the intervention and configuration time of GRUB. Writing a specific load command in the UEFI environment variable area can further reduce the kernel startup time. Since the UEFI environment variables already contain the necessary startup parameters, the kernel can directly use these parameters for loading, reducing the configuration time at startup.
[0080] In an embodiment of the present invention, the method further includes:
[0081] Blacklist information set according to the optimization strategy is obtained, wherein the blacklist includes drivers whose loading is delayed; and loading the optimized driver includes loading drivers outside the blacklist.
[0082] In a specific implementation, the loading of some drivers may be disabled according to a blacklist switch in the startup item parameters.
[0083] Preferably, the optimization strategy specifically includes analyzing the kernel startup log and adding the driver whose occupancy time exceeds a threshold and does not affect the normal startup of the kernel to a blacklist.
[0084] Through in-depth analysis of service dependencies and parallel perspectives in advance, we adjusted the optimization strategy for the system startup process, analyzed the kernel startup log, disabled some drivers in the kernel, shortened the kernel driver loading time to load other drivers first, disabled the drivers that took a long time first, and then loaded them as services after startup.
[0085] The embodiment of the present invention applies blacklist to the boot level, edits the blacklist.conf blacklist configuration file in the / etc / modprob.d directory, and adds some modules that take a long time to start and will not affect the normal startup of the kernel (but will affect the normal use of the system, so they need to be automatically loaded after the system is started) to the kernel startup blacklist blacklist. The following table is an embodiment of the blacklist:
[0086]
[0087]
[0088] like Figure 3 As shown, further, in one embodiment of the present invention, it also includes:
[0089] S6. Integrate the blacklisted driver into the systemd service to create a new systemd service, and load the new systemd service.
[0090] systemd is an init system and system manager in Linux systems. It is widely used in modern Linux distributions and is responsible for starting and managing system services.
[0091] In this embodiment of the present invention, the drivers added to the blacklist are integrated into a systemd service, and these disabled driver modules are loaded after the system starts and enters the login interface. Because these modules involve some necessary functions of the system, they must be loaded to ensure the integrity of the system functions.
[0092] Adjust the loading order of non-core drivers in the kernel, add some unnecessary drivers to the blacklist, and load them through the systemd service after the system starts, which can reduce the kernel startup time and system service / process startup time. This is because the kernel does not need to load these modules when it starts, thus speeding up the startup process. After the system starts, these modules are loaded on demand and will not affect the normal use of the system.
[0093] It is worth noting that the blacklist in the embodiment of the present invention is different from the traditional blacklist. The traditional blacklist is no longer loaded after being disabled, while the blacklist content in the embodiment of the present invention will be reloaded as a service later, that is, delayed loading. This can not only achieve fast login, but also avoid some unnecessary drivers before startup from being unable to continue to be used later.
[0094] In one embodiment of the present invention, it also includes:
[0095] Preferably, the optimizing of system services specifically includes:
[0096] Analyze the dependencies and running time of all services, and adjust the startup order of each service based on the analysis results.
[0097] That is, in this embodiment, it is used to load streamlined and optimized system services.
[0098] In order to start the lightdm service as quickly as possible and reduce user waiting time, start services without dependencies in parallel to speed up service startup.
[0099] At the same time, closing or disabling unnecessary services can reduce the number of services that need to be loaded when the system starts, thereby shortening the system startup time. This pruning can be permanent, as long as the user is sure that these services are no longer needed. Once services are disabled, they will not automatically start at system startup unless the user enables them again. At the same time, since unnecessary services are no longer loaded, the system will occupy less resources after startup, which can also improve system stability and performance. The following services are mainly closed:
[0100]
[0101]
[0102] Preferably, the analysis of the dependencies and running time of all services specifically includes:
[0103] Using the systemd-analyze and systemctl tools provided by the operating system, the time required for each service to start and their interdependencies are given;
[0104] Clean up the dependent services of the lightdm service, and remove the dependencies for services that do not have dependencies.
[0105] Further optionally, in order to speed up the startup speed, the following algorithm is used before this step to analyze the dependencies and running time of all services, and the startup order of each service is adjusted according to the analysis results, specifically including:
[0106] Using the systemd-analyze and systemctl tools provided by the operating system, the time required for each service to start and their interdependencies are given;
[0107] Specifically, the “systemd-analyze blame” command was used to list the startup time information of each service, the “systemctl list-dependencies” command was used to list the dependencies of all services, and the “systemd-analyze critical-chain” command was used to display the services and time information on the critical path.
[0108] Clean up the dependent services of the lightdm service, and remove the dependencies for those that can be ignored.
[0109] Preferably, adjusting the startup sequence of each service according to the analysis result specifically includes:
[0110] For services before lightdm, and for services that are not essential for lightdm, start them after the lightdm service, and start services that do not have dependencies before lightdm in parallel;
[0111] For services after lightdm, dependencies are also cleaned up, and services that have no dependencies after lightdm are started in parallel.
[0112] Organize services before lightdm, and start services that are not essential for lightdm after lightdm services, and use the parallel mechanism to reduce the startup time of services before lightdm. For services after lightdm, also clean up the dependencies, and start them in parallel as much as possible to reduce the total startup time.
[0113] Use the above steps to analyze the dependencies and running time of all services, and give priority to running the lightdm service. Here, lightdm is a lightweight desktop display manager. After the service is started, the login interface will be loaded immediately. The services that the lightdm service must depend on must be started first. There are some services that lightdm does not necessarily depend on. After removing the dependencies, put them behind lightdm, thereby shortening the login time and increasing the display speed of the login interface.
[0114] Here, lightdm is a lightweight display manager used to start the graphical user interface on the Linux system. Use the lightdm service to load the boot interface and complete the system login.
[0115] By adjusting the startup order of system services and starting the lightdm service first, you can shorten the startup time of system services / processes. By shutting down or disabling unnecessary services, you can reduce the number of services that need to be loaded at startup, thereby shortening the startup time. At the same time, optimizing the service startup order and ensuring that important services (such as the display manager) are started first can reduce the user's waiting time.
[0116] The embodiment of the present invention mainly reduces the process startup time by bypassing GRUB booting through kernel camouflage, adjusting the loading order of necessary drivers in the system as needed, and performing a fast startup mode after the important system services are loaded on the boot login interface. It not only adjusts the loading order, but also includes reducing unnecessary startup loads, optimizing resource allocation and improving the response speed of the system, thereby accelerating the startup speed of the Linux system and further improving the actual user experience.
[0117] See also Figure 4 , Figure 4 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 4As shown, the electronic device 1000 includes a processor 1001 and a memory 1002, and the processor 1001 and the memory 1002 can be connected to each other via a communication bus 1003. The communication bus 1003 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 1003 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The memory 1002 is used to store computer programs. The computer programs include program instructions. The processor 1001 is configured to call the program instructions. The program includes instructions for executing Figure 1-3 Any of the figures may contain some or all of the steps in the method.
[0118] The processor 1001 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
[0119] The memory 1002 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0120] The electronic device 1000 may further include a communication module 1004 and a display 1005. The communication module 1004 may be connected to the optical tracking device for communication. The communication module 1004 may be a wireless communication module (eg, a WiFi module, a Bluetooth module, etc.) or a wired communication module.
[0121] In addition, the electronic device 1000 may also include common components such as a communication interface (eg, a USB interface, a microphone interface, etc.), an antenna, etc., which will not be described in detail here.
[0122] An embodiment of the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any one of the Linux quick startup methods recorded in the above method embodiments.
[0123] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0124] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0125] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which 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, and the indirect coupling or communication connection of the device or unit can be electrical or other forms.
[0126] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0127] In addition, the functional units in the various embodiments of the application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of software program modules.
[0128] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0129] A person skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable memory, which may include a flash drive, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.
[0130] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
[0131] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments 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 principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A method for realizing fast startup of a Linux system, characterized in that: The method comprises: Read the parameters of the UEFI boot item of the system BIOS and enter the fast boot mode according to the parameters of the UEFI boot item; In the fast boot mode, the Linux kernel is loaded through a specified path, and the UEFI boot parameters of the kernel are passed to the Linux kernel; Load the optimized driver according to the blacklist information set by the optimization policy; Optimize system services and load the optimized system services; Display the Linux system login interface.
2. The method for implementing Linux fast startup according to claim 1, characterized in that: The method further comprises: Obtaining blacklist information set according to the optimization strategy, wherein the blacklist includes drivers that are delayed in loading; The loading of the optimized driver includes loading a driver outside the blacklist.
3. The method for implementing Linux fast startup as claimed in claim 2, characterized in that: The optimization strategy specifically includes analyzing the kernel startup log and adding the driver whose usage time exceeds a threshold and does not affect the normal startup of the kernel to a blacklist.
4. The method for implementing Linux fast startup according to any one of claims 1 to 3, characterized in that: The method further comprises: Integrate the blacklisted driver into the systemd service to create a new systemd service, load the new systemd service.
5. The method for implementing Linux fast startup according to claim 1, characterized in that: The optimization of system services specifically includes: Analyze the dependencies and running time of all services, and adjust the startup order of each service based on the analysis results.
6. The method for implementing Linux fast startup as claimed in claim 5, characterized in that: The analysis of dependencies and running time of all services specifically includes: Use the systemd-analyze and systemctl tools provided by the operating system to give the time required for each system service to start and their interdependencies; Clean up the dependent services of the lightdm service, and remove the dependencies for services that may not have dependencies; For services that lightdm must depend on, the service is loaded through a parallel mechanism.
7. The method for implementing Linux fast startup as claimed in claim 4, characterized in that: The method further comprises: Use the boot item command in the UEFI boot parameters to prioritize the fast boot mode.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is enabled to perform the method according to any one of claims 1 to 7.
Citation Information
Cited By
Peripheral extension method and system for robot with body
CN120190841A
A peripheral expansion method and system for embodied robots
CN120190841B
