Operating system mirror image construction method and system based on source code and configuration item

Through the operating system image construction method based on source code plus configuration items, users can accurately control the functions and performance characteristics of the operating system, solving the problems of low customization and high maintenance costs in the existing technology, and achieving efficient and flexible image construction and multi-platform support.

CN119690450APending Publication Date: 2025-03-25QUAN CHENG LABORATORY +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411752268.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing operating system image construction methods have problems such as low degree of customization, unwanted components, lack of configuration items, and high maintenance time costs, which are difficult to meet specific needs and multi-platform support.

Method used

Using an operating system image construction method based on source code plus configuration items, users upload operating system source code and write configuration files, including environment variables, dependency features and platform configuration files, ArceOS uses library functions and command line tools to perform source code compilation and configuration file tasks, and generates image files that are adapted to each hardware platform.

Benefits of technology

It has achieved the advantages of strong customization capabilities, rapid response to changes and cost-effectiveness, and can build customized images that meet specific use cases, adapt to multi-platform needs, and reduce operation and maintenance and update costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690450A_ABST
    Figure CN119690450A_ABST
Patent Text Reader

Abstract

The invention relates to an operating system mirror image construction method and system based on source codes and configuration items, and belongs to the technical field of operating systems. Comprising the following steps: source code preparation: a user uploads a required operating system source code to a specified code hosting platform; configuration file writing: a user writes configuration files according to actual requirements, wherein the configuration files comprise environment variables, dependency characteristics and plaatform configuration files; operating system mirror image construction: ArceOS executes various tasks in source code compiling and configuration files by calling a library function and a command line tool; and mirror image verification and deployment: after the generated mirror image file is tested and verified, deploying the mirror image file to various hardware platforms. The mirror image construction mode of source code and configuration not only improves the automation degree and flexibility, but also brings remarkable advantages in the aspects of safety, response speed and cost effectiveness, and is suitable for enterprises and organizations needing customization and high control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of operating systems, and in particular to a method and system for building an operating system image based on source code plus configuration items. Background Art

[0002] As new technologies are constantly updated and iterated, the functions of the operating system are becoming more and more powerful, and there are corresponding implementation functions for different scenarios and needs. However, this also brings a problem, that is, the amount of code is getting larger and larger, the structure is getting more and more complex, and the space occupied is also growing, making the entire system very bloated. In some specific areas, most of the operating system functions are often not used, and adding these contents will have a negative impact on the operation of the operating system. Therefore, it is necessary to propose an efficient and reliable operating system image construction method to solve the following problems:

[0003] The existing operating system image construction methods include pre-built binary images, that is, using pre-built binary files, such as using pre-built binary images provided by the operating system or a third party. This method has a low degree of customization and may contain unnecessary components or configurations that are not suitable for specific needs. In addition, the image can be built from the source code of the operating system, and the final operating system image can be generated through compilation tools. This method lacks configuration items, is not convenient for modifying the operating system image, and requires a long maintenance time cost, so it is cumbersome and complicated to build and manage.

[0004] Optional functional modules: Personalize functional configuration for specific scenarios and only select functional modules that meet the requirements to be added to the operating system image.

[0005] Multi-platform support: Different cloud platforms and hardware architectures have different requirements for operating system images, and a flexible construction method is needed to support image generation for multiple platforms. Summary of the invention

[0006] In view of the shortcomings of the prior art, the present invention provides a method for building an operating system image based on source code plus configuration items;

[0007] Operating systems written in rust usually involve modular design and platform architecture selection, where modules are relatively independent and specified modules are added to the Cargo configuration file Cargo.toml. In addition, the pre-compilation stage supports the selection of the adapted hardware platform architecture, such as x86, ARM, etc.

[0008] The present invention also provides an operating system image construction system based on source code plus configuration items.

[0009] The technical solution of the present invention is:

[0010] The method for building an operating system image based on source code and configuration items includes:

[0011] Source code preparation: Users upload the required operating system source code to the designated code hosting platform;

[0012] Configuration file writing: Users write configuration files according to actual needs. The configuration files include environment variables, dependency features, and platform configuration files.

[0013] Operating system image construction: ArceOS executes various tasks in source code compilation and configuration files by calling library functions and command line tools;

[0014] Image verification and deployment: The generated image files are tested and verified before being deployed on various hardware platforms.

[0015] Further preferably, the code hosting platforms include GitHub and GitLab.

[0016] Preferably, according to the present invention, environment variables are written, and the environment variables include: architecture, platform, virtual CPU, mode, log, target, IP address and gateway.

[0017] Preferably, according to the present invention, the dependency characteristics are written, including:

[0018] Determining component features requires configuring Cargo.toml's features. Features is a mechanism that allows you to enable or disable certain features for your package;

