A method for realizing AGV cross-compilation based on docker

By encapsulating the ARM cross-compilation environment using Docker container technology, the problems of poor environment consistency, weak isolation, and low CI/CD integration in traditional AGV cross-compilation methods are solved. This enables the automation and one-click deployment of the AGV cross-compilation environment, improving development efficiency and team collaboration efficiency.

CN121187594BActive Publication Date: 2026-02-06UQI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511726199.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-02-06
Estimated Expiration
2045-11-24

AI Technical Summary

Technical Problem

Traditional AGV cross-compilation methods suffer from problems such as complex environment configuration, poor consistency, weak isolation, low portability, and low CI/CD integration, resulting in low development efficiency and difficulties in team collaboration.

Method used

It uses Docker container technology to encapsulate the ARM cross-compilation environment, and combines ARM root file system mounting and command integration to achieve one-click deployment, reuse and automation of the environment. By creating ARM root file system images, configuring cross-compilation toolchains and integrating Docker commands, it supports the automated compilation and deployment of AGV projects.

Benefits of technology

It improves the consistency, isolation, portability, and CI/CD integration of the AGV cross-compilation environment, shortens the environment deployment time, improves development efficiency and team collaboration efficiency, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121187594B_ABST
    Figure CN121187594B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of embedded system software development and continuous integration, and particularly relates to a method for realizing AGV cross-compilation based on docker, which comprises the following steps: first, an ARM root file system is constructed by using a virtualization tool on an x86 development host, and after configuration of a header file and a dependent library, the ARM root file system is compressed to obtain an ARM root file system image; second, a basic image is pulled from a public warehouse to create an x86 Docker container, the ARM image is copied to a specific path of the container and is mounted to obtain a Docker image special for AGV cross-compilation; third, a CMake cross-toolchain file is written in the container, the ARM mounting path is introduced, the dependent path is set, and the toolchain is specified; fourth, commands are integrated, the container is automatically updated through image ID comparison, and operation commands such as Makefile encapsulation and compilation are constructed; and finally, the integrated commands are called to start cross-compilation, and a program that can run on an ARM board of AGV is generated. The present method can realize unified and efficient reuse of AGV cross-compilation environment, improve development efficiency, reduce maintenance cost, and is suitable for AGV projects that need cross-compilation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of embedded system software development and continuous integration, and particularly relates to a method for realizing AGV cross-compilation based on docker. BACKGROUND

[0002] As the core equipment of modern intelligent logistics and intelligent manufacturing, the core control system of an automatic guided vehicle (AGV) is usually developed based on an ARM architecture embedded board (such as Raspberry Pi, NVIDIA Jetson series, RK3399, etc.) with low power consumption and small size. Due to the limited computing performance of the ARM board, it cannot directly undertake complex software compilation tasks, so the software development of these boards generally adopts cross-compilation method, that is, on a powerful x86 / 64 architecture development host (host machine), an executable program that can run on an ARM architecture target board is compiled by using a cross-compilation tool chain.

[0003] However, the traditional AGV cross-compilation method has the following key problems, which seriously restrict the AGV development efficiency and team collaboration:

[0004] 1. Environment configuration is complex and inconsistent: the installation and configuration steps of the cross-compilation tool chain (such as arm-linux-gnueabihf) and dependent libraries (such as OpenCV, Eigen, ROS, etc.) are tedious, and are seriously dependent on specific versions of the host operating system (such as Ubuntu 18.04, Ubuntu 20.04). The subtle differences in the environment between different developers and different build servers (such as dependent library versions, environment variable paths, compiler configurations) can easily cause compilation failure problems such as “it works on my machine”, which seriously hinders team collaboration and continuous integration (CI) process.

[0005] 2. Poor environment isolation: multiple AGV projects (such as AGV navigation project, AGV cargo grabbing project) may depend on different versions of tool chains or libraries (such as project A depends on ROS Melodic and project B depends on ROS Noetic), when deployed on the same x86 host machine, different versions of dependent libraries will conflict with each other, causing environment chaos, which is difficult to manage and maintain.

[0006] 3. Difficulty in portability and reproducibility: when the development machine needs to be replaced, a new build server needs to be built, or the historical version code needs to be compiled and debugged, it takes several hours to several days to reconfigure a cross-compilation environment exactly the same as the original environment, and it cannot be guaranteed to be 100% reproducible, which is extremely easy to cause compilation failure of historical code due to environment differences.

