Transplanting method and device of swan gap system, storage medium and computer equipment

By building the Hongmeng system in the accelerator field, obtaining the source code and configuring the compilation environment, generating and burning the image, the problems of autonomous control and integration complexity of the accelerator's software and hardware platform were solved, the flexibility and security of the system were achieved, and the stable operation of the accelerator equipment was ensured.

CN120743348APending Publication Date: 2025-10-03INST OF MODERN PHYSICS CHINESE ACADEMY OF SCI
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510610094.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-13
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

In the existing technology, the software and hardware platforms in the accelerator field lack autonomous control capabilities at the operating system level, have poor response flexibility, and the complexity and security of integration and maintenance cannot be guaranteed. The Hongmeng system has not been widely used in accelerator-related projects.

Method used

By building the HarmonyOS to be ported based on the target chip, obtaining the source code and configuring the compilation configuration file, setting up the compilation environment, generating the kernel image and root file system image, burning them to the target chip and performing functional verification and testing, the kernel layer porting and the configuration of the boot recovery subsystem are realized.

Benefits of technology

It improves the system's response flexibility, simplifies the integration and maintenance process, ensures the system's security and stability, enables the Hongmeng system to successfully adapt to the target chip, and ensures the stable and reliable operation of the accelerator equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743348A_ABST
    Figure CN120743348A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of chip development, and discloses a transplanting method and device of a swan gap system, a storage medium and computer equipment, and the method comprises the steps: constructing a swan gap system to be transplanted based on a target chip, obtaining a corresponding source code, and then configuring a compiling configuration file in the source code, the compiling subsystem is used for establishing a compiling environment based on configuration information in the compiling configuration file, performing transplantation adaptation on a kernel layer in the compiling environment to generate a kernel mirror image, configuring the starting recovery subsystem, generating a root file system mirror image based on the file system configuration file, and starting the starting recovery subsystem. And finally burning the kernel mirror image and the root file system mirror image to a target chip, and performing function verification and test on the target chip. According to the method disclosed by the present invention, the swan-gap system transplantation including kernel layer transplantation, subsystem adaptation and root file system customization is designed and realized, so that the swan-gap system is successfully adapted to the target chip, and the accelerator equipment carrying the target chip can stably and reliably operate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chip development technology, and in particular to a transplantation method, device, storage medium and computer equipment for a Hongmeng system. Background Art

[0002] With the rapid development of particle accelerator technology, the number and complexity of related equipment continue to grow, which also poses challenges to the sustainability and maintenance efficiency of application software. In order to enhance the overall performance of accelerator systems, simplify the integration and maintenance processes, and reduce costs, the concept of hardware and software standardization has gradually been spread in some accelerator research projects, such as the Accelerator Driven Transmutation Research Device (CiADS) project. Based on this, OH (OpenHarmony, also known as Hongmeng), as an efficient and flexible distributed operating system, has a unique adaptation layer that can shield the differences between different kernels and hardware, providing a unified functional interface for the application layer. It also has good hardware compatibility and a modular design, providing an ideal development platform for accelerator software standardization.

[0003] In existing technologies, the software and hardware platforms in the accelerator field lack autonomous control capabilities at the operating system level, have poor response flexibility, and the complexity and security of integration and maintenance cannot be guaranteed. At the same time, although OH already supports some chips, it has not yet been applied in accelerator-related projects such as CiADS.

[0004] Therefore, a transplantation method of the Harmony system that can apply the Harmony system to the hardware and software platform in the accelerator field to reduce the difficulty of system integration and maintenance and improve system flexibility and security is in urgent need of research. Summary of the Invention

[0005] In view of this, the present application provides a transplantation method, device, storage medium and computer equipment of the Harmony system, the main purpose of which is to solve the technical problem in the prior art that the Harmony system cannot be applied to the software and hardware platform in the accelerator field.

[0006] According to a first aspect of the present invention, a method for porting a Hongmeng system is provided, the method comprising:

[0007] Building a HarmonyOS system to be transplanted based on the target chip, and obtaining the source code of the HarmonyOS system to be transplanted, wherein the HarmonyOS system to be transplanted includes a kernel layer;

[0008] Configuring a compilation configuration file in the source code, and using a compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file;

[0009] In the compilation environment, the kernel layer is transplanted and adapted to generate a kernel image, a startup recovery subsystem is configured, and a root file system image is generated based on a file system configuration file;

[0010] Burn the kernel image and the root file system image to the target chip, and perform functional verification and testing on the target chip.

[0011] Optionally, the building of the Harmony system to be ported based on the target chip includes: determining the hardware platform of the accelerator controller and the target chip in the hardware platform based on the hardware requirements of the accelerator controller in a preset project; selecting the Harmony system to be ported from multiple Harmony systems with different kernels according to the operating requirements of the hardware platform and the hardware requirements applicable to different types of Harmony systems, wherein the kernel supported by the Harmony system to be ported is the Linux kernel.

[0012] Optionally, the HarmonyOS system to be ported includes a hardware layer, a kernel layer, an adaptation layer and a system service layer from bottom to top; the hardware layer includes a target chip and multiple peripheral devices; the kernel layer integrates the Linux kernel and the driver subsystem, and the kernel layer implements a multi-kernel architecture based on the abstraction and management of the adaptation layer; the adaptation layer includes a kernel abstraction layer, an operating system abstraction layer, a hardware abstraction layer and a hardware device interface, and the adaptation layer is used to provide a unified interface and shield the differences between the underlying hardware and the kernel; the system service layer includes a boot recovery subsystem, a Hilog subsystem and a driver subsystem, and the system service layer is used to provide system services and perform unified management.

