Cloud mirror image construction method and device, equipment, medium and program product
By creating a partition table compatible with UEFI and Legacy BIOS and configuring a unified boot loader, the problem of low deployment efficiency of cloud images in mixed hardware environments is solved, and normal booting and operation in different boot modes are achieved.
Patent Information
- Application Number
- CN202511476140.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-01-16
AI Technical Summary
Existing cloud images can only be adapted to one computer boot method, resulting in low deployment efficiency in mixed hardware environments. This leads to problems such as low boot efficiency, limited disk capacity and number of partitions, poor hardware driver support, and inconvenience in booting multiple systems.
Create a globally unique identifier partition table compatible with UEFI and Legacy BIOS, configure a virtual machine with a unified extensible firmware interface, install the operating system and set the boot mode identifier, and generate a unified boot loader configuration file to enable the image disk to boot correctly in both boot modes.
It improves the deployment efficiency of cloud images in hybrid hardware environments, ensuring that they can start and run normally in different hardware environments.
Smart Images

Figure CN121349592A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, medium and program product for constructing a cloud image. Background Technology
[0002] Cloud images are template files containing operating systems, pre-installed software, configuration information, drivers, and bootloaders. Using cloud images can significantly improve resource deployment efficiency, enabling the rapid creation of virtual machines and bare metal environments in batches, while avoiding the need for repeated operating system installations and shortening service launch time. Therefore, developing more efficient cloud image construction methods has become a promising direction for improving resource deployment efficiency.
[0003] In existing technologies, cloud mirrors complete resource deployment by adapting to the computer's boot method. There are two boot methods for computers: one is the Basic Input / Output System (Legacy BIOS), which is based on 16-bit real mode. After the computer is powered on, the BIOS first performs initialization detection and settings on hardware such as the central processing unit (CPU), memory, and graphics card to ensure that the hardware is working properly; the other is the Unified Extensible Firmware Interface (UEFI), which is based on 32 / 64-bit protected mode, gets rid of the limitations of 16-bit real mode, and can make full use of the performance of modern hardware.
[0004] However, in the existing technology, cloud images can only be adapted to one type of computer boot method. Using Legacy BIOS alone has disadvantages such as low boot efficiency, limited disk capacity and number of partitions, poor hardware driver support, and inconvenience in multi-system booting. Although using UEFI alone is superior to Legacy BIOS in many aspects, it cannot be compatible with older hardware that only supports Legacy BIOS, which leads to low deployment efficiency of cloud images in mixed hardware environments. Summary of the Invention
[0005] The cloud image construction method, apparatus, equipment, media, and program products provided in this application are intended to improve the deployment efficiency of cloud images in hybrid hardware environments.
[0006] Firstly, this application provides a method for constructing a cloud image, including:
[0007] Create a bootable image disk and configure a globally unique identifier partition table for it; the globally unique identifier partition table is compatible with the first boot mode.
[0008] Create a hard disk partition compatible with the second boot mode in the globally unique identifier partition table;
[0009] Create a virtual machine; the virtual machine is configured with a unified and extensible firmware interface.
[0010] Based on the virtual machine, load the disk image file and operating system installation source from the image disk to install the operating system using the first boot mode;
[0011] In the operating system, set a second boot mode identifier for the hard drive partition;
[0012] Install the unified boot loader for the second boot mode to the master boot record of the image disk;
[0013] Generate a unified bootloader configuration file to complete the construction of the cloud image.
[0014] In one possible implementation, creating a mirror disk includes:
[0015] Use an image management tool to create a 10 gigabyte raw disk image format image disk.
[0016] In one possible implementation, creating a virtual machine includes:
[0017] Copy the startup dependency files for the first startup mode;
[0018] Based on the boot dependency files, create a virtual machine containing the firmware for the first boot mode.
[0019] In one possible implementation, the size of the hard disk partition is 1 megabyte.
[0020] In one possible implementation, setting a second boot mode flag for the hard disk partition in the operating system includes:
[0021] In the operating system, the device number for a 1-megabyte hard disk partition is determined;
[0022] Add a second boot mode flag to the hard drive partition based on the device number.
[0023] In one possible implementation, installing a unified boot loader for the second boot mode to the master boot record of the image disk includes:
[0024] Install the unified bootloader dependency package;
[0025] Install the unified bootloader for the second boot mode to the master boot record of the image disk based on the unified bootloader dependency package.
[0026] In one possible implementation, a unified bootloader configuration file is generated, including:
[0027] Based on the Master Boot Record, a unified boot loader configuration file is generated; the unified boot loader configuration file includes a kernel and load path that are compatible with both the first and second boot modes.
[0028] In one possible implementation, after generating the unified bootloader configuration file to complete the cloud image construction, the following steps are also included:
[0029] Start the cloud image using the first startup mode and the second startup mode respectively;
[0030] Based on the startup results, determine whether the cloud image was built successfully.
[0031] Secondly, this application provides a cloud image building apparatus, comprising:
[0032] The first creation module is used to create the image disk and configure a globally unique identifier partition table for the image disk; the globally unique identifier partition table is compatible with the first boot mode.
[0033] The second creation module is used to create hard disk partitions compatible with the second boot mode in the globally unique identifier partition table;
[0034] The third creation module is used to create virtual machines; the virtual machines are configured with a unified and extensible firmware interface.
[0035] The loading module is used to load the disk image file and operating system installation source from the image disk based on the virtual machine, so as to install the operating system using the first boot mode;
[0036] The configuration module is used to set a second boot mode identifier for hard disk partitions in the operating system;
[0037] The installation module is used to install a unified boot loader for the second boot mode to the master boot record of the image disk;
[0038] The generation module is used to generate a unified bootloader configuration file to complete the construction of the cloud image.
[0039] In one possible implementation, the first creation module is further configured to:
[0040] Use an image management tool to create a 10 gigabyte raw disk image format image disk.
[0041] In one possible implementation, the third creation module is also used for:
[0042] Copy the startup dependency files for the first startup mode;
[0043] Based on the boot dependency files, create a virtual machine containing the firmware for the first boot mode.
[0044] In one possible implementation, the second creation module is also used for hard disk partitioning; the size of the hard disk partition is 1 megabyte.
[0045] In one possible implementation, the setting module is also used for:
[0046] In the operating system, the device number for a 1-megabyte hard disk partition is determined;
[0047] Add a second boot mode flag to the hard drive partition based on the device number.
[0048] In one possible implementation, the installation module is also used for:
[0049] Install the unified bootloader dependency package;
[0050] Install the unified bootloader for the second boot mode to the master boot record of the image disk based on the unified bootloader dependency package.
[0051] In one possible implementation, the generation module is further configured to:
[0052] Based on the Master Boot Record, a unified boot loader configuration file is generated; the unified boot loader configuration file includes a kernel and load path that are compatible with both the first and second boot modes.
[0053] In one possible implementation, the generation module is further configured to:
[0054] Start the cloud image using the first startup mode and the second startup mode respectively;
[0055] Based on the startup results, determine whether the cloud image was built successfully.
[0056] Thirdly, this application provides a cloud image building device, including: a memory and a processor;
[0057] The memory stores instructions that the computer executes;
[0058] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0059] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible embodiments of the first aspect.
[0060] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0061] This application provides a cloud image construction method, apparatus, device, medium, and program product. It creates an image disk and configures a globally unique identifier partition table for a first boot mode, providing a basic storage structure for subsequent operations and ensuring booting in the first boot mode. A hard disk partition compatible with a second boot mode is created in this partition table, enabling the image disk to support two different boot modes. A virtual machine configured with a unified extensible firmware interface is created, providing a virtual runtime environment for installing the operating system. The virtual machine loads the image disk's disk image file and the operating system installation source and installs the operating system using the first boot mode, completing the initial deployment of the system in the virtual environment. A second boot mode identifier is set for the hard disk partition in the operating system, allowing the system to recognize that the partition supports the second boot mode. A unified boot loader for the second boot mode is installed to the image disk's master boot record, enabling the image disk to boot in the second boot mode. A unified boot loader configuration file is generated, completing the cloud image construction. This allows the cloud image to correctly boot in both boot modes according to the configuration file, thereby improving the deployment efficiency of cloud images in hybrid hardware environments. Attached Figure Description
[0062] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0063] Figure 1 This application provides a schematic diagram of an application data processing system architecture.
[0064] Figure 2 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 1 ;
[0065] Figure 3 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 2 ;
[0066] Figure 4 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 3 ;
[0067] Figure 5 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 4 ;
[0068] Figure 6 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 5 ;
[0069] Figure 7A schematic diagram of the structure of the cloud image building apparatus provided in the embodiments of this application;
[0070] Figure 8 This is a schematic diagram of the structure of the cloud image building device provided in the embodiments of this application.
[0071] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0072] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0073] Because existing technologies can only adapt to one type of computer boot method, using Legacy BIOS alone has disadvantages such as low boot efficiency, limited disk capacity and number of partitions, poor hardware driver support, and inconvenience in booting multiple systems. While using UEFI alone is superior to Legacy BIOS in many aspects, it cannot be compatible with older hardware that only supports Legacy BIOS, resulting in low deployment efficiency of cloud images in mixed hardware environments.
[0074] To address the aforementioned issues, this application provides a cloud image construction method, apparatus, device, medium, and program product. This involves creating an image disk and configuring a globally unique identifier partition table compatible with UEFI (the first boot mode) to provide the basic storage structure for subsequent operations and ensure booting in UEFI mode. A hard disk partition compatible with Legacy BIOS (the second boot mode) is created in this partition table, enabling the image disk to support both boot modes. A virtual machine configured with a unified extensible firmware interface is created to provide a virtual runtime environment for installing the operating system. The virtual machine loads the image disk's disk image file and the operating system installation source and installs the operating system using the first boot mode, completing the initial deployment of the system in the virtual environment. A second boot mode identifier is set for the hard disk partition in the operating system, allowing the system to recognize that the partition supports the second boot mode. A unified boot loader for the second boot mode is installed to the image disk's master boot record, enabling the image disk to boot in the second boot mode. A unified boot loader configuration file is generated to complete the cloud image construction, allowing the cloud image to correctly boot in both boot modes according to the configuration file. This achieves the technical effect of improving the deployment efficiency of cloud images in hybrid hardware environments.
[0075] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0076] Figure 1 This is a schematic diagram of an application data processing system architecture provided in an embodiment of this application. The application data processing system is a computer device. Figure 1 As shown, the above architecture includes at least one of a data acquisition device 101, a processing device 102, and a display device 103.
[0077] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the architecture of the application data processing system. In other feasible embodiments of this application, the above architecture may include more or fewer components than illustrated, or combine some components, or split some components, or arrange different components, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown can be implemented in hardware, software, or a combination of both.
[0078] In the specific implementation process, the data acquisition device 101 may include an input / output interface or a communication interface, and the data acquisition device 101 can be connected to the processing device through the input / output interface or the communication interface.
[0079] When network congestion occurs, processing device 102 first creates a partition table for a mirror disk supporting the first boot mode, and then creates a hard disk partition within it compatible with the second boot mode, laying the foundation for dual-booting. Next, it uses a virtual machine configured with the relevant firmware to install the operating system in the first boot mode. Then, it assigns a second boot mode identifier to the hard disk partition within the system, installs the corresponding unified boot loader to the master boot record of the mirror disk, and grants it second boot capability. Finally, it generates a configuration file to complete the construction of a cloud image compatible with dual-booting mode.
[0080] The display device 103 can also be a touch screen or the screen of a terminal device, used to receive user commands while displaying the above-mentioned content, so as to realize interaction with the user.
[0081] It should be understood that the aforementioned processing device can be implemented by a processor reading instructions from memory and executing those instructions, or it can be implemented by a chip circuit.
[0082] Furthermore, the network architecture and business 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 network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0083] Figure 2 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 1 ,like Figure 2 As shown, the cloud image construction method provided in this embodiment includes:
[0084] S201. Create a disk image and configure a globally unique identifier partition table for the disk image; the globally unique identifier partition table is compatible with the first boot mode.
[0085] In this embodiment, the first boot mode refers to UEFI.
[0086] In one possible implementation, creating a mirror disk includes: using a mirror management tool to create a 10-gigabyte raw disk image format mirror disk.
[0087] When creating the image disk, use an image management tool (such as qemu-img) to create a 10 gigabyte raw disk image format image disk. Then configure a globally unique identifier partition table for it. This table can break through the limitations of the traditional master boot record partition table and is compatible with UEFI (first boot mode), which is beneficial for subsequent operations.
[0088] S202. In the globally unique identifier partition table, create a hard disk partition compatible with the second boot mode.
[0089] In this embodiment, the second boot mode refers to Legacy BIOS; the size of the hard disk partition is 1 megabyte.
[0090] In the configured globally unique identifier partition table, create a 1-megabyte hard disk partition, activate the partition by setting the basic input / output system boot flag (bios_grub flag), and make it the boot entry point for Legacy BIOS (second boot mode).
[0091] It should be noted that the above hard drive partitions will not be formatted.
[0092] S203. Create a virtual machine.
[0093] In this embodiment, the virtual machine is configured with a unified and extensible firmware interface.
[0094] Use the virtual machine installation command (virt-install command) to create a virtual machine, configure the virtual machine with a unified and extensible firmware interface, set the virtual machine name, memory, CPU and other parameters, and specify the image disk and system installation source to prepare for the installation of the operating system.
[0095] S204. Based on the virtual machine, load the disk image file and operating system installation source of the image disk to install the operating system using the first boot mode.
[0096] Based on the created virtual machine, and in accordance with the UEFI standard, the disk image file and operating system installation source of the image disk are loaded, and the operating system is installed in the virtual machine to ensure that the system can boot in UEFI mode.
[0097] S205. In the operating system, set a second boot mode identifier for the hard disk partition.
[0098] In an installed operating system, use the lsblk command to list block devices to identify the device number of the 1-megabyte hard drive partition. Then, set the basic input / output system boot identifier (bios_grub identifier) for this hard drive partition so that the system can recognize that this partition supports Legacy BIOS boot mode.
[0099] S206. Install the unified boot loader for the second boot mode to the master boot record of the image disk.
[0100] Depending on the package management system, install the unified boot loader dependency package for the second boot mode, and then use the unified boot loader installation command (grub-install command) to install the unified boot loader to the master boot record of the image disk.
[0101] S207. Generate a unified bootloader configuration file to complete the construction of the cloud image.
[0102] Use the command to generate the GRUB configuration file (grub-mkconfig) to generate a unified boot loader configuration file. This file contains the kernel and initramfs loading path for UEFI and Legacy BIOS modes, thus completing the construction of the cloud image.
[0103] This application provides a method for constructing a cloud image. This method involves creating an image disk and configuring a globally unique identifier partition table for a first boot mode, providing the basic storage structure for subsequent operations and ensuring booting in the first boot mode. A hard disk partition compatible with a second boot mode is created in this partition table, enabling the image disk to support both boot modes. A virtual machine with a unified extensible firmware interface is created, providing a virtual runtime environment for installing the operating system. The virtual machine loads the image disk's disk image file and the operating system installation source, and installs the operating system using the first boot mode, completing the initial deployment of the system in the virtual environment. A second boot mode identifier is set for the hard disk partition in the operating system, allowing the system to recognize that the partition supports the second boot mode. A unified boot loader for the second boot mode is installed to the image disk's master boot record, enabling the image disk to boot in the second boot mode. A unified boot loader configuration file is generated, completing the cloud image construction. This allows the cloud image to correctly boot in both boot modes according to the configuration file, thereby improving the deployment efficiency of cloud images in hybrid hardware environments.
[0104] Figure 3 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 2 ,like Figure 3 As shown, this embodiment, based on the above embodiments, provides a detailed description of the virtual machine creation process, including:
[0105] S301. Copy the startup dependency files of the first startup mode.
[0106] The first boot mode is UEFI, and its boot dependency is the OVMF_VARS.fd file. This file contains the non-volatile random access memory (NVRAM) configuration information required for UEFI boot. This file needs to be copied from the system default path to the current working directory to ensure that it can be directly called when creating virtual machines later, providing the necessary configuration parameters for the UEFI boot environment and avoiding boot failures due to path issues.
[0107] S302. Based on the boot dependency file, create a virtual machine containing the firmware for the first boot mode.
[0108] The virtual machine is created using the virt-install command based on copied boot dependency files. Parameters such as virtual machine name, memory, number of CPU cores, disk path and format, and system installation source CD image file (ISO file) must be specified. The UEFI boot mode must be configured through boot parameters, including loader type (pflash), read-only mode (loader_ro=yes), and NVRAM file path (nvram=OVMF_VARS.fd) to ensure that the virtual machine can correctly load the UEFI firmware and recognize the configuration upon startup.
[0109] The cloud image construction method provided in this application provides the virtual machine with the NVRAM configuration required for the first boot mode by copying the boot dependency file of the first boot mode to the working directory, thus avoiding the failure of boot environment initialization due to missing paths; based on the file, a virtual machine with the firmware configured for the first boot mode is created, and the boot parameters are specified by the virt-install command to ensure that the virtual machine can correctly load the firmware of the first boot mode and recognize the configuration when it starts up, and finally realizes that the virtual machine starts in the first boot mode, providing a compatible boot environment for subsequent operating system installation.
[0110] Figure 4 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 3 ,like Figure 4 As shown, this embodiment, based on the above embodiment, elaborates on the process of setting the second startup mode flag, including:
[0111] S401. In the operating system, determine the device number of the 1-megabyte hard disk partition.
[0112] In the operating system, use the `lsblk` command to view hard drive partition information, filter out the partition with a capacity of 1 megabyte (1 MiB), and record its device number. This partition is usually the EFI system partition (ESP) required for UEFI boot, used to store boot loaders (such as GRUB or UEFI Shell), and you need to ensure that its file system type is FAT32 to be compatible with the UEFI specification.
[0113] S402. Add a second boot mode flag to the hard disk partition based on the device number.
[0114] Use a partitioning tool (such as parted or gdisk) to add a second boot mode flag to the partition.
[0115] For example, the command "parted / dev / sda set 1 boot on" marks partition 1 as bootable, enabling the UEFI firmware to recognize the partition and load the boot program at startup, thus supporting the booting of the operating system from that partition.
[0116] The cloud image construction method provided in this application uses lsblk to locate a 1-megabyte EFI system partition and record the device number to lock the target partition for subsequent operations; then, a partitioning tool is used to add a second boot mode flag to the partition so that the UEFI firmware can recognize it as a valid boot partition, ensuring that the boot program in the partition can be correctly loaded when the system starts, and finally achieving the technical goal of booting the operating system from the specified partition.
[0117] Figure 5 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 4 ,like Figure 5 As shown, this embodiment, based on the above embodiments, provides a detailed description of the installation process of the Master Boot Record, including:
[0118] S501. Install the unified bootloader dependency package.
[0119] Unified bootloader dependencies typically refer to the GRUB-related toolset, which needs to be installed via a system package manager (such as apt or yum). This dependency package contains the GRUB core files, modules, and configuration tools, and is fundamental for building the Master Boot Record (MBR) or EFI system partition boot environment, ensuring the system can recognize disk partitions and load the operating system kernel.
[0120] S502. Based on the unified boot loader dependency package, install the unified boot loader for the second boot mode to the master boot record of the image disk.
[0121] For the second boot mode, use the grub-install command to install the GRUB bootloader to the master boot record (MBR) of the image disk.
[0122] For example, executing "grub-install --target=i386-pc --boot-directory= / boot / dev / sda" writes the GRUB stage 1 code into the 512-byte space of the MBR and establishes a link with the subsequent boot program, enabling GRUB to be loaded and the boot menu to be displayed when booting from the second boot mode.
[0123] The cloud image construction method provided in this application provides the GRUB core file and configuration tools to the system by installing a unified boot loader dependency package, ensuring the integrity of the basic components of the boot environment; after writing the GRUB boot loader into the master boot record of the image disk, the second boot mode can locate and load GRUB through the code in the MBR, thereby recognizing disk partitions, loading the operating system kernel, and finally realizing the multi-system boot management function in the second boot mode.
[0124] Figure 6 A flowchart illustrating the cloud image construction method provided in this application embodiment. Figure 5 ,like Figure 6 As shown, this embodiment, based on the above embodiments, provides supplementary explanations of the generation process of the unified bootloader configuration file and the subsequent processes after the cloud image is built, including:
[0125] S601. Generate a unified boot loader configuration file based on the master boot record to complete the construction of the cloud image.
[0126] In this embodiment, the unified bootloader configuration file includes a kernel and loading path that are compatible with both the first and second boot modes.
[0127] For example, a unified boot loader configuration file is generated by combining the GRUB configuration file generation command (grub-mkconfig command) for either the second boot mode or the first boot mode with the Master Boot Record. This file must contain a kernel and load path compatible with both boot modes to ensure that the cloud image is compatible with both boot modes.
[0128] S602, start the cloud image using the first startup mode and the second startup mode respectively.
[0129] Using a virtual machine management tool, load the built cloud image file in both the first and second boot modes. Observe the bootloader to see if it loads the kernel, verifying that the cloud image can start normally in both modes.
[0130] S603. Based on the startup results, determine whether the cloud image has been successfully built.
[0131] If both the first and second boot modes can successfully load the kernel, display the login screen, or enter system maintenance mode, the cloud image is considered to have been successfully built. If either mode fails to boot, the integrity of the GRUB boot configuration file (grub.cfg), partition identifier, or kernel file must be checked, repaired, and the image rebuilt.
[0132] The cloud image construction method provided in this application ensures that the cloud image is compatible with both the first and second boot modes by generating a GRUB boot configuration file containing the kernel path of the dual boot mode; it verifies the integrity of the image in terms of hardware compatibility by testing the boot process of the two modes respectively; and finally determines whether the image construction is successful based on the boot result, thus providing a reliable base image for subsequent batch deployment or cloud platform upload and avoiding deployment failures caused by boot mode mismatch.
[0133] Figure 7This is a schematic diagram of the cloud image building apparatus provided in an embodiment of this application. The apparatus in this embodiment can be in the form of software and / or hardware. Figure 7 As shown in the embodiment of this application, the cloud image building apparatus 700 includes: a first creation module 701, a second creation module 702, a third creation module 703, a loading module 704, a setting module 705, an installation module 706, and a generation module 707.
[0134] The first creation module 701 is used to create a disk image and configure a globally unique identifier partition table for the disk image; wherein, the globally unique identifier partition table is compatible with the first boot mode.
[0135] The second creation module 702 is used to create a hard disk partition compatible with the second boot mode in the globally unique identifier partition table;
[0136] The third creation module 703 is used to create virtual machines; the virtual machines are configured with a unified extensible firmware interface.
[0137] Loading module 704 is used to load the disk image file of the image disk and the operating system installation source according to the virtual machine, so as to install the operating system using the first boot mode;
[0138] The configuration module 705 is used to set a second boot mode identifier for the hard disk partition in the operating system;
[0139] Install module 706 is used to install a unified boot loader for the second boot mode to the master boot record of the image disk;
[0140] Module 707 is used to generate a unified bootloader configuration file to complete the construction of the cloud image.
[0141] In one possible implementation, the first creation module 701 is further configured to:
[0142] Use an image management tool to create a 10 gigabyte raw disk image format image disk.
[0143] In one possible implementation, the third creation module 703 is further configured to:
[0144] Copy the startup dependency files for the first startup mode;
[0145] Based on the boot dependency files, create a virtual machine containing the firmware for the first boot mode.
[0146] In one possible implementation, the second creation module 702 is also used for hard disk partitioning; the size of the hard disk partition is 1 megabyte.
[0147] In one possible implementation, the setting module 705 is further configured to:
[0148] In the operating system, the device number for a 1-megabyte hard disk partition is determined;
[0149] Add a second boot mode flag to the hard drive partition based on the device number.
[0150] In one possible implementation, the mounting module 706 is further configured to:
[0151] Install the unified bootloader dependency package;
[0152] Install the unified bootloader for the second boot mode to the master boot record of the image disk based on the unified bootloader dependency package.
[0153] In one possible implementation, the generation module 707 is further configured to:
[0154] Based on the Master Boot Record, a unified boot loader configuration file is generated; the unified boot loader configuration file includes a kernel and load path that are compatible with both the first and second boot modes.
[0155] In one possible implementation, the generation module 707 is further configured to:
[0156] Start the cloud image using the first startup mode and the second startup mode respectively;
[0157] Based on the startup results, determine whether the cloud image was built successfully.
[0158] The cloud image building apparatus provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0159] Figure 8 This is a schematic diagram of the structure of the cloud image building device provided in an embodiment of this application. Figure 8 As shown, the cloud image building device 800 provided in this embodiment includes at least one processor 801 and a memory 802. Optionally, the device 800 also includes a communication component 803. The processor 801, memory 802, and communication component 803 are connected via a bus.
[0160] In a specific implementation, at least one processor 801 executes computer execution instructions stored in memory 802, causing at least one processor 801 to perform the above-described method.
[0161] The specific implementation process of processor 801 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0162] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0163] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0164] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0165] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0166] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0167] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0168] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0169] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0170] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0171] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0172] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part 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 of the various embodiments of this invention. 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.
[0173] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0174] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for constructing a cloud image, characterized by, The method comprises the following steps: creating an image disk and configuring a globally unique identifier partition table for the image disk; wherein the globally unique identifier partition table is compatible with a first boot mode; in the globally unique identifier partition table, creating a hard disk partition compatible with a second boot mode; creating a virtual machine; wherein the virtual machine is configured with a unified extensible firmware interface firmware; loading a disk image file and an operating system installation source of the image disk according to the virtual machine, so as to install the operating system in the first boot mode; setting a second boot mode identifier for the hard disk partition in the operating system; installing a unified boot loader for the second boot mode to a master boot record of the image disk; generating a unified boot loader configuration file to complete the construction of a cloud image.
2. The method of claim 1, wherein, The step of creating an image disk comprises the following steps: using an image management tool to create an image disk in a 10-gigabyte bare disk image format.
3. The method of claim 1, wherein, The step of creating a virtual machine comprises the following steps: copying a boot dependency file of the first boot mode; creating a virtual machine containing a first boot mode firmware according to the boot dependency file.
4. The method of claim 1, wherein, The size of the hard disk partition is 1 megabyte.
5. The method of claim 4, wherein, The step of setting a second boot mode identifier for the hard disk partition in the operating system comprises the following steps: determining a device number of the 1-megabyte hard disk partition in the operating system; adding a second boot mode identifier to the hard disk partition according to the device number.
6. The method according to any one of claims 1 to 5, characterized in that, The step of installing a unified boot loader for the second boot mode to a master boot record of the image disk comprises the following steps: installing a unified boot loader dependency package; installing a unified boot loader for the second boot mode to a master boot record of the image disk according to the unified boot loader dependency package.
7. The method according to any one of claims 1 to 5, characterized in that, The step of generating a unified boot loader configuration file comprises the following steps: generating a unified boot loader configuration file according to the master boot record; wherein the unified boot loader configuration file comprises a kernel and a loading path compatible with the first boot mode and the second boot mode.
8. The method according to any one of claims 1 to 5, characterized in that, After the step of generating a unified boot loader configuration file to complete the construction of a cloud image, the method further comprises the following steps: starting the cloud image in the first boot mode and the second boot mode respectively; determining whether the cloud image is successfully constructed according to the starting result.
9. An apparatus for constructing a cloud image, the apparatus comprising: The method comprises the following steps: a first creating module is configured to create an image disk and configure a globally unique identifier partition table for the image disk; wherein the globally unique identifier partition table is compatible with a first boot mode; a second creating module is configured to create a hard disk partition compatible with a second boot mode in the globally unique identifier partition table; a third creating module is configured to create a virtual machine; wherein the virtual machine is configured with a unified extensible firmware interface firmware; a loading module is configured to load a disk image file and an operating system installation source of the image disk according to the virtual machine, so as to install the operating system in the first boot mode; a setting module is configured to set a second boot mode identifier for the hard disk partition in the operating system; an installation module is configured to install a unified boot loader for the second boot mode to a master boot record of the image disk; and a generating module is configured to generate a unified boot loader configuration file to complete the construction of a cloud image. The generating module is configured to generate a uniform start-up bootloader configuration file to complete construction of the cloud image.
10. A cloud image construction device, comprising: Comprising: a memory, a processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the processor executes the method in any one of claims 1-8.
11. A computer readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by the processor to implement the method in any one of claims 1-8.
12. A computer program product, characterised in that, The computer program is executed by the processor to implement the method in any one of claims 1-8.