[0007] 4. Low CI / CD process integration: The traditional cross-compilation environment lacks standardized packaging and cannot quickly access the AGV development continuous integration / continuous deployment (CI / CD) process (such as the Jenkins-based automation process). Manual execution of steps such as "pull code -> configure environment -> compile -> test -> deploy" is required, which is low in automation and low in construction efficiency.

[0008] Docker container technology has the advantages of environment isolation, lightweight, portability, versioning, etc., and has been widely used in general software development fields. However, in the field of AGV embedded development, how to deeply combine Docker technology with the characteristics of ARM cross-compilation (such as ARM root file system mounting, tool chain adaptation, and AGV special dependent library integration) to design a complete and out-of-box system cross-compilation solution is still a technical problem to be solved in the field. SUMMARY

[0009] The present application aims to overcome the shortcomings of the prior art and provides a method for implementing AGV cross-compilation based on docker. By encapsulating the ARM cross-compilation environment in a Docker container and combining ARM root file system mounting and command integration, the method solves the technical problems of poor environment consistency, weak isolation, low portability, and difficult CI / CD integration in traditional AGV cross-compilation, and realizes one-key deployment, reuse, and automation of the AGV cross-compilation environment.

[0010] The above-mentioned object is achieved by the following technical solutions:

[0011] A method for implementing AGV cross-compilation based on docker, comprising:

[0012] S1: Making an ARM root file system image, building a root file system of ARM architecture on a development host (host) of x86 architecture through a virtualization tool, configuring header files and dependent libraries required for cross-compilation, and packaging and compressing the root file system to obtain an ARM root file system image;

[0013] S2: Making an AGV cross-compilation special Docker image, pulling a basic operating system image from a public image repository, creating a Docker container of x86 architecture, copying the ARM root file system image obtained in S1 to a specific path of the Docker container and mounting it, so that the Docker container has an ARM system structure, and obtaining an AGV cross-compilation special Docker image, which is a fusion image of embedding an ARM root file system in a docker container of x86;

[0014] S3: configuring a cross-compiler tool chain, writing a CMake cross-compiler tool chain file in the Docker container obtained in S2, introducing the mounting path of the ARM root file system, setting the dependent library file path of the AGV project, and specifying the ARM architecture cross-compiler tool chain;

[0015] S4: integrating Docker commands and compilation commands, on the one hand, automatically judging whether to update the local Docker container according to the ID comparison result of the remote image repository and the local Docker image; on the other hand, building a Makefile file to encapsulate the compilation, testing, installation, publishing and dynamic library synchronization commands of the AGV project;

[0016] S5: executing AGV project cross-compilation, calling the commands integrated in S4, starting the cross-compilation process in the Docker container to generate an executable program that can run on the AGV ARM architecture computing board.

[0017] Preferably, the root file system of the ARM architecture constructed by the virtualization tool in S1 specifically includes: installing qemu-aarch64-static virtualization tool on x86 host, constructing root file system of arm64 architecture through debootstrap command, and packaging the initial root file system through dd tool to obtain initial ARM root file system image.

[0018] Preferably, the configuration of the header file and the dependent library required for cross-compilation in S1 specifically includes: entering the initial ARM root file system through chroot command, configuring the header file, dependent library and configuration file required for AGV cross-compilation; wherein the dependent library includes dependent library (OpenCV, Eigen, ROS) installed from apt source and dynamic library or static file compiled by self; during the configuration process, the network of x86 host is bound to ARM root file system through mount bind command, so that ARM root file system can download apt source dependent package online.

[0019] Preferably, the packaging and compression of the root file system in S1 specifically includes: setting the storage size of ARM root file system image (IMG file) in advance, packaging the configured ARM root file system into IMG file, and then performing minimal compression on the IMG file through mksquashfs tool to reduce the image storage volume.

[0020] Preferably, the pulling of the basic operating system image from the public image repository in S2 specifically includes: pulling the Ubuntu version image adapted to AGV development from DockerHub public image repository;

[0021] The copying of the ARM root file system image to the specific path of the Docker container and the mounting in S2 specifically include: copying the compressed ARM root file system IMG file in S1 to the " / opt / arm-rootfs / " path of the Docker container, and mounting the IMG file to the " / arm-rootfs / " directory of the Docker container through the mount command, so that the Docker container can directly access the header files and dependent libraries of the ARM root file system.