[0013] Optionally, the configuration includes configuring a compilation configuration file in the source code and using a compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file, including: searching for a compilation configuration file in the directory of the source code, and configuring the compilation configuration file according to the basic information of the HarmonyOS system to be ported; installing multiple preset compilation tools, and designing a componentized compilation subsystem based on the compilation tools; using the compilation subsystem to parse the configuration information carried in the compilation configuration file, determining the subsystem to be compiled and the dependencies of the subsystem to be compiled, and building a compilation environment.

[0014] Optionally, the kernel layer includes a Linux kernel; the transplanting and adapting of the kernel layer to generate a kernel image includes: creating a cross-level log agent module in the Linux kernel to manage and transmit log data between the kernel layer and the user space; calling a log bidirectional transmission channel to realize log data interaction between the kernel layer and the user space; adjusting the buffer based on the kernel characteristics of the Linux kernel to complete the transplantation of the Hilog subsystem.

[0015] Optionally, the kernel layer includes a driver subsystem; the transplanting and adapting of the kernel layer to generate a kernel image also includes: adding the compilation rules of the Linux kernel in a preset compilation tool, and generating a kernel image based on the compilation rules; integrating the driver subsystem into the kernel image based on the kernel link script, and adapting the hardware driver framework and operating system abstraction layer in the kernel driver of the kernel image; adding configuration items related to the driver subsystem to the kernel configuration system, and generating a kernel image based on the kernel image and the kernel configuration system.

[0016] Optionally, configuring the startup recovery subsystem includes: adding the startup recovery subsystem and its components in the compiled configuration file, and configuring multiple key configuration files in the compiled configuration file based on the target chip; configuring the startup configuration file based on a preset format, wherein the startup configuration file is used to define system startup services and permissions.

[0017] According to a second aspect of the present invention, a transplantation device for a Hongmeng system is provided, the device comprising:

[0018] A transplantation system selection module is used to build a HarmonyOS system to be transplanted based on the target chip and obtain the source code of the HarmonyOS system to be transplanted, wherein the HarmonyOS system to be transplanted includes a kernel layer;

[0019] A compilation environment building module, configured to configure a compilation configuration file in the source code, and use a compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file;

[0020] A system image generation module is used to transplant and adapt the kernel layer to generate a kernel image in the compilation environment, configure the startup recovery subsystem, and generate a root file system image based on the file system configuration file;

[0021] The system burning and testing module is used to burn the kernel image and the root file system image to the target chip, and perform functional verification and testing on the target chip.

[0022] According to a third aspect of the present invention, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Hongmeng system porting method is implemented.

[0023] According to a fourth aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned Hongmeng system porting method when executing the program.

[0024] The present invention provides a method, device, storage medium, and computer device for porting a Hongmeng system. First, the Hongmeng system to be ported is constructed based on a target chip, and the source code of the Hongmeng system to be ported is obtained. Then, a compilation configuration file in the source code is configured, and a compilation environment is built using a compilation subsystem based on the configuration information in the compilation configuration file. Then, in the compilation environment, the kernel layer of the Hongmeng system to be ported is ported and adapted to generate a kernel image, a boot recovery subsystem is configured, and a root file system image is generated based on the file system configuration file. Finally, the kernel image and the root file system image are burned to the target chip, and the target chip is functionally verified and tested. The above method is customized based on the source code of the Hongmeng system. By configuring the compilation configuration file and utilizing the compilation subsystem, the system's response flexibility is improved. Further, by porting and adapting the kernel layer, configuring the boot recovery subsystem, and generating the root file system image, the integration and maintenance process is simplified. Finally, by functionally verifying and testing the target chip, the system's security and stability are ensured. The above method designs and implements the Hongmeng system porting, including kernel layer porting, subsystem adaptation, and root file system customization, so that the Hongmeng system is successfully adapted to the target chip, and the accelerator device equipped with the target chip can operate stably and reliably.

[0025] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0027] Figure 1 A schematic diagram showing a flow chart of a transplantation method of a Hongmeng system provided by an embodiment of the present invention is shown;

[0028] Figure 2 A schematic diagram showing a flow chart of another method for transplanting a Hongmeng system provided by an embodiment of the present invention is shown;

[0029] Figure 3 A system architecture diagram of a Harmony system to be transplanted in a method for transplanting a Harmony system provided in an embodiment of the present invention is shown;

[0030] Figure 4 A diagram showing the relationship between the transplantation work of the HarmonyOS system to be transplanted in a method for transplanting the HarmonyOS system provided in an embodiment of the present invention is shown;

[0031] Figure 5A schematic diagram of system startup time in a system startup verification test in a Hongmeng system transplantation method provided by an embodiment of the present invention is shown;

[0032] Figure 6 A system automation test report in a system stability test in a transplantation method of a Hongmeng system provided by an embodiment of the present invention is shown;

[0033] Figure 7 A schematic structural diagram of a transplantation device for a Hongmeng system provided by an embodiment of the present invention is shown;

[0034] Figure 8 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0035] The following describes exemplary embodiments of the present application in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0036] The embodiment of the present application provides a transplantation method of the Hongmeng system, such as Figure 1 As shown, the method includes the following steps:

[0037] 101. Build the HarmonyOS to be transplanted based on the target chip and obtain the source code of the HarmonyOS to be transplanted, wherein the HarmonyOS to be transplanted includes the kernel layer.