[0019] Load the configuration files that ArceOS depends on.

[0020] Further preferably, determining component features requires configuring the features of Cargo.toml, including:

[0021] For support of different file systems, select the configuration in the Cargo.toml file by setting the characteristics;

[0022] Each feature is a key-value pair. The key is the name of the feature, and the value is other features or libraries that the feature depends on. Configuration files include devfs, ramfs, procfs, fatfs, and sysfs. Devfs refers to the device file system, ramfs refers to the memory file system, procfs refers to the virtual file system, sysfs refers to the virtual file system, fatfs is an open source file system library used for the FAT file system in embedded systems, and myfs refers to a custom file system.

[0023] Further preferably, the configuration files that ArceOS depends on include:

[0024] Axhal component, used to abstract and encapsulate the details of hardware operations;

[0025] The axconfig component is used to manage and load configuration files;

[0026] Global memory allocator Axalloc;

[0027] Graphical module axdisplay;

[0028] Device driver module axdriver;

[0029] File system module axfs;

[0030] Multiple levels of logging macros axlog, including: error, warn, info, debug, trace;

[0031] Network module axnet, including: IpAddr, TcpSocket, UdpSocket, DnsSocket;

[0032] Runtime library axruntime;

[0033] Synchronous operation module axsync: including: Mutex, spin;

[0034] Task scheduling management module axtask: includes: task creation, scheduling, sleep, and destruction.

[0035] Preferably, according to the present invention, ArceOS executes various tasks in source code compilation and configuration files by calling library functions and command line tools; including:

[0036] Source code analysis: parse the uploaded operating system source code to determine the compilation target and its dependencies;

[0037] Environment preparation: Set the operating environment according to the configuration file, including CPU architecture, number of CPUs, platform type, memory size, build target, mode, log, and network configuration parameters;

[0038] Compile and link: Use Rust and C programming languages ​​to compile and link source code and generate executable files;

[0039] Image generation: Package the compiled executable files into an image file.

[0040] An operating system image building system based on source code and configuration items, including:

[0041] The source code preparation module is configured as follows: the user uploads the required operating system source code to a designated code hosting platform;

[0042] The configuration file writing module is configured as follows: users write configuration files according to actual needs. The configuration files include environment variables, dependency features, and platform configuration files.

[0043] The operating system image building module is configured as follows: ArceOS performs various tasks in source code compilation and configuration files by calling library functions and command line tools;

[0044] The image verification and deployment module is configured to: deploy the generated image files to various hardware platforms after testing and verification.

[0045] The beneficial effects of the present invention are:

[0046] 1. Strong customization capability: Source code plus configuration allows users to precisely control the compilation options and configuration parameters of each component, and can customize the functions and performance characteristics of the operating system according to specific needs. This flexibility enables the construction of customized images that meet specific use cases or standards, such as high-performance computing, security hardening, or optimized versions for specific workloads.

[0047] 2. Rapid response to changes: In a fast-paced technology development environment, the source code plus configuration construction method enables rapid adaptation to new technologies and demand changes. By updating and adjusting the source code and its configuration, new features can be quickly deployed, bugs can be fixed, or performance parameters can be adjusted.

[0048] 3. Cost-effectiveness: In the long run, the source code plus configuration construction method can save operation and maintenance and update costs.

[0049] In summary, the image building method of source code plus configuration not only improves the degree of automation and flexibility, but also brings significant advantages in security, response speed and cost-effectiveness. It is suitable for enterprises and organizations that require customization and high control. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 It is a flowchart of the operating system image construction method based on source code plus configuration items of the present invention;

[0051] Figure 2 This is a schematic diagram of a configuration file of the present invention;

[0052] Figure 3 It is a schematic diagram of the effect after the operating system image construction method based on source code plus configuration items of the present invention is run. DETAILED DESCRIPTION

[0053] The present invention will be further defined below in conjunction with the accompanying drawings and embodiments, but is not limited thereto.

[0054] Terminology explanation:

[0055] ArceOS, a componentized operating system;

[0056] GitHub, a code hosting platform;

[0057] GitLab, a comprehensive development platform;

[0058] Platform, platform architecture;

[0059] Cargo.toml, ArceOS configuration file;

[0060] QEMU virtual machine, an open source virtual machine monitor and system emulator;

[0061] virt virtual machine, a virtualization solution based on libvirt. libvirt is an open source tool set for managing virtualization technology;

[0062] Example 1

[0063] The operating system image construction method based on source code plus configuration items, such as Figure 1 As shown, including:

[0064] ArceOS builds images by combining source code and configuration files. The core is its source code library, which contains all the main functions and modules of the operating system. According to the configuration in the configuration file, it generates specific code snippets adapted to each hardware platform, including device drivers, interrupt handling functions, and device initialization codes.