[0022] Preferably, S2 further includes: pushing the AGV cross-compilation special Docker image to a domestic remote image warehouse (Aliyun image warehouse), the remote image warehouse is used for storing, recording and publishing the Docker image, and supports multiple developers and multiple build servers to pull the image from the remote image warehouse, so as to realize environment consistency sharing.

[0023] Preferably, the specified ARM architecture cross-compilation tool chain in S3 specifically includes: specifying the aarch64-linux-gnu cross tool chain as the compilation tool of the AGV project;

[0024] The CMake cross tool chain file in S3 specifically includes: setting "CMAKE_SYSTEM_NAME" as Linux and "CMAKE_SYSTEM_PROCESSOR" as arm64 in the CMake file, pointing "CMAKE_FIND_ROOT_PATH" and "CMAKE_SYSROOT" to the mounting path " / arm-rootfs / " of the ARM root file system in the Docker container, ensuring that CMake can find dependent libraries and header files from the ARM root file system, and additionally specifying the third-party library and header file of the source code compilation, ensuring the compilation of the entire project.

[0025] Preferably, S4 automatically judges whether to update the local Docker container according to the ID comparison result of the remote image warehouse and the local Docker image, specifically including: pushing the AGV cross-compilation special Docker image obtained in S2 to the remote image warehouse (Aliyun image warehouse) and recording the image ID; when the local Docker environment starts, automatically comparing the image ID of the remote image warehouse with the local image ID, if the two are inconsistent, automatically pulling the latest image from the remote and updating the local Docker container; and before pushing the image, the Docker image is flattened through the docker-squash command, ensuring that only one version of the AGV cross-compilation special Docker image is retained in the remote image warehouse, so that any project referring to this image will be automatically updated when executing the compilation.

[0026] Preferably, the Makefile file is constructed in S4, encapsulating the compilation, testing, installation, release and dynamic library synchronization commands of the AGV project, specifically including: integrating cross-compilation commands, CMake parameter configuration commands, multi-core compilation commands (make-jN, N is the number of x86 host CPU cores), gtest testing commands, installation package release commands (make pub), running script invocation commands (make run), dynamic library synchronization commands (make rsync) and environment cleaning commands (make clean) in the Makefile, and the user realizes one-key operation of the AGV project through "make+instruction" (make install, make test, make pub), wherein make install automatically identifies the number of cores of the CPU of the host through nproc, so as to ensure that the compilation performance of the host is maximized; make test automatically compiles the test project, executes test output on multiple nodes, and make pub is equipped with an installation package preparation module, which performs file archiving processing on running binaries, dependent libraries and configuration files, and then performs alignment compression, a complete set of process processing. In addition, make run supports parameter transmission, and can directly specify a start node and a debugging mode to simplify running configuration; make rsync ensures real-time synchronization of dynamic libraries between the development machine and the target device, single package verification and debugging; make clean completely removes compilation products and temporary files, and keeps the project clean. The complete instruction architecture is clear and has clear responsibilities, which significantly improves the development, testing and deployment efficiency, and forms a standardized AGV project management process.

[0027] Preferably, the ARM architecture computing board of the AGV includes a Raspberry Pi, an NVIDIA Jetson series board card and an RK3399 board card.

[0028] Preferably, the executable program generated in S5 is adapted to all AGV projects (C++ projects, ROS node projects) that need cross-compilation; and the method can be integrated into a continuous integration / continuous deployment (CI / CD) process of AGV development, realizing full automation of code submission-automatic pulling of a Docker image-cross-compilation-testing-deployment.

[0029] The method for implementing AGV cross-compilation based on docker provided by the application solves the problems of poor consistency, weak isolation and difficult transplantation of a traditional AGV cross-compilation environment, realizes one-key deployment and automatic update of the environment, shortens the environment deployment time, improves team collaboration and compilation efficiency, reduces maintenance costs, is suitable for multiple AGV projects and ARM board cards, and optimizes resource utilization. Specific beneficial effects are as follows:

[0030] 1. Significantly improved environment consistency and collaboration efficiency: Pre-packaged Docker images eliminate host machine version dependencies and environment differences. All developers and build servers use a completely consistent compilation environment, which completely solves the problem of "it can be compiled on my machine but not on other people's machines", and effectively improves team collaboration efficiency.

[0031] 2. Enhanced environment isolation and reduced maintenance costs: The isolation features of Docker containers allow different versions of toolchains / dependencies of multiple AGV projects to run independently. The same x86 host machine can support the compilation of 3-5 AGV projects in parallel, reducing environment maintenance costs and shortening troubleshooting time to minutes.

