Docker-based linux kernel compiling method and system

By building standardized kernel compilation environment Docker images and kernel upload environments for different target architectures and dynamically scheduling compilation nodes, the problems of environment differences and GPG signature inconsistencies in the Linux kernel compilation environment are solved, achieving efficient and stable kernel compilation and delivery.

CN120872355AActive Publication Date: 2025-10-31KYLIN CORP
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202511384330.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-26
Publication Date
2025-10-31
Estimated Expiration
2045-09-26

AI Technical Summary

Technical Problem

Traditional Linux kernel compilation environments suffer from nondeterminism due to environmental differences between compilation nodes and difficulty in reproducing compilation results. They lack the ability to dynamically adapt across nodes, resulting in high operational complexity and resource scheduling delays. Additionally, inconsistent GPG signature algorithms lead to verification failures and delivery delays.

Method used

A Docker-based kernel compilation method is adopted. By building standardized kernel compilation environment Docker images for different target architectures, compilation nodes are dynamically scheduled to ensure that the same type of compilation tasks are executed in a consistent environment. A kernel upload environment Docker image is pre-deployed on each node to achieve automated GPG signing and release.

Benefits of technology

It improves the determinism of compilation results and resource reuse rate, reduces operational complexity, ensures the consistency of GPG signature algorithm, and guarantees the stability and efficiency of kernel delivery chain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120872355A_ABST
    Figure CN120872355A_ABST
Patent Text Reader

Abstract

The invention discloses a docker-based linux kernel compiling method and a docker-based linux kernel compiling system, which are characterized in that standardized kernel compiling environment docker mirror images are respectively constructed for server operating systems and desktop operating systems of different target architectures, uploading environment docker mirror images are constructed for different target kernel architectures, two types of compiling environment mirror images and uploading mirror images of corresponding architectures are pre-deployed by compiling nodes, and the docker-based linux kernel compiling method comprises the following steps of: constructing standard kernel compiling environment docker mirror images and uploading mirror images of corresponding architectures; the first compiling node is selected according to the compiling node scheduling rule, and the first compiling node calls the adaptive compiling environment mirror image according to the task type to perform kernel compiling, so that the consistency of the task environments with the same framework and the same type is ensured, the result certainty can be improved, and the resource reuse rate is increased; the kernel file selects the second compiling node according to the preset publishing node screening rule to start the kernel uploading environment mirror image to automatically publish the kernel file, so that the global consistency of a GPG signature algorithm and key configuration is ensured, and the stability and efficiency of a kernel delivery link are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Linux kernel compilation methods, specifically to a Linux kernel compilation method and system based on Docker. Background Technology

[0002] The rapid iteration of upper-layer application software (such as feature expansion, architectural restructuring, and the intensive release of security patches) forces the Linux kernel to maintain ecosystem compatibility through continuous version updates. This "application-kernel" co-evolution model has led to two major trends in Linux kernel development: exponential growth in codebase size and continuously compressed version release cycles. Under this dual pressure, the traditional linear compilation process can no longer meet development needs.

[0003] For domestically developed operating system kernels, the software environment of compilation nodes exhibits significant dispersion (such as differences in operating system version, dependent library version, and compilation toolchain configuration), leading to two major technical challenges in traditional compilation environments: First, environmental differences between compilation nodes may lead to nondeterministic compilation results, which not only seriously threatens kernel functional safety, but also makes it difficult to reproduce and troubleshoot problems that occur during the compilation process. Secondly, the statically bound compilation environment configuration lacks the ability to dynamically adapt across nodes, which requires manual intervention to reconstruct the environment when migrating compilation tasks, increasing the complexity of operation and maintenance and the delay in resource scheduling.

[0004] Meanwhile, to achieve continuous delivery, the kernel's iteration cycle is constantly being compressed, exhibiting characteristics of high-frequency releases and a surge in parallel development branches. This trend poses greater challenges to the kernel compilation infrastructure—the faster kernel release iteration rate significantly increases the demands on the speed and flexibility of compilation resources.

[0005] Furthermore, during the continuous delivery of the kernel, to meet the data transmission standards for software packages, end-to-end encrypted verification of the kernel build artifacts is required via GPG digital signatures. However, currently, each step relies on manual configuration of the local GPG environment (including key generation, trust chain establishment, and toolchain integration), which can easily lead to inconsistencies in the GPG signature algorithm due to differences in operation. This can result in problems such as verification failures at the repository receiving end and delivery delays. Summary of the Invention

[0006] The technical problem to be solved by this invention is to provide a Docker-based Linux kernel compilation method and system that can reduce environmental differences between compilation nodes, dynamically configure the compilation environment of compilation nodes, enable cross-system construction of compilation environments for server operating systems and desktop operating systems, and achieve high reuse rate of compilation resources.