[0038] Among them, Hongmeng system is a distributed operating system with a modular design and microkernel architecture. It provides rich API interfaces and development tools, supports multi-device collaboration, can provide a unified operating system platform for various devices, and supports multiple device types, such as smartphones, smart wearable devices, smart home devices, etc.; the source code is a text file written in a programming language, which contains all the logic and functions of the program. It is the basis of the software. Developers can view, modify and compile programs through the source code to implement specific functions or fix problems; the kernel layer is the core part of the operating system, responsible for managing hardware resources and process scheduling, serving as a bridge between the operating system and hardware to ensure that each application can correctly access hardware resources.

[0039] In an embodiment of the present application, a Harmony system to be ported is constructed based on a target chip, and the latest source code is obtained from the official repository of the Harmony project. The source code contains the entire content of the entire operating system, including the kernel layer and other subsystems. After obtaining the source code, it is necessary to adapt it according to the specific hardware characteristics of the target chip. Considering that different chips have different hardware architectures and peripheral configurations, only by ensuring that the source code is compatible with the target chip can the subsequent porting work be carried out smoothly. After obtaining the source code, a development environment can be built to compile, port, debug and optimize the system. Therefore, the construction of the Harmony system to be ported is the basis of the entire porting process.

[0040] 102. Configure the compilation configuration file in the source code, and use the compilation subsystem to build the compilation environment based on the configuration information in the compilation configuration file.

[0041] Specifically, the compilation configuration file is a setting file used to tell the compilation tool how to process the source code. It specifically defines the various parameters and options required in the compilation process, such as the target architecture, optimization level, include path, etc.; and the compilation subsystem is a set of tools and scripts responsible for managing and executing the compilation process. It reads the information in the compilation configuration file and automatically completes the entire compilation process from source code to executable file based on the information.

[0042] In the embodiment of the present application, by configuring the compilation configuration file, the functions and modules included in the final system image can be precisely controlled. The use of the compilation subsystem can automate the complex compilation process, improve compilation efficiency and consistency, build a compilation environment suitable for the target chip, and ensure that the generated binary file can run correctly on the target hardware platform; the present application uses a flexible configuration file to quickly adjust the compilation options according to different needs. The use of the compilation subsystem can easily manage the dependencies and build process in complex projects, improve the maintainability of the project, and after the compilation environment is set up, the system can be compiled, debugged and optimized to gradually complete the entire transplantation process, which is the basis for subsequent steps.

[0043] 103. In the compilation environment, transplant and adapt the kernel layer to generate a kernel image, configure the boot recovery subsystem, and generate a root file system image based on the file system configuration file.

[0044] Among them, the kernel image is the core part of the operating system, which contains code for managing hardware resources and providing basic services. It is specifically responsible for initializing hardware, loading drivers and other key components; the boot recovery subsystem is responsible for managing the system startup process and fault handling, specifically including initialization processes, such as the init process, and recovery mechanisms to ensure that the system can start correctly and handle errors that may occur during the startup process; the root file system image is an image file containing all files and directory structures of the operating system, specifically including all files required after the system starts, such as executable files, library files, configuration files, etc.

[0045] In the embodiment of the present application, by generating a kernel image, it is ensured that the system has the basic ability to manage and control hardware resources. The kernel image serves as the basis for system startup. The system can only start and run normally when the kernel image is correct, and is adapted according to the specific hardware characteristics of the target chip to ensure that the generated kernel image can run correctly on the target hardware platform; the boot recovery subsystem is responsible for the initialization work during the system startup process, ensuring that each system service can start and run smoothly, and the boot recovery subsystem also provides a fault recovery mechanism to ensure that the system can automatically recover or provide corresponding processing measures when encountering problems; the root file system image contains all the files and directory structures required for system operation, ensuring that the system can run normally after startup, and can also generate root file system images in different formats according to different needs to meet specific application scenarios and storage requirements.

[0046] 104. Burn the kernel image and the root file system image to the target chip, and perform functional verification and testing on the target chip.

[0047] Among them, burning refers to writing the generated kernel image and root file system image to the storage device of the target chip, so that the target chip can load the image and run the operating system at startup; functional verification and testing refers to checking whether each functional module is working normally after running the system on the target chip, including verifying whether the hardware driver, service process, user interface, etc. are running as expected, and ensuring that the system is stable and reliable.

[0048] In an embodiment of the present application, by burning the generated kernel image and root file system image onto the target chip, it is ensured that the system can start and run correctly on the target hardware platform, and then functional verification is performed to ensure that all necessary hardware and software components have been correctly configured and integrated, and the system can work normally according to the design requirements; specifically, by running the system on the actual hardware platform, potential hardware compatibility issues can be discovered and resolved. For example, some hardware drivers may work normally in a simulation environment, but may have problems on actual hardware. Through functional verification and testing, potential errors and vulnerabilities in the software can be discovered and fixed, and the stability and reliability of the system can be improved. Through performance testing, bottlenecks in the system can be identified and corresponding optimizations can be performed, for example, adjusting kernel parameters, optimizing file system structure, etc., to improve the overall performance of the system; finally, after comprehensive functional verification and testing, it can be confirmed that the system has met the release conditions and can enter the production environment or formal deployment stage.