[0032] 3. Significantly improved cross-compilation efficiency: From the initial 1-2 hours required to compile a project on an ARM board, the compilation, release, installation, and deployment of the entire installation package now only takes 3-5 minutes, greatly improving development efficiency.

[0033] 4. Breakthrough in portability and reproducibility: The AGV cross-compilation environment is stored in the form of a Docker image. When changing the development machine or setting up a new server, the environment deployment can be completed simply by "pulling the project code and executing the make command", which significantly reduces the time consumption. Historical version images can be traced through remote repositories to ensure 100% reproducibility of historical code compilation.

[0034] 5. Improved CI / CD integration and automation efficiency: Automatic update scripts and one-click Makefile commands support full automation of the CI / CD process. The entire process of "code submission → automatic image pull → cross-compilation → testing → deployment" requires no manual intervention, significantly improving the efficiency of AGV project construction and significantly shortening the development iteration cycle.

[0035] 6. High versatility and optimized resource utilization: The method is compatible with all ARM architecture AGV boards (Raspberry Pi, NVIDIA Jetson, RK3399) and all AGV projects that require cross-compilation (C++, ROS); mksquashfs compression reduces the size of ARM images, and the lightweight nature of Docker containers improves the resource utilization of x86 host machines, avoiding resource redundancy in traditional virtual machines. Attached Figure Description

[0036] Figure 1 This is a flowchart of a method for cross-compiling AGVs based on Docker, as described in this invention. Detailed Implementation

[0037] The application will be further described in detail below according to the drawings and embodiments. The described embodiments are only part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the application.

[0038] The scheme provides a method for realizing AGV cross-compilation based on docker. The cross-compilation of ARM board is realized based on docker. Makefile is used to unify the compilation command. The image is automatically updated. The compilation environment is more convenient to maintain and deploy. The compilation efficiency and development efficiency are greatly improved. It is suitable for all projects that need cross-compilation; including four cores:

[0039] 1. Remote Docker image repository: standardized environment storage and distribution

[0040] A remote repository (preferably a domestic image repository such as Aliyun) for storing AGV cross-compilation special Docker images is established. The image encapsulates the cross-compilation tool chain (aarch64-linux-gnu) for a specific AGV ARM board card (Raspberry Pi, NVIDIA Jetson, RK3399), necessary header files (ARM system header files, AGV driver header files), basic dependent libraries (OpenCV, Eigen, ROS), and environment variable configurations. The remote repository supports image version recording, publishing and pulling, ensuring that multiple developers and multiple build servers use completely consistent compilation environments, and solving the environment consistency problem from the source.

[0041] As shown in Figure 1 The output (AGV cross-compilation special Docker image) of the “Docker image making” module will be pushed to the remote repository. The “command integration” module will realize automatic image updating by comparing the local and remote image IDs, supporting environment sharing.

[0042] 2. Embedded ARM root file system: simulate ARM running environment to ensure compilation compatibility

[0043] An ARM root file system is embedded in the x86 architecture Docker container. The following steps are taken to achieve this:

[0044] First, build the arm64 architecture root file system through the qemu-aarch64-static virtualization tool, then initialize the file system basic environment through the debootstrap command, and package the initial image through the dd tool;

[0045] The header files and dependent libraries required for AGV configuration in the chroot environment are bound to the x86 host network through mount bind, ensuring that the ARM environment can be connected to download apt dependencies.

[0046] The ARM root file system image is compressed using the mksquashfs tool, reducing the storage volume, and then mounted in the Docker container.

[0047] As shown in Figure 1 , the "ARM image making" module is based on an x86 computer, and goes through the process of "basic image making → introducing dependent libraries and header files → packaging and compressing image files", outputting an ARM root file system image to provide ARM environment support for subsequent Docker images. The source of the ARM image file is the arm64 file system built on the x86 host, ensuring consistency with the system structure of the AGV target board.

[0048] 3. Docker customization command: automatic image management, realizing no-sense update

[0049] Integrate basic operation commands such as Docker image pulling, publishing, container creation, updating, and deletion, and design automatic update logic: when the local Docker environment starts, automatically pull the AGV cross-compilation dedicated Docker image ID from the remote repository and compare it with the local image ID. If they are not the same, automatically pull the latest image from the remote repository and update the local container, without the need for manual operation, realizing no-sense update.

