A unified Linux operating system image design method and device for multiple RISC-V platforms

By unifying the package of bootloader, Linux kernel, hardware-independent image files and hardware-related deb installation packages, a unified Linux operating system image for multi-RISC-V platforms is generated, which solves the fragmentation problem caused by inconsistent RISC-V hardware platform standards, and realizes the multi-platform adaptability and maintenance cost of operating system images.

CN118245073BActive Publication Date: 2025-04-08先进计算与关键软件(信创)海河实验室
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410626992.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2025-04-08
Estimated Expiration
2044-05-21

AI Technical Summary

Technical Problem

Due to the inconsistent standards of RISC-V hardware platform, each hardware platform needs to create an operating system image separately, and it is impossible to install a mirror version on different RISC-V hardware platforms, resulting in fragmentation problems and increasing the maintenance cost of the operating system version.

Method used

A unified Linux operating system image design method for multi-RISC-V platforms is proposed. By uniformly packaging bootloader files, Linux kernel files, hardware-independent mirror files and hardware-related deb installation packages, a unified Linux operating system image file for multi-RISC-V platforms is generated, so that a mirror can be adaptively installed on multiple different RISC-V hardware platforms.

Benefits of technology

It realizes that an operating system image can be installed on multiple different RISC-V hardware platforms, reducing the cost of operating system management and maintenance, and supports unified startup and file system management of different RISC-V platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118245073B_ABST
    Figure CN118245073B_ABST
Patent Text Reader

Abstract

This invention proposes a method and apparatus for designing a unified Linux operating system image for multiple RISC-V platforms. During image creation, the bootloader files and Linux kernel files for different RISC-V platforms are placed in their respective paths. The maximum intersection of the sets of hardware-independent files for each RISC-V platform is packaged to generate a hardware-independent image file. Files outside the intersection, along with software packages and configuration files tightly coupled to the hardware platform, are packaged to generate corresponding hardware-related deb installation packages. These are then uniformly packaged to generate a unified Linux operating system image file for multiple RISC-V platforms. Each RISC-V platform downloads the image file and performs adaptive flashing and installation during system installation. This invention enables a single operating system image to be adaptively installed on multiple different RISC-V hardware platforms, thus forming a unified RISC-V operating system image version and reducing the cost of operating system management and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information technology, and in particular relates to a unified Linux operating system image design method and device for multiple RISC-V platforms. Background Art

[0002] RISC-V is an open source, open and free instruction set architecture. Compared with X86, ARM and other instruction sets, RISC-V is more flexible, customizable and easy to implement. It has received widespread attention from around the world in the past decade. At present, many domestic enterprises and institutions such as Xuantie, Institute of Computing Technology of the Chinese Academy of Sciences and Saifang have successively released processor cores and development boards of RISC-V architecture, and are actively carrying out subsequent research and development work.

[0003] With the rapid development of RISC-V hardware platforms, the demand for RISC-V operating system research and development has become increasingly urgent. In recent years, major open source operating system communities at home and abroad have successively released RISC-V operating system versions, such as Debian, Ubuntu, and openKylin, to support an increasingly rich RISC-V software ecosystem. However, building a RISC-V operating system is a complex system engineering project, especially because the current RISC-V hardware platform standards are not unified, resulting in each hardware platform needing to produce a separate operating system image version, and it is impossible to install a single image version on different RISC-V hardware platforms. This fragmentation problem not only increases the maintenance cost of the operating system version, but is also not conducive to the development of the RISC-V software ecosystem.

[0004] Generally speaking, the RISC-V image mainly includes four parts: opensbi, uboot, Linux kernel and file system. Among them, the first three parts are highly related to the hardware platform, and are generally provided or released by hardware manufacturers directly as open source code; at the same time, the file system also contains some basic libraries and configuration files related to the hardware platform, such as mesa library and hardware configuration. Due to the different hardware standards of various hardware manufacturers, operating system manufacturers or communities need to customize the operating system image for each hardware platform and release the image version corresponding to the hardware platform. This has led to the current fragmentation problem of the RISC-V operating system, that is, the same operating system manufacturer or community needs to release a customized image version for each RISC-V hardware platform, which greatly increases the difficulty of operating system version management and maintenance. Summary of the invention