[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows: A Docker-based method for compiling a Linux kernel includes the following steps: S1. For server operating systems with different target kernel architectures, build corresponding server kernel compilation environment Docker images; for desktop operating systems with different target kernel architectures, build corresponding desktop kernel compilation environment Docker images; for different target kernel architectures, build corresponding kernel upload environment Docker images. The kernel upload environment Docker images are used to perform GPG signing operations on kernel files and upload kernel files to the specified kernel software distribution platform. S2 deploys compilation nodes consistent with each target kernel architecture, configures Docker runtime environment for compilation nodes that support Docker services, and pre-deploys server kernel compilation environment Docker image, desktop kernel compilation environment Docker image and kernel upload environment Docker image corresponding to its own kernel architecture on these compilation nodes; S3, the compilation task scheduling server creates a kernel compilation task based on the input kernel compilation parameters, selects a node that meets the conditions from all compilation nodes according to the preset compilation node scheduling rules as the first compilation node, and sends the kernel compilation task carrying the kernel compilation parameters to the first compilation node. S4. Determine whether the first compilation node supports Docker service and whether the Docker service can run normally. If the determination result is yes and the compilation task type is a server operating system kernel compilation task, the first compilation node starts the pre-deployed server kernel compilation environment Docker image to perform kernel compilation operations and records compilation logs. If the determination result is yes and the compilation task type is a desktop operating system kernel compilation task, the first compilation node starts the pre-deployed desktop kernel compilation environment Docker image to perform kernel compilation operations and records compilation logs. If the determination result is no, the first compilation node uses its native compilation environment to perform kernel compilation operations and records compilation logs. S5. Determine whether the kernel compilation was successful. If the result is yes, upload the compiled kernel file and the compilation log to the cloud storage service and proceed to step S6. If the result is no, upload the compilation log to the cloud storage service and then end. S6. Determine whether automatic distribution of the compiled kernel file is required. If so, select a node that meets the conditions from all compilation nodes as the second compilation node according to the preset distribution node filtering rules. The second compilation node starts the pre-deployed kernel upload environment Docker image, downloads the kernel file from the cloud storage service, performs encryption and signing operations on the kernel file, and uploads the kernel file with completed encryption and signing operations to the designated kernel software distribution platform. If not, the process ends.

[0008] Optionally, in step S1, building corresponding server kernel compilation environment Docker images for server operating systems with different target kernel architectures includes the following steps: A11, Download the server operating system ISO image file corresponding to the target kernel architecture to a designated server host with the same kernel architecture, and build a Docker service environment on the designated server host; A12, mount the server operating system ISO image file to the specified directory of the specified server host, modify the software source download address of the specified server host to the absolute path of the specified directory, create a root file directory on the specified server host and use the root file directory as the root file system, and install the software dependencies required by the server operating system in the root file directory to build the rootfs file system of the server operating system. A13, copy the host machine's environment variable file / etc / skel / .bash* to the root directory; A14 clears all bash history in the root directory / etc, removes the proc, sys, dev, run, and boot directories in the root directory, and then compresses the root directory into a tar archive. A15. Based on the tar file format compressed package created in step A14, build a Docker image for the server kernel compilation environment; A16, repeat steps A11 to A15 until the corresponding server kernel compilation environment Docker image has been built for all target kernel architecture server operating systems; Building corresponding desktop kernel compilation environment Docker images for desktop operating systems with different target kernel architectures includes the following steps: B11: Download the desktop operating system ISO image file corresponding to the target kernel architecture to a designated desktop host with the same kernel architecture, and build a Docker service environment on the designated desktop host; B12, create a root file directory on the specified desktop host and use the root file directory as the root file system, install the software dependencies required by the desktop operating system in the root file directory to build the rootfs file system of the desktop operating system; B13, mount the desktop operating system ISO image file to the temporary mount directory of the specified desktop host, decompress the / casper / filesystem.squashfs file in the desktop operating system ISO image file mounted to the temporary mount directory to the root file directory, enter the root file directory through the chroot command, and uninstall unnecessary software dependencies of the desktop operating system through the apt tool, and then compress the root file directory into a tar file format compressed package; B14. Based on the tar file format compressed package created in step B13, build a Docker image for the desktop kernel compilation environment. B15. Repeat steps B11 to B14 until the corresponding server kernel compilation environment Docker image has been built for all target kernel architecture desktop operating systems.

[0009] Optionally, step A15 includes the following steps: A151, Create the first base Docker image from the tar file format compressed package prepared in step A14; A152, Select a host machine with the target kernel architecture, import and start the first base Docker image to generate a temporary container for the server system; A153, Use the yum tool to install the dependencies required for the rpm kernel format package in the temporary container of the server system; A154, build a distcc distributed compilation topology for the current target kernel architecture: Prepare N distcc server nodes with the target kernel and record the IP of each distcc server node; install distcc service dependencies matching the target kernel architecture on the distcc server and configure the distcc server to receive distributed compilation requests from compilation nodes with the same kernel architecture; install and configure the required dependency packages for the distcc service in the temporary container of the server system, configure the IP of each distcc server node to update the temporary container of the server system in the Docker environment, so that the updated temporary container of the server system can act as a distcc client to distribute distributed compilation tasks. A155, the latest temporary container of the server system is used as the Docker image of the server kernel compilation environment and synchronized to the preset Docker repository; Step B14 includes the following steps: B141, Create a second base Docker image from the tar file format compressed package created in step B14; B142, Select a host machine with the target kernel architecture, import and start the second base Docker image to generate a temporary container for the desktop system; B143, Use the apt tool to install the dependencies required for the deb kernel format package within the temporary container of the desktop system; B144, build a distcc distributed compilation topology for the current target kernel architecture: Prepare N distcc server nodes consistent with the target kernel architecture, and record the IP of each distcc server node; install distcc service dependencies matching the target kernel architecture on the distcc server, and configure the distcc server to receive distributed compilation requests from compilation nodes with the same kernel architecture; install and configure the required distcc service dependency packages in the desktop system temporary container, and configure the IP of each distcc server node in the Docker environment of the desktop system temporary container, so that the desktop system temporary container can act as a distcc client to distribute distributed compilation tasks; B145, update the desktop system temporary container to a desktop kernel compilation environment Docker image, and synchronize it to the preset Docker repository.

[0010] Optionally, in step S1, corresponding kernel upload environment Docker images are built for different target kernel architectures, including the following steps: C1, select either the server kernel compilation environment Docker image or the desktop kernel compilation environment Docker image corresponding to the target kernel architecture as the target kernel compilation environment Docker image, select a host machine with the target kernel architecture to obtain and start the target kernel compilation environment Docker image, and generate a temporary kernel upload container; C2, install the GPG encryption tool dependency package in the temporary kernel upload container to generate a GPG key, and add the GPG key to the specified kernel software distribution platform; C3 saves the temporary kernel upload container configured with GPG encryption tool dependency packages and GPG keys as a kernel upload environment Docker image, and synchronizes the kernel upload environment Docker image to the preset Docker repository; C4. Repeat steps C1 to C3 until a corresponding kernel upload environment Docker image is built for each different target kernel architecture.

[0011] Optionally, the kernel compilation parameters include the kernel source code repository access address (Url), the kernel series name (Tree), the corresponding branch in the kernel source code repository (Branch), the commit ID (Commit), the kernel package type (Kernel), the link to the configuration file required for compilation (Config), the architecture name (Arch) corresponding to the compiled kernel, and the download link for the kernel code customization patch (Patch).

[0012] Optionally, in step S3, the compilation task scheduling server creates a kernel compilation task based on the input kernel compilation parameters, and selects the first compilation node that meets the conditions from all compilation nodes according to the preset compilation node scheduling rules, including the following steps: S31. Determine whether there is an idle compilation node that meets the following conditions: the kernel version series name is consistent with the series name Tree of the compiled kernel, and the kernel architecture name is consistent with the architecture name Arch of the compiled kernel. If the determination result is yes, proceed to step S33; otherwise, proceed to step S32. S32, determine whether there is an idle compilation node that meets the following conditions: the kernel architecture name is consistent with the architecture name Arch corresponding to the compiled kernel and supports Docker service. If the determination result is yes, proceed to step S33; if the determination result is no, wait for a preset time and then execute steps S31 to S32 again. S33 selects the node with the most CPU cores from the available idle compilation nodes that meet the conditions as the first compilation node.

[0013] Optionally, after assigning the kernel compilation task to the first compilation node, the following steps are performed before the kernel compilation operation is executed on the first compilation node: D1, based on the access address URL of the kernel source code repository, downloads the kernel source code of the corresponding branch Branch in the kernel source code repository to the first compilation node, and extracts the code corresponding to the version point of the commit ID from the downloaded kernel source code as the code to be compiled. D2. Determine whether the configuration file pointed to by the link Config for the required configuration file is a custom configuration file. If so, download the configuration file pointed to by the link to the first compilation node and replace the configuration file used by the code to be compiled in step D1 with the downloaded configuration file. If not, proceed to step D3. D3. Determine if the download link Patch for the kernel code customization patch is empty. If the result is yes, proceed to step S4; otherwise, download the download link Patch for the kernel code customization patch and download the kernel code customization patch compressed package to the first compilation node. The first compilation node will decompress the downloaded kernel code customization patch compressed package and apply all the decompressed patch files. D4. Determine whether all patch files have been successfully applied. If the result is no, mark the kernel compilation as failed and end. If the result is yes, proceed to step S4.

[0014] Optionally, in step S4, the first compilation node starts the pre-deployed server kernel compilation environment Docker image to perform kernel compilation operations, including the following steps: starting the pre-deployed server kernel compilation environment Docker image, determining whether the kernel package type Kernel is image; if the determination result is yes, starting the distcc service, and calling the distcc server node to perform distributed kernel compilation according to the IP of the distcc server node configured in the server kernel compilation environment Docker image; if the determination result is no, then relying on the Docker container generated by the server kernel compilation environment Docker image to perform kernel compilation. The first compilation node starts the pre-deployed desktop kernel compilation environment Docker image to perform kernel compilation operations, including the following steps: Start the pre-deployed desktop kernel compilation environment Docker image, determine whether the kernel package type to be compiled is "image", if the result is yes, start the distcc service, and call the distcc server node to perform distributed kernel compilation according to the IP of the distcc server node configured in the desktop kernel compilation environment Docker image; if the result is no, rely on the Docker container generated by the desktop kernel compilation environment Docker image to perform kernel compilation.

[0015] Optionally, step S6 includes the following steps: S61, the compilation task scheduling server determines whether the compiled kernel file needs to be automatically released. If the result is yes, proceed to step S62; if the result is no, end. S62, determine whether there is an idle compilation node that meets the following conditions: the kernel architecture name is consistent with the architecture name Arch corresponding to the compiled kernel and supports Docker service. If the determination result is yes, select the node with the most CPU cores from the nodes that meet the conditions as the second compilation node; if the determination result is no, wait for a preset time and then execute step S62 again until the second compilation node is selected. S63, the second compilation node starts the pre-deployed kernel upload environment Docker image to create a kernel upload environment container; S64, the kernel upload environment container downloads the kernel file that needs to be automatically released from the cloud storage service; S65, the kernel upload environment container standardizes the changelog file content of the kernel file according to the kernel version series name specified by the user; S66, Use the GPG tool to perform a GPG signing operation on the kernel file downloaded to the kernel upload environment container. After completing the GPG signing operation, upload the kernel file downloaded to the kernel upload environment container to the designated kernel software distribution platform corresponding to the pre-deployed kernel upload environment Docker image for distribution. S67, output all kernel upload processing logs and upload the kernel upload processing logs to the cloud storage service.

[0016] In addition, the present invention also provides a Docker-based Linux kernel compilation system, including interconnected microprocessors and memory, wherein the microprocessors are programmed or configured to execute the above-described Docker-based Linux kernel compilation method.

[0017] Compared with the prior art, the present invention has the following main advantages: By building standardized kernel compilation environment Docker images for server / desktop operating systems with different target architectures, the portability and replicability of the kernel compilation environment are achieved. Server kernel compilation environment Docker images and desktop kernel compilation environment Docker images corresponding to their own kernel architecture are pre-deployed on the compilation nodes. After the first compilation node is dynamically selected according to the preset compilation node scheduling rules, the first compilation node calls the appropriate kernel compilation environment Docker image according to the type of compilation task (compilation tasks are divided into server operating system kernel compilation tasks and desktop operating system kernel compilation tasks). This helps to ensure that compilation tasks of the same type under the same architecture are executed in a consistent environment, resulting in high determinism of compilation results. At the same time, it also breaks through system-level limitations, allowing the same compilation node to support the execution of two types of compilation tasks, improving the reuse rate of compilation resources. The whole process does not require manual intervention to reconstruct the kernel environment of the compilation node, resulting in fast resource scheduling and low operational complexity.

[0018] By building corresponding kernel upload environment Docker images for different target kernel architectures, and pre-deploying kernel upload environment Docker images corresponding to their own kernel architecture on the compilation nodes, when automatic deployment of compiled kernel files is required, a second compilation node is dynamically selected for automatic deployment based on preset deployment node filtering rules. The second compilation node starts the pre-deployed kernel upload environment Docker image to automatically deploy the kernel files, ensuring global consistency of GPG signature algorithms and key configurations. This avoids the problem of verification failure at the repository receiving end caused by inconsistent GPG signature algorithms, and ensures the stability and efficiency of the kernel delivery chain. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the execution flow of the method of the present invention.

[0020] Figure 2 This is a schematic diagram of the execution flow after the compilation task is issued by the method of the present invention.

[0021] Figure 3 This is a schematic diagram of the execution flow of the first compilation node of the method of the present invention.

[0022] Figure 4 This is a schematic diagram illustrating the distcc distributed compilation topology in an embodiment of the present invention. Detailed Implementation

[0023] To facilitate understanding, the technical terms that may be involved in the embodiments of the present invention will be introduced first.

[0024] Docker is an open-source virtualization technology based on the operating system level that packages software and its dependencies into containers, allowing applications in different containers to be isolated from each other and work efficiently.

[0025] Docker images are templates for containers; multiple containers can be instantiated from an image.

[0026] A container is a running instance of an image.

[0027] Docker repository: A server service for storing and managing Docker images, allowing organizations to host their own collections of Docker images within their internal networks.

[0028] distcc is an open-source distributed compiler tool specifically designed to accelerate the compilation process of languages ​​such as C / C++ and Objective C.

[0029] Launchpad is a platform used to manage and maintain software releases.

[0030] GPG keys are encryption key pairs based on the OpenPGP standard, used to encrypt, decrypt, sign, and verify data, and are a core tool for ensuring the security of digital communication and files.

[0031] The technical solution of the present invention will now be described in further detail with reference to the accompanying drawings.

[0032] like Figure 1 As shown, the Docker-based Linux kernel compilation method in this embodiment includes the following steps: S1. For server operating systems with different target kernel architectures, build corresponding server kernel compilation environment Docker images; for desktop operating systems with different target kernel architectures, build corresponding desktop kernel compilation environment Docker images; for different target kernel architectures, build corresponding kernel upload environment Docker images. The kernel upload environment Docker images are used to perform GPG signing operations on kernel files and upload kernel files to a specified kernel software distribution platform (specifically Launchpad, but in other embodiments it can also be other platforms used to manage and maintain software version distribution). S2 deploys compilation nodes consistent with each target kernel architecture, configures Docker runtime environment for compilation nodes that support Docker services, and pre-deploys server kernel compilation environment Docker image, desktop kernel compilation environment Docker image and kernel upload environment Docker image corresponding to its own kernel architecture on these compilation nodes; S3, the compilation task scheduling server creates a kernel compilation task (with kernel parameter information) based on the input kernel compilation parameters, selects a node that meets the conditions from all compilation nodes as the first compilation node according to the preset compilation node scheduling rules, and sends the kernel compilation task carrying the kernel compilation parameters to the first compilation node. S4. Determine whether the first compilation node supports Docker service and whether the Docker service can run normally. If the determination result is yes and the compilation task type is server operating system kernel compilation task, the first compilation node starts the pre-deployed server kernel compilation environment Docker image to perform kernel compilation operation and records compilation logs. If the determination result is yes and the compilation task type is desktop operating system kernel compilation task, the first compilation node starts the pre-deployed desktop kernel compilation environment Docker image to perform kernel compilation operation and records compilation logs. If the determination result is no, the first compilation node uses its native compilation environment to perform kernel compilation operation and records compilation logs. S5. Determine whether the kernel compilation was successful. If the result is yes, upload the compiled kernel file and compilation log to the cloud storage service and proceed to step S6. If the result is no, upload the compilation log to the cloud storage service and then end. S6 determines whether automatic distribution of the compiled kernel file is required. If so, a node that meets the criteria is selected from all compilation nodes as the second compilation node according to the preset distribution node filtering rules. The second compilation node starts the pre-deployed kernel upload environment Docker image, downloads the kernel file from the cloud storage service, performs encryption and signing operations on the kernel file, and uploads the encrypted and signed kernel file to the specified kernel software distribution platform. If not, the process ends.

[0033] By building standardized kernel compilation environment Docker images for server / desktop operating systems with different target architectures, the portability and replicability of the kernel compilation environment are achieved. Server kernel compilation environment Docker images and desktop kernel compilation environment Docker images corresponding to their own kernel architecture are pre-deployed on the compilation nodes. After the first compilation node is dynamically selected according to the preset compilation node scheduling rules, the first compilation node calls the appropriate kernel compilation environment Docker image according to the type of compilation task (compilation tasks are divided into server operating system compilation tasks and desktop operating system compilation tasks). This helps to ensure that compilation tasks of the same type under the same architecture are executed in a consistent environment, resulting in high determinism of compilation results. At the same time, it also breaks through system-level limitations, allowing the same compilation node to support the execution of two types of compilation tasks, improving the reuse rate of compilation resources. The whole process does not require manual intervention to reconstruct the kernel environment of the compilation node, resulting in fast resource scheduling and low operational complexity. By building corresponding kernel upload environment Docker images for different target kernel architectures, and pre-deploying kernel upload environment Docker images corresponding to their own kernel architecture on the compilation nodes, when automatic deployment of compiled kernel files is required, a second compilation node is dynamically selected for automatic deployment based on preset deployment node filtering rules. The second compilation node starts the pre-deployed kernel upload environment Docker image to automatically deploy the kernel files, ensuring global consistency of GPG signature algorithms and key configurations. This avoids the problem of verification failure at the repository receiving end caused by inconsistent GPG signature algorithms, and ensures the stability and efficiency of the kernel delivery chain.

[0034] As an optional implementation, the compiled kernel file in step S5 is compressed before being uploaded to the cloud storage service to save storage space.

[0035] Furthermore, in this embodiment, step S1, which involves building corresponding server kernel compilation environment Docker images for server operating systems with different target kernel architectures, includes the following steps: A11 downloads the server operating system ISO image file corresponding to the target kernel architecture to a specified server host with the same kernel architecture, and sets up a Docker service environment on the specified server host. A12 mounts the server operating system ISO image file to a specified directory on the specified server host, modifies the software source download address on the specified server host to the absolute path of the specified directory, creates a root file directory on the specified server host and uses the root file directory as the root file system, and installs the software dependencies required by the server operating system in the root file directory to build the rootfs file system of the server operating system. A13, copy the host machine's environment variable file / etc / skel / .bash* to the root directory; A14 clears all bash history in the root directory / etc, removes the proc, sys, dev, run, and boot directories in the root directory, and then compresses the root directory into a tar archive. A15. Based on the tar file format compressed package created in step A14, build a Docker image for the server kernel compilation environment; A16, repeat steps A11 to A15 until the corresponding server kernel compilation environment Docker image has been built for all target kernel architecture server operating systems; Building corresponding desktop kernel compilation environment Docker images for desktop operating systems with different target kernel architectures includes the following steps: B11 downloads the desktop operating system ISO image file corresponding to the target kernel architecture to a specified desktop host with the same kernel architecture, and sets up a Docker service environment on the specified desktop host; B12 creates a root file directory on the specified desktop host and uses the root file directory as the root file system. It then installs the software dependencies required by the desktop operating system in the root file directory to build the rootfs file system of the desktop operating system. B13 mounts the desktop operating system ISO image file to the temporary mount directory of the specified desktop host, extracts the / casper / filesystem.squashfs file in the desktop operating system ISO image file mounted to the temporary mount directory to the root file directory, enters the root file directory using the chroot command, and uninstalls unnecessary software dependencies of the desktop operating system using the apt tool. Then, it compresses the root file directory into a tar archive. B14. Based on the tar file format compressed package created in step B13, build a Docker image for the desktop kernel compilation environment. B15. Repeat steps B11 to B14 until the corresponding server kernel compilation environment Docker image has been built for all target kernel architecture desktop operating systems.

[0036] Furthermore, in this embodiment, step A15 includes the following steps: A151, Create the first base Docker image from the tar file format compressed package prepared in step A14; A152, Select a host machine with the target kernel architecture, import and start the first base Docker image to generate a temporary container for the server system; A153, use the yum tool to install the dependencies required for rpm kernel format packages within a temporary container on the server system; A154 establishes a distcc distributed compilation topology for the current target kernel architecture: Prepare N distcc server nodes with the target kernel and record the IP address of each distcc server node; install distcc service dependencies matching the target kernel architecture on the distcc server and configure the distcc server to receive distributed compilation requests from compilation nodes with the same kernel architecture; install and configure the required distcc service dependencies within a temporary container on the server system, and update the temporary container on the server system by configuring the IP address of each distcc server node in the Docker environment of the temporary container on the server system, so that the updated temporary container on the server system can act as a distcc client to distribute distributed compilation tasks; This allows compilation nodes receiving kernel compilation tasks, after starting the pre-deployed server kernel compilation environment Docker image, to work with the built-in distcc distributed compilation topology to decompose tasks and process them in parallel on servers with the same architecture, significantly improving the compilation efficiency of large-scale code and adapting to the speed requirements of high-frequency kernel iteration.

[0037] A155 uses the latest temporary container of the server system as a Docker image for the server kernel compilation environment and synchronizes it to the preset Docker repository; To further clarify the distcc distributed compilation topology, corresponding to the previous section, a specific example is provided. There are two target kernel architectures: ARM and X86. There are four compilation nodes: Node1 and Node2 correspond to the ARM architecture, and Node3 and Node4 correspond to the X86 architecture. N distcc server nodes are prepared for both the ARM and X86 architectures. ARM architecture corresponds to distcc server nodes 1 to N, and X86 architecture corresponds to distcc server nodes N+1 to 2N. For the detailed distcc distributed compilation topology, see [link to distcc documentation]. Figure 4 .

[0038] Step B14 includes the following steps: B141, Create a second base Docker image from the tar file format compressed package created in step B14; B142, Select a host machine with the target kernel architecture, import and start the second base Docker image to generate a temporary container for the desktop system; B143, using the apt tool to install the dependencies required for a deb kernel format package within a temporary container on the desktop system; B144 establishes a distcc distributed compilation topology for the current target kernel architecture: Prepare N distcc server nodes identical to the target kernel architecture and record the IP address of each distcc server node; install distcc service dependencies matching the target kernel architecture on the distcc server and configure the distcc server to receive distributed compilation requests from compilation nodes with the same kernel architecture; install and configure the required distcc service dependencies within a desktop system temporary container, and configure the IP address of each distcc server node in the Docker environment of the desktop system temporary container, enabling the desktop system temporary container to act as a distcc client to distribute distributed compilation tasks; This allows compilation nodes receiving kernel compilation tasks, after starting the pre-deployed desktop kernel compilation environment Docker image, to work with the built-in distcc distributed compilation topology to decompose kernel compilation tasks into parallel processing on servers with the same architecture, significantly improving the compilation efficiency of large-scale code and adapting to the speed requirements of high-frequency kernel iteration.

[0039] B145 updates the desktop system's temporary container to a desktop kernel compilation environment Docker image and synchronizes it to the preset Docker repository.

[0040] Furthermore, in this embodiment, in step S1, corresponding kernel upload environment Docker images are built for different target kernel architectures, including the following steps: C1 selects either the server kernel compilation environment Docker image or the desktop kernel compilation environment Docker image corresponding to the target kernel architecture as the target kernel compilation environment Docker image, selects a host machine with the target kernel architecture to obtain and start the target kernel compilation environment Docker image, and generates a temporary kernel upload container; C2 installs the GPG encryption tool dependency package in the temporary kernel upload container to generate a GPG key, and adds the GPG key to the specified kernel software distribution platform; C3 saves the temporary kernel upload container configured with GPG encryption tool dependency packages and GPG keys as a kernel upload environment Docker image, and synchronizes the kernel upload environment Docker image to the preset Docker repository; C4. Repeat steps C1 to C3 until a corresponding kernel upload environment Docker image is built for each different target kernel architecture.

[0041] As an optional implementation, in step S2, a Docker runtime environment is configured for the compilation nodes that support Docker services, and server kernel compilation environment Docker images, desktop kernel compilation environment Docker images, and kernel upload environment Docker images corresponding to their own kernel architecture are pre-deployed on these compilation nodes. These pre-deployed images are the latest versions of the images in the Docker repository at the time of deployment. During the actual execution of the compilation task, before starting the corresponding kernel compilation environment Docker image, each time a compilation node receives a compilation task, if the compilation task type is a server operating system kernel compilation task, the latest server kernel compilation environment Docker image is pulled from the Docker repository to replace the original server kernel compilation environment Docker image deployed locally; if the compilation task type is a desktop operating system kernel compilation task, the latest desktop kernel compilation environment Docker image is pulled from the Docker repository to replace the original desktop kernel compilation environment Docker image deployed locally. This eliminates the need for manual upgrading of the pre-deployed images on each compilation node individually. Instead, a "task-triggered automatic pull" mechanism is used to achieve dynamic environment synchronization, significantly reducing the manual operation costs for maintenance personnel and enabling the compilation environment to quickly respond to the iterative needs of kernel development. It should be noted that if the latest version of the standard kernel compilation environment Docker image from the Docker repository is already deployed locally on the compilation node, there is no need to perform a pull replacement operation; if the compilation node fails to pull the latest version of the standard kernel compilation environment Docker image from the Docker repository, the kernel compilation task will be performed based on the standard kernel compilation environment Docker image deployed locally on the compilation node.

[0042] Furthermore, in this embodiment, the kernel compilation parameters include the kernel source code repository access address (Url), the kernel series name (Tree), the corresponding branch in the kernel source code repository (Branch), the commit ID (Commit), the kernel package type (Kernel), the link to the configuration file required for compilation (Config), the architecture name (Arch) corresponding to the compiled kernel, and the download link for the kernel code customization patch (Patch).

[0043] like Figure 2 As shown, further, in this embodiment, in step S3, the compilation task scheduling server creates a kernel compilation task based on the input kernel compilation parameters, and selects the first compilation node that meets the conditions from all compilation nodes according to the preset compilation node scheduling rules, including the following steps: S31. Determine if there is an idle compilation node that meets the following conditions: the kernel version series name (referring to the series name of the kernel version of the host where the compilation node is located) is consistent with the series name Tree of the compiled kernel, and the kernel architecture name (referring to the kernel architecture of the host where the compilation node is located) is consistent with the architecture name Arch of the compiled kernel (referring to the architecture to be applied by the compiled kernel file). If the result is yes, proceed to step S33; otherwise, proceed to step S32. The idle node that meets the conditions of step S31 is the compilation node that best matches the kernel compilation task. Even if such a node does not support Docker service or Docker service cannot run normally, its own compilation environment is also suitable for performing kernel compilation tasks.

[0044] S32, determine whether there is an idle compilation node that meets the following conditions: the kernel architecture name is consistent with the architecture name Arch corresponding to the compiled kernel, and it supports Docker service. If the result is yes, proceed to step S33; if the result is no, wait for a preset time and then execute steps S31 to S32 again. Although the compilation environment of the node that meets the conditions in S32 is not as good as that of the compilation node that meets the conditions in step S31, it can use Docker service to deploy a compilation environment that matches the kernel compilation task.

[0045] S33 selects the node with the most CPU cores from the available idle compilation nodes that meet the conditions as the first compilation node, which can maximize the utilization of compilation resources and improve the efficiency of compilation task completion.

[0046] Corresponding to the previous paragraph, the kernel compilation task trunk Tree value is 5.4 and the Arch value is arm. If the kernel architecture of the host where an idle compilation node is located is arm, then the kernel architecture name of the idle node is considered to be consistent with the architecture name Arch corresponding to the compiled kernel. If the kernel version series name of the host where an idle compilation node is located is 5.4.18-115, then the kernel version series name of the idle node is considered to be consistent with the series name Tree of the compiled kernel. If the docker_status=1 of the compilation node, it means that its Docker service is enabled, and if docker_status=0, it is not enabled.

[0047] like Figure 3 As shown, further, in this embodiment, after the kernel compilation task is assigned to the first compilation node, the following steps are performed before the kernel compilation operation is executed on the first compilation node: D1: Based on the access address URL of the kernel source code repository, download the kernel source code of the corresponding branch Branch in the kernel source code repository to the first compilation node, and cut out the code corresponding to the version point of the commit ID from the downloaded kernel source code as the code to be compiled. D2. Determine whether the configuration file pointed to by the link Config for the required configuration file is a custom configuration file. If so, download the configuration file pointed to by the link to the first compilation node and replace the configuration file used by the code to be compiled in step D1 with the downloaded configuration file. If not, proceed to step D3. D3. Determine if the download link Patch for the kernel code customization patch is empty. If the result is yes, proceed to step S4; otherwise, download the download link Patch for the kernel code customization patch and download the kernel code customization patch compressed package to the first compilation node. The first compilation node will decompress the downloaded kernel code customization patch compressed package and apply all the decompressed patch files. D4. Determine whether all patch files have been successfully applied. If the result is no, mark the kernel compilation as failed and end. If the result is yes, proceed to step S4.

[0048] like Figure 3As shown, further, in step S4, the first compilation node's startup of the pre-deployed server kernel compilation environment Docker image to perform kernel compilation includes the following steps: starting the pre-deployed server kernel compilation environment Docker image, determining whether the compiled kernel package type (Kernel) is an image; if the determination result is yes, starting the distcc service, and calling the distcc server node for distributed kernel compilation based on the IP address of the distcc server node configured in the server kernel compilation environment Docker image; if the determination result is no, then relying on the Docker container generated by the server kernel compilation environment Docker image to perform kernel compilation; the first compilation node's startup of the pre-deployed desktop kernel compilation environment Docker image to perform kernel compilation includes the following steps: starting the pre-deployed desktop kernel compilation environment Docker image, determining whether the compiled kernel package type (Kernel) is an image; if the determination result is yes, starting the distcc service, and calling the distcc server node for distributed kernel compilation based on the IP address of the distcc server node configured in the desktop kernel compilation environment Docker image; if the determination result is no, then relying on the Docker container generated by the desktop kernel compilation environment Docker image to perform kernel compilation. This can significantly improve the compilation efficiency of large-scale code and adapt to the speed requirements of high-frequency kernel iteration.

[0049] like Figure 1 As shown, as an optional implementation, after uploading the compiled kernel file and compilation logs to the cloud storage service in step S5, the following steps are also included: The compilation task scheduling server obtains the download link for the kernel file uploaded to the cloud storage service, downloads the kernel file according to the download link, and signs the downloaded kernel file using the kernel security module to generate a kernel file with a secure signature. The securely signed kernel file is then sent to a pre-defined signature verification node, which performs signature verification. If the verification passes, the corresponding unsigned kernel file on the cloud storage service is replaced with the securely signed kernel file; otherwise, the process ends. The standardized signing of the compiled kernel file by the kernel security module and the verification operation by the signature verification node effectively identify potential tampering of the kernel file during transmission or storage, technically preventing malicious tampering risks and ensuring the integrity of the kernel file from compilation completion to release.

[0050] like Figure 3 As shown, further, in this embodiment, step S6 includes the following steps: S61, the compilation task scheduling server determines whether the compiled kernel file needs to be automatically released. If the result is yes, proceed to step S62; if the result is no, end. S62, determine whether there is an idle compilation node that meets the following conditions: the kernel architecture name is consistent with the architecture name Arch corresponding to the compiled kernel, and it supports Docker service. If the result is yes, select the node with the most CPU cores from the nodes that meet the conditions as the second compilation node; if the result is no, wait for a preset time and then execute step S62 again until the second compilation node is selected. S63, the second compilation node starts the pre-deployed kernel upload environment Docker image to create a kernel upload environment container; S64, the kernel upload environment container downloads the kernel file that needs to be automatically released from the cloud storage service; S65, the kernel upload environment container standardizes the changelog file content of the kernel file according to the kernel version series name specified by the user; S66 uses the GPG tool to perform GPG signing on the kernel file downloaded to the kernel upload environment container. After completing the GPG signing, the kernel file downloaded to the kernel upload environment container is uploaded to the specified kernel software distribution platform corresponding to the pre-deployed kernel upload environment Docker image for distribution. S67 outputs all kernel upload processing logs and uploads them to the cloud storage service.

[0051] As an optional implementation, in step S63, it is determined whether the kernel upload environment Docker image currently deployed locally on the second compilation node is the latest kernel upload environment Docker image in the Docker repository. If the determination result is yes, the kernel upload environment Docker image currently deployed locally is started to create a kernel upload environment container; if the determination result is no, the latest kernel upload environment Docker image is pulled from the Docker repository to replace the locally deployed kernel upload environment Docker image, and the locally updated kernel upload environment Docker image is started to create a kernel upload environment container.

[0052] like Figure 3As shown, as an optional implementation, if automatic distribution of the compiled kernel file is required, the kernel upload parameter PPAmsg={Signurl,Dputurl,Seriesname} is input to the compilation task scheduling server. Here, Signurlb represents the download link address of the kernel file to be automatically distributed on the cloud storage service, Dputurl represents the target kernel version management repository address of the specified kernel software distribution platform, and Seriesname represents the kernel series name required for uploading to the specified kernel software distribution platform. After the second compilation node is selected in step S62, the kernel upload parameter PPAmsg is sent to the second compilation node. In step S64, the kernel upload environment container downloads the kernel file to be automatically distributed according to Signurlb. In step S65, the kernel upload environment container standardizes the changelog file content of the kernel file according to Seriesname. In step S66, the kernel file downloaded to the kernel upload environment container is uploaded to the target kernel version management repository corresponding to Dputurl in the specified kernel software distribution platform corresponding to the pre-deployed kernel upload environment Docker image.

[0053] In addition, this embodiment also provides a Docker-based Linux kernel compilation system, including interconnected microprocessors and memory, wherein the microprocessors are programmed or configured to execute Docker-based Linux kernel compilation methods.

[0054] Those skilled in the art will understand that the technical solutions provided by the embodiments of this application may be in the form of a method, system, or computer program product. Therefore, this application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application may take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create an implementation for the process. Figure 1 One or more processes and / or boxes Figure 1The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0055] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