[0050] At the same time, through the docker-squash command, the Docker image is flattened to ensure that only one version of the image is retained in the remote repository, avoiding update confusion caused by image redundancy, as shown in Figure 1 , the integration logic of "Docker image command" in the "command integration" module supports image automatic management.

[0051] 4. Compilation customization command: one-key compilation operation, improving development efficiency

[0052] Based on Makefile, integrate the full-process commands of AGV project, including:

[0053] Cross-compilation command: call aarch64-linux-gnu toolchain to compile code;

[0054] CMake parameter configuration: specify ARM root file system mounting path, dependent library path;

[0055] Auxiliary commands: multi-core compilation (make-jN), gtest test (make test), package release (make pub), script invocation (make run), dynamic library synchronization (make rsync), etc.

[0056] Users only need to input "make + instruction" to complete the corresponding operation, without the need to remember long commands, such as Figure 1 As shown, the "cross-compiled tool chain" obtains dependent libraries from the ARM path mounted in the Docker image, and through the process of "project CMake construction → checking configuration file writing → dependent library path import → configuration compilation options → execution of compilation", outputs AGV executable files, and the "compilation operation and maintenance command" in the "command integration" module provides one-key support for the process.

[0057] As a specific embodiment of the present scheme, taking a c++ project as an example, the method for implementing AGV cross-compilation based on docker in the embodiment includes the following specific steps:

[0058] S1: Basic image making

[0059] On the x86 architecture development host, the construction work of the ARM basic image is carried out, which is the basic environment support for all subsequent operations:

[0060] Firstly, a series of tools need to be installed on the development host, wherein qemu-aarch64-static is a key tool for realizing the virtualization of ARM architecture in the x86 environment, debootstrap is used to construct a specific version of ARM file system, and dd tool is used to initially package the file system.

[0061] Then, a special temporary directory is created to store the files in the construction process. By specifying the architecture as arm64 and selecting the Ubuntu version (such as Ubuntu 20.04) suitable for the AGV target board through the debootstrap command, the initial ARM file system is constructed.

[0062] After that, the qemu-aarch64-static tool is copied to the specified directory of the ARM file system just constructed, to ensure that the x86 environment can simulate the running environment of ARM.

[0063] Finally, an empty image file of a specified size is created using the dd tool, which is formatted through the mkfs.ext4 command, and then the content of the constructed ARM file system is copied into the image file, to complete the making of the basic image.

[0064] S2: Fill the file system

[0065] Environment configuration is performed on the base image to have all dependencies required for AGV engineering compilation:

[0066] First, the device directory, process directory, system directory, and network configuration file directory of the x86 development host are bound to the corresponding directories of the ARM file system using the mount bind command. This allows the ARM file system to access the devices, process information, and networking functions of the x86 host, facilitating the installation of subsequent dependent libraries.

[0067] Then, use the chroot command to enter the ARM file system environment. After entering, configure the domestic apt software source (such as Aliyun source) to speed up the download speed of dependent packages.

[0068] Next, install various dependent libraries required by AGV engineering, including basic libraries such as OpenCV, Eigen, and ROS installed directly from the apt source, and custom dynamic libraries or static files such as AGV motor drive, radar, and camera compiled by yourself.

[0069] After configuration, exit the chroot environment and use the umount command to unload the previously bound directories one by one to complete the filling of the file system.

[0070] S3: Package image file

[0071] Optimize the configured ARM file system image to facilitate subsequent embedding into the Docker container:

[0072] First, mount the ARM image file to the temporary directory of the x86 development host again, check whether the dependent libraries (such as OpenCV library files) exist, and ensure the integrity of the file system.

[0073] Then, set the storage size of the ARM image file (IMG format) according to actual requirements to ensure that it can accommodate all dependencies. Use the mksquashfs tool to perform minimal compression on the IMG file. This compression method can significantly reduce the storage space of the image while ensuring the integrity of the file, facilitating subsequent embedding into the Docker image.

[0074] S4: Docker image production

[0075] Integrate the ARM image into the Docker container to form a Docker image dedicated to AGV cross-compilation:

[0076] First, pull the Ubuntu base image (such as Ubuntu20.04) compatible with the development host system version from the Docker Hub public image repository, and create a local Docker container based on the base image.

[0077] Then, copy the previously packaged ARM compressed image file from the x86 development host to a specific path (such as / opt / arm-rootfs / ) inside the Docker container.

[0078] Inside the Docker container, create a dedicated directory as the mounting point for the ARM file system, and use the mount command to mount the ARM compressed image under this directory, so that the Docker container with x86 architecture embeds an ARM architecture file system, which has the system structure of ARM.