[0049] The present invention provides a method, device, storage medium, and computer device for porting a Hongmeng system. First, the Hongmeng system to be ported is constructed based on a target chip, and the source code of the Hongmeng system to be ported is obtained. Then, a compilation configuration file in the source code is configured, and a compilation environment is built using a compilation subsystem based on the configuration information in the compilation configuration file. Then, in the compilation environment, the kernel layer of the Hongmeng system to be ported is ported and adapted to generate a kernel image, a boot recovery subsystem is configured, and a root file system image is generated based on the file system configuration file. Finally, the kernel image and the root file system image are burned to the target chip, and the target chip is functionally verified and tested. The above method is customized based on the source code of the Hongmeng system. By configuring the compilation configuration file and utilizing the compilation subsystem, the system's response flexibility is improved. Further, by porting and adapting the kernel layer, configuring the boot recovery subsystem, and generating the root file system image, the integration and maintenance process is simplified. Finally, by functionally verifying and testing the target chip, the system's security and stability are ensured. The above method designs and implements the Hongmeng system porting, including kernel layer porting, subsystem adaptation, and root file system customization, so that the Hongmeng system is successfully adapted to the target chip, and the accelerator device equipped with the target chip can operate stably and reliably.

[0050] The embodiment of the present application provides another transplantation method of the Hongmeng system, such as Figure 2 As shown, the method includes the following steps:

[0051] 201. Determine the target chip and build the Hongmeng system to be transplanted.

[0052] Among them, based on the hardware requirements of the accelerator controller in the preset project, the hardware platform of the accelerator controller and the target chip in the hardware platform are determined; according to the operating requirements of the hardware platform and the hardware requirements applicable to different types of HarmonyOS systems, the HarmonyOS system to be ported is selected from multiple HarmonyOS systems with different kernels, among which the kernel supported by the HarmonyOS system to be ported is the Linux kernel.

[0053] In the embodiments of the present application, specifically taking the CiADS (Accelerator Driven Transmutation Research Device) project as an example, the accelerator controller in the CiADS project is composed of a Zynq7045 chip motherboard and its peripherals. As a high-performance embedded hardware platform, it integrates a dual-core ARM Cortex-A9 processor and an FPGA logic unit, combining powerful computing power with hardware acceleration features, and can meet complex computing needs and diverse application scenarios; as the selected target chip, the Zynq7045 chip itself has high performance, high integration and rich peripheral interfaces (such as high-speed serial communication, general I / O, storage expansion interface, etc.), which enables it to perform well in data-intensive tasks and has good peripheral compatibility and scalability.

[0054] Specifically, after determining the target chip, considering that in the accelerator control system, a large number of command operations and real-time data processing require the operating system to have high timeliness and stability, it is necessary to ensure the stable operation of the system under high load. Combined with the hardware requirements of the OH (Hongmeng) system type in Table 1 below, a small Hongmeng system with the Linux kernel is selected to complete the porting and adaptation work; at the same time, it is necessary to consider that many current accelerator control software rely on customized operating systems or embedded platforms. These non-standard implementation methods limit the interoperability between different accelerator systems and increase the system maintenance complexity and development costs. Therefore, the ported operating system must have standardized interfaces, good hardware compatibility and modular design to support cross-platform development, optimize system performance, and reduce development and maintenance costs. In addition, the ported operating system should have high scalability to adapt to the future development of accelerator technology and changes in demand.

[0055]

[0056] Table 1

[0057] Among them, the Hongmeng system to be ported includes the hardware layer, kernel layer, adaptation layer and system service layer from bottom to top; the hardware layer includes the target chip and multiple peripheral devices; the kernel layer integrates the Linux kernel and driver subsystem, and the kernel layer realizes the multi-kernel architecture based on the abstraction and management of the adaptation layer; the adaptation layer includes the kernel abstraction layer, operating system abstraction layer, hardware abstraction layer and hardware device interface. The adaptation layer is used to provide a unified interface and shield the differences between the underlying hardware and the kernel; the system service layer includes the boot recovery subsystem, Hilog subsystem and driver subsystem. The system service layer is used to provide system services and perform unified management.