[0065] ArceOS kernel source code preparation: Users upload the required operating system source code to the designated code hosting platform; these operating system source codes will serve as the basis for building the image.

[0066] Configuration file writing: Users write configuration files according to actual needs, such as Figure 2 As shown, the configuration file includes environment variables, dependency features, and platform configuration files;

[0067] System image building is operating system image building: ArceOS uses its kernel advantages to perform various tasks in source code compilation and configuration files by calling corresponding library functions and command line tools;

[0068] Image verification and deployment: The generated image files are tested and verified before being deployed on various hardware platforms. For example, running an image of the x86_64 architecture on a QEMU virtual machine and running an image of the riscv64 / aarch64 architecture on a virt virtual machine.

[0069] Assuming that the name of the built operating system image is system_image.elf, you can use the following command to start an x86_64 architecture virtual machine based on this system image through QUMU:

[0070]

[0071] Example 2

[0072] The difference between the method for constructing an operating system image based on source code plus configuration items described in Example 1 is that:

[0073] Write environment variables, including: architecture, platform, virtual cpu, mode, log, target, IP address and gateway. The details are as follows:

[0074]

[0075] Write the platform configuration file, including:

[0076] Assuming that you want to build an operating system image on the x86_64 architecture, write the platform configuration file x86_64-qemu-q35.toml as follows:

[0077]

[0078]

[0079]

[0080] Write dependent features, including:

[0081] Determining component features requires configuring the features of Cargo.toml. Features is a mechanism that allows you to enable or disable certain functions for your package; by setting features, you can choose whether to include specific code at compile time, so that you can optimize the program according to different needs.

[0082] Load the configuration files that ArceOS depends on.

[0083] To determine the component features, you need to configure the features of Cargo.toml, including:

[0084] For support of different file systems, select the configuration in the Cargo.toml file by setting the characteristics;

[0085] Each feature is a key-value pair, the key is the name of the feature, the value is other features or libraries that the feature depends on, and the configuration file includes devfs, ramfs, procfs, fatfs and sysfs; Devfs refers to the device file system, ramfs refers to the memory file system, procfs refers to the virtual file system, sysfs refers to the virtual file system, fatfs is an open source file system library used for the FAT file system in embedded systems, and myfs refers to a custom file system. This indicates that the operating system image supports these file systems, where def is the default supported file system type. As shown below:

[0086]

[0087] ArceOS dependent configuration files; including:

[0088] The axhal component is used to abstract and encapsulate the details of hardware operations, allowing upper-layer applications to interact with hardware through a unified interface;

[0089] The axconfig component is used to manage and load configuration files; these configuration files may contain various runtime settings, parameters, and environment variables. Through these configurations, it is ensured that these components can correctly participate in the execution of tasks during construction and runtime.

[0090] Global memory allocator Axalloc;

[0091] Graphical module axdisplay;

[0092] Device driver module axdriver;

[0093] File system module axfs;

[0094] Multiple levels of logging macros axlog, including: error, warn, info, debug, trace;

[0095] Network module axnet, including: IpAddr, TcpSocket, UdpSocket, DnsSocket;

[0096] Runtime library axruntime; it is the basic environment for application running.

[0097] Synchronous operation module axsync: including: Mutex, spin;

[0098] Task scheduling management module axtask: includes: task creation, scheduling, sleep, and destruction.

[0099] The following are the dependencies configured for the axtask component, including the name, path, and whether the dependent component is enabled;

[0100]

[0101] ArceOS executes various tasks in source code compilation and configuration files by calling library functions and command line tools; including:

[0102] Source code analysis: parse the uploaded operating system source code to determine the compilation target and its dependencies;

[0103] Environment preparation: Set the operating environment according to the configuration file, including CPU architecture, number of CPUs, platform type, memory size, build target, mode, log, and network configuration parameters; ensure the completeness of the compilation environment.

[0104] Compile and link: Use Rust and C programming languages ​​to compile and link source code and generate executable files;

[0105] Image generation: Package the compiled executable files into an image file.

[0106] Figure 3 It is a schematic diagram of the effect after the operating system image construction method based on source code plus configuration items of the present invention is run.

[0107] Example 3

[0108] The difference between the method for constructing an operating system image based on source code plus configuration items described in Example 2 is that:

[0109] Taking ArceOS, an operating system written in rust, running helloworld as an example, the process of building an operating system image based on source code and configuration items is described in detail:

[0110] 1) Execute the following command to obtain the ArceOS source code:

[0111] git clone https: / / github.com / rcore-os / arceos.git

[0112] 2) Write the configuration file. The configuration file has been compiled in the default project. If there are options that require additional configuration, modify the corresponding features and dependencies in the configuration file.