[0079] Finally, commit the configured Docker container as a local image, add a tag for the remote repository, and push it to the remote image repository such as Alibaba Cloud. Before pushing, use the docker-squash command to flatten the image, ensuring that only one version of the image is retained in the remote repository, facilitating subsequent automatic update operations.

[0080] S5: Cross-compilation toolchain

[0081] Configure the cross-compilation environment for the AGV project to enable the project to compile ARM executable programs in the Docker container:

[0082] First, write a CMake cross-toolchain file on the x86 development host, specify the target system as Linux and the target architecture as arm64, and set the cross-compilation toolchain to aarch64-linux-gnu series tools.

[0083] Then, introduce the mounting path of the ARM root file system in the Docker container, set the header file and library file path of the AGV project dependent libraries (such as OpenCV, Eigen, ROS), and ensure that CMake can correctly find these dependencies during compilation.

[0084] Copy the written CMake toolchain file to the specified directory inside the Docker container for AGV project compilation. In the Docker container, enter the AGV project directory, create a build directory, execute the CMake command and specify the toolchain file, then start the compilation process to generate executable programs that can run on ARM architecture.

[0085] S6: Command integration

[0086] Integrate the Docker image management command and the compilation operation command to realize one-key operation:

[0087] On the one hand, for Docker image management, an automatic update script is written. The script obtains the ID of the AGV cross-compilation special image in the remote image repository and the ID of the local Docker image, and judges whether the local container needs to be updated by comparing the IDs of the two. If the remote image is updated, the script will automatically pull the latest image and update the local container. When make is executed, the latest compilation environment will be automatically pulled to complete the compilation. The addition, deletion, entry and release of the docker image are all packaged into the docker xx mode, which is convenient for one-key operation.

[0088] On the other hand, for compilation operation, a Makefile file is written. In this file, the above docker command is combined, and cross-compilation command, CMake parameter configuration command, multi-core compilation command, gtest test command, installation package release command, running script call command, dynamic library synchronization command and environment cleaning command are integrated. Users only need to execute "make + instruction" (such as make install, make test, make pub) in the host to complete the corresponding operation, without the need to remember long commands, which greatly improves the development efficiency.

[0089] To help those skilled in the art better understand the present scheme, the present embodiment combines the flowchart of Figure 1 , taking the C++ navigation project of AGV as an object. The project depends on components such as OpenCV, Eigen and ROS Noetic, and the target runs on NVIDIA Jetson Xavier NX (ARM architecture). The implementation goal is to build a unified cross-compilation environment on an x86_64 architecture Ubuntu 20.04 development host through Docker container technology, and finally generate a program that can run directly on the AGV target board. The implementation steps are as follows:

[0090] (I) ARM image making (corresponding to the "ARM image making" module in Figure 1 )

[0091] This module completes the construction of the root file system image from x86 computer to ARM, which consists of three links:

[0092] 1. Basic image making:

[0093] On the x86 development host, install tools such as qemu-aarch64-static, debootstrap, dd, etc. Build an Ubuntu 20.04 file system with arm64 architecture using the debootstrap command, then use qemu-aarch64-static to implement x86 environment simulation for ARM, and finally use the dd tool to package the initial file system into an IMG format base image.

[0094] 2. Import dependent libraries and header files:

[0095] Enter the file system of the base image through the chroot command, configure the domestic apt source to accelerate dependency download. Install AGV project required dependent libraries such as OpenCV, Eigen, ROS Noetic, and custom AGV motor drive library. Use the bind command of mount to bind the x86 host network during the process, so that the ARM environment can be connected to download apt dependency packages. After configuration, uninstall the bound system directory.

[0096] 3. Package and compress the image file:

[0097] Set the storage size of the configured ARM file system image, package it into an IMG file, and then use the mksquashfs tool for minimal compression to significantly reduce the image size, making it easier to embed in the Docker container later.

[0098] (2) x86-docker image production (corresponding to the "x86-docker image production" module in Appendix Figure 1 )

[0099] This module realizes embedding ARM image into Docker container to form AGV cross-compilation special image, which consists of three links:

[0100] 1. Create x86 Docker container and import ARM image:

[0101] Pull Ubuntu 20.04 base image from Docker Hub, start and create local Docker container, copy the previously packaged ARM compressed image to a specific path in the container.