[0058] In the embodiment of the present application, the system architecture of the Hongmeng system to be transplanted is as follows: Figure 3 As shown, the hardware layer specifically includes the Zynq7045 chip and multiple peripheral devices connected based on various serial communication protocols such as I2C or URAT; the kernel layer, as the core of the OH system, is mainly composed of the Linux kernel and the characteristics of OH, and realizes the multi-kernel architecture through the unified abstraction and management of the adaptation layer. Specifically, in this application, the kernel layer of the Hongmeng system to be transplanted is composed of the Linux kernel and the driver subsystem, and the kernel abstraction layer KAL (Kernel Abstract Layer) provides the upper layer with kernel capabilities such as memory management, task management, synchronization and mutual exclusion, and process management; the adaptation layer is specifically composed of KAL (kernel abstraction layer), OSAL (Operating System Abstraction Layer, operating system abstraction layer), HAL (Hardware Abstract Layer, hardware abstraction layer) and HDI (Hardware Driver The system service layer integrates the core functions of the Hongmeng system and provides system-level services and unified management capabilities for upper-layer applications. Specifically, the system service layer of the Hongmeng system includes the boot and recovery subsystem, the Hilog subsystem, and the driver subsystem, which are responsible for system boot and recovery management, logging and debugging support, and device driver management, respectively. Each subsystem and functional component adopts a modular design with low coupling, and can be flexibly tailored according to actual needs.

[0059] It should be noted that the driver subsystem of the Hongmeng system is based on the Hardware Driver Foundation (HDF), which provides a unified development and management platform for diverse hardware devices through modular design, improving code reusability and maintainability. Figure 3As shown in the figure, HDF decouples the kernel and driver through the abstract kernel capability interface provided by OSAL, shielding the differences between different kernels. At the same time, HDF provides a standardized hardware driver interface for upper-layer applications through HDI. Depending on the deployment location, HDF is divided into KHDF in kernel space and UHDF in user space. KHDF and UHDF can communicate with each other through message passing and serialized data.

[0060] 202. Build the compilation subsystem and set up the compilation environment.

[0061] Among them, the compilation configuration file is searched in the source code directory, and the compilation configuration file is configured according to the basic information of the Harmony system to be ported; multiple preset compilation tools are installed, and a componentized compilation subsystem is designed based on the compilation tools; the compilation subsystem is used to parse the configuration information carried in the compilation configuration file, determine the subsystem to be compiled and the dependencies of the subsystem to be compiled, and build the compilation environment.

[0062] In the embodiment of the present application, the compilation subsystem is based on GN (Generate Ninja) and Ninja compilation tools to build a system, and adopts a componentized design; during the compilation process, the compilation subsystem first determines the subsystems and components that need to be compiled for the product, as well as their dependencies, based on the configuration information in the compilation configuration file config.json file, and then performs the full compilation task; during porting, it is necessary to add the core motherboard information, kernel subsystem, driver subsystem, boot recovery subsystem, Hilog subsystem and dependent components of each subsystem of the Zynq7045 chip to the compilation configuration file config.json file to generate an adapted system image for the Zynq7045 chip.

[0063] 203. Complete the transplantation of Hilog subsystem in the kernel layer.

[0064] Among them, a cross-level log agent module is created in the Linux kernel to manage and transmit log data between the kernel layer and the user space; a log bidirectional transmission channel is called to realize log data interaction between the kernel layer and the user space; the buffer is adjusted based on the kernel characteristics of the Linux kernel to complete the transplantation of the Hilog subsystem.

[0065] In the embodiment of the present application, when performing the transplantation adaptation process of the Linux kernel in the Hongmeng system to be transplanted, such as Figure 4As shown in the figure, its main task is to transplant the Hilog log service and driver subsystem kernel state. Specifically, with the help of the Linux-4.9 kernel that comes with the Zynq7045 chip core motherboard, fast and efficient transplantation can be achieved. Specifically, the Hilog subsystem is the core logging service in the Hongmeng system, which uniformly stores kernel logs, system logs and application logs in the buffer hilog_buffer. Specifically, in the transplantation process, a cross-level log agent module, namely the Hilog character device, is created in the Linux-4.9 kernel to manage and transmit log data between kernel space and user space. The system realizes log data interaction between user space and kernel space by calling the log bidirectional transmission channel, namely the read() and write() functions. At the same time, in order to ensure log reliability, the buffer size also needs to be adjusted according to the characteristics of the Linux-4.9 kernel.

[0066] 204. Complete the transplantation of the driver subsystem in the kernel layer.

[0067] Specifically, the compilation rules of the Linux kernel are added to the preset compilation tool, and the kernel image is generated based on the compilation rules; the driver subsystem is integrated into the kernel image based on the kernel link script, and the hardware driver framework and operating system abstraction layer are adapted in the kernel driver of the kernel image; the configuration items related to the driver subsystem are added to the kernel configuration system, and the kernel image is generated based on the kernel image and the kernel configuration system.

[0068] In an embodiment of the present application, HDF can provide OSAL (operating system abstraction layer) for different operating system kernels, including support for LiteOS-M kernel, LiteOS-A kernel and Linux kernel. Specifically in this porting, the operating system abstraction layer adapted to the Linux kernel and khdf deployed in the kernel state are selected to achieve effective integration of HDF and the Linux-4.9 kernel. Among them, khdf provides a unified driver framework, configuration management, driver general model and hardware general platform capability interface for various kernels. It is the core of the operation of the kernel-state driver subsystem, responsible for driver configuration, parsing and loading, and realizes standardized driver management and efficient deployment; and, since the adaptation of kernel log and khdf has been completed in the kernel porting process of the Hongmeng system to be ported, it is only necessary to add Hilog log component and HDF framework component in the compilation configuration file config.json file, and compile the log service, HDI and uhdf into the system.

[0069] 205. Configure the startup recovery subsystem.

[0070] Specifically, a startup recovery subsystem and its components are added to the compiled configuration file, and multiple key configuration files are configured in the compiled configuration file based on the target chip; and a startup configuration file is configured based on a preset format, wherein the startup configuration file is used to define system startup services and permissions.

[0071] In the embodiment of the present application, the startup recovery subsystem is responsible for managing the system startup process and fault handling. After the kernel initialization is completed, the Init process starts and performs the initialization task, and then starts each system service process in sequence and sets permissions according to the startup configuration file Init.cfg to ensure the correct startup of the system; during the transplantation process, in addition to adding the startup recovery subsystem and its components in config.json, it is also necessary to configure the five key configuration files "rcS", "fstab", "S00devs", "S01mdev" and "S82ohos" according to the actual situation of the Zynq7045 chip core motherboard to implement the startup process such as device loading, mounting the file system, and initializing the device node. In addition, the startup configuration file Init.cfg adopts the JSON format. When transplanting, it is necessary to configure the system startup service and permissions according to the format requirements to ensure the stable operation of the system.

[0072] 206. Generate a root file system image.

[0073] In the embodiment of the present application, the root file system is the first file system loaded when the operating system starts, and contains the basic tools, configuration files, and library resources required for system startup. The core goal of customizing the root file system is to meet the specific hardware platform and application requirements, and to generate a file system image that meets the target environment by integrating the necessary files, directories, and configurations. Specifically, in the Hongmeng system to be ported, the customization of the root file system is completed through the fs.yml file, which defines the layout and configuration of the file system, including file organization, permission settings, symbolic link creation, and root file system generation. The following is the key code used to generate the root file system:

[0074] fs_make_cmd:

[0075] ${root_path} / build / lite / make_rootfs / rootfsimg_linux.sh${fs_dir}ext4

[0076] This command calls the rootfsimg_linux.sh script to generate the file system in ext4 format to meet system operation requirements.

[0077] 207. Functional verification and testing.

[0078] Specifically, after completing the porting of the HarmonyOS system based on the Zynq7045 chip, the core functions of the system are verified and tested to ensure that the ported system can run stably and that the drivers and services can function properly. The testing content covers system startup, driver subsystem function verification, Hilog logging service verification, and system stability testing.

[0079] In the embodiment of the present application, the verification includes four parts. The first part is the system startup verification. The compiled image file is burned to the Zynq7045 development board through the SD card. After restarting the device, the startup time of the transplanted system is tested. A total of 50 independent measurements were conducted in the experiment. The results showed that the mean of the system startup time was 3.207s, the standard deviation was 0.017s, and the maximum value was 3.242s. The experimental results are detailed in Figure 5 ;

[0080] The second part is the functional verification of the driver subsystem. Specifically, a simple test case is created based on the HDF framework to verify the functionality of the driver subsystem. First, by executing the ls -l / dev / my_hdf_sample command, it is confirmed whether khdf has successfully created a character device. The character device is successfully created and has the correct permissions set, indicating that the driver service has been correctly loaded and managed, and the device interface is normally available. The HDF framework provides a unified driver message mechanism that supports user-mode and kernel-mode driver interaction. When executing user-mode driver commands, the kernel-mode driver successfully returns a custom string, verifying the functionality of the driver subsystem. Its user-mode driver module can be loaded normally and the device interface can respond stably to command requests. The HDF test results are as follows;

[0081] #ls -L / dev / my_hdf_sample

[0082] crw-rw-1 0 0 243,5 2000-01-01 00:00 / dev / my_hdf_sample

[0083] #

[0084] #myhdftest

[0085] read result from driver:The HDF test is successful!

[0086] enter myOnDevEventReceive,service address is 0xb6f2bf80,event cmdIdis 1234

[0087] 01-01 00:04:30.329 863 863D 02500 / hdf_syscall_adapter:loctl send pollthread(3)exit event,ret=0

[0088] 01-01 00:04:30.329 864 863I 02500 / hdf_syscall_adapter:event listenertask received exit event

[0089] 01-01 00:04:30.329 864 863I 02500 / hdf_syscall_adapter:event listenertask exit01-01 00:04:30.330 863 863I 02500 / hdf_syscall_adapter:poll threadexited

[0090] The third part is Hilog log verification. To verify the correctness and usability of the Hilog log function, the system startup log was analyzed. Hilog can capture key system operations and their results in real time. The log shows that when attempting to create the / userdata / thumb and / userdata / video directories, the DoMkDir and DoChmod operations failed because the file system was read-only or the files did not exist. The log records the operation name, failure reason, and error code in detail. In addition, the log also records the startup information of core system services (such as shell and apphilogcat). The above verification shows that the Hilog subsystem runs normally after transplantation, and the accuracy and detail of the log records meet the requirements of debugging and problem location. The system startup log is as follows:

[0091] 01-01 00:00:26.309 1 1E 00719 / Init:DoHkDir:DoHkDir, failed for' / userdata / thumb',err 30,

[0092] 01-01 00:00:26.309 1 1E 00719 / Init:DoChmod:Failed to change mode" / userdata / thumb"mode to 0777,err=2

[0093] 01-01 00:00:26.309 1 1E 00719 / Init:DoMkDir:DoMkDir, failed for' / userdata / video',err 30,

[0094] 01-01 00:00:26.309 1 1E 00719 / Init:Dochmod:Failed to change mode" / userdata / video"mode to 0777,err=2

[0095] 01-01 00:00:26.309 1 1E 00719 / Init:StartServiceByName:StartServiceByName Service shell

[0096] 01-01 00:00:26.309 1 1E 00719 / Init:StartServiceByName:StartServiceByName Service apphilogcat

[0097] The fourth part is the system stability test. In order to verify the stability of the system, the transplanted Harmony system was automatically tested. The test was based on the OHACTS-1.0.1 test suite, covering 7 key modules such as capability management, system boot and permission management, with a total of 380 test cases. During the test, all test cases passed successfully without failure, blocking or neglect. The test execution time was 48 minutes. The test results show that the system has excellent performance in functional implementation and stability, and can meet the reliability requirements of the basic functions of the accelerator controller; based on the above tests, it was verified that the Harmony system based on the Zynq7045 chip can run stably, the system startup time is 3.207s, the driver subsystem functions normally, and the log service can meet the usage requirements. The test results show that the porting process successfully completed the integration of core functions, and the system has the foundation for further development and expansion. The system automation test report is as follows: Figure 6As shown, the test was performed on a device named local_COMS. The operating system of the test host HostInfo was Wrdow-10-10.0.19041-SPO. The test started at 4:13:47 PM on December 3, 2024, and ended at 5:02:32 PM on December 3, 2024. The entire test process took 48 minutes and 45 seconds. The version of the test framework used was OpenHarmony-ACTS 1.0.1. The test results showed that the test included 7 modules, all of which had run RunModules. 380 test cases TotalTests were executed, Passed: 380 indicates that all 380 test cases passed, Failed: 0 indicates that no test case failed. Taking the two specific test modules ActsAbilityMgrTest and ActsBootstrapTest as examples, AbilityMgrTest2 and SamgrApiTest correspond to the test suite names of the two modules respectively. The number of test cases contained in the two test suites are 26 and 7 respectively. All test cases in each test suite passed, no test case failed, no test case was blocked, and no test case was ignored. The test report shows that the system provided in this application performed well under specific test conditions.

[0098] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a transplantation device of the Hongmeng system, such as Figure 7 As shown, the device includes: a transplantation system selection module 301, a compilation environment construction module 302, a system image generation module 303 and a system burning and testing module 304.

[0099] The transplantation system selection module 301 is used to build the Hongmeng system to be transplanted based on the target chip and obtain the source code of the Hongmeng system to be transplanted, wherein the Hongmeng system to be transplanted includes a kernel layer;

[0100] A compilation environment building module 302 is used to configure a compilation configuration file in the source code and use the compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file;

[0101] The system image generation module 303 is used to transplant and adapt the kernel layer to generate a kernel image in a compilation environment, configure the startup recovery subsystem, and generate a root file system image based on the file system configuration file;

[0102] The system burning and testing module 304 is used to burn the kernel image and the root file system image to the target chip, and perform functional verification and testing on the target chip.

[0103] In a specific application scenario, the transplantation system selection module 301 can be used to determine the hardware platform of the accelerator controller and the target chip in the hardware platform based on the hardware requirements of the accelerator controller in the preset project; according to the operating requirements of the hardware platform and the hardware requirements applicable to different types of Harmony systems, the Harmony system to be transplanted is selected from multiple Harmony systems with different kernels, among which the kernel supported by the Harmony system to be transplanted is the Linux kernel.

[0104] In a specific application scenario, the Hongmeng system to be transplanted in the transplantation system selection module 301 includes the hardware layer, kernel layer, adaptation layer and system service layer from bottom to top; the hardware layer includes the target chip and multiple peripheral devices; the kernel layer integrates the Linux kernel and the driver subsystem, and the kernel layer implements a multi-kernel architecture based on the abstraction and management of the adaptation layer; the adaptation layer includes the kernel abstraction layer, the operating system abstraction layer, the hardware abstraction layer and the hardware device interface, and the adaptation layer is used to provide a unified interface and shield the differences between the underlying hardware and the kernel; the system service layer includes the boot recovery subsystem, the Hilog subsystem and the driver subsystem, and the system service layer is used to provide system services and perform unified management.

[0105] In a specific application scenario, the compilation environment building module 302 can be used to search for compilation configuration files in the source code directory, and configure the compilation configuration files according to the basic information of the Harmony system to be ported; install multiple preset compilation tools, and design a componentized compilation subsystem based on the compilation tools; use the compilation subsystem to parse the configuration information carried in the compilation configuration file, determine the subsystem to be compiled and the dependencies of the subsystem to be compiled, and build the compilation environment.

[0106] In a specific application scenario, the kernel layer includes the Linux kernel; the system image generation module 303 can be specifically used to create a cross-level log agent module in the Linux kernel to manage and transmit log data between the kernel layer and the user space; call the log bidirectional transmission channel to realize the log data interaction between the kernel layer and the user space; adjust the buffer based on the kernel characteristics of the Linux kernel to complete the transplantation of the Hilog subsystem.

[0107] In a specific application scenario, the kernel layer includes a driver subsystem; the system image generation module 303 can be specifically used to add the compilation rules of the Linux kernel in a preset compilation tool, and generate a kernel image based on the compilation rules; integrate the driver subsystem into the kernel image based on the kernel link script, and adapt the hardware driver framework and the operating system abstraction layer in the kernel driver of the kernel image; add configuration items related to the driver subsystem to the kernel configuration system, and generate a kernel image based on the kernel image and the kernel configuration system.

[0108] In a specific application scenario, the system image generation module 303 can be used to add a startup recovery subsystem and its components in the compiled configuration file, and configure multiple key configuration files in the compiled configuration file based on the target chip; configure the startup configuration file based on a preset format, wherein the startup configuration file is used to define system startup services and permissions.

[0109] It should be noted that for other corresponding descriptions of the functional units involved in the transplantation device of the Hongmeng system provided in this embodiment, please refer to Figure 1 and Figure 2 The corresponding description in will not be repeated here.

[0110] Based on the above Figure 1 The method shown, accordingly, this embodiment also provides a storage medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Hongmeng system transplantation method is implemented.

[0111] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product. The software product to be identified can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the transplantation method of the Harmony system in each implementation scenario of the present application.

[0112] Based on the above Figure 1 and Figure 2 The method shown, and Figure 7 In order to achieve the above-mentioned purpose, the transplantation device embodiment of the Hongmeng system shown in FIG. Figure 8 As shown, this embodiment also provides a physical device for transplanting the Hongmeng system, which includes a communication bus, a processor, a memory, and a communication interface. It may also include an input and output interface and a display device, wherein the various functional units can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and perform the transplantation method of the Hongmeng system in the above embodiment.

[0113] Optionally, the physical device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Wi-Fi interface), etc.