[0113]

[0114]

[0115] 3) Use the command . / build_img.sh-a x86_64-s 80-fs ext4-file x86_64_ZLM to build the Arceos system image, where the image building script build_img.sh is:

[0116]

[0117]

[0118]

[0119]

[0120] 4) Image verification and deployment. After the system image is built, use the command make A=apps / monolithic_userboot FEATURES=lwext4_rust,img,sched_rr LOG=error NET=y BLK=y ARCH=x86_64ACCEL=n run to start the operating system. After startup, the system automatically runs the helloworld test case, and you can see the text "Hello, world!" printed on the screen.

[0121] Example 4

[0122] An operating system image building system based on source code and configuration items, including:

[0123] The source code preparation module is configured as follows: the user uploads the required operating system source code to a designated code hosting platform;

[0124] The configuration file writing module is configured as follows: users write configuration files according to actual needs. The configuration files include environment variables, dependency features, and platform configuration files.

[0125] The operating system image building module is configured as follows: ArceOS performs various tasks in source code compilation and configuration files by calling library functions and command line tools;

[0126] The image verification and deployment module is configured to: deploy the generated image files to various hardware platforms after testing and verification.

Claims

1. A method for constructing an operating system image based on source code plus configuration items, characterized in that: include: Source code preparation: Users upload the required operating system source code to the designated code hosting platform; Configuration file writing: Users write configuration files according to actual needs. The configuration files include environment variables, dependency features, and platform configuration files. Operating system image construction: ArceOS executes various tasks in source code compilation and configuration files by calling library functions and command line tools; Image verification and deployment: The generated image files are tested and verified before being deployed on various hardware platforms.

2. The method for constructing an operating system image based on source code plus configuration items according to claim 1, characterized in that: Code hosting platforms include GitHub and GitLab.

3. The method for constructing an operating system image based on source code plus configuration items according to claim 1, characterized in that: Write environment variables, including: architecture, platform, virtual cpu, mode, log, target, IP address, and gateway.

4. The method for constructing an operating system image based on source code plus configuration items according to claim 1, characterized in that: Write dependent features, including: Determine component features and configure Cargo.toml's features. Features is a mechanism that allows you to enable or disable certain functions for your package. Load the configuration files that ArceOS depends on.

5. The method for constructing an operating system image based on source code plus configuration items according to claim 4, characterized in that: Determine component features and configure Cargo.toml features, including: For support of different file systems, select the configuration in the Cargo.toml file by setting the characteristics; Each feature is a key-value pair. The key is the name of the feature, and the value is other features or libraries that the feature depends on. Configuration files include devfs, ramfs, procfs, fatfs, and sysfs. Devfs refers to the device file system, ramfs refers to the memory file system, procfs refers to the virtual file system, sysfs refers to the virtual file system, fatfs is an open source file system library used for the FAT file system in embedded systems, and myfs refers to a custom file system.

6. The method for constructing an operating system image based on source code plus configuration items according to claim 4, characterized in that: ArceOS dependent configuration files; including: Axhal component, used to abstract and encapsulate the details of hardware operations; The axconfig component is used to manage and load configuration files; Global memory allocator Axalloc; Graphical module axdisplay; Device driver module axdriver; File system module axfs; Multiple levels of logging macros axlog, including: error, warn, info, debug, trace; Network module axnet, including: IpAddr, TcpSocket, UdpSocket, DnsSocket; Runtime library axruntime; Synchronous operation module axsync: including: Mutex, spin; Task scheduling management module axtask: includes: task creation, scheduling, sleep, and destruction.

7. The method for constructing an operating system image based on source code plus configuration items according to any one of claims 1 to 6, characterized in that: ArceOS executes various tasks in source code compilation and configuration files by calling library functions and command line tools; including: Source code analysis: parse the uploaded operating system source code to determine the compilation target and its dependencies; Environment preparation: Set the operating environment according to the configuration file, including CPU architecture, number of CPUs, platform type, memory size, build target, mode, log, and network configuration parameters; Compile and link: Use Rust and C programming languages ​​to compile and link source code and generate executable files; Image generation: Package the compiled executable files into an image file.

8. An operating system image building system based on source code plus configuration items, characterized in that: include: The source code preparation module is configured as follows: the user uploads the required operating system source code to a designated code hosting platform; The configuration file writing module is configured as follows: users write configuration files according to actual needs. The configuration files include environment variables, dependency features, and platform configuration files. The operating system image building module is configured as follows: ArceOS performs various tasks in source code compilation and configuration files by calling library functions and command line tools; The image verification and deployment module is configured to: deploy the generated image files to various hardware platforms after testing and verification.

Citation Information

Cited By

  • Cutting deployment method of Euler system in aircraft embedded software

    CN119938080A