Claims

1. A Linux kernel compilation method based on Docker, characterized in that, Includes the following steps: S1. For server operating systems with different target kernel architectures, build corresponding server kernel compilation environment Docker images; for desktop operating systems with different target kernel architectures, build corresponding desktop kernel compilation environment Docker images; for different target kernel architectures, build corresponding kernel upload environment Docker images. The kernel upload environment Docker images are used to perform GPG signing operations on kernel files and upload kernel files to the specified kernel software distribution platform. S2 deploys compilation nodes consistent with each target kernel architecture, configures Docker runtime environment for compilation nodes that support Docker services, and pre-deploys server kernel compilation environment Docker image, desktop kernel compilation environment Docker image and kernel upload environment Docker image corresponding to its own kernel architecture on these compilation nodes; S3, the compilation task scheduling server creates a kernel compilation task based on the input kernel compilation parameters, selects a node that meets the conditions from all compilation nodes according to the preset compilation node scheduling rules as the first compilation node, and sends the kernel compilation task carrying the kernel compilation parameters to the first compilation node. S4. Determine whether the first compilation node supports Docker service and whether the Docker service can run normally. If the determination result is yes and the compilation task type is a server operating system kernel compilation task, the first compilation node starts the pre-deployed server kernel compilation environment Docker image to perform kernel compilation operations and records compilation logs. If the determination result is yes and the compilation task type is a desktop operating system kernel compilation task, the first compilation node starts the pre-deployed desktop kernel compilation environment Docker image to perform kernel compilation operations and records compilation logs. If the determination result is no, the first compilation node uses its native compilation environment to perform kernel compilation operations and records compilation logs. S5. Determine whether the kernel has been successfully compiled. If the result is yes, upload the compiled kernel file and the compilation log to the cloud storage service and proceed to step S6. If the result is negative, the compilation log will be uploaded to the cloud storage service and the process will end. S6. Determine whether automatic distribution of the compiled kernel file is required. If so, select a node that meets the conditions from all compilation nodes as the second compilation node according to the preset distribution node filtering rules. The second compilation node starts the pre-deployed kernel upload environment Docker image, downloads the kernel file from the cloud storage service, performs encryption and signing operations on the kernel file, and uploads the kernel file with completed encryption and signing operations to the designated kernel software distribution platform. If not, the process ends.