[0114] Those skilled in the art will understand that the transplantation entity device structure of the Harmony system provided in this embodiment does not constitute a limitation on the entity device, and may include more or fewer components, or a combination of certain components, or different component arrangements.

[0115] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the physical device hardware and the software resources to be identified, supporting the execution of the information processing program and other software and / or programs to be identified. The network communication module is used to enable communication between components within the storage medium and with other hardware and software in the physical information processing device.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the technical solution of the present application, first, the Hongmeng system to be transplanted is constructed based on the target chip, and the source code of the Hongmeng system to be transplanted is obtained, and then the compilation configuration file in the source code is configured, and the compilation subsystem is used to build a compilation environment based on the configuration information in the compilation configuration file. After that, in the compilation environment, the kernel layer of the Hongmeng system to be transplanted is transplanted and adapted to generate a kernel image, the boot recovery subsystem is configured, and the root file system image is generated based on the file system configuration file. Finally, the kernel image and the root file system image are burned to the target chip, and the target chip is functionally verified and tested. The above method is customized based on the source code of the Hongmeng system. By configuring the compilation configuration file and utilizing the compilation subsystem, the response flexibility of the system is improved. Further, by transplanting and adapting the kernel layer, configuring the boot recovery subsystem and generating the root file system image, the integration and maintenance process is simplified. Finally, by functionally verifying and testing the target chip, the security and stability of the system are ensured. The above method designs and implements the Hongmeng system transplantation, including kernel layer transplantation, subsystem adaptation, and root file system customization, so that the Hongmeng system can successfully adapt to the target chip and the accelerator device equipped with the target chip can run stably and reliably.

