Operating system switching methods, chips and devices
By using the same bootloader and kernel on the computing device, and directly jumping to the container of the operating system to be started using the boot configuration parameters in the storage medium, the problem of excessively long operating system switching time is solved, achieving fast and efficient operating system switching and improving the user experience.
Patent Information
- Application Number
- CN202311871807.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-12-29
AI Technical Summary
In existing technologies, operating system switching takes too long, resulting in low switching efficiency and affecting user experience.
By using the same bootloader and kernel on the computing device, the container that is about to start the operating system can be directly jumped to run using the boot configuration parameters in the storage medium, avoiding the need to restart the bootloader and kernel, thus achieving a fast operating system switch.
It shortens the operating system switching time, improves switching efficiency, and enhances the user experience.
Smart Images

Figure CN117873580B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an operating system switching method, chip, and device. Background Technology
[0002] In related technologies, when a computing device is running its current operating system and needs to switch operating systems, it typically reverts to a read-only memory (ROM) bootloader. Then, according to the partition address indicated by the ROM bootloader, the bootloader, kernel, root file system, applications, etc., of the operating system to be booted are loaded sequentially, thus enabling the booting of the operating system. In this case, the operating system switching takes a particularly long time, resulting in extremely low efficiency and severely impacting the user experience. Summary of the Invention
[0003] This application provides an operating system switching method, chip, and device, which helps to shorten the time consumed by operating system switching, improve the efficiency of operating system switching, and thus improve the user experience.
[0004] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0005] In a first aspect, an operating system switching method is provided for a computing device, the computing device including a first operating system and a second operating system, the first operating system including a container of the first operating system, the second operating system including a container of the second operating system, the first operating system and the second operating system using the same bootloader, kernel and memory file system; the method includes: loading a bootloader and kernel to run the container of the first operating system; when a target event is detected, switching from the container of the first operating system to run the memory file system; determining boot configuration parameters based on the identifier of the container of the first operating system, and writing the boot configuration parameters into the storage medium of the computing device, the boot configuration parameters being used to indicate the container of the operating system to be booted, the container of the operating system to be booted being either the container of the first operating system or the container of the second operating system; and switching from the memory file system to run the container of the operating system to be booted based on the boot configuration parameters.
[0006] In this scheme, when the computing device is running the first operating system, if a target event is detected, it indicates that a switch to the operating system is required. Based on this, the computing device jumps from the container of the first operating system to the running memory file system, and writes the boot configuration parameters, determined by the identifier of the container of the first operating system, into the storage medium. Then, based on the boot configuration parameters in the storage medium indicating the container of the operating system to be booted, the device directly jumps from the memory file system to run the container of the operating system to be booted. Since the boot configuration parameters are determined based on the identifier of the currently running operating system container and written to the storage medium, the container of the operating system to be booted can be determined using the boot configuration parameters in the storage medium when needed. This not only improves the convenience of determining the container of the operating system to be booted, but also helps to improve the accuracy of the determined container of the operating system to be booted. Furthermore, since the first and second operating systems use the same bootloader, kernel, and memory file system, after the computing device determines the container of the operating system to be started based on the boot configuration parameters, it can directly jump from the memory file system of the first operating system to run the container of the operating system to be started without restarting the bootloader and kernel, that is, without having to fall back to the ROM bootloader. This achieves fast startup of the operating system to be started, which helps to shorten the time consumed by operating system switching, improve the efficiency of operating system switching, and thus improve the user experience.
[0007] In one possible implementation, the storage medium includes a volatile storage medium; writing the boot configuration parameters into the storage medium of the computing device includes: if the system switch type is container switch, writing the boot configuration parameters into the volatile storage medium; the container switch is used to indicate that a container of the operating system to be started is loaded during the system switch process.
[0008] In this implementation, when the system switch type is container switch, the computing device will not be powered off. In other words, the data in the volatile storage medium of the computing device will not be lost. By storing the startup configuration parameters in the volatile storage medium, it not only helps to ensure that the startup configuration parameters can be read during this system switch, but also automatically clears the startup configuration parameters in the volatile storage medium during the subsequent power-down process of the computing device, avoiding the startup configuration parameters occupying storage space for a long time and affecting the normal operating system startup process.
[0009] In another possible implementation, the storage medium also includes a non-volatile storage medium; writing the boot configuration parameters into the storage medium of the computing device includes: if the system switch type is a non-container switch, writing the boot configuration parameters into the non-volatile storage medium; the non-container switch is used to indicate the loading of the bootloader and kernel during the system switch process.
[0010] In this implementation, when the system switching type is non-container switching, the boot configuration parameters are stored in a non-volatile storage medium. This helps to avoid the loss of boot configuration parameters when jumping to run the ROM boot program, thereby helping to ensure the smooth execution of the operating system switching process.
[0011] In another possible implementation, the non-volatile storage medium includes a raw partition of the computing device or user flash memory (UFM). This helps to make full use of the storage space on different storage media within the computing device.
[0012] Another possible implementation involves determining the startup configuration parameters based on the container's identifier within the first operating system. This includes identifying the container's identifier as the startup configuration parameter. This helps improve the efficiency of writing the startup configuration parameters.
[0013] In another possible implementation, the boot configuration parameters are determined based on the identifier of the container in the first operating system, including: determining the identifier of the container in the second operating system as the boot configuration parameter based on the identifier of the container in the first operating system. This helps improve the efficiency of switching operating systems based on boot configuration parameters.
[0014] In another possible implementation, the occurrence of a target event is detected, including: the detection of a system switch request.
[0015] In this implementation, when a system switch request is received, the system jumps to the running memory file system. In this way, users can send a system switch request to the computing device to trigger the operating system switch. This not only helps to increase the diversity of ways to trigger the operating system switch, but also helps to improve the user experience.
[0016] In another possible implementation, the occurrence of a target event is detected, including: the system upgrade is detected as complete.
[0017] In this implementation, after the system upgrade operation is completed, the system automatically switches to the running memory file system, thereby automatically switching to the upgraded operating system after the upgrade is finished. This eliminates the need for the user to manually trigger the operating system switch, which not only improves the convenience of system switching after the upgrade but also enhances the user experience.
[0018] Another possible implementation involves multiple operating systems using the same bootloader and kernel, including different operating systems within multiple operating systems sharing the same bootloader and kernel.
[0019] In this implementation, when a computing device is configured with multiple operating systems, the different operating systems within these multiple operating systems share the same bootloader and kernel. This helps to reduce the storage space occupied when a computing device is configured with multiple operating systems.
[0020] In another possible implementation, multiple operating systems use the same bootloader and kernel, including: the bootloader code and kernel code of different operating systems in multiple operating systems are the same.
[0021] In this implementation, by setting the bootloader code and kernel code of different operating systems to be the same, not only can each operating system use the bootloader and kernel of other operating systems, but it also helps to ensure the integrity of each operating system.
[0022] Secondly, an operating system switching apparatus is provided, comprising: functional units for executing any of the methods provided in the first aspect, wherein the actions performed by each functional unit are implemented by hardware or by hardware executing corresponding software. For example, the operating system switching apparatus may include a running module, a jump module, a configuration module, and a switching module; the running module is used to load a bootloader and a kernel to run a container of a first operating system; the jump module is used to jump from the container of the first operating system to a running memory file system when a target event is detected; the configuration module is used to determine boot configuration parameters based on the identifier of the container of the first operating system and write the boot configuration parameters into the storage medium of a computing device, wherein the boot configuration parameters indicate the container of the operating system to be booted, and the container of the operating system to be booted is either a container of the first operating system or a container of the second operating system; and the switching module is used to jump from the memory file system to run the container of the operating system to be booted based on the boot configuration parameters.
[0023] Thirdly, a chip is provided, comprising: a processor and a memory, the processor being connected to the memory; the memory being used to store computer execution instructions, and the processor executing the computer execution instructions stored in the memory to cause the chip to implement any of the methods provided in the first aspect.
[0024] Fourthly, a chip is provided, comprising: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to execute the code instructions to perform any of the methods provided in the first aspect above.
[0025] Fifthly, a computer device is provided, comprising: a power supply and a chip provided by a third or fourth aspect, wherein the power supply is used to power the chip, and the chip is used to implement any of the methods provided by the first aspect.
[0026] In a sixth aspect, a computer-readable storage medium is provided, storing computer-executable instructions that, when executed on a computer, cause the computer to perform any of the methods provided in the first aspect above.
[0027] In a seventh aspect, a computer program product is provided, comprising: computer execution instructions that, when executed on a computer, cause the computer to perform any of the methods provided in the first aspect above.
[0028] The technical effects of any of the implementation methods in aspects two through seven can be found in the technical effects of different implementation methods in aspect one, and will not be repeated here. Attached Figure Description
[0029] Figure 1 A schematic diagram of a computing device provided in an embodiment of this application;
[0030] Figure 2 A hierarchical diagram of a BMC unit provided in an embodiment of this application;
[0031] Figure 3 A flowchart illustrating an operating system switching method provided in this application embodiment;
[0032] Figure 4 A schematic diagram of an interface provided for an embodiment of this application;
[0033] Figure 5 A flowchart illustrating another operating system switching method provided in this application embodiment;
[0034] Figure 6 A schematic diagram illustrating storage startup configuration parameters provided in an embodiment of this application;
[0035] Figure 7 This application provides a schematic diagram illustrating the configuration for operating system startup in an embodiment.
[0036] Figure 8 This is a schematic diagram of an operating system switching device provided in an embodiment of this application. Detailed Implementation
[0037] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0038] In the description of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can mean A or B. "And / or" in this application is merely a description of the relationship between the related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. A and B can be singular or plural.
[0039] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0040] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" are not necessarily different. Meanwhile, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is being used as an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.
[0041] The following is a brief introduction to the relevant terms used in the embodiments of this application.
[0042] Containers are a type of virtualization technology in computer operating systems. They can be used to encapsulate and isolate the runtime environments of different applications, thus separating the applications from the operating system. This allows the applications to access only temporarily assigned resources and prevents them from accessing the actual files and folders that exist on the operating system.
[0043] In this embodiment of the application, the container may include a root file system, a system daemon, and applications, etc.
[0044] Partitioning, also known as operating system partitioning or system partitioning, refers to dividing the storage space of a storage device into different sections. Storage devices storing the operating system can be divided into different partitions according to the functional characteristics of the operating system, such as partitions for the boot loader (e.g., uboot), the kernel (e.g., kernel), the root file system (e.g., rootfs), and application partitions.
[0045] In this embodiment of the application, the partition may include a partition for the bootloader, a partition for the kernel, and a partition for the container, etc.
[0046] Root file system (e.g., rootfs): used for managing and storing files.
[0047] Memory file system (ramfs): This is the basic file system launched by the operating system kernel, used for switching containers, mounting / unmounting partitions, system restarts, and interacting with the processor.
[0048] The `change root` (chroot) command is used to change the root directory to a specified directory, that is, to switch the program's runtime environment to the specified directory. After the switch, the old root directory structure and files will not be accessible in the new runtime environment. For example, the `chroot` command can switch from a ramfs environment to the root directory environment of a specified container.
[0049] System daemon (systemd): A process used to start applications and constrain the pre- and post-start dependencies of each application.
[0050] Applications: also known as services, are used to implement relatively independent functions. Different applications can communicate with each other through inter-process communication.
[0051] The following provides an exemplary description of the application scenarios of the embodiments of this application.
[0052] In related technologies, when a computing device is running its current operating system and needs to switch operating systems, it typically reverts to a ROM bootloader. Then, according to the partition address indicated by the ROM bootloader, the bootloader, kernel, root file system, applications, etc., of the operating system to be booted are loaded sequentially, thereby restarting the operating system. In this case, the operating system switching takes a particularly long time, resulting in extremely low efficiency and severely impacting the user experience.
[0053] In view of this, this application provides an operating system switching method for a computing device. When the computing device is running a first operating system, if a target event is detected, it indicates that the operating system needs to be switched. Based on this, the computing device jumps from the container of the first operating system to the running memory file system, and determines the startup configuration parameters based on the identifier of the container of the first operating system, writing them into the storage medium. Then, based on the startup configuration parameters in the storage medium indicating the container of the operating system to be started, the device directly jumps from the memory file system to run the container of the operating system to be started. Since the startup configuration parameters are determined based on the identifier of the container of the currently running operating system and written to the storage medium, when it is necessary to determine the container of the operating system to be started, it can be determined through the startup configuration parameters in the storage medium. This not only improves the convenience of determining the container of the operating system to be started, but also helps to improve the accuracy of the determined container of the operating system to be started.
[0054] The system architecture of the embodiments of this application will be described below as an example.
[0055] The operating system switching method provided in this application is applicable to computing devices, which include at least one management unit. Each management unit may include a processor, memory, and storage devices. The storage device stores at least one operating system, and the processor can run the at least one operating system from the storage device via memory.
[0056] In this embodiment, each operating system in at least one operating system may include a bootloader, a kernel, and containers, etc. Each operating system's container may include a root file system, a system daemon, and at least one application, etc.
[0057] It should be noted that in the embodiments of this application, at least one can be one, or there can be multiple. Among them, multiple can be two, or there can be more than two, which will not be elaborated further.
[0058] The operating system switching method provided in this application is applicable to each management unit of a computing device. Each management unit can store the startup configuration parameters in the storage medium of each management unit when switching operating systems, so that the container of the operating system to be started can be directly determined according to the startup configuration parameters. Thus, it can directly switch from the memory file system of the currently running operating system to the container of the operating system to be started without restarting the bootloader, kernel and memory file system.
[0059] In this embodiment, each management unit may further include a read-only memory (ROM). The ROM stores a ROM bootloader. The ROM bootloader indicates the partition address of the bootloader in the storage device. Based on this, when the operating system starts, the management unit can run the ROM bootloader to jump to the operating system's bootloader based on the partition address indicated by the ROM bootloader, and jump to the kernel based on the kernel's partition address indicated by the bootloader, thereby restarting the operating system's bootloader and kernel. For example, the ROM may be embedded in the processor. For processors of the same model, the code in the ROM may be identical.
[0060] In this embodiment of the application, at least one management unit may include an in-band management unit and an out-of-band management unit.
[0061] For example, an in-band management unit refers to a unit used to implement in-band management, such as a central management unit. In-band management means that the management data of the computing device and the business data of the user are transmitted using the same physical channel.
[0062] For example, an out-of-band management unit refers to a unit used to implement out-of-band management, such as a board management controller (BMC) unit. Out-of-band management means that the management data of the computing device and the service data of the user are transmitted using different physical channels.
[0063] It should be noted that different computing devices may use different names for BMC. For example, some computing devices call it BMC, some call it iLO, and others call it iDRAC. Regardless of whether it is called BMC, iLO, or iDRAC, it can be understood as the BMC in this embodiment of the invention.
[0064] Alternatively, the computing device may include a network device or a terminal device.
[0065] Network devices can include servers. A server can be a single physical or logical server, or it can consist of two or more physical or logical servers that share different responsibilities and work together to perform various server functions. For example, a server can be a blade server, a high-density server, a rack server, or a tower server.
[0066] Terminal devices may include augmented reality (AR) devices, virtual reality (VR) devices, personal digital assistants (PDAs), ultra-mobile personal computers (UMPCs), tablets, laptops, netbooks, desktop computers, all-in-one computers, etc.
[0067] It should be noted that the embodiments of this application do not limit the form of the computing device; the above is merely an illustrative example.
[0068] like Figure 1 The diagram shown is a schematic of a computing device provided in an embodiment of this application.
[0069] For example, see Figure 1 The computing device may include a first management unit and a second management unit. The first management unit may be an out-of-band management unit, which may include a processor 1, a ROM 1, a memory 1, and a storage device 1, etc. The second management unit may be an in-band management unit, which may include a processor 2, a ROM 2, a memory 2, and a storage device 2, etc.
[0070] It needs to be explained that, Figure 1 The computing device shown is merely a structural schematic diagram of a computing device applicable to the embodiments of this application, and does not constitute a limitation on the computing device applicable to the embodiments of this application.
[0071] The following describes the embodiments of this application by taking the out-of-band management unit as an example of the BMC unit.
[0072] In this embodiment of the application, the BMC unit may include at least one operating system. Each of the at least one operating system may include a bootloader, a kernel, and a container.
[0073] When a BMC unit includes an operating system, that operating system may include a bootloader, a kernel, and containers. The containers include a root filesystem, a system daemon (systemd), and at least one application.
[0074] Based on this, an operating system is stored in multiple partitions of storage device 1. For example, the multiple partitions include partition 1, partition 2, and partition 3, where partition 1 stores the bootloader, partition 2 stores the kernel, and partition 3 stores the container.
[0075] It should be noted that the embodiments of this application do not limit the number of applications in the container.
[0076] When a BMC unit includes multiple operating systems, the bootloaders and kernels used by these operating systems are the same. Since the memory file system is kernel-based, if different operating systems use the same kernel, they will also use the same memory file system.
[0077] It should be noted that different operating systems use the same bootloader and kernel, and it can be considered that one operating system can be compatible with the bootloader and kernel of other operating systems.
[0078] The following examples, using methods 1 and 2, illustrate the use of the same bootloader and kernel. Method 1: Multiple operating systems share the same bootloader and kernel.
[0079] Different operating systems use different containers.
[0080] For example, the BMC unit includes M operating systems; that is, multiple partitions of storage device 1 store M operating systems, where M is a positive integer greater than 1. Since different operating systems use the same bootloader and kernel, that is, they share the same bootloader and kernel, the M operating systems can include one bootloader, one kernel, and M containers. Each container belongs to one operating system; in other words, different containers belong to different operating systems. A container within an operating system can include the root file system of that operating system, the system daemon (systemd), and applications.
[0081] This approach uses the same bootloader and kernel for different operating systems, which helps reduce the storage space occupied by multiple operating systems and thus saves storage resources.
[0082] For example, the storage device 1 may include M+2 partitions, wherein the M+2 partitions may be partition 1, partition 2, partition 3, ..., partition M+2, wherein partition 1 may be used to store the bootloader, partition 2 may be used to store the kernel, and partitions 3, ..., partition M+2 may be used to store M containers.
[0083] It should be noted that the applications in different containers can be the same or different, and this application embodiment does not impose any restrictions on this.
[0084] Method 2: Multiple operating systems use the same bootloader code and the same kernel code. However, each operating system uses a different container.
[0085] In other words, multiple operating systems have independent bootloaders and kernels; however, the bootloader code and kernel code used by different operating systems are the same. In this case, one operating system can also use the bootloader and kernel of another operating system.
[0086] In this approach, different operating systems are configured with independent bootloaders, kernels, and containers, and the bootloader and kernel code used by different operating systems are identical. This not only helps to ensure the integrity of each operating system but also improves interoperability when switching between different operating systems. Furthermore, it allows for direct switching from the container of the currently running operating system to the container of the operating system to be started during system switching, thereby improving the efficiency of system switching.
[0087] It should be noted that for relevant information about containers, please refer to Method 1 above, which will not be repeated here.
[0088] The embodiments of this application will be described below using method 1 as an example.
[0089] like Figure 2 The diagram shown is a hierarchical schematic of a BMC unit provided in an embodiment of this application.
[0090] See Figure 2 The BMC unit consists of a hardware layer and a software layer. The software layer is the program code that runs on the hardware layer.
[0091] The hardware layer includes the processor, memory, ROM, and storage devices. The software layer includes the operating system (such as the bootloader and kernel). Users can access applications running on the computing device through the file system in the software layer.
[0092] The following, combined with Figure 2 The system startup process of the BMC unit is described exemplarily.
[0093] For example, the BMC unit includes a first operating system and a second operating system. The first operating system includes a first container, and the second operating system includes a second container. The first operating system and the second operating system share the same bootloader and kernel.
[0094] It needs to be explained that, in Figure 3 In the diagram, the first container is represented by a solid line, indicating a container in a running state. The second container is represented by a dashed line, indicating a container in a non-running state, or a container in a dormant state.
[0095] When the BMC unit powers on, the processor in the BMC unit first runs the ROM bootloader, such as loading the ROM bootloader into the memory of the BMC unit. Then, the processor runs the operating system in the storage device based on the partition address in the ROM bootloader (i.e., the partition address of the bootloader).
[0096] The operating system running on the storage device may include the following steps:
[0097] 1) Run the operating system's bootloader: Switch to the partition where the bootloader is located according to the partition address indicated by the ROM bootloader, load the bootloader into the specified memory address and run it. The specified memory address can be set at the factory. During the running of the bootloader, basic input / output (I / O) configurations can be performed.
[0098] 2) Running the kernel: Based on the partition address indicated by the bootloader, switch to the partition where the kernel is located and load the kernel into the specified memory address for execution. While running the kernel, you can configure and load driver devices, launch the memory file system, etc.
[0099] The kernel includes a switching configuration module, which can be used to implement at least some of the functions in the operating system switching method, such as determining boot configuration parameters and storing boot configuration parameters to a storage medium. When launching the memory file system, the switching configuration module can be used to launch the memory file system, thereby allowing the memory file system to include the switching configuration module and thus enabling the memory file system to be used to implement the operating system switching method provided in this application embodiment. The kernel also includes a switcher, which can be used to implement at least some of the functions in the operating system switching method, such as jumping from the memory file system to the container of the operating system to be launched. When launching the memory file system, the switching configuration module and the switcher can be used to launch the memory file system, thereby allowing the memory file system to include the switching configuration module and the switcher and thus enabling the memory file system to be used to implement the operating system switching method provided in this application embodiment.
[0100] 3) Run the container: After launching the memory file system, switch to the partition where the first container is located, mount the partition where the first container is located, and mount the initial directory of the first container as the root directory. That is, load the contents of the first container into the specified memory address and run it.
[0101] 4) Run the application: Start the application in the first container through the system daemon in the first container.
[0102] It should be noted that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0103] For ease of understanding, the system startup configuration method provided in the embodiments of this application will be described below with reference to the above system architecture and the accompanying drawings.
[0104] Figure 3 This is a flowchart illustrating a system startup configuration method according to an exemplary embodiment. Exemplarily, the system startup configuration method may include the following steps S301-S305.
[0105] The following example, using the operating system of the BMC unit of a computing device, illustrates the operating system switching method. The processor, storage device, memory, ROM, and operating system mentioned below all belong to the BMC unit and will not be discussed further thereafter.
[0106] The following section uses the BMC unit, which includes a first operating system and a second operating system, as an example to illustrate this point. Figure 3 The illustrated embodiments are provided as examples.
[0107] The first operating system includes containers within the first operating system, and the second operating system includes containers within the second operating system. The first and second operating systems use the same bootloader, kernel, and memory file system. The containers within the first operating system can be named "first container," and the containers within the second operating system can be named "second container."
[0108] The first container and the second container may include a root file system, a system daemon, and at least one application.
[0109] It should be noted that the embodiments of this application do not limit the number of applications in the first container and the second container, and the applications in the first container and the second container can be all the same, partially the same, or all different. The following example, where the first container and the second container include multiple applications, will be used to illustrate the embodiments of this application.
[0110] For example, one of the first and second operating systems can be a BMC architecture operating system (referred to as the BMC system), and the other operating system can be an OpenBMC architecture operating system (referred to as the OpenBMC system).
[0111] The following example illustrates the operating system switching method provided in this application, using the operating system currently running on the BMC unit as the first operating system (e.g., the first operating system is the BMC system).
[0112] S301: A container for a computing device to load a bootloader and kernel to run a first operating system.
[0113] In this embodiment of the application, the BMC unit of the computing device loads the bootloader and the kernel in sequence, and generates a memory file system based on the switching configuration module, switcher and other components included in the kernel during the kernel operation. Then, a container of the first operating system is run.
[0114] Since the memory system includes a switcher, the operating system switching method provided in this application embodiment can be implemented during the BMC's operation of the memory file system.
[0115] It should be noted that other relevant information regarding S301 can be found above. Figure 2 The explanation will not be repeated here.
[0116] S302: When the computing device detects that a target event has occurred, it jumps from the container of the first operating system to the running memory file system.
[0117] In this embodiment of the application, if a target event is detected during the operation of the first container by the BMC unit of the computing device, the BMC unit will switch from running the first container to running the memory file system of the first operating system.
[0118] It should be noted that the BM unit runs the first container, which can be considered as the BMC unit running multiple applications included in the first container.
[0119] It should be noted that in the embodiments of this application, the BMC unit performing a certain operation (such as loading the memory file system, the first container, etc.) may be the processor of the BMC unit performing a certain operation, which will not be described further hereafter.
[0120] In this application embodiment, the detection of a target event includes multiple situations, which are illustrated below by examples of situations 1 to 2.
[0121] Scenario 1: The computing device receives a system switching request.
[0122] For example, when a user needs to switch the operating system running on the BMC unit, they can send a system switch request to the BMC unit of the computing device through an electronic device to request a switch of the operating system running on the BMC unit. If the BMC unit receives a system switch request while running the first container, it will jump to run the memory file system of the first operating system.
[0123] In this embodiment, the target event can be set as a system switching request, so that when the user sends a system switching request to the computing device through the electronic device, the operating system switching method provided in this application embodiment can be used to select the operating system startup path, that is, directly select the container to start the operating system to be started, thereby helping to improve the user experience.
[0124] Scenario 2: The computing device has completed the system upgrade operation.
[0125] For example, when the BMC unit of the computing device detects that an operating system (e.g., a second operating system) has completed an upgrade operation, that is, when the system upgrade is detected to be complete, the BMC unit switches from running the first container to running the memory file system of the first operating system.
[0126] In one example, the BMC unit can immediately switch from running the first container to running the memory file system of the first operating system after the upgrade operation of the second operating system is completed.
[0127] In another example, the BMC unit can switch from running the first container to running the memory file system of the first operating system after the upgrade operation of the second operating system has been completed and a preset time has elapsed.
[0128] It should be noted that the specific value of the preset duration is not limited in the embodiments of this application. For example, it can be 5 seconds, 10 seconds, etc.
[0129] In yet another example, the BMC unit can jump from running the first container to running the memory file system of the first operating system at a specified time after the upgrade operation of the second operating system has been completed.
[0130] It should be noted that the specific time point for the specified time is not limited in the embodiments of this application. For example, the specified time can be 0:00 or 1:00 of the next day.
[0131] In this embodiment, a target event can be set for the system upgrade completion, thereby enabling automatic switching to the newly upgraded operating system after the upgrade is completed. This eliminates the need for users to manually switch operating systems, thus improving the user experience.
[0132] It should be noted that the upgrade of the second operating system can be a container upgrade of the second operating system, or it can be an upgrade of the entire second operating system. The upgrade of the entire second operating system refers to the simultaneous upgrade of the bootloader, kernel, container, etc. of the second operating system. This application embodiment does not limit this.
[0133] In this embodiment of the application, before the BMC unit of the computing device jumps from the first container to run the memory file system of the first operating system, it can perform a shutdown operation on multiple applications included in the first container, so that after the multiple applications are shut down, it can jump from the first container to run the memory file system of the first operating system.
[0134] This helps prevent the sudden exit of the first container from causing multiple applications to crash, affecting the stability of the first operating system, and ultimately leading to a computing device shutdown. Furthermore, it helps prevent applications on the first operating system from impacting the stability of applications on the second operating system that are subsequently launched.
[0135] S303: The computing device determines the startup configuration parameters.
[0136] The startup configuration parameters are used to indicate the container for the operating system to be started. The container for the operating system to be started can also be called the container to be started.
[0137] It should be noted that in the embodiments of this application, the operating system to be started, the container to be started, etc., refer to the operating system to be started and the container to be started in general, and do not specifically refer to a certain operating system or container.
[0138] In this embodiment, after the BMC unit of the computing device jumps from the container of the first operating system to run the memory file system of the first operating system, unlike in related technologies, it no longer jumps to run the ROM boot program. Instead, it determines the boot configuration parameters based on the identifier of the container of the first operating system, so that the container of the operating system to be booted can be determined according to the boot configuration parameters. This enables a direct switch from the container of the first operating system to the container of the operating system to be booted, without having to return to the ROM boot program.
[0139] In this embodiment, the startup configuration parameters may include a container identifier, which can be used to indicate the container to be started. Alternatively, the startup configuration parameters may include an operating system identifier, which can be used to indicate the operating system to be started. Based on this, the computing device can determine the container belonging to the operating system to be started as the container to be started.
[0140] It should be noted that the embodiments of this application do not limit the form of the startup configuration parameters; the above is merely an illustrative example. The following example, where the startup configuration parameters include a container identifier, will be used to illustrate the embodiments of this application.
[0141] For containers that are about to start an operating system, there are several scenarios, which are illustrated below using scenarios a to c.
[0142] Case a: The container whose operating system is to be started is currently not running.
[0143] When the currently running operating system is the first operation, the container currently in the running state is the first operating system container. Based on this, the container currently in the non-running state is the second operating system container. In other words, the container whose operating system is to be started is the second operating system container.
[0144] For example, in case a, after the BMC unit detects the target event, it can determine the container of the second operating system as the container of the operating system to be started by using the startup configuration parameters.
[0145] Case b: The container whose operating system is to be started is a container that is currently running.
[0146] When the currently running operating system is the first operation, the container currently in the running state is the first operating system container. In other words, the container whose operating system is to be started is the first operating system container.
[0147] For example, in case b, after the BMC unit detects the target event, it can determine the container of the first operating system as the container of the operating system to be started by using the startup configuration parameters.
[0148] Case c: The container of the operating system to be started is either a container of the first operating system or a container of the second operating system.
[0149] The BMC unit is pre-configured with a system switching policy, which may include booting an operating system other than the current one or restarting the current operating system.
[0150] For example, a user can specify a system switching policy, such as root directory path / mnt / inittramfs / rofs1, and the BMC unit can determine rofs1 as the boot configuration parameter. In this example, since the identifier of the container of the first operating system, that is, the identifier of the container of the currently running operating system, can be directly determined as the boot configuration parameter, it helps to improve the efficiency of determining the boot configuration parameter.
[0151] Example 2: The computing device can determine the identifier of the container of the second operating system as the boot configuration parameter. Thus, when it is necessary to determine the container of the operating system to be booted, the computing device can identify the container indicated by the boot configuration parameter as the container of the operating system to be booted.
[0152] For example, if the root directory path is / mnt / inittramfs / rofs1, the BMC unit can determine that rofs2 (i.e., the identifier of the container of the second operating system) is the boot configuration parameter. In this example, since the container indicated by the boot configuration parameter can be directly determined to be the container of the operating system to be booted, this helps to improve the efficiency of determining the container of the operating system to be booted.
[0153] Method 2: Determine startup configuration parameters based on the target event.
[0154] In this embodiment of the application, after the BMC unit detects the target event, it can determine the startup configuration parameters based on the target event.
[0155] In one example, when the target event is a system switch request, the system switch request may include a container identifier (i.e., the identifier of the container for the operating system to be started). After receiving the system switch request, the BMC unit can determine the boot configuration parameters based on the container identifier in the system switch request.
[0156] For example, such as Figure 4 As shown in (a), a first interface is displayed on the user's electronic device. The first interface includes a first control, which is used to indicate system switching. The user selects the first control and clicks the next control on the first interface, as shown in (a). Figure 4 As shown in (b), the electronic device displays a second interface in response to a user's action. The second interface includes a second control used to indicate a container. After the user selects a second container (i.e., the container to which the operating system is to be started) on the second interface and clicks the next control on the second interface, the electronic device, in response to the user's action, sends a system switching request to the computing device. This system switching request includes an identifier of the second container.
[0157] In another example, when the target event is the completion of a system upgrade, the BMC unit can determine the startup configuration parameters based on the container that underwent a system upgrade operation in the most recent time period. For example, if the container that underwent a system upgrade operation in the most recent time period is the second container, the computing device can determine the startup configuration parameters based on the identifier of the second container.
[0158] It should be noted that other relevant explanations for Method 2 can be found in the explanations for Method 1 above, and will not be repeated here.
[0159] It should be noted that the execution order of "jumping from the container of the first operating system to the running memory file system" in S302 and S303 in this embodiment of the application is not limited; the above is only an illustrative example.
[0160] S304: The computing device writes the startup configuration parameters to the computing device's storage medium.
[0161] In this embodiment of the application, the storage medium may include volatile storage media and non-volatile storage media.
[0162] In one example, the BMC unit of the computing device can write boot configuration parameters to volatile storage. For further details on this example, please refer to [link to relevant documentation]. Figure 5 The S505 of the illustrated embodiment will not be described in detail here.
[0163] In another example, the BMC unit can write boot configuration parameters to non-volatile storage. For further details on this example, please refer to [link to relevant documentation]. Figure 5 The S506 of the illustrated embodiment will not be described in detail here.
[0164] S305: The computing device jumps from the memory file system to run a container of the operating system to be started based on the boot configuration parameters.
[0165] In one example, referring to Example 1 of Method 1 in S303 above, after the BMC unit of the computing device obtains the boot configuration parameters from the storage medium, it determines the container not indicated by the boot configuration parameters as the container of the operating system to be booted, that is, it determines the container of the second operating system as the container of the operating system to be booted. In another example, referring to Example 2 of Method 1 in S303 above, after the BMC unit obtains the boot configuration parameters from the storage medium, it determines the container indicated by the boot configuration parameters as the container of the operating system to be booted, that is, it determines the container of the second operating system as the container of the operating system to be booted.
[0166] In the above embodiments, when the computing device is running the first operating system, if a target event is detected, it indicates that a switch to the operating system is required. Based on this, the computing device jumps from the container of the first operating system to the running memory file system, and writes the startup configuration parameters determined based on the identifier of the container of the first operating system into the storage medium. Then, based on the startup configuration parameters in the storage medium indicating the container of the operating system to be started, the device directly jumps from the memory file system to run the container of the operating system to be started. Since the startup configuration parameters are determined based on the identifier of the currently running operating system container and written to the storage medium, when it is necessary to determine the container of the operating system to be started, it can be determined through the startup configuration parameters in the storage medium. This not only improves the convenience of determining the container of the operating system to be started, but also helps to improve the accuracy of the determined container of the operating system to be started.
[0167] Furthermore, since the first and second operating systems use the same bootloader, kernel, and memory file system, after the computing device determines the container of the operating system to be started based on the boot configuration parameters, it can directly jump from the memory file system of the first operating system to run the container of the operating system to be started without restarting the bootloader and kernel, that is, without having to fall back to the ROM bootloader. This achieves fast startup of the operating system to be started, which helps to shorten the time consumed by operating system switching, improve the efficiency of operating system switching, and thus improve the user experience.
[0168] The following, combined with Figure 5 Different implementations of S304 are illustrated by example.
[0169] Figure 5 This is a flowchart illustrating another operating system switching configuration method according to an exemplary embodiment. Exemplarily, this operating system switching method may include the following steps S501-S507.
[0170] S501: A container for a computing device to load a bootloader and kernel, thereby running a first operating system.
[0171] S502: When the computing device detects that a target event has occurred, it jumps from the container of the first operating system to the running memory file system.
[0172] S503: The computing device determines the startup configuration parameters.
[0173] It should be noted that the relevant explanations for S501-S503 can be found in S301-S303 above, and will not be repeated here.
[0174] S504: The computing device determines whether the system switching type is container switching.
[0175] If the result is yes, then proceed to step S505 below. If the result is no, then proceed to step S506 below.
[0176] In this embodiment, the system switching type may include container switching or non-container switching. Container switching can also be called fast switching, and non-container switching can also be called full switching or full partition switching.
[0177] Container switching is used to instruct the system to load the container of the operating system to be started during the system switch process; in other words, the bootloader and kernel are not loaded. For example, the container switching path is: container of the current operating system → memory file system of the current operating system → container of the operating system to be started.
[0178] The non-container switchover is used to indicate the container running the bootloader, kernel, and the operating system to be booted during the system switchover process. For example, the non-container switchover path is: current operating system container → current operating system memory file system → ROM bootloader → bootloader of the operating system to be booted → kernel of the operating system to be booted → memory file system of the operating system to be booted → container of the operating system to be booted.
[0179] In this application embodiment, S504 includes multiple cases, which are illustrated below by way of case A to case B.
[0180] Scenario A: The target event is a system switch request.
[0181] If the target event indicates a container switch, the system switch type is determined to be a container switch. If the target event indicates a non-container switch, the system switch type is determined to be a non-container switch.
[0182] In one example, the system switch request indicates the switch type. The BMC unit of the computing device can determine whether the system switch type is a container switch based on the switch type indicated in the system switch request. This allows the system switch to be performed according to the switch type indicated by the user, which helps improve the user experience.
[0183] For example, a system switch request includes a switch identifier that indicates the switch type. If the switch identifier indicates a container switch, the system switch type is determined to be a container switch. If the switch identifier indicates a non-container switch, the system switch type is determined to be a non-container switch.
[0184] In another example, the system switch request indicates the switch type. The BMC unit can determine whether it is a container switch by the switch type indicated by the system switch request and whether the shutdown operations of multiple applications meet preset conditions. If the switch identifier indicates a container switch and the shutdown operations of multiple applications meet the preset conditions, it is a container switch. If the switch identifier indicates a non-container switch or the shutdown operations of multiple applications do not meet the preset conditions, it is a non-container switch.
[0185] In this way, by setting appropriate preset conditions, it is not only helpful to avoid the current operating system from crashing due to the crash of multiple applications, but also to help prevent the applications of the current operating system from affecting the normal operation of applications of the subsequently launched operating system.
[0186] The closing operation of multiple applications meets preset conditions, including: each application in the multiple applications is closed successfully, and / or, the closing order of the multiple applications is the reverse of the starting order of the multiple applications.
[0187] By setting each application in a multiple application list to close successfully, you can prevent applications currently running on the operating system from affecting the normal operation of applications launched later. Setting the closing order of multiple applications to be the reverse of their startup order helps prevent the crashing of multiple applications from causing the current operating system to crash.
[0188] For example, if multiple applications are launched sequentially from the inside out according to their dependencies, it can be assumed that the multiple applications are shut down sequentially from the outside in according to their dependencies.
[0189] For example, the container of the first operating system includes application 1, application 2, and application 3. When the processor of the BMC unit starts the applications in the container of the first operating system, it starts application 1 first, then application 2, and finally application 3. That is, the startup order of the multiple applications is: application 1 → application 2 → application 3. Based on this, the order in which the multiple applications are closed is: application 3 → application 2 → application 1.
[0190] Scenario B: The target event is the completion of the system upgrade.
[0191] In one example, the system upgrade type indicates the switching type. The BMC unit of the computing device can determine whether the system switching type is a container switching based on the system upgrade type. For example, if the operating system upgrade only upgrades the containers, the system upgrade type is a container upgrade, and the BMC unit determines the system switching type to be a container switching. If the operating system upgrade upgrades the entire operating system, that is, simultaneously upgrades the operating system's bootloader, kernel, and containers, the system upgrade type is a non-container upgrade, and the BMC unit can determine the system switching type to be a non-container switching.
[0192] It should be noted that the BMC unit can check the system upgrade type through the system log. If the system log records that the most recent operating system upgrade only upgraded the container, that is, the bootloader and kernel were not upgraded, then the system upgrade type is a container upgrade. If the system log records that the most recent operating system upgrade upgraded the bootloader, kernel, and memory file system simultaneously, then the system upgrade type is a non-container upgrade.
[0193] In another example, when the target event is system upgrade complete, the system switch type is determined to be a container switch. That is, regardless of whether the system upgrade type is a container upgrade or a non-container upgrade, the system switch type is determined to be a container switch.
[0194] In another example, when the target event is system upgrade completion, the system switch type is determined to be a non-container upgrade. That is, regardless of whether the system upgrade type is a container upgrade or a non-container upgrade, the system switch type is determined to be a non-container switch.
[0195] In another example, if the system upgrade type is container upgrade and the shutdown operations of multiple applications meet the preset conditions, the system switch type is determined to be container switch.
[0196] It should be noted that other relevant explanations for situation B can be found in situation A above, and will not be repeated here.
[0197] It should be noted that the execution order of S504 and S502-S503 is not limited in this embodiment.
[0198] S505: The computing device writes the startup configuration parameters to the volatile storage medium.
[0199] In this embodiment, the volatile storage medium can be the memory of the BMC.
[0200] Since the system switch type is container switch, after the BMC unit jumps to run the memory file system, it will not continue to jump to run the ROM boot program. Therefore, the BMC unit will not be powered down. Based on this, storing the boot configuration parameters in volatile storage media can not only ensure that the boot configuration parameters can be obtained, but also automatically clear the boot configuration parameters during the subsequent power-down process of the BMC unit, avoiding the boot configuration parameters occupying storage space for a long time and affecting the normal system boot process.
[0201] For example, the volatile storage medium can be the memory of the BMC unit, which helps to improve the speed of reading and writing startup configuration parameters, thereby helping to improve the efficiency of system startup.
[0202] S506: The computing device will write startup configuration parameters to a non-volatile storage medium.
[0203] In this embodiment of the application, the non-volatile storage medium may include a raw partition on a storage device, or user flash memory (UFM) on a programmable logic device.
[0204] In one example, the BMC unit of the computing device includes a storage device, such as an embedded multimedia card (EMMC), NAND flash memory, NOR flash memory, or universal flash storage (UFS). The BMC unit can partition a portion of the storage area of the storage device into raw partitions (also called raw devices or raw partitions), which may not have a file system format. Based on this, when it is necessary to determine the container to be booted from, the BMC unit can access the raw device through a fixed offset address to obtain the boot configuration parameters.
[0205] For example, see Figure 6 In (a), after the BMC unit determines the container of the operating system to be started, it can record the identifier of the container of the operating system to be started as a boot configuration parameter in init-options and write init-options to the raw partition.
[0206] In another example, the BMC unit of the computing device may include a programmable logic device, such as a Complex Programmable Logic Device (CPLD) or a Field Programmable Gate Array (FPGA). The programmable logic includes a UFM storage space, which refers to the flash memory storage space available to the user. Furthermore, when it is necessary to determine the container to be booted from, the BMC unit can access the UFM storage space through the external access interface provided by the programmable logic device to obtain boot configuration parameters.
[0207] For example, see Figure 6 In (b), after the BMC unit determines the container of the operating system to be started, it can record the identifier of the container of the operating system to be started as a startup configuration parameter in init-options and write init-options into the UFM memory space of the programmable logic device.
[0208] In the above embodiments, the computing device provides multiple ways to store startup configuration parameters, such as storing them in volatile storage media when a container starts and storing them in non-volatile storage media when a non-container starts. This allows startup configuration parameters to be obtained from different storage media when the system starts using different startup types, which not only helps to ensure the diversity of storage methods, but also helps to make full use of the different storage media of the computing device.
[0209] S507: The computing device jumps from the memory file system to run a container of the operating system to be started based on the boot configuration parameters.
[0210] It should be noted that the relevant explanations for S507 can be found in the explanations for S305, and will not be repeated here.
[0211] In one example, if the system switch type is container switch, the BMC unit of the computing device writes the boot configuration parameters to the volatile storage medium, and can then unload the root directory of the first operating system and the partition where the container of the first operating system is located. Afterwards, the BMC unit reads the boot configuration parameters from the volatile storage medium, determines the container of the operating system to be booted based on the boot configuration parameters, and then directly jumps from the memory file system of the first operating system to run the container of the operating system to be booted.
[0212] In another example, if the system switch type is a non-container switch, the BMC unit writes the boot configuration parameters to the non-volatile storage medium, then jumps to run the ROM bootloader. Based on the partition address indicated by the ROM bootloader (i.e., the partition address of the bootloader), it sequentially runs the bootloader and the kernel. During kernel execution, it generates a memory file system based on the switch configuration module and switcher within the kernel. While running the memory file system, the BMC unit reads the switch configuration parameters from the non-volatile storage medium, determines the container of the operating system to be booted based on the boot configuration parameters, and then directly jumps from the memory file system to run the container of the operating system to be booted.
[0213] It should be noted that in this other example, the BMC unit runs the bootloader and kernel, which can be the first operating system or the second operating system. This application embodiment does not limit this.
[0214] like Figure 7 The diagram shown is a schematic representation of an operating system switching method provided in an embodiment of this application. The following, in conjunction with... Figure 7 The following is an exemplary description of the operating system switching process provided in the embodiments of this application.
[0215] For example, when the BMC unit is running a container of the first operating system (also known as the original container), and the user triggers a target event, such as triggering a system upgrade or system switch, the BMC unit detects the target event and performs a shutdown operation on multiple applications in the container of the first operating system to close these applications. Afterwards, the BMC unit determines whether the system switch type is a container switch. If it is, the BMC unit executes the container startup process; otherwise, it executes a non-container switch process, such as a full startup process.
[0216] If the BMC unit executes the container boot process, after jumping from the container of the first operating system to run the memory file system of the first operating system, the BMC unit does not jump to run the ROM boot program, but stays in the stage of running the memory file system of the first operating system. During the process of running the memory file system of the first operating system, the BMC unit writes the boot configuration parameters to volatile storage media and unmounts the root directory of the first operating system and the partition where the container of the first operating system is located.
[0217] If a full boot process is executed, the BMC unit jumps from the container of the first operating system to run the memory file system of the first operating system. During the process of running the memory file system of the first operating system, the boot configuration parameters are written to the non-volatile storage medium. After that, it continues to jump to ROM to return to the ROM boot program. Then, based on the partition address indicated by the ROM boot program, the boot record program, kernel and memory file system are run.
[0218] Next, the BMC unit obtains the boot configuration parameters and, based on these parameters, determines the container for the operating system to be booted. For example, if the boot configuration parameter is the identifier of container 1 or is empty (NULL), the BMC unit runs container 1 (i.e., the container for the operating system to be booted), such as mounting the partition corresponding to container 1 and setting the initial directory of container 1 as the root directory. If the boot configuration parameter is the identifier of container 2, the BMC unit runs container 2 (i.e., the container for the operating system to be booted), such as mounting the partition corresponding to container 2 and setting the initial directory of container 2 as the root directory.
[0219] Afterwards, the BMC unit jumps to the root directory environment via chroot. For example, if the startup configuration parameters indicate the identifier of container 2, the BMC unit jumps to the root directory corresponding to the initial directory of container 2 and starts multiple applications in container 2 through the system daemon in container 2.
[0220] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the operating system switching device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0221] This application embodiment can, based on the above method, exemplarily divide the operating system switching device into functional modules. For example, the operating system switching device may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0222] For example, Figure 8 A possible structural diagram of the operating system switching device (denoted as operating system switching device 800) involved in the above embodiments is shown. The actions performed by the operating system switching device 800 are implemented through a computer device or through corresponding software executed by the computing device. The computing device includes a first operating system and a second operating system. The first operating system includes a container of the first operating system, and the second operating system includes a container of the second operating system. The first and second operating systems use the same bootloader, kernel, and memory file system. The operating system switching device 800 may include a running module 801, a jump module 802, a configuration module 803, and a switching module 804. The running module 801 is used to load the bootloader and kernel, thereby running the container of the first operating system. For example, Figure 3 S301 is shown. Jump module 802 is used to jump from the container of the first operating system to the running memory file system when a target event is detected. For example, Figure 3 S302 is shown. Configuration module 803 is used to determine boot configuration parameters based on the identifier of the container of the first operating system, and write the boot configuration parameters into the storage medium of the computing device. The boot configuration parameters indicate the container of the operating system to be booted, which may be a container of the first operating system or a container of the second operating system. For example, Figure 3S303-S304 are shown. Switching module 804 is used to switch from the memory file system to the container running the operating system to be started, based on boot configuration parameters. For example, Figure 3 S305 is shown.
[0223] Optionally, the storage medium includes a volatile storage medium; the configuration module 803 is specifically used to: if the system switching type is container switching, write the startup configuration parameters to the volatile storage medium; container switching is used to instruct the container of the operating system to be started to be loaded during the system switching process.
[0224] Optionally, the storage medium also includes a non-volatile storage medium; the configuration module 803 is specifically used to: write the startup configuration parameters to the non-volatile storage medium if the system switching type is a non-container switching; non-container switching is used to instruct the system to load the bootloader and kernel during the system switching process.
[0225] Alternatively, non-volatile storage media may include raw partitions of a computing device or user flash memory (UFM).
[0226] Optionally, the configuration module 803 is specifically used to: determine the identifier of the container of the first operating system as the startup configuration parameter based on the identifier of the container of the first operating system.
[0227] Optionally, the configuration module 803 is specifically used to: determine the identifier of the container in the second operating system as the startup configuration parameter based on the identifier of the container in the first operating system.
[0228] Optionally, a target event is detected, including: detecting a system switch request, or detecting that a system upgrade is complete.
[0229] Optionally, the first operating system and the second operating system use the same bootloader and kernel, including: the first operating system and the second operating system share the same bootloader and kernel; or, the code of the bootloader of the first operating system is the same as the code of the bootloader of the second operating system, and the code of the kernel of the first operating system is the same as the code of the kernel of the second operating system.
[0230] For a detailed description of the above-mentioned optional methods, please refer to the foregoing method embodiments, which will not be repeated here. Furthermore, the explanation of any of the operating system switching devices 800 provided above, as well as the description of its beneficial effects, can be found in the corresponding method embodiments described above, and will not be repeated here.
[0231] This application also provides a computing device, which includes a processor and a memory. The processor is connected to the memory, and the memory stores computer execution instructions. When the processor executes the computer execution instructions, it implements the operating system switching method in the above embodiments.
[0232] This application also provides a computer-readable storage medium storing a computer program that, when run on a computing device, causes the computer to perform any of the methods performed by the computing device described above.
[0233] For explanations of the relevant content and descriptions of the beneficial effects in any of the computer-readable storage media provided above, please refer to the corresponding embodiments described above, which will not be repeated here.
[0234] This application also provides a chip. This chip integrates control circuitry for implementing the functions of the aforementioned computer device and one or more ports. Optionally, the functions supported by this chip are as described above and will not be repeated here.
[0235] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The processing unit or processor mentioned above can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
[0236] This application also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of this application, such as, but not limited to, the aforementioned memory, computer-readable storage medium, and communication chip, are all non-transitory.
[0237] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, it can be implemented, in whole or in part, as a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0238] Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. A computer-readable storage medium can be any usable medium that a computer can access, or it can include one or more data storage devices such as servers or data centers that can be integrated with that medium. Usable media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives), etc.
[0239] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, the disclosure, and the appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0240] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. An operating system switching method, characterized in that, A computing device, the computing device including a first operating system and a second operating system, the first operating system including a container of the first operating system, and the second operating system including a container of the second operating system; The first operating system and the second operating system use the same bootloader, kernel, and memory file system; the method includes: Load the bootloader and the kernel to run a container of the first operating system; When a target event is detected, the system jumps from the container of the first operating system to run the memory file system; Based on the identifier of the container of the first operating system, the startup configuration parameters are determined. The startup configuration parameters are used to indicate the container of the operating system to be started. The container of the operating system to be started is either the container of the first operating system or the container of the second operating system. If the system switch type is container switch, the boot configuration parameters are written to volatile storage medium; the container switch is used to indicate that the container of the operating system to be booted is loaded during the system switch process, and the storage medium includes volatile storage medium; or, if the system switch type is non-container switch, the boot configuration parameters are written to non-volatile storage medium; the non-container switch is used to indicate that the bootloader, the kernel, and the container of the operating system to be booted are loaded during the system switch process, and the storage medium also includes non-volatile storage medium; Based on the startup configuration parameters, the container that will start the operating system jumps from the memory file system.
2. The method according to claim 1, characterized in that, The non-volatile storage medium includes a raw partition of the computing device or a user flash memory (UFM).
3. The method according to claim 1 or 2, characterized in that, The determination of startup configuration parameters based on the container identifier of the first operating system includes: Based on the identifier of the container in the first operating system, the identifier of the container in the first operating system is determined as the startup configuration parameter.
4. The method according to claim 1 or 2, characterized in that, The determination of startup configuration parameters based on the container identifier of the first operating system includes: Based on the identifier of the container in the first operating system, the identifier of the container in the second operating system is determined as the startup configuration parameter.
5. The method according to claim 1 or 2, characterized in that, The detection of a target event includes: A system switch request has been detected, or a system upgrade has been completed.
6. The method according to claim 1 or 2, characterized in that, The first operating system and the second operating system use the same bootloader and kernel, including: The first operating system and the second operating system share the same bootloader and kernel; or, the code of the bootloader of the first operating system is the same as the code of the bootloader of the second operating system, and the code of the kernel of the first operating system is the same as the code of the kernel of the second operating system.
7. A chip, characterized in that, include: A processor and a memory, wherein the processor is connected to the memory; The memory is used to store computer execution instructions, and the processor executes the computer execution instructions stored in the memory to cause the chip to implement the method as described in any one of claims 1-6.
8. A computing device, characterized in that, include: A power supply and a chip as described in claim 7, wherein the power supply is used to power the chip, and the chip is used to implement the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for simultaneously running Android / Linux operating systems
CN104268017A
Container based mobile terminal operating system upgrading method and device
CN105511920A