2. The Linux kernel compilation method based on Docker according to claim 1, characterized in that, In step S1, building corresponding server kernel compilation environment Docker images for server operating systems with different target kernel architectures includes the following steps: A11, Download the server operating system ISO image file corresponding to the target kernel architecture to a designated server host with the same kernel architecture, and build a Docker service environment on the designated server host; A12, mount the server operating system ISO image file to the specified directory of the specified server host, modify the software source download address of the specified server host to the absolute path of the specified directory, create a root file directory on the specified server host and use the root file directory as the root file system, and install the software dependencies required by the server operating system in the root file directory to build the rootfs file system of the server operating system. A13, copy the host machine's environment variable file / etc / skel / .bash* to the root directory; A14 clears all bash history in the root directory / etc, removes the proc, sys, dev, run, and boot directories in the root directory, and then compresses the root directory into a tar archive. A15. Based on the tar file format compressed package created in step A14, build a Docker image for the server kernel compilation environment; A16, repeat steps A11 to A15 until the corresponding server kernel compilation environment Docker image has been built for all target kernel architecture server operating systems; Building corresponding desktop kernel compilation environment Docker images for desktop operating systems with different target kernel architectures includes the following steps: B11: Download the desktop operating system ISO image file corresponding to the target kernel architecture to a designated desktop host with the same kernel architecture, and build a Docker service environment on the designated desktop host; B12, create a root file directory on the specified desktop host and use the root file directory as the root file system, install the software dependencies required by the desktop operating system in the root file directory to build the rootfs file system of the desktop operating system; B13, Mount the desktop operating system ISO image file to the temporary mount directory of the specified desktop host, decompress the / casper / filesystem.squashfs file in the desktop operating system ISO image file mounted to the temporary mount directory to the root file directory, enter the root file directory through the chroot command, and uninstall unnecessary software dependencies of the desktop operating system through the apt tool, and then compress the root file directory into a tar file format archive; B14. Based on the tar file format compressed package created in step B13, build a Docker image for the desktop kernel compilation environment. B15. Repeat steps B11 to B14 until the corresponding server kernel compilation environment Docker image has been built for all target kernel architecture desktop operating systems.