[0005] The present invention proposes a unified Linux operating system image design method and device for multiple RISC-V platforms, so that one operating system image can be adaptively installed on multiple different RISC-V hardware platforms, thereby forming a unified RISC-V operating system image version and reducing the cost of operating system management and maintenance.

[0006] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0007] A unified Linux operating system image design method for multiple RISC-V platforms, comprising:

[0008] S1. When making an image, place the bootloader files and Linux kernel files of different RISC-V platforms in the path directory corresponding to each platform in the image file system;

[0009] S2. According to the software package list of the full image file, the maximum intersection of the software package sets of each platform and RISC-V hardware-independent software packages is packaged to generate a hardware-independent image file;

[0010] Package the software packages and configuration files that are tightly coupled with the platform for each RISC-V platform, as well as the irrelevant software packages other than the maximum intersection, to generate the corresponding hardware-related deb installation packages, and place them in the path directory corresponding to the RISC-V platform;

[0011] S3, the bootloader file, Linux kernel file, hardware-independent image file, and hardware-related deb installation package are packaged together to generate a unified Linux operating system image file for multiple RISC-V platforms;

[0012] S4. When each RISC-V platform performs system installation, it downloads the unified Linux operating system image file for multiple RISC-V platforms and performs adaptive burning and installation.

[0013] Furthermore, in step S1, the Linux kernel files of different RISC-V platforms are placed in the boot path directory corresponding to each RISC-V platform called by the respective bootloader files.

[0014] Furthermore, the specific process of generating the hardware-independent image file in step S2 includes:

[0015] S201, traverse the file list of the full image, remove the file names related to the RISC-V platform hardware, and obtain a set of image software packages that are independent of the RISC-V platform hardware;

[0016] S202, comparing all hardware-independent image software package sets of RISC-V platforms, selecting the maximum intersection therein, and generating a maximum intersection image software package file list;

[0017] S203: According to the maximum intersection image software package file list, all software packages in the list are pulled from the software package repository, and packaged into an img image file as the hardware-independent image file.

[0018] Furthermore, the specific process of generating the hardware-independent image file in step S2 also includes: when a new RISC-V platform appears, the hardware-independent image software package set of the new RISC-V platform is compared with the current maximum intersection image software package file list, and a new maximum intersection image software package file list is regenerated.

[0019] Furthermore, the adaptive burning installation in step S4 includes:

[0020] S401, select the current RISC-V platform, extract the bootloader and Linux kernel files required by the current RISC-V platform, and burn them to the system installation medium according to the platform default partition requirements;

[0021] S402, using the hardware-independent image file to install the operating system, and copying the hardware-related deb installation package of the current RISC-V platform to the corresponding location;

[0022] S403, when the operating system is installed and started for the first time, the hardware-related deb installation package of the current RISC-V platform is installed.

[0023] On the other hand, the present invention also proposes a unified Linux operating system image design device for multiple RISC-V platforms, comprising:

[0024] Boot and kernel file setting module: When making an image, the bootloader files and Linux kernel files of different RISC-V platforms are placed in the path directory corresponding to each platform in the image file system;

[0025] File system setting module: Pack and generate hardware-independent image files based on the maximum intersection of the file sets in the file systems of different RISC-V platforms that are independent of the RISC-V platform hardware;

[0026] Package the software packages and configuration files that are tightly coupled with the platform for each RISC-V platform, as well as the irrelevant software packages other than the maximum intersection, to generate the corresponding hardware-related deb installation packages, and place them in the path directory corresponding to the RISC-V platform;

[0027] Packaging module: Packaging the bootloader file, Linux kernel file, hardware-independent image file, and hardware-related deb installation package to generate a unified Linux operating system image file for multiple RISC-V platforms;

[0028] Adaptive installation module: When each RISC-V platform performs system installation, it downloads the unified Linux operating system image file for multiple RISC-V platforms and performs adaptive burning and installation.

[0029] Furthermore, in the startup and kernel file setting module, the Linux kernel files of different RISC-V platforms are placed in the boot path directory corresponding to each RISC-V platform called by the respective bootloader files.