[0117] Those skilled in the art will understand that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required to implement the present application. Those skilled in the art will understand that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple sub-modules.

[0118] The serial numbers of the above application are for descriptive purposes only and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosure only discloses several specific implementation scenarios of the present application, but the present application is not limited thereto. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present application.

Claims

1. A transplantation method of Hongmeng system, characterized in that: The method comprises: Building a HarmonyOS system to be transplanted based on the target chip, and obtaining the source code of the HarmonyOS system to be transplanted, wherein the HarmonyOS system to be transplanted includes a kernel layer; Configuring a compilation configuration file in the source code, and using a compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file; In the compilation environment, the kernel layer is transplanted and adapted to generate a kernel image, a startup recovery subsystem is configured, and a root file system image is generated based on a file system configuration file; Burn the kernel image and the root file system image to the target chip, and perform functional verification and testing on the target chip.

2. The method according to claim 1, characterized in that The construction of the Hongmeng system to be transplanted based on the target chip includes: Determining a hardware platform for the accelerator controller and a target chip in the hardware platform based on hardware requirements for the accelerator controller in a preset project; According to the operating requirements of the hardware platform and the hardware requirements applicable to different types of HarmonyOS systems, the HarmonyOS system to be ported is selected from multiple HarmonyOS systems with different kernels, wherein the kernel supported by the HarmonyOS system to be ported is the Linux kernel.