3. The Linux kernel compilation method based on Docker according to claim 2, characterized in that, Step A15 includes the following steps: A151, Create the first base Docker image from the tar file format compressed package prepared in step A14; A152, Select a host machine with the target kernel architecture, import and start the first base Docker image to generate a temporary container for the server system; A153, Use the yum tool to install the dependencies required for the rpm kernel format package in the temporary container of the server system; A154, build a distcc distributed compilation topology for the current target kernel architecture: Prepare N distcc server nodes with the target kernel and record the IP of each distcc server node; install distcc service dependencies matching the target kernel architecture on the distcc server and configure the distcc server to receive distributed compilation requests from compilation nodes with the same kernel architecture; install and configure the required dependency packages for the distcc service in the temporary container of the server system, configure the IP of each distcc server node to update the temporary container of the server system in the Docker environment, so that the updated temporary container of the server system can act as a distcc client to distribute distributed compilation tasks. A155, the latest temporary container of the server system is used as the Docker image of the server kernel compilation environment and synchronized to the preset Docker repository; Step B14 includes the following steps: B141, Create a second base Docker image from the tar file format compressed package created in step B14; B142, Select a host machine with the target kernel architecture, import and start the second base Docker image to generate a temporary container for the desktop system; B143, Use the apt tool to install the dependencies required for the deb kernel format package within the temporary container of the desktop system; B144, build a distcc distributed compilation topology for the current target kernel architecture: Prepare N distcc server nodes consistent with the target kernel architecture, and record the IP of each distcc server node; install distcc service dependencies matching the target kernel architecture on the distcc server, and configure the distcc server to receive distributed compilation requests from compilation nodes with the same kernel architecture; install and configure the required distcc service dependency packages in the desktop system temporary container, and configure the IP of each distcc server node in the Docker environment of the desktop system temporary container, so that the desktop system temporary container can act as a distcc client to distribute distributed compilation tasks; B145, update the desktop system temporary container to a desktop kernel compilation environment Docker image, and synchronize it to the preset Docker repository.