[0030] Further, the file system setting module includes a hardware-independent image file generation submodule, and the hardware-independent image file generation submodule includes:

[0031] Traversal unit: traverses the file list of the full image, removes the file names related to the RISC-V platform hardware, and obtains a set of image software packages that are independent of the RISC-V platform hardware;

[0032] Intersection unit: compares all hardware-independent image software package sets of the RISC-V platform, selects the largest intersection among them, and generates a list of image software package files with the largest intersection;

[0033] Packaging unit: according to the maximum intersection image software package file list, pull all software packages in the list from the software package repository, and pack them into an img image file as the hardware-independent image file.

[0034] Furthermore, the hardware-independent image file generation submodule also includes:

[0035] New platform unit: When a new RISC-V platform appears, the hardware-independent image package set of the new RISC-V platform is compared with the current maximum intersection image package file list to regenerate a new maximum intersection image package file list.

[0036] Furthermore, the adaptive installation module includes:

[0037] Selection unit: Select the current RISC-V platform, extract the bootloader and Linux kernel files required by the current RISC-V platform, and burn them to the system installation media according to the platform's default partition requirements;

[0038] Hardware-independent file installation unit: uses the hardware-independent image file to install the operating system, and copies the hardware-related deb installation package of the current RISC-V platform to the corresponding location;

[0039] Hardware-related file installation unit: When the operating system is installed and started for the first time, the hardware-related deb installation package of the current RISC-V platform is installed.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] 1. The present invention proposes a configurable bootloader startup method, provides a unified bootloader management mechanism and configurable kernel path startup items, thereby supporting the startup of different RISC-V platforms from the power-on stage.

[0042] 2. The image of the present invention contains multiple Linux kernels suitable for different RISC-V hardware platforms. These kernel files are placed according to unified rules, and with the help of configurable bootloader startup items, the system can correctly load the Linux kernel corresponding to the hardware platform.

[0043] 3. The mirror file system of the present invention is divided into hardware-independent files and hardware-dependent files. Hardware-independent files can be shared by all RISC-V hardware platforms, and hardware-dependent files are packaged into deb installation packages and placed according to unified rules, thereby reducing the management and maintenance costs of the file system.

[0044] 4. The adaptive burning and installation of the present invention can realize the burning and installation of a unified image on the installation medium for different RISC-V platforms according to different platform models, thereby reducing the management and maintenance costs of installing the operating system on the RISC-V platform. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Attached Figure 1 This is a schematic diagram of a unified Linux operating system image production process according to an embodiment of the present invention;

[0046] Attached Figure 2 It is a schematic diagram of the system adaptive burning installation process of an embodiment of the present invention. DETAILED DESCRIPTION

[0047] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0048] The present invention is further described below in conjunction with specific embodiments and drawings.

[0049] The object of the present invention is to provide a unified Linux operating system image design scheme for multiple RISC-V hardware platforms. The main design idea is to realize a unified Linux operating system image production method by implementing a configurable bootloader startup method for different RISC-V platforms, a multi-platform Linux kernel system and a modular file system. At present, there are many productized RISC-V hardware platforms, nearly more than 20 kinds, such as visionfive, Lichee Pi, Sifive and SG2042. For the convenience of description, this embodiment uses simplified rv1, rv2 and rv3 to represent three different RISC-V hardware platforms respectively. It should be noted that the scheme of the present invention is not limited to the three platforms of rv1, rv2 and rv3 listed in the embodiment, but can be expanded and applied to more RISC-V platform Linux image production.

[0050] 1. The steps for generating a unified Linux operating system image file for multiple RISC-V platforms in this embodiment are as follows: Figure 1 As shown, specifically including:

[0051] 1. Configurable bootloader startup method:

[0052] The bootloader of the RISC-V operating system image mainly consists of two parts: opensbi and uboot. Among them, opensbi is mainly responsible for initializing the processor, memory and peripherals, and then transferring control to uboot; uboot is mainly responsible for starting the system, loading the kernel image and file system, and provides boot selection, debugging and configuration system functions. Although the details of the startup process on different hardware platforms are different, the startup part mainly depends on these two parts. In particular, since the initialization process of opensbi and uboot is strongly related to the hardware, the opensbi and uboot of each RISC-V platform are different, which also brings challenges to the unified production of system images.

