A system startup method and apparatus
By outputting an interactive menu in the embedded device and detecting the user's selected boot method, the problem of differences in boot methods under different processor architectures is solved, enabling Linux system booting with low learning cost, simplifying the development process and improving system stability.
Patent Information
- Application Number
- CN202210962987.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-11
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-08-11
AI Technical Summary
Existing embedded devices require specific boot methods due to the different processor architectures they use, which means developers need to understand multiple operating methods, increasing the learning burden and difficulty of getting started.
A system boot method is provided, which outputs an interactive menu when the system boots, detects the boot method selected by the user, and extracts the boot loader and system boot files from the image partition based on the selected method to achieve the booting of the Linux system.
It eliminates the differences between different startup methods, reduces the learning burden for developers, simplifies system operation, improves the stability and versatility of system startup, and lowers the learning curve.
Smart Images

Figure CN115269026B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a system startup method and apparatus. Background Technology
[0002] Currently, embedded devices based on the Linux operating system have occupied a large share of the market. However, these existing embedded devices typically do not use the same processor architecture, which means that each processor architecture requires a specific boot method to start the Linux operating system.
[0003] However, in practice, it has been found that this situation forces developers to learn all the operation methods and interaction modes, which greatly increases the learning burden for developers and raises the entry difficulty of this industry. Summary of the Invention
[0004] The purpose of this application is to provide a system startup method and apparatus that can shield the differences between different startup methods, thereby significantly reducing the learning burden for developers and lowering the entry barrier for this industry.
[0005] The first aspect of this application provides a system startup method, including:
[0006] An interactive menu is displayed when system startup is detected;
[0007] Detect the launch method selected by the user based on the interactive menu;
[0008] Based on the aforementioned boot method, the boot files are extracted from the first image partition, and the system boot files are extracted from the second image partition based on the aforementioned boot method.
[0009] The Linux system is started based on the boot loader file and the system boot file.
[0010] In the above implementation process, this method can prioritize outputting an interactive menu when system startup is detected. This allows the user to easily select a boot method, shielding them from detailed developer intervention and simplifying the system for easier operation. Furthermore, the method can detect the boot method selected by the user through the interactive menu. This increases user flexibility and ensures diverse boot options. Next, the method extracts the boot file from the first image partition and the system boot file from the second image partition based on the boot method. This allows obtaining the necessary boot files from both image partitions, facilitating subsequent steps to boot the system from the boot file, ensuring targeted booting and improving system stability. Finally, the method can boot the Linux system from the boot file and system boot file. This hides the entire boot process within the method, enabling seamless and user-friendly startup and facilitating subsequent system operations. In summary, this method can mask the differences between different startup methods, thereby significantly reducing the learning burden for developers and lowering the entry barrier for this industry.
[0011] Furthermore, the boot methods include at least uboot boot method and grub boot method; the uboot boot method and the grub boot method correspond to different boot files and system boot files.
[0012] In the above implementation, the boot methods include at least uboot and grub boot; uboot and grub boot correspond to different boot files and system boot files. It is evident that this method allows Linux to boot through at least these two methods, with the specific boot method stored as a file within the image. This allows users to boot Linux without needing to know how to boot from scratch, thus achieving a low-learning-cost dual-boot method for Linux.
[0013] Furthermore, the steps for starting the Linux system based on the boot loader file and the system boot file include:
[0014] The system boot file is booted based on the boot file to start the Linux system.
[0015] In the above implementation process, this method, in the process of starting the Linux system based on the boot loader and system boot files, specifically boots the system boot file based on the boot loader to enable the Linux system to start. It can be seen that this method specifically drives the system boot file based on the boot loader, and its effect is to enable the Linux system to start accurately and stably during the boot process.
[0016] Furthermore, before detecting system startup, the method includes:
[0017] Create a first image partition in FAT16 format and a second image partition in ext4 format; the first image partition is used to store boot files, and the second image partition is used to store system boot files;
[0018] Set an interactive menu script in the second mirror partition; the interactive menu script is used to output an interactive menu when the system starts up.
[0019] In the above implementation process, before detecting the system startup step, this method can pre-create a first image partition in FAT16 format and a second image partition in ext4 format. This demonstrates that the method can pre-format the first and second image partitions differently, allowing different partition formats to better accommodate different stored files, thereby improving subsequent file retrieval and ultimately enhancing the system startup process. Furthermore, the method can set an interactive menu script in the second image partition. This ensures that the Linux system startup will always output an interactive menu, which is then used to call the first image partition. This balanced approach between the first and second image partitions improves system startup stability.
[0020] Furthermore, the step of setting the interactive menu script in the second mirror partition includes:
[0021] The Linux system kernel is compiled to obtain the kernel file and device tree file;
[0022] Based on Busybox, the startup script in the root file system is modified; the modified root file system can call the preset interactive menu script and output the interactive menu when the system starts.
[0023] The kernel file, the device tree file, the root file system, and the interactive menu script are set in the second image partition.
[0024] In the above implementation process, during the setting of the interactive menu script in the second image partition, this method prioritizes compiling the Linux system kernel to obtain the kernel file and device tree file. This demonstrates that the method can obtain the files necessary for system startup, thus ensuring stable system boot. Then, the method can further compile Busybox and modify the startup script in its root file system based on the compilation result. This allows the modified root file system to call the preset interactive menu script and output the interactive menu during system startup. Finally, the method can also set the kernel file, device tree file, root file system, and interactive menu script in the second image partition, enabling the system to output the interactive menu based on the modified startup script during startup, thereby achieving interactive menu script output and facilitating user operation.
[0025] Furthermore, after the step of detecting the launch method selected by the user based on the interactive menu, the method further includes:
[0026] If no boot method selected by the user based on the interactive menu is detected within the preset time, the Linux system will be started normally based on the system boot files in the second image partition.
[0027] In the above implementation, after detecting the user's selected boot method from the interactive menu, this method can, if no boot method is detected within a preset time, start the Linux system normally based on the system boot files in the second image partition. Therefore, this method can detect whether the user has performed an operation; if so, it assumes the user has selected a boot mode; if not, it assumes the user has not selected a boot mode, thus directly starting the corresponding Linux system and ensuring stable booting of the Linux system.
[0028] A second aspect of this application provides a system startup device, the system startup device comprising:
[0029] The output unit is used to output an interactive menu when system startup is detected.
[0030] The detection unit is used to detect the launch method selected by the user based on the interactive menu;
[0031] The extraction unit is used to extract the boot files from the first image partition based on the boot method, and to extract the system boot files from the second image partition based on the boot method.
[0032] The boot unit is used to start the Linux system based on the boot file and the system boot file.
[0033] In the above implementation process, the device can output an interactive menu when the system starts up, through the output unit. This allows the device to output an interactive menu that facilitates user selection of the boot method, thus shielding developers from detailed system operations and simplifying the system for developers to perform other operations. Furthermore, the device can detect the boot method selected by the user based on the interactive menu through the detection unit. This allows the device to execute the corresponding boot process by detecting user input commands, thereby increasing user flexibility and ensuring diverse boot options. Next, the device can extract the boot boot file from the first image partition based on the boot method, and extract the system boot file from the second image partition based on the boot method. This allows the device to obtain the necessary boot files and corresponding boot-related files from the two image partitions, facilitating subsequent steps to boot the system based on the boot boot file, ensuring targeted booting and improving system stability. Finally, the device can also boot a Linux system based on the boot loader and system boot files via the boot unit. As can be seen, this device can boot a Linux system using corresponding files from two images, thus hiding the entire boot process within the device itself, achieving a seamless and efficient boot process for the user, and facilitating subsequent system operations. In summary, this device can shield the differences between different boot methods, significantly reducing the learning burden for developers and lowering the entry barrier for this industry.
[0034] Furthermore, the boot methods include at least uboot boot method and grub boot method; the uboot boot method and the grub boot method correspond to different boot files and system boot files.
[0035] In the above implementation, the boot methods include at least uboot and grub; uboot and grub correspond to different boot files and system boot files. This configuration ensures that Linux can boot using at least these two methods, with the specific boot method stored as a file within the image. This allows users to boot Linux without needing to know how to boot from scratch, thus achieving a low-learning-cost dual-boot method for Linux.
[0036] Furthermore, the boot unit is specifically used to boot the system boot file based on the boot boot file, so as to enable the Linux system to start.
[0037] In the above implementation process, the device can boot the system boot file based on the boot boot file through the boot unit, thereby enabling the Linux system to start. It is evident that the device specifically drives the system boot file based on the boot boot file, and its effect is to enable the Linux system to start accurately and stably during the boot process.
[0038] Furthermore, the system startup device also includes:
[0039] The production unit is used to create a first image partition in FAT16 format and a second image partition in ext4 format before the system startup step is detected; the first image partition is used to store the boot files, and the second image partition is used to store the system startup files;
[0040] The setting unit is used to set an interactive menu script in the second image partition; the interactive menu script is used to output an interactive menu when the system startup is detected.
[0041] In the above implementation process, the device can create a first image partition in FAT16 format and a second image partition in ext4 format before detecting the system startup step. This demonstrates that the device can pre-format the first and second image partitions differently, allowing different partition formats to better accommodate different stored files, thereby improving subsequent file retrieval and ultimately enhancing the system startup process. Then, the device sets an interactive menu script in the second image partition through a setting unit. This ensures that the Linux system startup will always output an interactive menu, which is then used to call the first image partition. This balanced approach between the first and second image partitions improves system startup stability.
[0042] Furthermore, the setting unit includes:
[0043] The compilation subunit is used to compile the Linux system kernel to obtain the kernel file and device tree file;
[0044] Modify the subunit for compilation based on Busybox, and modify the startup script in the root file system; the modified root file system can call the preset interactive menu script and output the interactive menu when the system starts.
[0045] The configuration subunit is used to set the kernel file, the device tree file, the root file system, and the interactive menu script in the second image partition.
[0046] In the above implementation process, the device can compile the Linux system kernel through the compilation subunit to obtain the kernel file and device tree file. This demonstrates that the device can obtain the files necessary for system startup, thus ensuring stable system boot. Then, the device can continue compiling Busybox through the modification subunit and modify the startup script in its root file system based on the compilation result. This allows the modified root file system to call a preset interactive menu script and output an interactive menu during system startup. Finally, the device can also set the kernel file, device tree file, root file system, and interactive menu script in the second image partition through the setting subunit, so that the system outputs an interactive menu based on the modified startup script during startup, thereby realizing interactive menu script output and facilitating user operation.
[0047] Furthermore, the startup unit is also used to start the Linux system normally based on the system startup file in the second image partition if no startup method selected by the user based on the interactive menu is detected within a preset time after the step of detecting the startup method selected by the user based on the interactive menu.
[0048] In the above implementation process, after the boot unit detects the user's selected boot method based on the interactive menu, and if no boot method is detected within a preset time, the device will normally boot the Linux system based on the system boot files in the second image partition. Therefore, the device can detect whether the user has performed an operation; if so, it assumes the user has selected a boot mode; if not, it assumes the user has not selected a boot mode, and thus directly boots the corresponding Linux system, thereby ensuring a stable Linux system startup.
[0049] A third aspect of this application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to cause the electronic device to perform a system startup method according to any one of the first aspects of this application.
[0050] The fourth aspect of this application provides a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the system startup method of any one of the first aspects of this application. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 A flowchart illustrating a system startup method provided in an embodiment of this application;
[0053] Figure 2 This is a schematic diagram of the structure of a system startup device provided in an embodiment of this application;
[0054] Figure 3 This is a schematic diagram illustrating an example of a first mirror partition and a second mirror partition provided in an embodiment of this application;
[0055] Figure 4 This is a schematic diagram illustrating a file example of a second mirror partition provided in an embodiment of this application;
[0056] Figure 5 The content of a boot.scr script provided in an embodiment of this application;
[0057] Figure 6 This is a schematic diagram of a first mirror partition file structure provided in an embodiment of this application. Detailed Implementation
[0058] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0059] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0060] Example 1
[0061] Please refer to Figure 1 , Figure 1 This embodiment provides a flowchart illustrating a system startup method. The system startup method includes:
[0062] S101. Create a first image partition in FAT16 format and a second image partition in ext4 format; the first image partition is used to store the boot files, and the second image partition is used to store the system boot files.
[0063] In this embodiment, the method can pre-create an IMG image (bootmenu.img) and divide it into two partitions. The first partition (i.e., the first image partition) is formatted as FAT16 and is used to store system boot-related configuration files; the second partition (i.e., the second image partition) is formatted as ext4 and is used to store system kernel, root file system, device tree, menu scripts, and other files.
[0064] In this embodiment, the boot file is a system startup-related configuration file.
[0065] In this embodiment, the system startup files include the system kernel, root file system, device tree, menu scripts, and other files.
[0066] Please refer to Figure 3 , Figure 3 This diagram illustrates an example of creating a first mirror partition in FAT16 format and a second mirror partition in ext4 format.
[0067] S102. Compile the Linux system kernel to obtain the kernel file and device tree file.
[0068] In this embodiment, the method can compile the Linux kernel to obtain the kernel file kernel and the device tree file dtb, which are necessary for device startup.
[0069] S103. Based on Busybox compilation, modify the startup script in the root file system; the modified root file system can call the preset interactive menu script when the system starts and output the interactive menu.
[0070] In this embodiment, the method can compile busybox to create the root file system initrd.gz and modify the startup script rcS so that it can call the interactive menu script bootmenu.sh during the startup phase.
[0071] S104. Set the kernel file, device tree file, root file system, and interactive menu script to the second image partition.
[0072] In this embodiment, this step can place kernel, dtb, and initrd.gz into the second image partition.
[0073] Please refer to Figure 4 , Figure 4 The diagram shows an example of files in the second mirror partition.
[0074] In this embodiment, the interactive menu script is used to output an interactive menu when the system startup is detected.
[0075] In this embodiment, the method can place the interactive menu script bootmenu.sh in the second image partition.
[0076] In this embodiment, after the IMG image is created, the completed image can be burned to the device storage medium.
[0077] S105. When system startup is detected, an interactive menu is output.
[0078] In this embodiment, upon system startup, the menu system calls the interactive menu script bootmenu.sh to output the interactive menu to the serial port. As an intermediate layer, the menu system can shield the operational differences between different boot methods.
[0079] S106. Detect the startup method selected by the user based on the interactive menu, and execute steps S107 to S108 or execute step S109.
[0080] In this embodiment, the boot methods include at least uboot boot mode and grub boot mode; uboot boot mode and grub boot mode correspond to different boot files and system boot files.
[0081] S107. Extract the boot files from the first image partition based on the boot method, and extract the system boot files from the second image partition based on the boot method.
[0082] S108. Boot the system from the boot loader file to start the Linux system and then terminate this process.
[0083] In this embodiment, if the boot method is uboot boot, the method does not modify the source code, but reads the boot script boot.scr from the first partition to modify the uboot environment variables, thereby booting the system.
[0084] Please see Figure 5 , Figure 5 The contents of a boot.scr script are shown.
[0085] In this embodiment, if the boot method is GRUB boot, the method does not modify the source code. Instead, it places the GRUB-related files in the first image partition, modifies the GRUB.cfg configuration file, and then boots from the second image partition.
[0086] In this embodiment, the first image partition stores the files required for various boot methods, so an IMG image can support multiple boot methods.
[0087] Please refer to Figure 6 , Figure 6 A schematic diagram of a first-image partition file structure is shown.
[0088] S109. If no boot method selected by the user based on the interactive menu is detected within the preset time, the Linux system is started normally based on the system boot file in the second image partition.
[0089] In this embodiment, the method can perform different operations according to the user's needs; if the user does not perform an operation within the timeout period, the system will continue to start; if an operation option is selected, the logic selected by the user will be executed.
[0090] In this embodiment, the method provides a way to shield the operational differences between different boot methods and provide a unified style interactive menu when a device using different boot methods (such as redboot, uboot, grub) starts by launching a menu system call interactive menu script.
[0091] For example, this method can provide a unified interactive menu interface, as illustrated in the following example process:
[0092] ① Create an IMG format image and format two partitions;
[0093] ② The first partition stores grub and boot.scr, and can support both uboot and grub boot methods;
[0094] ③ The second partition stores files such as kernel, dtb, initrd.gz, and bootmenu.sh;
[0095] ④ When the device uses uboot, the device needs boot.scr from the first partition of the IMG image, and kernel, dtb, initrd.gz, and bootmenu.sh from the second partition to boot.
[0096] ⑤ When the device uses grub, the device boot requires grub from the first partition of the IMG image, and kernel, initrd.gz, and bootmenu.sh from the second partition;
[0097] ⑥ The above-mentioned menu system, created using an IMG image, serves as an intermediate layer, achieving a unified interaction style and shielding the operational differences between uboot and grub boot methods.
[0098] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0099] As can be seen, implementing the system startup method described in this embodiment can reduce the overall development difficulty without modifying the source code of the boot method. Furthermore, this method can shield the operational differences between different boot methods by providing a unified interactive menu. In addition, this method can significantly reduce the impact of changes in boot method versions and eliminates the need for code re-porting. Finally, this method uses an IMG format image, which facilitates file replacement when developing for different devices, thereby enabling rapid development.
[0100] Example 2
[0101] Please refer to Figure 2 , Figure 2 This is a schematic diagram of a system startup device provided in this embodiment. Figure 2 As shown, the system startup device includes:
[0102] Output unit 210 is used to output an interactive menu when system startup is detected;
[0103] Detection unit 220 is used to detect the launch method selected by the user based on the interactive menu;
[0104] Extraction unit 230 is used to extract boot files from the first image partition based on the boot method, and extract system boot files from the second image partition based on the boot method;
[0105] The boot unit 240 is used to boot the Linux system based on the boot loader file and the system boot file.
[0106] In this embodiment, the boot methods include at least uboot boot mode and grub boot mode; uboot boot mode and grub boot mode correspond to different boot files and system boot files.
[0107] As an optional implementation, the boot unit 240 is specifically used to boot the system boot file based on the boot boot file so that the Linux system can start.
[0108] As an optional implementation, the system startup device further includes:
[0109] The production unit 250 is used to create a first image partition in FAT16 format and a second image partition in ext4 format before the system startup step is detected; the first image partition is used to store the boot files, and the second image partition is used to store the system startup files;
[0110] Setting unit 260 is used to set an interactive menu script in the second mirror partition; the interactive menu script is used to output an interactive menu when the system startup is detected.
[0111] As an optional implementation, the setting unit 260 includes:
[0112] Compilation subunit 261 is used to compile the kernel of the Linux system to obtain the kernel file and device tree file;
[0113] Modify subunit 262 for compilation based on busybox, and modify the startup script in the root file system; the modified root file system can call the preset interactive menu script and output the interactive menu when the system starts.
[0114] Set subunit 263 to set the kernel file, device tree file, root file system, and interactive menu script in the second image partition.
[0115] As an optional implementation, the startup unit 240 is also used to start the Linux system normally based on the system startup file in the second image partition if no startup method selected by the user based on the interactive menu is detected within a preset time after the step of detecting the startup method selected by the user based on the interactive menu.
[0116] In this embodiment, the explanation of the system startup device can be referred to the description in Embodiment 1, and will not be repeated here.
[0117] As can be seen, implementing the system startup device described in this embodiment can reduce the overall development difficulty without modifying the source code of the boot method. Furthermore, the device can shield the operational differences between different boot methods by providing a unified interactive menu. In addition, the device can significantly reduce the impact of changes in boot method versions without requiring code re-porting. Finally, the device uses an IMG format image, which facilitates file replacement when developing for different devices, thereby enabling rapid development.
[0118] This application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to enable the electronic device to execute the system startup method in embodiment 1 of this application.
[0119] This application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the system startup method in embodiment 1 of this application is performed.
[0120] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0121] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0122] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0123] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0124] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0125] It should be noted that, in this document, relational terms such as "first" and "second" 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.
Claims
1. A system startup method, characterized in that, include: An interactive menu is displayed when system startup is detected; Detect the launch method selected by the user based on the interactive menu; Based on the aforementioned boot method, the boot files are extracted from the first image partition, and the system boot files are extracted from the second image partition based on the aforementioned boot method. Start the Linux system based on the boot file and the system boot file; The boot methods include at least uboot boot and grub boot; the uboot boot and grub boot methods correspond to different boot files and system boot files.
2. The system startup method according to claim 1, characterized in that, The steps for starting the Linux system based on the boot loader file and the system boot file include: The system boot file is booted based on the boot file to start the Linux system.
3. The system startup method according to claim 1, characterized in that, Before detecting system startup, the method includes: Create a first image partition in FAT16 format and a second image partition in ext4 format; the first image partition is used to store boot files, and the second image partition is used to store system boot files; Set an interactive menu script in the second mirror partition; the interactive menu script is used to output an interactive menu when the system starts up.
4. The system startup method according to claim 3, characterized in that, The steps for setting the interactive menu script in the second mirror partition include: The Linux system kernel is compiled to obtain the kernel file and device tree file; Based on Busybox, the startup script in the root file system is modified; the modified root file system can call the preset interactive menu script and output the interactive menu when the system starts. The kernel file, the device tree file, the root file system, and the interactive menu script are set in the second image partition.
5. The system startup method according to claim 1, characterized in that, After the step of detecting the user's selected launch method based on the interactive menu, the method further includes: If no boot method selected by the user based on the interactive menu is detected within the preset time, the Linux system will be started normally based on the system boot files in the second image partition.
6. A system startup device, characterized in that, The system startup device includes: The output unit is used to output an interactive menu when system startup is detected. The detection unit is used to detect the launch method selected by the user based on the interactive menu; The extraction unit is used to extract the boot files from the first image partition based on the boot method, and to extract the system boot files from the second image partition based on the boot method. A boot unit is used to boot the Linux system based on the boot file and the system boot file; The boot methods include at least uboot boot and grub boot; the uboot boot and grub boot methods correspond to different boot files and system boot files.
7. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the system startup method of any one of claims 1 to 5.
8. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the system startup method of any one of claims 1 to 5.
Citation Information
Patent Citations
Storage-based operating system guiding method and system, terminal and storage medium
CN114385251A