4. The Linux kernel compilation method based on Docker according to claim 1, characterized in that, In step S1, corresponding kernel upload environment Docker images are built for different target kernel architectures, including the following steps: C1, select either the server kernel compilation environment Docker image or the desktop kernel compilation environment Docker image corresponding to the target kernel architecture as the target kernel compilation environment Docker image, select a host machine with the target kernel architecture to obtain and start the target kernel compilation environment Docker image, and generate a temporary kernel upload container; C2, install the GPG encryption tool dependency package in the temporary kernel upload container to generate a GPG key, and add the GPG key to the specified kernel software distribution platform; C3 saves the temporary kernel upload container configured with GPG encryption tool dependency packages and GPG keys as a kernel upload environment Docker image, and synchronizes the kernel upload environment Docker image to the preset Docker repository; C4. Repeat steps C1 to C3 until a corresponding kernel upload environment Docker image is built for each different target kernel architecture.

5. The Linux kernel compilation method based on Docker according to claim 3, characterized in that, The kernel compilation parameters include the kernel source code repository access address (Url), the kernel family name (Tree), the corresponding branch in the kernel source code repository (Branch), the commit ID (Commit), the kernel package type (Kernel), the configuration file link (Config), the architecture name (Arch) corresponding to the compiled kernel, and the download link (Patch) for kernel code customization patches.

