Method for building jailhouse based on x86 platform using qemu
By downloading container images on the x86 platform and manually building QEMU virtual machines, and using KVM and QEMU virtualization technologies, the complexity of setting up Jailhouse in existing technologies is solved, enabling easy setup and operation in domestic network environments.
Patent Information
- Application Number
- CN202111479062.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2041-12-06
AI Technical Summary
The existing methods for building Jailhouse on the x86 platform are complex, especially in the domestic network environment.
By downloading the container image of Jailhouse source code, running the container image and manually building a QEMU virtual machine, configuring the Jailhouse program, using KVM and QEMU virtualization technologies, and modifying the startup script, the Jailhouse setup can be completed.
It enables easy setup of Jailhouse on the x86 platform, suitable for domestic network environments, ensuring smooth setup and operation.
Smart Images

Figure CN114398144B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer science and technology, and specifically to a method for building a Jailhouse using QEMU on an x86 platform. Background Technology
[0002] Jailhouse is a Linux-based hypervisor released by Siemens in 2013 under the GPLv2 license. Jailhouse is significantly more efficient than QEMU, KVM, and XEN in virtualization, making it suitable for embedded systems. Besides Linux, it can run bare-metal applications or (adapted) operating systems. To achieve this, it configures the CPU and device virtualization capabilities of the hardware platform in a way that prevents these domains (referred to here as "units") from interfering with each other in an unacceptable manner. Jailhouse is optimized for simplicity rather than feature richness. Unlike fully feature-rich Linux-based hypervisors such as KVM or XEN, Jailhouse does not support excessive use of resources such as CPU, RAM, or devices. It does not perform scheduling; it only virtualizes resources essential to the platform and not partitionable in the hardware. Once enabled, Jailhouse runs on bare metal, providing complete control over the hardware without external support. However, unlike other bare-metal hypervisors, it is loaded and configured by a standard Linux system. Its management interface is based on the Linux infrastructure. Therefore, first boot Linux, then enable Jailhouse, and finally split a portion of the system resources and allocate them to other units.
[0003] However, most existing methods for building Jailhouse on the x86 platform are quite complex, and this complexity is even more pronounced in the unique network context in China.
[0004] Therefore, it is necessary to provide a method for building Jailhouse on the x86 platform, which can be easily completed in a domestic network environment. Summary of the Invention
[0005] Technical problems to be solved
[0006] To address the aforementioned shortcomings of existing technologies, this invention provides a method for building a Jailhouse using QEMU on an X86 platform. This method enables the construction of a Jailhouse using QEMU on an X86 platform, making the construction of a Jailhouse highly convenient in the domestic network environment.
[0007] Technical solution
[0008] To achieve the above objectives, the present invention provides the following technical solution:
[0009] This invention provides a method for building a Jailhouse using QEMU on an x86 platform, comprising the following steps:
[0010] S1. On the X86 platform, download the container image including the Jailhouse source code;
[0011] S2. Run the container image and manually build the QEMU virtual machine so that the Jailhouse program is set on the QEMU virtual machine;
[0012] S3. Run the QEMU virtual machine to complete the setup of the Jailhouse program.
[0013] Furthermore, step S1 specifically includes:
[0014] Install the necessary software on the X86 platform, download the Jailhouse source code, and combine the necessary software and the Jailhouse source code to generate a container.
[0015] Manually download the container image.
[0016] Furthermore, step S2 specifically includes:
[0017] First, enter the container image interactively, revoke the NO_PROXY environment variable and reconfigure the agent, and then manually build the QEMU virtual machine, which is based on the Jailhouse source code and has the Jailhouse program configured.
[0018] Furthermore, the manual construction of the QEMU virtual machine specifically includes: using KVM virtualization technology to handle CPU virtualization and memory virtualization, using QEMU virtualization technology to virtualize the I / O device interface and the user-mode control interface, and combining the two to generate the QEMU virtual machine.
[0019] Furthermore, the manual method of building the QEMU virtual machine specifically uses the command kas build / repo / kas.yml.
[0020] Furthermore, the construction of the QEMU virtual machine also includes observation of the construction process, specifically using the iftop-B and top-d1 commands outside the container image to observe whether the system is building the QEMU virtual machine.
[0021] Furthermore, use the unset command to delete the NO_PROXY environment variable.
[0022] Furthermore, it also includes modifying the startup script of the QEMU virtual machine, specifically including: replacing the executable path of the QEMU virtual machine, adding a VNC full network interface listening port on the QEMU virtual machine, and adding an SSH debugging port on the QEMU virtual machine.
[0023] Based on the same inventive concept, the present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it implements the method described in any of the above-mentioned embodiments.
[0024] Based on the same inventive concept, the present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the method described in any of the above-mentioned embodiments.
[0025] Beneficial effects
[0026] This invention provides a method for building Jailhouse using QEMU on the X86 platform. It can correctly and smoothly complete the construction of Jailhouse in the QEMU environment on the X86 platform and run the official demo, making the construction and operation of Jailhouse very convenient in the domestic network environment. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0028] Figure 1 This is a schematic diagram illustrating the steps of a method for building a Jailhouse using QEMU on an X86 platform according to an embodiment of the present invention;
[0029] Figure 2 This is a schematic diagram of a method for building a Jailhouse using QEMU on an X86 platform, provided in an embodiment of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0031] First, the technical terms mentioned in this invention will be explained:
[0032] QEMU is an open-source virtual machine monitor widely used on the Linux platform. It provides virtualization services purely in software and, combined with the KVM (Kernel Virtual Machine) module in the Linux kernel, supports hardware virtualization. Currently, the Linux platform typically uses QEMU+KVM to provide virtualization services: KVM handles CPU and memory virtualization, while QEMU handles device emulation, including emulating BIOS, PCI / PCIe buses, disks, network cards, graphics cards, sound cards, keyboards, mice, etc. QEMU also handles the interface with cloud desktops such as SPICE: receiving user operation requests from SPICE and other cloud desktops and passing them to the virtual machine, and sending image, sound, and other data from the virtual machine to SPICE and other cloud desktops.
[0033] See Figure 1 One embodiment of the present invention provides a method for building a Jailhouse using QEMU on an X86 platform, comprising the following steps:
[0034] S1. On the X86 platform, download the container image including the Jailhouse source code;
[0035] S2. Run the container image and manually build the QEMU virtual machine so that the Jailhouse program is set on the QEMU virtual machine;
[0036] S3. Run the QEMU virtual machine to complete the setup of the Jailhouse program.
[0037] In this embodiment, for step S1, when building the environment, an agent tool is required, and a physical Linux machine is generally used instead of VMware, vSphere, or QEMUS virtual machines. Taking CentOS 8.2 system as an example, the implementation steps are as follows:
[0038] See Figure 2Install the necessary software on the x86 platform, download the Jailhouse source code, and combine the necessary software and the Jailhouse source code to generate a container; finally, manually download the container image. Necessary software includes, for example, git, elfutils-libelf-devel, qemu-kvm, python3, and python3-pip. When downloading the Jailhouse source code, generally use the git tool to clone it from the official address https: / / github.com / siemens / jailhouse-images.git; set the terminal proxy so that export http_proxy=xxx https_proxy=xxx; manually download the container image, generally using podman or docker.
[0039] In this embodiment, for step S2, the container image is typically accessed interactively first. The NO_PROXY environment variable is then removed, and the agent is reconfigured. Then, the QEMU virtual machine is built manually. This QEMU virtual machine is based on the Jailhouse source code and includes the Jailhouse program. Specific steps are as follows: Figure 2 As shown. In addition, the following command is generally executed to enter the container image: `podman run -v `pwd`: / repo:ro -v `pwd`: / work:rw --workdir= / work -e USER_ID=0 -e GROUP_ID=0 --rm-tie TERM=xterm -e KAS_TARGET=mc:qemu-amd64-jailhouse-demo:demo-image -e SHELL= / bin / bash --privileged --pid=host --userns=keep-id --security-opt label=disable ghcr.io / siemens / kas / kas-isar:2.4 / bin / bash`; Further, the `unset` command is generally used to delete the `NO_PROXY` environment variable; even further, the terminal proxy is set so that `export http_proxy=xxx`. https_proxy=xxx; Finally, the QEMU virtual machine is usually built manually using the kasbuild / repo / kas.yml command, and then the container image is exited after successful execution, which takes about 2-6 hours.
[0040] In this embodiment, the construction of the QEMU virtual machine also includes observation of the construction process. Specifically, the iftop-B and top-d1 commands are used outside the container image to observe whether the system is building the QEMU virtual machine, so as to know the construction status and enable the operator to make adjustments during the construction process.
[0041] In this embodiment, the manual construction of the QEMU virtual machine specifically includes: using KVM virtualization technology for CPU and memory virtualization, and using QEMU virtualization technology for I / O device interfaces and user-space control interfaces, combining both to generate the QEMU virtual machine. This invention, on an x86 platform, sets up a terminal agent and manually downloads the container image. After successful download, it manually starts the container to execute the QEMU virtual machine construction process using KAS. Before the construction process, NO_PROXY is disabled and terminal agent variables are set, enabling Yocto to access certain resources normally. The complete above operation process can successfully complete the setup of the Jailhouse KVM environment.
[0042] In this embodiment, the method further includes modifying the startup script of the QEMU virtual machine, specifically by: replacing the executable path of the QEMU virtual machine, adding a VNC global network interface listening port to the QEMU virtual machine, and adding an SSH debugging port to the QEMU virtual machine. Furthermore, to replace the executable path of the QEMU virtual machine, the sed command can be used to replace qemu-system-x86_64 with / usr / libexec / qemu-kvm; further, to add a VNC global network interface listening port to the QEMU virtual machine, the sed command can be used to replace serial vc with serial vc-vnc 0.0.0.0:1; and further still, to add an SSH debugging port to the QEMU virtual machine, the sed command can be used to replace netdev=net with netdev=net0-netdev user,id=net0,hostfwd=tcp::5555-:22. After the QEMU virtual machine is built, before starting the QEMU virtual machine in the Jailhouse program, modify the official QEMU virtual machine startup script to add an SSH port for easier debugging.
[0043] Based on the same inventive concept, the present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it implements the method of building Jailhouse using QEMU based on the X86 platform.
[0044] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor (e.g., a GPU (Graphics Processing Unit)), or other data processing chip. The processor is typically used to control the overall operation of the electronic device. In this embodiment, the processor is used to run program code stored in the memory or process data, for example, to run the program code for the method of building Jailhouse using QEMU on an x86 platform.
[0045] The memory includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory may be an internal storage unit of the electronic device, such as the hard disk or RAM of the electronic device. In other embodiments, the memory may also be an external storage device of the electronic device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, flash card, etc., equipped on the electronic device. Of course, the memory may also include both internal storage units and external storage devices of the electronic device. In this embodiment, the memory is typically used to store operating methods and various application software installed on the electronic device, such as the program code of the method for building Jailhouse using QEMU on the x86 platform. In addition, the memory can also be used to temporarily store various types of data that have been output or will be output.
[0046] Based on the same inventive concept, the present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the method of building Jailhouse using QEMU on an X86 platform.
[0047] The advantage of this invention is that it provides a method for building Jailhouse using QEMU on the X86 platform. This method can correctly and smoothly complete the construction of Jailhouse and the running of the official demo on the X86 platform QEMU environment, making the construction and operation of Jailhouse very convenient in the domestic network environment.
[0048] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for building Jailhouse based on X86 platform using QEMU, characterized in that, The method comprises the following steps: S1, under an X86 platform, downloading a container image comprising Jailhouse source code; S2, running the container image and manually building a QEMU virtual machine, so that the QEMU virtual machine is provided with the Jailhouse program; S3, running the QEMU virtual machine to complete the building of the Jailhouse program; Step S2 specifically comprises: first entering the inside of the container image using an interactive mode, revoking the NO_PROXY environment variable and setting the proxy again, and then manually building the QEMU virtual machine, which is provided with the Jailhouse program based on the Jailhouse source code.
2. The method of building Jailhouse based on X86 platform using QEMU according to claim 1, characterized in that, Step S1 specifically comprises: installing necessary software on an X86 platform, downloading Jailhouse source code, and generating a container by integrating the necessary software and the Jailhouse source code; manually downloading a container image.
3. The method of building Jailhouse based on X86 platform using QEMU according to claim 1, characterized in that, The manually building the QEMU virtual machine specifically comprises: using KVM virtualization technology to be responsible for CPU virtualization and memory virtualization, using QEMU virtualization technology to virtualize IO device interfaces and user state control interfaces, and generating the QEMU virtual machine by integrating the two.
4. The method of building Jailhouse based on X86 platform using QEMU according to claim 1, characterized in that, The manually building the QEMU virtual machine specifically adopts a kas build / repo / kas.yml command.
5. The method of building Jailhouse based on X86 platform using QEMU according to claim 1, characterized in that, The building of the QEMU virtual machine further comprises observing the building process, specifically using iftop-B and top-d1 commands outside the container image to observe whether the system is building the QEMU virtual machine.
6. The method of building Jailhouse based on X86 platform using QEMU according to claim 1, characterized in that, The NO_PROXY environment variable is deleted using an unset command.
7. The method of building Jailhouse based on X86 platform using QEMU according to claim 1, characterized in that, It also comprises modifying the startup script of the QEMU virtual machine, specifically comprising: replacing the execution program path of the QEMU virtual machine, adding a vnc full network card listening port on the QEMU virtual machine, and adding an ssh debugging port on the QEMU virtual machine.
8. An electronic device, comprising: The computer program stored on the storage medium is executed by the processor to implement the method of any one of claims 1 to 7.
9. A readable storage medium, characterized by, The computer program stored in the readable storage medium is executed by the processor to implement the method of any one of claims 1 to 7.