[0102] 2. Mount ARM file system in Docker container:

[0103] Create a mount point directory for ARM file system in Docker container, mount ARM compressed image to this directory, and write an automatic mounting script to ensure automatic mounting of ARM environment when the container starts.

[0104] 3. Package and publish Docker image:

[0105] The configured Docker container is submitted as a local image, marked and pushed to a remote image repository such as Alibaba Cloud. Before pushing, use the docker-squash command to flatten the image, ensuring that the remote repository only retains one version of the image, facilitating subsequent automatic updates.

[0106] (Three) Cross-compilation tool chain configuration (corresponding to the "Cross-Compilation Tool Chain" module in Appendix Figure 1 )

[0107] This module completes the cross-compilation configuration of the AGV project, divided into three stages:

[0108] 1. Write CMake cross-toolchain file:

[0109] Write the toolchain file on the x86 host machine, specify the target system as Linux and the architecture as arm64, set the cross-compilation tool chain as aarch64-linux-gnu, import the mounting path of the ARM root file system in the Docker container, and configure the header file and library file paths of dependent libraries (such as OpenCV, Eigen, and ROS).

[0110] 2. Import toolchain file to Docker container:

[0111] Copy the written CMake toolchain file to the specified directory in the Docker container for AGV project invocation.

[0112] 3. Compile AGV project:

[0113] In the Docker container, enter the AGV project directory, create a build directory, execute the CMake command (specify the toolchain file), and then perform multi-core compilation to generate executable programs that can run on ARM architecture.

[0114] (Four) Command integration (corresponding to the "Command Integration" module in Appendix Figure 1 )

[0115] This module realizes the one-key integration of Docker image management and compilation commands, divided into two stages:

[0116] 1. Docker image automatic update command:

[0117] Write a script to compare the IDs of local Docker images and remote repository images. If the remote image is updated, automatically pull the latest version and update the local container. At the same time, set the script to start automatically on the x86 host machine, realizing the non-sensory update of the image.

[0118] 2. Makefile compilation command integration:

[0119] Write a Makefile to encapsulate the entire process of an AGV project, including commands for compilation, testing, installation, deployment, running, dynamic library synchronization, and cleanup. Users can complete the corresponding operations simply by using "make + command" without having to memorize lengthy commands.

[0120] In summary, within the Docker container, navigate to the AGV project directory and execute commands such as `make build` (compile), `make test` (test), `make pub` (publish), and `make rsync` (synchronize dynamic libraries). Copy the generated distribution package to the AGV target board (NVIDIA Jetson XavierNX), decompress it, and run the executable program to verify that it can start normally and complete the navigation function without environment dependency errors.

[0121] This embodiment achieves standardization, automation, and portability of the AGV cross-compilation environment through a process of ARM image creation → Docker image packaging → cross-toolchain configuration → one-click command processing. Compared with traditional methods, environment deployment time is shortened, team collaboration efficiency is improved, and the pain points of poor environment consistency and high maintenance costs are completely solved, demonstrating significant engineering value.

[0122] The above description is merely illustrative of the embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for cross-compiling AGV based on docker, characterized in that, The application comprises the following steps: S1: making an ARM root file system image, building a root file system of ARM architecture on a development host of x86 architecture through a virtualization tool, configuring header files and dependent libraries required for cross-compilation, and packaging and compressing the root file system to obtain an ARM root file system image; S2: making a Docker image special for AGV cross-compilation, pulling a basic operating system image from a public image warehouse, creating a Docker container of x86 architecture, copying the ARM root file system image obtained in S1 to a specific path of the Docker container and mounting, so that the Docker container has an ARM system structure, and obtaining a Docker image special for AGV cross-compilation; S3: configuring a cross-compilation tool chain, writing a CMake cross-tool chain file in the Docker container obtained in S2, introducing the mounting path of the ARM root file system, setting the dependent library file path of the AGV project, and specifying an ARM architecture cross-compilation tool chain; S4: integrating Docker commands and compilation commands, on the one hand, automatically judging whether to update the local Docker container according to the ID comparison result of the remote image warehouse and the local Docker image, if they are inconsistent, automatically pulling the latest remote image and updating the local Docker container; on the other hand, building a Makefile file, encapsulating the compilation, testing, installation, release and dynamic library synchronization commands of the AGV project; S5: performing AGV project cross-compilation, calling the commands integrated in S4, starting the cross-compilation process in the Docker container, and generating an executable program that can run on the ARM architecture computing board of AGV. 2.The method for implementing AGV cross-compilation based on docker according to claim 1, wherein, In S1, the root file system of ARM architecture is built through a virtualization tool, specifically comprising: installing a qemu-aarch64-static virtualization tool on an x86 host, building a root file system of arm64 architecture through a debootstrap command, and then packaging the initial root file system through a dd tool to obtain an initial ARM root file system image. 3.The method for AGV cross-compilation based on docker according to claim 2, characterized in that, In S1, the header files and dependent libraries required for cross-compilation are configured, specifically comprising: entering the initial ARM root file system through a chroot command, configuring the header files, dependent libraries and configuration files required for AGV cross-compilation; wherein the dependent libraries include dependent libraries installed from an apt source and dynamically compiled libraries or static files; during the configuration process, the network of the x86 host is bound to the ARM root file system through the bind command of mount, so that the ARM root file system can download the apt source dependent package online.