6. The Linux kernel compilation method based on Docker according to claim 5, characterized in that, In step S3, the compilation task scheduling server creates a kernel compilation task based on the input kernel compilation parameters, and selects the first compilation node that meets the conditions from all compilation nodes according to the preset compilation node scheduling rules, including the following steps: S31, determine whether there is an idle compilation node that meets the following conditions: the kernel version series name is consistent with the series name Tree of the compiled kernel, and the kernel architecture name is consistent with the architecture name Arch of the compiled kernel. If the determination result is yes, proceed to step S33; otherwise, proceed to step S32. S32, determine whether there is an idle compilation node that meets the following conditions: the kernel architecture name is consistent with the architecture name Arch corresponding to the compiled kernel and supports Docker service. If the determination result is yes, proceed to step S33; if the determination result is no, wait for a preset time and then execute steps S31 to S32 again. S33 selects the idle compilation node with the most CPU cores from the available compilation nodes that meet the conditions as the first compilation node.

7. The Linux kernel compilation method based on Docker according to claim 5, characterized in that, After the kernel compilation task is assigned to the first compilation node, the following steps are performed before the kernel compilation operation is executed on the first compilation node: D1, based on the access address URL of the kernel source code repository, downloads the kernel source code of the corresponding branch Branch in the kernel source code repository to the first compilation node, and extracts the code corresponding to the version point of the commit ID from the downloaded kernel source code as the code to be compiled. D2. Determine whether the configuration file pointed to by the link Config for the required configuration file is a custom configuration file. If so, download the configuration file pointed to by the link to the first compilation node and replace the configuration file used by the code to be compiled in step D1 with the downloaded configuration file. If not, proceed to step D3. D3. Determine if the download link Patch for the kernel code customization patch is empty. If the result is yes, proceed to step S4; otherwise, download the download link Patch for the kernel code customization patch and download the kernel code customization patch compressed package to the first compilation node. The first compilation node will decompress the downloaded kernel code customization patch compressed package and apply all the decompressed patch files. D4. Determine whether all patch files have been successfully applied. If the result is no, mark the kernel compilation as failed and end. If the result is yes, proceed to step S4.

