A hybrid deployment method of Hongmeng operating system and real-time operating system
By determining hardware virtualization support on the RK3568 chip, cross-compiling Jailhouse and configuring an independent running space, the problem of resource allocation and communication between operating systems in embedded systems is solved, efficient hardware resource utilization and high-performance computing are achieved, and expanded Application scenarios.
Patent Information
- Application Number
- CN202410320339.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-20
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-03-20
AI Technical Summary
In embedded systems, a single operating system cannot meet the real-time and high-performance computing requirements of complex applications. Traditional virtualization solutions consume high resources, making it difficult to effectively deploy Jailhouse and Hongmeng OpenHarmony systems on ARM architecture hardware platforms.
By determining the hardware virtualization support on the RK3568 chip, cross-compile Jailhouse into an OpenHarmony function module, configure an independent running space, realize inter-core communication between OpenHarmony and RTOS, and use shared memory and virtual interrupts for efficient communication.
It achieves reasonable allocation and efficient utilization of hardware resources, combines the high-performance computing of Hongmeng operating system and the high real-time performance of RTOS, and expands the application scenarios and working capabilities of the chip.
Smart Images

Figure CN118227145B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of embedded system virtualization technology, and specifically relates to a method for hybrid deployment of a Hongmeng operating system and a real-time operating system. Background Art
[0002] In modern computing environments, embedded systems are increasingly used, from smart home devices to industrial automation equipment to complex aerospace systems. However, as the complexity of applications increases, a single operating system often cannot meet all needs. For example, some applications may require a real-time operating system (RTOS) to meet strict real-time requirements, while other applications also require an operating system with high-performance computing to support rich functions and user interfaces such as AI computing. Therefore, how to run multiple operating systems in parallel on a single hardware platform has become an important research topic.
[0003] Virtualization technology provides a possible solution to this problem. Through virtualization technology, multiple virtual machines can be created on the same platform, and each virtual machine can run a different operating system. However, traditional virtualization solutions, such as KVM and Xen, often require a large amount of system resources, which is unacceptable in embedded systems with limited resources.
[0004] Jailhouse is a new type of ultra-micro virtual machine hypervisor, which is designed to achieve the minimum resource usage and the highest performance. However, applying Jailhouse to embedded systems, especially on ARM architecture hardware platforms, still faces many challenges. For example, how to load and start Jailhouse in the Hongmeng OpenHarmony system, how to run RTOS in Jailhouse, how to achieve communication between operating systems, and how to manage and allocate hardware resources. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a hybrid deployment method of the Hongmeng operating system and the real-time operating system, which runs Jailhouse on the RK3568 chip equipped with OpenHarmony and starts the RTOS operating system, and at the same time, realizes the communication function between the two operating systems.
[0006] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0007] A hybrid deployment method of a Hongmeng operating system and a real-time operating system comprises the following steps:
[0008] Step 1) Make sure that the RK3658 chip of the Hongmeng OpenHarmony operating system supports hardware virtualization;
[0009] Step 2), cross-compile JailHouse into a functional module of the OpenHarmony operating system;
[0010] Step 3) Create and write the JailHouse configuration file to configure the independent running space Cell that runs OpenHarmony and the real-time RTOS operating system;
[0011] Step 4), run the OpenHarmony operating system and activate the JailHouse function module within it;
[0012] Step 5) Create and activate a new isolated Cell and run the RTOS operating system on it;
[0013] Step 6) Use shared memory to implement the inter-core communication mechanism between OpenHarmony and RTOS operating system.
[0014] Furthermore, the step 1) includes, by referring to the technical manual and hardware specification of the RK3568 chip, determining that the RK3568 chip supports hardware virtualization and IOMMU technology.
[0015] Furthermore, the step 2) includes cross-compiling Jailhouse on the RK3568 chip equipped with the OpenHarmony operating system, compiling Jailhouse into a functional module of the OpenHarmony operating system, mounting it on the OpenHarmony operating system kernel, and providing it to the RK3568 chip for use.
[0016] Furthermore, the Jailhouse source code is cross-compiled using the entire compilation tool chain of the OpenHarmony operating system, and compiled into a binary file that can run on the RK3568 chip, forming a kernel-loadable functional module; after the compilation is completed, the "Jailhouse.ko" file is generated under the compilation path, and then the insmod command is used to load the Jailhouse functional module into the OpenHarmony operating system, and the loading status of the Jailhouse functional module is confirmed through the lsmod command.
[0017] Furthermore, the step 3) includes creating independent running cells for OpenHarmony and RTOS operating systems in the Jailhouse function module through configuration files, assigning OpenHarmony to run in the root cell and assigning RTOS to run in the non-root cell, so as to realize an independent running environment for each operating system.
[0018] Furthermore, the step 4) includes first loading the OpenHarmony operating system when the system starts, activating the Jailhouse function module therein, and running the OpenHarmony operating system in the root cell.
[0019] Furthermore, the step 5) includes, based on the configuration file written in step 3), using the create command to create a new non-root cell, so that the system allocates CPU, memory, and device resources to it, and starts loading the new non-root cell into the Jailhouse function module.
[0020] Furthermore, the step 6) includes allocating a shared memory for the two operating systems, OpenHarmony and RTOS, and then realizing communication between the two operating systems by reading and writing data in the shared memory, and then using virtual interrupts to simultaneously notify the two operating systems that new data is available for reading.
[0021] The beneficial effects of the present invention are:
[0022] On the RK3568 chip, Jailhouse is used to allocate chip resources on demand to the OpenHarmony operating system and the RTOS operating system, ensuring the reasonable and full use of hardware resources. At the same time, the high-performance computing capabilities of OpenHarmonyOS, the interoperability capabilities of soft bus interconnection, atomic services, and other Hongmeng capabilities are perfectly combined with the high real-time capabilities of RTOS. By sharing memory, high-speed communication between the two operating systems is achieved, solving the problem of low real-time capabilities of the Hongmeng operating system itself. In addition, by hybrid deployment of OpenHarmonyOS and RTOS, the RK3568 control board also has functions with high-performance requirements such as Hongmeng strong AI computing in scenarios with high real-time requirements. The present invention enables the RK3568 chip to have the advantages of both operating systems, with a wider range of usage scenarios and more powerful working capabilities. Based on the idea of the present invention, multiple operating systems can also be hybrid deployed on RK3568 and other series chips to achieve the purpose of use in established scenarios and gradually expand chip capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flow chart of a hybrid deployment method of Hongmeng operating system and real-time operating system according to the present invention;
[0024] Figure 2 This is an application flow chart of a hybrid deployment method of Hongmeng operating system and real-time operating system based on the present invention. DETAILED DESCRIPTION
[0025] In order to express the purpose, technical solutions and advantages of the present invention more clearly, the present invention will be further described in detail below through embodiments and drawings.
[0026] The present invention provides a hybrid deployment method of Hongmeng operating system and real-time operating system; Figure 1 As shown, a flow chart of a hybrid deployment method of Hongmeng operating system and real-time operating system of the present invention is given:
[0027] First of all, the present invention involves confirming that RK3568 supports ARM hardware virtualization and IOMMU technology. This is a critical step, because the working principle of Jailhouse is based on hardware virtualization technology, which allows multiple independent virtual machines to run on a physical machine, each with its own operating system and application. By referring to the technical manual and hardware specification of RK3568, it can be determined that the RK3568 chip supports hardware virtualization and IOMMU technology. These two technologies can provide hardware-level isolation, so that each virtual machine runs independently and does not interfere with each other; IOMMU technology can also be used to provide direct memory access protection for devices to prevent devices from accessing illegal memory areas. The support of these two technologies is the basis for the subsequent work of the present invention.
[0028] Secondly, the present invention relates to cross-compiling Jailhouse on the RK3568 chip equipped with the OpenHarmony system, compiling Jailhouse into a functional module of the OpenHarmony system, mounting it on the system kernel, and providing it to the RK3568 chip for use. The present invention selects a complete set of compilation tool chains for the OpenHarmony operating system, cross-compiles the Jailhouse source code, and compiles it into a binary file that can be run on the RK3568 chip to form a kernel-loadable module. In this process, it is necessary to fine-tune various parameters to ensure that the binary file can maximize the hardware characteristics of the RK3568 chip, and it is also necessary to adapt the relevant components to achieve the best performance. This process involves the adaptation of key parts such as memory management, task scheduling, and interrupt processing. After the compilation is completed, a "Jailhouse.ko" file is generated under the compilation path, and then the Jailhouse module is loaded into the OpenHarmony system using the insmod command. The loading of the Jailhouse module can be confirmed by the lsmod command. If the mounting is successful, the Jailhouse can be further used to complete the implementation of subsequent functions.
[0029] Subsequently, the present invention involves creating independently running Cells for OpenHarmony and RTOS in Jailhouse through configuration files, assigning OpenHarmony to run in the root cell, and assigning RTOS to run in the non-root cell, so as to realize an independent operating environment for each operating system. When writing each configuration file, the resource allocation, startup parameters and other information of the Cell are specified, and then the command line tool of the Jailhouse is used to create the Cell and load the operating system. By creating different Cells, the present invention can run OpenHarmony and RTOS operating systems in parallel on the same hardware platform RK3568, and theoretically can run multiple different operating systems.
[0030] Then, the present invention first loads the OpenHarmony operating system when the system starts, activates the Jailhouse inside it, and loads and runs the RTOS in the isolated Cell. According to the rules specified in the configuration file, OpenHarmony will first run in the root cell, have access to all hardware resources, run the command line tools of the Jailhouse in it, and manage and control other Cells. Based on the above configuration file, a new non-root cell is created using the create command, so that the system allocates resources including CPU, memory, devices, etc. to it, and starts loading the Cell into the Jailhouse, providing the RTOS operating system with an independent, non-interfering operating environment, so that the entire RK3568 hardware platform has both the high-performance computing advantages of the OpenHarmony system and the high real-time characteristics of the RTOS operating system, thereby achieving the core purpose of the present invention.
[0031] Finally, the present invention implements an inter-core communication mechanism of two operating systems, and realizes efficient communication between the two operating systems based on a communication mechanism of shared memory, without the need for direct interaction through hardware. Specifically, the present invention allocates a section of shared memory for the two operating systems, and then realizes communication by reading and writing data in the shared memory, and then uses virtual interrupts to notify the operating systems that new data is available. This communication mechanism can not only realize efficient communication, but also ensure the consistency and integrity of data.
[0032] Example
[0033] The present invention provides a hybrid deployment method of Hongmeng operating system and real-time operating system, which specifically includes the processes of determining hardware virtualization support, cross-compiling Jailhouse, writing configuration files, starting two systems, and realizing inter-core communication, etc. Figure 2The specific implementation process of Jailhouse adaptation for RK3568 chip is as follows:
[0034] Step 1. Hardware preparation. Before starting, make sure the RK3568 development board is ready and connected to the necessary peripherals to provide a corresponding physical foundation for subsequent software deployment and testing.
[0035] Step 2. Make sure that the RK3568 chip supports hardware virtualization and IOMMU technology by referring to the RK3568 technical manual and hardware specification.
[0036] Step 3. Obtain source code. Download the source code of OpenHarmony, Jailhouse, and FreeRTOS from the official repository, manage the source code in a unified manner, and prepare for compilation.
[0037] Step 4. Configure and check the compilation environment. To ensure that the software can run on RK3568, you need to install a cross-compilation tool chain compatible with the RK3568 chip, set relevant environment variables, and ensure that these tools can be called directly in the terminal.
[0038] Step 5. Compile OpenHarmony source code. According to the hardware characteristics of RK3568, adjust the compilation configuration of Openharmony appropriately, and then use the cross-compilation tool chain to compile OpenHarmony to generate a binary image file compatible with RK3568.
[0039] Step 6. Compile Jailhouse. Use OpenHarmony's complete compilation tool chain to cross-compile the Jailhouse source code into a binary file that can run on the RK3568 chip, forming a kernel-loadable module (".ko") file, ready to be provided to the system kernel.
[0040] Step 7. Adapt Jailhouse to OpenHarmony. Integrate Jailhouse's kernel module file into the OpenHarmony system, mount it on the kernel, modify OpenHarmony's kernel configuration, and ensure that the Jailhouse module will be automatically loaded by the system when the system starts.
[0041] Step 8. Compile FreeRTOS. Similar to the compilation process of OpenHarmony, first configure FreeRTOS according to the hardware characteristics of RK3568, then compile it using the cross-compilation toolchain to generate a FreeRTOS binary file compatible with RK3568.
[0042] Step 9. System startup and Jailhouse activation. First, start the OpenHarmony operating system and ensure that it runs stably on RK3568. Then load and activate the Jailhouse function module inside it, and then start the ultra-micro virtual machine hypervisor.
[0043] Step 10. Write the jailhouse configuration file. Use the configuration file to create independent cells for OpenHarmony and RTOS in the jailhouse. Assign OpenHarmony to the root cell and RTOS to the non-root cell to achieve an independent operating environment for each operating system. When writing each configuration file, specify the resource allocation, startup parameters, and other information of the cell.
[0044] Step 11. Start the root cell. In Jailhouse, first create a root cell for OpenHarmony, write configuration files, allocate corresponding resources to the main system, etc., have access to all hardware resources, run Jailhouse command line tools in it, and manage and control other cells.
[0045] Step 12. Create a non-root cell and start the RTOS. Use the create command to create a new non-root cell, so that the system can allocate resources including CPU, memory, and devices to it, and start loading the Cell into the Jailhouse, providing the RTOS operating system with an independent and non-interfering operating environment. Start the RTOS in this Cell.
[0046] Step 13. Implement inter-core communication. Allocate a shared memory for the two operating systems, and then implement communication by reading and writing data in the shared memory, and then use virtual interrupts to notify the operating system that new data is available. This communication mechanism can not only achieve efficient communication, but also ensure data consistency and integrity.
[0047] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A hybrid deployment method of Hongmeng operating system and real-time operating system, It is characterized in that The following steps are involved: Step 1) Make sure that the RK3658 chip of the Hongmeng OpenHarmony operating system supports hardware virtualization; Step 2) Cross-compile JailHouse into a functional module of the OpenHarmony operating system; Step 3) Create and write the JailHouse configuration file to configure the independent running space Cell that runs OpenHarmony and the real-time RTOS operating system; Step 4) Run the OpenHarmony operating system and activate the JailHouse function module within it; Step 5) Create and activate a new isolated Cell and run the RTOS operating system on it; Step 6) Use shared memory to implement the inter-core communication mechanism between OpenHarmony and RTOS operating system; Wherein, the step 2) includes cross-compiling Jailhouse on the RK3568 chip equipped with the OpenHarmony operating system, compiling Jailhouse into a functional module of the OpenHarmony operating system, mounting it on the kernel of the OpenHarmony operating system, and providing it to the RK3568 chip for use: using the entire compilation tool chain of the OpenHarmony operating system, cross-compiling the Jailhouse source code, compiling it into a binary file that can run on the RK3568 chip, and forming a kernel-loadable functional module; after the compilation is completed, generating a "Jailhouse.ko" file under the compilation path, and then using the insmod command to load the Jailhouse functional module into the OpenHarmony operating system, and confirming the loading status of the Jailhouse functional module through the lsmod command; The step 3) includes creating independent running cells for OpenHarmony and RTOS operating systems in the Jailhouse function module through configuration files, allocating OpenHarmony to run in the root cell and allocating RTOS to run in the non-root cell, so as to realize an independent running environment for each operating system; The step 4) includes first loading the OpenHarmony operating system when the system starts, activating the Jailhouse function module inside the OpenHarmony operating system, and running the OpenHarmony operating system in the root cell.
2. According to claim 1, a hybrid deployment method of Hongmeng operating system and real-time operating system, It is characterized in that The step 1) includes determining that the RK3568 chip supports hardware virtualization and IOMMU technology by referring to the technical manual and hardware specification of the RK3568 chip.
3. According to the method for hybrid deployment of Hongmeng operating system and real-time operating system according to claim 1, It is characterized in that The step 5) includes, based on the configuration file written in step 3), using the create command to create a new non-root cell, allowing the system to allocate CPU, memory, and device resources to it, and starting to load the new non-root cell into the Jailhouse function module.
4. According to claim 1, a hybrid deployment method of Hongmeng operating system and real-time operating system, It is characterized in that The step 6) includes allocating a shared memory for the two operating systems, OpenHarmony and RTOS, and then realizing communication between the two operating systems by reading and writing data in the shared memory, and then using virtual interrupts to simultaneously notify the two operating systems that new data is readable.