3. The method according to claim 1, characterized in that The Hongmeng system to be transplanted includes the hardware layer, kernel layer, adaptation layer and system service layer from bottom to top; The hardware layer includes a target chip and multiple peripheral devices; The kernel layer integrates the Linux kernel and the driver subsystem, and the kernel layer implements a multi-kernel architecture based on the abstraction and management of the adaptation layer; The adaptation layer includes a kernel abstraction layer, an operating system abstraction layer, a hardware abstraction layer and a hardware device interface. The adaptation layer is used to provide a unified interface and shield the differences between the underlying hardware and the kernel; The system service layer includes a startup recovery subsystem, a Hilog subsystem and a drive subsystem. The system service layer is used to provide system services and perform unified management.

4. The method according to claim 1, wherein The configuring the compilation configuration file in the source code and using the compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file includes: Searching for a compilation configuration file in the source code directory, and configuring the compilation configuration file according to the basic information of the Hongmeng system to be transplanted; Install multiple preset compilation tools and design a componentized compilation subsystem based on the compilation tools; The compilation subsystem is used to parse the configuration information carried in the compilation configuration file, determine the subsystems to be compiled and the dependencies between the subsystems to be compiled, and build a compilation environment.

5. The method according to claim 1, wherein The kernel layer includes a Linux kernel; and the step of transplanting and adapting the kernel layer to generate a kernel image includes: Creating a cross-level log agent module in the Linux kernel to manage and transfer log data between the kernel layer and the user space; Calling a log bidirectional transmission channel to implement log data interaction between the kernel layer and the user space; The buffer is adjusted based on the kernel characteristics of the Linux kernel to complete the transplantation of the Hilog subsystem.

6. The method according to claim 5, characterized in that The kernel layer includes a driver subsystem; and the step of transplanting and adapting the kernel layer to generate a kernel image further includes: Adding the compilation rules of the Linux kernel in a preset compilation tool, and generating a kernel image based on the compilation rules; Integrating the driver subsystem into the kernel image based on a kernel link script, and adapting a hardware driver framework and an operating system abstraction layer in the kernel driver of the kernel image; Adding configuration items related to the driver subsystem to a kernel configuration system, and generating a kernel image based on the kernel image and the kernel configuration system.

7. The method according to claim 1, characterized in that The configuration starts the recovery subsystem, including: Adding a startup recovery subsystem and its components to the compiled configuration file, and configuring multiple key configuration files in the compiled configuration file based on the target chip; A startup configuration file is configured based on a preset format, wherein the startup configuration file is used to define system startup services and permissions.

8. A transplantation device for the Hongmeng system, characterized in that: The device comprises: A transplantation system selection module is used to build a HarmonyOS system to be transplanted based on the target chip and obtain the source code of the HarmonyOS system to be transplanted, wherein the HarmonyOS system to be transplanted includes a kernel layer; A compilation environment building module, configured to configure a compilation configuration file in the source code, and use a compilation subsystem to build a compilation environment based on the configuration information in the compilation configuration file; A system image generation module is used to transplant and adapt the kernel layer to generate a kernel image in the compilation environment, configure the startup recovery subsystem, and generate a root file system image based on the file system configuration file; The system burning and testing module is used to burn the kernel image and the root file system image to the target chip, and perform functional verification and testing on the target chip.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Adapting and cutting method and system based on power terminal equipment swan operating system

    CN121143890A

  • Industrial gap controller and working method thereof

    CN121455042A

  • An industrial HarmonyOS controller and its working method

    CN121455042B