8. The Linux kernel compilation method based on Docker according to claim 5, characterized in that, In step S4, the first compilation node starts the pre-deployed server kernel compilation environment Docker image to perform kernel compilation operations, including the following steps: start the pre-deployed server kernel compilation environment Docker image, determine whether the kernel package type to be compiled is "image", if the result is yes, start the distcc service, and call the distcc server node to perform distributed kernel compilation according to the IP of the distcc server node configured in the server kernel compilation environment Docker image; if the result is no, rely on the Docker container generated by the server kernel compilation environment Docker image to perform kernel compilation. The first compilation node starts the pre-deployed desktop kernel compilation environment Docker image to perform kernel compilation operations, including the following steps: Start the pre-deployed desktop kernel compilation environment Docker image, determine whether the kernel package type to be compiled is "image", if the result is yes, start the distcc service, and call the distcc server node to perform distributed kernel compilation according to the IP of the distcc server node configured in the desktop kernel compilation environment Docker image; if the result is no, rely on the Docker container generated by the desktop kernel compilation environment Docker image to perform kernel compilation.

9. The Linux kernel compilation method based on Docker according to claim 5, characterized in that, Step S6 includes the following steps: S61, the compilation task scheduling server determines whether the compiled kernel file needs to be automatically released. If the result is yes, proceed to step S62; if the result is no, end. S62, determine whether there is an idle compilation node that meets the following conditions: the kernel architecture name is consistent with the architecture name Arch corresponding to the compiled kernel and supports Docker service. If the determination result is yes, select the node with the most CPU cores from the nodes that meet the conditions as the second compilation node; if the determination result is no, wait for a preset time and then execute step S62 again until the second compilation node is selected. S63, the second compilation node starts the pre-deployed kernel upload environment Docker image to create a kernel upload environment container; S64, the kernel upload environment container downloads the kernel file that needs to be automatically released from the cloud storage service; S65, the kernel upload environment container standardizes the changelog file content of the kernel file according to the kernel version series name specified by the user; S66, Use the GPG tool to perform a GPG signing operation on the kernel file downloaded to the kernel upload environment container. After completing the GPG signing operation, upload the kernel file downloaded to the kernel upload environment container to the designated kernel software distribution platform corresponding to the pre-deployed kernel upload environment Docker image for distribution. S67, output all kernel upload processing logs and upload the kernel upload processing logs to the cloud storage service.

10. A Docker-based Linux kernel compilation system, comprising interconnected microprocessors and memory, characterized in that, The microprocessor is programmed or configured to execute the Docker-based Linux kernel compilation method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Software compiling method and device

    CN106325966A

  • Method for realizing cross compiling of Docker mirror image

    CN111309451A

  • Processing method and device of compiling environment, electronic equipment and storage medium

    CN118113298A

  • Big data framework compiling method and device, equipment and storage medium

    CN119248275A

  • Compiling verification system generation method, driving program compiling verification method, system, device, equipment, medium and program product

    CN119415441A