[0053] Therefore, the present invention designs a configurable bootloader startup method for different hardware platforms. The main features of the method are: when making an image, according to the bootloader startup requirements of different hardware platforms, the startup files and configuration files of each platform are placed in the corresponding positions of the image, and the bootloader files used are selected by the burning program when burning the image. Taking rv1, rv2 and rv3 as examples, the bootloader related files are placed in the / bootloader / rv1 / , / bootloader / rv2 / and / bootloader / rv3 / directories respectively, so as to achieve mutual independence and isolation between each other.

[0054] 2. Multi-platform Linux kernel system:

[0055] The relationship between the Linux kernel and hardware is very close, and it needs to support various device drivers, thereby supporting hardware architectures and devices, to ensure that the operating system can run correctly and efficiently on various hardware platforms. Due to the large differences in RISC-V hardware platform interfaces and peripherals, the same kernel cannot be used between platforms at present, that is, the kernel files cannot be unified. Therefore, the present invention integrates and places the Linux kernel files of multiple RISC-V platforms in the image file according to the storage and loading form of the Linux kernel files, and places its kernel files in its corresponding position for each supported hardware platform.

[0056] The booting and starting of the kernel are completed by uboot, and uboot will call the path where the kernel is located and start the kernel program. Generally, the Linux kernel is stored in the / boot / folder. In order to uniformly manage kernel files, the present invention puts the kernels of different platforms into the specified file path according to the platform name, that is, / boot / [platform name]. Taking the three RISC-V platforms rv1, rv2 and rv3 as examples, their kernel files are placed in / boot / rv1 / , / boot / rv2 / and / boot / rv3 / respectively. When performing image installation, the burning program will adaptively select the required kernel, and by modifying the uboot configuration, it is ensured that the uboot of different platforms can call the correct kernel path and files required by the platform.

[0057] 3. Modular file system:

[0058] The file system of the operating system image mainly includes system library files, applications and desktop environment, etc. Most of them are independent of the hardware platform. However, there are still some basic libraries and configuration files that are strongly related to the hardware platform. Therefore, the present invention proposes a modular file system design method to adapt to the needs of different hardware platforms for file systems.

[0059] 3.1. Create a hardware-independent maximum file system set, that is, all files in the file system are independent of the hardware platform and are the maximum intersection of the file sets required by each hardware platform. The maximum intersection is specifically presented as a software package name list file, and the method for generating the file is as follows:

[0060] (1) Traverse the file list of the full image of the RISC-V platform, remove the file names related to the RISC-V platform hardware, and obtain a set of image software packages that are independent of the RISC-V platform hardware;

[0061] For example, the software packages related to the hardware platform include libqt5quick5, libqt5gui5, libqt5quick5-gles, libqt5gui5-gles and other libraries related to GUP and NPU; after removing them, a list of files not related to hardware in the file system of each RISC-V platform is obtained;

[0062] (2) Compare all hardware-independent image software package sets of the RISC-V platform, select the largest intersection among them, and generate a list of image software package files with the largest intersection;

[0063] Generally, the hardware-independent files remaining after the RISC-V platform removes the hardware-related files are the same, but there are different cases, so it is necessary to select the file list with the largest intersection.

[0064] The maximum intersection file list is made based on the existing RISC-V platform. When a new RISC-V platform appears, the hardware-independent image package set of the new RISC-V platform is compared with the current maximum intersection image package file list to regenerate a new maximum intersection image package file list.

[0065] 3.2. Pull all the files in the list from the software package repository according to the maximum intersection file list, and package them into an img image file as a hardware-independent image file:

[0066] The packaging process is:

[0067] (1) Build an empty image file and partition it;

[0068] (2) debootstrap builds the basic root file system and installs basic software packages such as apt required by the system;

[0069] (3) Read the maximum intersection file list and pull the software packages in the list from the software package repository;