4. The method for cross-compiling AGV based on docker according to claim 1, characterized in that, In S1, the root file system is packaged and compressed, specifically comprising: setting the storage size of the ARM root file system image in advance, packaging the configured ARM root file system into an IMG file, and then performing minimal compression on the IMG file through a mksquashfs tool to reduce the image storage volume.

5. The method for cross-compiling AGV based on docker according to claim 1, characterized in that, The pulling of the base operating system image from the public image warehouse in S2 specifically comprises: pulling the Ubuntu version image adapted to the AGV development from the DockerHub public image warehouse; The copying of the ARM root file system image to the specific path of the Docker container and the mounting in S2 specifically comprises: copying the compressed ARM root file system IMG file in S1 to the " / opt / arm-rootfs / ” path of the Docker container, and mounting the IMG file to the " / arm-rootfs / ” directory of the Docker container through the mount command, so that the Docker container can directly access the header file and dependent library of the ARM root file system.

6. The method for cross-compiling AGV based on docker according to claim 1 or 5, characterized in that, S2 further comprises: pushing the AGV cross-compilation special Docker image to a domestic remote image warehouse, the remote image warehouse is used for storing, recording and releasing the Docker image, and supports multiple developers and multiple build servers to pull the image from the remote image warehouse, so as to realize environment consistency sharing.

7. The method for cross-compiling AGV based on docker according to claim 1, characterized in that, The specified ARM architecture cross-compilation tool chain in S3 specifically comprises: specifying the aarch64-linux-gnu cross-compilation tool chain as the compilation tool of the AGV project; The CMake cross-compilation tool chain file in S3 specifically comprises: setting "CMAKE_SYSTEM_NAME” as Linux and "CMAKE_SYSTEM_PROCESSOR” as arm64 in the CMake file, pointing "CMAKE_FIND_ROOT_PATH” and "CMAKE_SYSROOT” to the mounting path " / arm-rootfs / ” of the ARM root file system in the Docker container, ensuring that CMake can find dependent libraries and header files from the ARM root file system, and additionally specifying the third-party library and header file of the source code compilation, ensuring the compilation of the entire project. 8.The method for AGV cross-compilation based on docker according to claim 1, wherein, The automatic judgment of whether to update the local Docker container according to the ID comparison result of the remote image warehouse and the local Docker image in S4 specifically comprises: pushing the AGV cross-compilation special Docker image obtained in S2 to the remote image warehouse and recording the image ID; when the local Docker environment is started, the image ID of the remote image warehouse is automatically pulled and compared with the local image ID, if the two are inconsistent, the latest image of the remote is automatically pulled and the local Docker container is updated.

9. The method for cross-compiling AGV based on docker according to claim 1, characterized in that, The construction of the Makefile file in S4 encapsulates the compilation, test, installation, release and dynamic library synchronization commands of the AGV project, specifically comprising: integrating the cross-compilation command, CMake parameter configuration command, multi-core compilation command, gtest test command, installation package release command, running script calling command, dynamic library synchronization command and environment cleaning command in the Makefile, and the user realizes one-key operation of the AGV project through "make+instruction”.

10. The method for cross-compiling AGV based on docker according to claim 1, characterized in that, The ARM architecture computing board of the AGV includes a Raspberry Pi, an NVIDIA Jetson series board, and an RK3399 board.

Citation Information

Patent Citations

  • Advanced RISC Machines (ARM) processor-oriented deep learning model deployment method and equipment

    CN115660104A

  • Container mirror image construction and use method oriented to embedded cross compiling

    CN119806530A