init commit

This commit is contained in:
EricX-Zhao
2026-02-11 17:54:06 +03:00
commit c15a3552ae
18 changed files with 1593 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
FROM ubuntu:22.04 AS cc_base
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
build-essential \
wget \
git \
python3 \
software-properties-common \
curl \
pkg-config \
vim \
&& add-apt-repository universe \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN apt update && apt install -y \
python3-flake8-blind-except \
python3-flake8-class-newline \
python3-flake8-deprecated \
python3-mypy \
python3-pip \
python3-future \
python3-pytest \
python3-pytest-cov \
python3-pytest-mock \
python3-pytest-repeat \
python3-pytest-rerunfailures \
python3-pytest-runner \
python3-pytest-timeout \
python3-future \
python3-argcomplete \
autoconf automake libtool patchelf ninja-build python3.10-venv \
ros-dev-tools
+5
View File
@@ -0,0 +1,5 @@
# Build Cross Compiled Develop Image
```bash
PLATFORM=rk3588 docker compose build
```
+44
View File
@@ -0,0 +1,44 @@
#
services:
# 第一步:编译基础镜像
cc-base:
build:
context: .
dockerfile: Dockerfile.cc_base
image: cc-base:latest
# 第二步:编译针对 RK3588 的镜像
cc-platform:
build:
context: . # 上下文设为根目录,这样才能同时访问 rk3588 文件夹
dockerfile: ${PLATFORM}/Dockerfile.cc_${PLATFORM}
args:
- BASE_TAG=latest
image: cc-${PLATFORM}:latest
depends_on:
- cc-base
# 第三步:编译最终的供应商包镜像
vendor_packages:
build:
context: .
dockerfile: vendor_packages/Dockerfile.vendor_packages
args:
- BASE_IMAGE=cc-${PLATFORM}:latest
image: vendor-packages:${PLATFORM}
depends_on:
- cc-platform
ros2:
build:
context: .
dockerfile: ros2/Dockerfile.ros_${ROS_DISTRO}
args:
- ROS_DISTRO=rolling
- PLATFORM=${PLATFORM}
- CC_PLATFORM_IMAGE=cc-${PLATFORM}:latest
- VENDOR_PACKAGES=vendor-packages:${PLATFORM}
image: cc-ros-${ROS_DISTRO}:${PLATFORM}
depends_on:
- vendor_packages
+16
View File
@@ -0,0 +1,16 @@
FROM cc-base:latest as cc_rk3588
WORKDIR /opt
COPY rk3588/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.gz /opt/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.gz
RUN tar -zxf gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.gz \
&& rm /opt/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.gz
COPY rk3588/rk3588.toolchain.cmake /opt/cmake/
ENV PATH="/opt/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin:${PATH}"
ENV CC_TOOLCHAIN_FILE=/opt/cmake/rk3588.toolchain.cmake
ENV TARGET_SYSROOT=/opt/rk3588
WORKDIR /root
@@ -0,0 +1,31 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(SYSROOT /opt/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu)
set(CMAKE_SYSROOT
${SYSROOT}/aarch64-none-linux-gnu/libc
)
set(CMAKE_C_COMPILER ${SYSROOT}/bin/aarch64-none-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${SYSROOT}/bin/aarch64-none-linux-gnu-g++)
list(APPEND CMAKE_FIND_ROOT_PATH
$ENV{TARGET_SYSROOT}
${CMAKE_INSTALL_PREFIX}
)
# Set compile flags which are overwritter by android.toolchain.cmake
# set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-error=unused-variable")
# set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wno-error=unused-variable")
# add_link_options("LINKER:-rpath-link,$ENV{TARGET_SYSROOT}/lib")
set(Python3_EXECUTABLE /usr/bin/python3)
set(Python3_NumPy_INCLUDE_DIR $ENV{TARGET_SYSROOT}/lib/python3.10/site-packages/numpy/core/include)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+20
View File
@@ -0,0 +1,20 @@
ARG CC_PLATFORM_IMAGE
ARG VENDOR_PACKAGES
ARG PLATFORM
FROM ${CC_PLATFORM_IMAGE} as ros_src
ARG ROS_DISTRO
WORKDIR /workspace
RUN mkdir -p /workspace/src
COPY ros2/ros_rolling.repos .
RUN vcs import --input ros_${ROS_DISTRO}.repos src
RUN echo "Build ros ${ROS_DISTRO}"
FROM vendor-packages:${PLATFORM} AS vendor_images
FROM ${CC_PLATFORM_IMAGE} as ros_builder
COPY --from=ros_src /workspace /workspace
COPY --from=vendor_images ${TARGET_SYSROOT} ${TARGET_SYSROOT}
+417
View File
@@ -0,0 +1,417 @@
repositories:
ament/ament_cmake:
type: git
url: https://github.com/ament/ament_cmake.git
version: rolling
ament/ament_index:
type: git
url: https://github.com/ament/ament_index.git
version: rolling
ament/ament_lint:
type: git
url: https://github.com/ament/ament_lint.git
version: rolling
ament/ament_package:
type: git
url: https://github.com/ament/ament_package.git
version: rolling
ament/google_benchmark_vendor:
type: git
url: https://github.com/ament/google_benchmark_vendor.git
version: rolling
ament/googletest:
type: git
url: https://github.com/ament/googletest.git
version: rolling
diagnostics:
type: git
url: https://github.com/ros/diagnostics.git
version: ros2
eProsima/Fast-CDR:
type: git
url: https://github.com/eProsima/Fast-CDR.git
version: 2.3.x
eProsima/Fast-DDS:
type: git
url: https://github.com/eProsima/Fast-DDS.git
version: 3.4.x
eProsima/foonathan_memory_vendor:
type: git
url: https://github.com/eProsima/foonathan_memory_vendor.git
version: master
ffmpeg_image_transport_msgs:
type: git
url: https://github.com/ros-misc-utilities/ffmpeg_image_transport_msgs.git
version: rolling
ros-perception/image_transport_plugins:
type: git
url: https://github.com/ros-perception/image_transport_plugins.git
version: rolling
osrf/osrf_pycommon:
type: git
url: https://github.com/osrf/osrf_pycommon.git
version: master
osrf/osrf_testing_tools_cpp:
type: git
url: https://github.com/osrf/osrf_testing_tools_cpp.git
version: rolling
ros-perception/pcl_msgs:
type: git
url: https://github.com/ros-perception/pcl_msgs.git
version: ros2
ros-perception/image_common:
type: git
url: https://github.com/ros-perception/image_common.git
version: rolling
ros-perception/laser_geometry:
type: git
url: https://github.com/ros-perception/laser_geometry.git
version: rolling
ros-perception/perception_pcl:
type: git
url: https://github.com/ros-perception/perception_pcl.git
version: ros2
ros-perception/point_cloud_transport:
type: git
url: https://github.com/ros-perception/point_cloud_transport.git
version: rolling
ros-planning/navigation_msgs:
type: git
url: https://github.com/ros-planning/navigation_msgs.git
version: rolling
ros-tooling/keyboard_handler:
type: git
url: https://github.com/ros-tooling/keyboard_handler.git
version: rolling
ros-tooling/libstatistics_collector:
type: git
url: https://github.com/ros-tooling/libstatistics_collector.git
version: rolling
ros-visualization/interactive_markers:
type: git
url: https://github.com/ros-visualization/interactive_markers.git
version: rolling
ros-visualization/python_qt_binding:
type: git
url: https://github.com/ros-visualization/python_qt_binding.git
version: rolling
ros-visualization/qt_gui_core:
type: git
url: https://github.com/ros-visualization/qt_gui_core.git
version: rolling
ros-visualization/rqt:
type: git
url: https://github.com/ros-visualization/rqt.git
version: rolling
ros-visualization/rqt_action:
type: git
url: https://github.com/ros-visualization/rqt_action.git
version: rolling
ros-visualization/rqt_bag:
type: git
url: https://github.com/ros-visualization/rqt_bag.git
version: rolling
ros-visualization/rqt_console:
type: git
url: https://github.com/ros-visualization/rqt_console.git
version: rolling
ros-visualization/rqt_graph:
type: git
url: https://github.com/ros-visualization/rqt_graph.git
version: rolling
ros-visualization/rqt_msg:
type: git
url: https://github.com/ros-visualization/rqt_msg.git
version: rolling
ros-visualization/rqt_plot:
type: git
url: https://github.com/ros-visualization/rqt_plot.git
version: rolling
ros-visualization/rqt_publisher:
type: git
url: https://github.com/ros-visualization/rqt_publisher.git
version: rolling
ros-visualization/rqt_py_console:
type: git
url: https://github.com/ros-visualization/rqt_py_console.git
version: rolling
ros-visualization/rqt_reconfigure:
type: git
url: https://github.com/ros-visualization/rqt_reconfigure.git
version: rolling
ros-visualization/rqt_service_caller:
type: git
url: https://github.com/ros-visualization/rqt_service_caller.git
version: rolling
ros-visualization/rqt_shell:
type: git
url: https://github.com/ros-visualization/rqt_shell.git
version: rolling
ros-visualization/rqt_srv:
type: git
url: https://github.com/ros-visualization/rqt_srv.git
version: rolling
ros-visualization/rqt_topic:
type: git
url: https://github.com/ros-visualization/rqt_topic.git
version: rolling
ros-visualization/tango_icons_vendor:
type: git
url: https://github.com/ros-visualization/tango_icons_vendor.git
version: rolling
ros/class_loader:
type: git
url: https://github.com/ros/class_loader.git
version: rolling
ros/kdl_parser:
type: git
url: https://github.com/ros/kdl_parser.git
version: rolling
ros/pluginlib:
type: git
url: https://github.com/ros/pluginlib.git
version: rolling
ros/resource_retriever:
type: git
url: https://github.com/ros/resource_retriever.git
version: rolling
ros/robot_state_publisher:
type: git
url: https://github.com/ros/robot_state_publisher.git
version: rolling
ros/ros_environment:
type: git
url: https://github.com/ros/ros_environment.git
version: rolling
ros/ros_tutorials:
type: git
url: https://github.com/ros/ros_tutorials.git
version: rolling
ros/urdfdom:
type: git
url: https://github.com/ros/urdfdom.git
version: rolling
ros/urdfdom_headers:
type: git
url: https://github.com/ros/urdfdom_headers.git
version: rolling
ros/eigen_stl_containers:
type: git
url: https://github.com/ros/eigen_stl_containers.git
version: ros2
ros/angles:
type: git
url: https://github.com/ros/angles.git
version: ros2
ros-geographic-info:
type: git
url: https://github.com/ros-geographic-info/geographic_info.git
version: ros2
ros2/ament_cmake_ros:
type: git
url: https://github.com/ros2/ament_cmake_ros.git
version: rolling
ros2/common_interfaces:
type: git
url: https://github.com/ros2/common_interfaces.git
version: rolling
ros2/demos:
type: git
url: https://github.com/ros2/demos.git
version: rolling
ros2/eigen3_cmake_module:
type: git
url: https://github.com/ros2/eigen3_cmake_module.git
version: rolling
ros2/example_interfaces:
type: git
url: https://github.com/ros2/example_interfaces.git
version: rolling
ros2/examples:
type: git
url: https://github.com/ros2/examples.git
version: rolling
ros2/geometry2:
type: git
url: https://github.com/ros2/geometry2.git
version: rolling
ros2/launch:
type: git
url: https://github.com/ros2/launch.git
version: rolling
ros2/launch_ros:
type: git
url: https://github.com/ros2/launch_ros.git
version: rolling
ros2/message_filters:
type: git
url: https://github.com/ros2/message_filters.git
version: rolling
ros2/performance_test_fixture:
type: git
url: https://github.com/ros2/performance_test_fixture.git
version: rolling
ros2/python_cmake_module:
type: git
url: https://github.com/ros2/python_cmake_module.git
version: rolling
ros2/rcl:
type: git
url: https://github.com/ros2/rcl.git
version: rolling
ros2/rcl_interfaces:
type: git
url: https://github.com/ros2/rcl_interfaces.git
version: rolling
ros2/rcl_logging:
type: git
url: https://github.com/ros2/rcl_logging.git
version: rolling
ros2/rclcpp:
type: git
url: https://github.com/ros2/rclcpp.git
version: rolling
ros2/rclpy:
type: git
url: https://github.com/ros2/rclpy.git
version: rolling
ros2/rcpputils:
type: git
url: https://github.com/ros2/rcpputils.git
version: rolling
ros2/rcutils:
type: git
url: https://github.com/ros2/rcutils.git
version: rolling
ros2/realtime_support:
type: git
url: https://github.com/ros2/realtime_support.git
version: rolling
ros2/rmw:
type: git
url: https://github.com/ros2/rmw.git
version: rolling
ros2/rmw_connextdds:
type: git
url: https://github.com/ros2/rmw_connextdds.git
version: rolling
ros2/rmw_cyclonedds:
type: git
url: https://github.com/ros2/rmw_cyclonedds.git
version: rolling
ros2/rmw_dds_common:
type: git
url: https://github.com/ros2/rmw_dds_common.git
version: rolling
ros2/rmw_fastrtps:
type: git
url: https://github.com/ros2/rmw_fastrtps.git
version: rolling
ros2/rmw_implementation:
type: git
url: https://github.com/ros2/rmw_implementation.git
version: rolling
ros2/ros2_tracing:
type: git
url: https://github.com/ros2/ros2_tracing.git
version: rolling
ros2/ros2cli:
type: git
url: https://github.com/ros2/ros2cli.git
version: rolling
ros2/ros2cli_common_extensions:
type: git
url: https://github.com/ros2/ros2cli_common_extensions.git
version: rolling
ros2/ros_testing:
type: git
url: https://github.com/ros2/ros_testing.git
version: rolling
ros2/rosbag2:
type: git
url: https://github.com/ros2/rosbag2.git
version: rolling
ros2/rosidl:
type: git
url: https://github.com/ros2/rosidl.git
version: rolling
ros2/rosidl_core:
type: git
url: https://github.com/ros2/rosidl_core.git
version: rolling
ros2/rosidl_dds:
type: git
url: https://github.com/ros2/rosidl_dds.git
version: rolling
ros2/rosidl_defaults:
type: git
url: https://github.com/ros2/rosidl_defaults.git
version: rolling
ros2/rosidl_dynamic_typesupport:
type: git
url: https://github.com/ros2/rosidl_dynamic_typesupport.git
version: rolling
ros2/rosidl_dynamic_typesupport_fastrtps:
type: git
url: https://github.com/ros2/rosidl_dynamic_typesupport_fastrtps.git
version: rolling
ros2/rosidl_python:
type: git
url: https://github.com/ros2/rosidl_python.git
version: rolling
ros2/rosidl_runtime_py:
type: git
url: https://github.com/ros2/rosidl_runtime_py.git
version: rolling
ros2/rosidl_typesupport:
type: git
url: https://github.com/ros2/rosidl_typesupport.git
version: rolling
ros2/rosidl_typesupport_fastrtps:
type: git
url: https://github.com/ros2/rosidl_typesupport_fastrtps.git
version: rolling
ros2/rpyutils:
type: git
url: https://github.com/ros2/rpyutils.git
version: rolling
ros2/rviz:
type: git
url: https://github.com/ros2/rviz.git
version: rolling
ros2/sros2:
type: git
url: https://github.com/ros2/sros2.git
version: rolling
ros2/system_tests:
type: git
url: https://github.com/ros2/system_tests.git
version: rolling
ros2/test_interface_files:
type: git
url: https://github.com/ros2/test_interface_files.git
version: rolling
ros2/tlsf:
type: git
url: https://github.com/ros2/tlsf.git
version: rolling
ros2/unique_identifier_msgs:
type: git
url: https://github.com/ros2/unique_identifier_msgs.git
version: rolling
ros2/urdf:
type: git
url: https://github.com/ros2/urdf.git
version: rolling
variants:
type: git
url: https://github.com/ros2/variants.git
version: rolling
vision_msgs:
type: git
url: https://github.com/ros-perception/vision_msgs.git
version: ros2
vision_opencv:
type: git
url: https://github.com/ros-perception/vision_opencv.git
version: rolling
@@ -0,0 +1,145 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE} as vendor_packages_src
# RUN mkdir -p workspace/src
# COPY vendor_packages workspace/src/
RUN mkdir -p workspace/src \
&& cd workspace/src \
&& git clone https://github.com/EricX-Zhao/vendor_packages.git
FROM vendor_packages_src as system_packages
RUN cd workspace \
&& colcon build \
--install-base ${TARGET_SYSROOT} \
--merge-install \
--packages-up-to system_vendor_packages \
--cmake-force-configure \
--cmake-args \
--no-warn-unused-cli \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DCMAKE_TOOLCHAIN_FILE=${CC_TOOLCHAIN_FILE}
FROM vendor_packages_src as ceres_vendor
RUN cd workspace \
&& colcon build \
--install-base ${TARGET_SYSROOT} \
--merge-install \
--packages-up-to ceres_vendor \
--cmake-force-configure \
--cmake-args \
--no-warn-unused-cli \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${CC_TOOLCHAIN_FILE}
FROM vendor_packages_src as opencv_vendor
RUN cd workspace \
&& colcon build \
--install-base ${TARGET_SYSROOT} \
--merge-install \
--packages-up-to opencv_vendor \
--cmake-force-configure \
--cmake-args \
--no-warn-unused-cli \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${CC_TOOLCHAIN_FILE}
FROM ${BASE_IMAGE} AS boost
WORKDIR /tmp
RUN wget https://archives.boost.io/release/1.83.0/source/boost_1_83_0.tar.gz
RUN tar -zxf boost_1_83_0.tar.gz \
&& cd boost_1_83_0 \
&& ./bootstrap.sh --prefix=${TARGET_SYSROOT} --without-libraries=python \
&& sed -i "/using gcc/c using gcc : arm64 : aarch64-none-linux-gnu-gcc ;" project-config.jam \
&& ./b2 cxxflags="-fPIC" cflags="-fPIC" link=static install
FROM vendor_packages_src as pcl_vendor
COPY --from=boost ${TARGET_SYSROOT} ${TARGET_SYSROOT}
RUN cd workspace \
&& colcon build \
--install-base ${TARGET_SYSROOT} \
--merge-install \
--packages-up-to pcl_vendor \
--cmake-force-configure \
--cmake-args \
--no-warn-unused-cli \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=${CC_TOOLCHAIN_FILE}
# OpenSSL
FROM ${BASE_IMAGE} AS ssl_builder
WORKDIR /tmp
RUN git clone --depth=1 https://github.com/janbar/openssl-cmake.git \
&& cd openssl-cmake \
&& mkdir build \
&& cd build \
&& cmake .. \
-DCMAKE_TOOLCHAIN_FILE=${CC_TOOLCHAIN_FILE} \
-DCMAKE_INSTALL_PREFIX=${TARGET_SYSROOT} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
&& make -j$(($(nproc) / 2)) && make install \
&& rm -rf /tmp
# Python 3.12
FROM ${BASE_IMAGE} AS python_builder
WORKDIR /tmp
COPY --from=ssl_builder ${TARGET_SYSROOT} ${TARGET_SYSROOT}
# COPY vendor_packages/Python-3.10.12.tar.xz .
RUN wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tar.xz && \
RUN tar -xf Python-3.10.12.tar.xz && \
rm Python-3.10.12.tar.xz
# 配置和编译 Python
WORKDIR /tmp/Python-3.10.12
ENV CC=aarch64-none-linux-gnu-gcc \
CXX=aarch64-none-linux-gnu-g++ \
AR=aarch64-none-linux-gnu-ar \
RANLIB=aarch64-none-linux-gnu-ranlib \
HOSTARCH=aarch64-none-linux-gnu \
BUILDARCH=x86_64-linux-gnu
RUN CFLAGS="-fPIC" LDFLAGS="-fPIC" ./configure \
--host=aarch64-none-linux-gnu \
--build=x86_64-linux-gnu \
--prefix=${TARGET_SYSROOT} \
--with-build-python=python3.12 \
--disable-ipv6 \
--enable-optimizations \
--with-openssl=${TARGET_SYSROOT} \
ac_cv_file__dev_ptmx=yes \
ac_cv_file__dev_ptc=yes \
&& make -j$(($(nproc) / 2)) && make install
# https://github.com/benfogle/crossenv
# cross compile python packages
WORKDIR /tmp
RUN python3 -m pip install crossenv \
&& python3 -m crossenv ${TARGET_SYSROOT}/bin/python3 venv \
&& . venv/bin/activate \
&& pip -v install numpy==1.21.5 lark==1.1.1 packaging --prefix=${TARGET_SYSROOT}
FROM ${BASE_IMAGE} as final
COPY --from=system_packages ${TARGET_SYSROOT} ${TARGET_SYSROOT}
COPY --from=ceres_vendor ${TARGET_SYSROOT} ${TARGET_SYSROOT}
COPY --from=opencv_vendor ${TARGET_SYSROOT} ${TARGET_SYSROOT}
COPY --from=pcl_vendor ${TARGET_SYSROOT} ${TARGET_SYSROOT}
COPY --from=python_builder ${TARGET_SYSROOT} ${TARGET_SYSROOT}