[0070] (4) Modify the user, password, language and other configuration files that are common to each hardware platform.

[0071] After the hardware-independent image file is created, the remaining files of each RISC-V platform, including the hardware-independent image software package outside the maximum intersection, and the hardware-related (tightly coupled) basic libraries and configuration files, are packaged into one or more deb installation packages for the platform and copied to the specific location / etc / platformfs / [platform name] path. In general, there are fewer hardware-related software packages, including system configuration files, GPU and NPU related libraries, binaries, etc. Therefore, the packaging process is to place these files in the same directory, write the deb installation script, and use the debuild command to generate hardware-related deb installation packages for all files in the directory.

[0072] Taking the three RISC-V platforms rv1, rv2 and rv3 as examples, their hardware-related deb installation packages are placed in / etc / platformfs / rv1 / , / etc / platformfs / rv2 / and / etc / platformfs / rv3 / respectively. When the operating system is installed and started for the first time, the system automatically installs the platform-related deb package, thereby completing the complete installation of the platform-related file system.

[0073] 4. Unified image packaging:

[0074] Finally, package all the above bootloaders, Linux kernels, and file systems (hardware-independent image files, hardware-related deb installation packages) to generate a unified Linux operating system image file for multiple RISC-V platforms.

[0075] 2. System adaptive burning and installation:

[0076] At present, the system installation of the RISC-V platform mainly adopts the burning method, that is, the image is downloaded locally, and then the image is burned into the system storage medium of the platform, such as an SD card, a mobile hard disk or an eMMC. In this embodiment, since the unified Linux operating system image file for multiple RISC-V platforms contains redundant (i.e., multiple RISC-V platforms) bootloaders, Linux kernels and image files, adaptive installation is required during burning and installation. Therefore, the present invention designs a system adaptive burning and installation technology to facilitate the burning and use of unified images.

[0077] The system adaptive burning installation process is as follows Figure 2As shown, first, download the unified Linux operating system image file for multiple RISC-V platforms to the local computer disk, and connect the local computer to the image burning medium through a data cable; then, start the system adaptive burning installation, select the current RISC-V platform name and the image burning medium type used by the user; third, according to the RISC-V platform name and the burning medium, extract the bootloader and Linux kernel files required by the current platform from the image, and burn them into the system's installation medium according to the platform's default partition requirements; fourth, use the hardware-independent image file to install the platform-independent file system into the corresponding partition, and copy the hardware-related deb installation package of the RISC-V platform to the corresponding location; finally, complete the installation, and install the relevant basic libraries and configuration files required by the platform when the system is started for the first time.

[0078] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A unified Linux operating system image design method for multiple RISC-V platforms, characterized in that: include: S1. When making an image, place the bootloader files and Linux kernel files of different RISC-V platforms in the path directory corresponding to each platform in the image file system; S2. According to the software package list of the full image file, the maximum intersection of the software package sets of each platform and RISC-V hardware-independent software packages is packaged to generate a hardware-independent image file; Hardware-independent image files are shared by all RISC-V platforms; Package the software packages and configuration files that are tightly coupled with the platform for each RISC-V platform, as well as the irrelevant software packages other than the maximum intersection, to generate the hardware-related deb installation packages corresponding to each RISC-V platform, and place them in the path directory corresponding to the RISC-V platform; S3, the bootloader file, Linux kernel file, hardware-independent image file, and hardware-related deb installation package are packaged together to generate a unified Linux operating system image file for multiple RISC-V platforms; S4, when each RISC-V platform performs system installation, it downloads the unified Linux operating system image file for multiple RISC-V platforms and performs adaptive burning and installation; The specific process of generating the hardware-independent image file in step S2 includes: S201, traverse the file list of the full image, remove the file names related to the RISC-V platform hardware, and obtain a set of image software packages that are independent of the RISC-V platform hardware; S202, comparing all hardware-independent image software package sets of RISC-V platforms, selecting the maximum intersection therein, and generating a maximum intersection image software package file list; S203, according to the maximum intersection image software package file list, pull all the software packages in the list from the software package warehouse, and package them into an img image file as the hardware-independent image file; the packaging process is: construct an empty image file and partition it; construct a basic root file system and install the basic software packages required by the system; read the maximum intersection image software package file list, and pull the software packages in the list from the software package warehouse; modify the configuration files common to each hardware platform; The specific process of generating the hardware-independent image file in step S2 also includes: when a new RISC-V platform appears, comparing the hardware-independent image software package set of the new RISC-V platform with the current maximum intersection image software package file list, and regenerating a new maximum intersection image software package file list; The adaptive burning installation in step S4 includes: S401, select the current RISC-V platform, adaptively select the bootloader and Linux kernel files required by the current RISC-V platform, and burn them to the system installation medium according to the platform default partition requirements; S402, using the hardware-independent image file to install the operating system, and copying the hardware-related deb installation package of the current RISC-V platform to the corresponding location; S403, when the operating system is installed and started for the first time, the hardware-related deb installation package of the current RISC-V platform is installed; In step S1, the Linux kernel files of different RISC-V platforms are placed in the boot path directory corresponding to each RISC-V platform called by the respective bootloader files.

2. A unified Linux operating system image design device for multiple RISC-V platforms, characterized in that: include: Boot and kernel file setting module: When making an image, the bootloader files and Linux kernel files of different RISC-V platforms are placed in the path directory corresponding to each platform in the image file system; File system setting module: Pack and generate a hardware-independent image file based on the maximum intersection of the file sets in the file systems of different RISC-V platforms that are independent of the RISC-V platform hardware; the hardware-independent image file is shared by all RISC-V platforms; Package the software packages and configuration files that are tightly coupled with the platform for each RISC-V platform, as well as the irrelevant software packages other than the maximum intersection, to generate the hardware-related deb installation packages corresponding to each RISC-V platform, and place them in the path directory corresponding to the RISC-V platform; Packaging module: Packaging the bootloader file, Linux kernel file, hardware-independent image file, and hardware-related deb installation package to generate a unified Linux operating system image file for multiple RISC-V platforms; Adaptive installation module: when each RISC-V platform performs system installation, it downloads the unified Linux operating system image file for multiple RISC-V platforms and performs adaptive burning and installation; The file system setting module includes a hardware-independent image file generation submodule, and the hardware-independent image file generation submodule includes: Traversal unit: traverses the file list of the full image, removes the file names related to the RISC-V platform hardware, and obtains a set of image software packages that are independent of the RISC-V platform hardware; Intersection unit: compares all hardware-independent image software package sets of the RISC-V platform, selects the largest intersection among them, and generates a list of image software package files with the largest intersection; Packaging unit: according to the maximum intersection image software package file list, pull all the software packages in the list from the software package warehouse, and pack them into an img image file as the hardware-independent image file; the packaging process is: build an empty image file and partition it; build a basic root file system and install the basic software packages required by the system; read the maximum intersection image software package file list and pull the software packages in the list from the software package warehouse; modify the configuration files common to each hardware platform; The hardware-independent image file generation submodule also includes: New platform unit: When a new RISC-V platform appears, the hardware-independent image package set of the new RISC-V platform is compared with the current maximum intersection image package file list to regenerate a new maximum intersection image package file list; Adaptive installation modules include: Selection unit: Select the current RISC-V platform, adaptively select the bootloader and Linux kernel files required by the current RISC-V platform, and burn them to the system installation medium according to the platform's default partition requirements; Hardware-independent file installation unit: uses the hardware-independent image file to install the operating system, and copies the hardware-related deb installation package of the current RISC-V platform to the corresponding location; Hardware-related file installation unit: When the operating system is installed and started for the first time, the hardware-related deb installation package of the current RISC-V platform is installed; In the startup and kernel file setting module, the Linux kernel files of different RISC-V platforms are placed in the boot path directory corresponding to each RISC-V platform called by their respective bootloader files.

Citation Information

Patent Citations

  • Resource packaging method and device, electronic equipment and computer readable storage medium

    CN113885935A

  • RISC-V-oriented extensible segmented automatic mirror image construction technology

    CN116594640A

  • Multi-RISC-V platform-oriented general Linux operating system mirror image design method

    CN117075957A