diff --git a/.github/workflows/arm64_builds.yml b/.github/workflows/arm64_builds.yml new file mode 100644 index 0000000..6d73cc3 --- /dev/null +++ b/.github/workflows/arm64_builds.yml @@ -0,0 +1,89 @@ +name: Build & Publish ARM64 Docker images + +on: + workflow_dispatch: + tags: + - '*' + branches: + - '*' + push: + tags: + - '*' + branches: + - master + paths: + - docker/Dockerfile_*-l4t + pull_request: + branches: + - master + paths: + - docker/Dockerfile_*-l4t +jobs: + px4-dev-base-l4t: + name: "Ubuntu L4T Base" + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - + name: Configure emulator + id: emu + run: | + docker run --privileged --rm tonistiigi/binfmt --install arm64 + - + name: Build container + run: | + cd docker + make px4-dev-base-l4t + - + name: Build & Publish container + if: github.event_name == 'push' && (contains(github.ref, '/heads/master') || contains(github.ref, '/tags/')) + uses: julianoes/Publish-Docker-Github-Action@master + with: + name: px4io/px4-dev-base-l4t + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + dockerfile: Dockerfile_base-l4t + cache: false + tag_names: true + workdir: docker + + px4-dev-simulation-l4t: + name: "Ubuntu L4T Simulation" + runs-on: ubuntu-latest + needs: px4-dev-base-l4t + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - + name: Configure emulator + id: emu + run: | + docker run --privileged --rm tonistiigi/binfmt --install arm64 + - + name: Build container + run: | + cd docker + make px4-dev-simulation-l4t + - + name: Build & Publish container + if: github.event_name == 'push' && (contains(github.ref, '/heads/master') || contains(github.ref, '/tags/')) + uses: julianoes/Publish-Docker-Github-Action@master + with: + name: px4io/px4-dev-simulation-l4t + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + dockerfile: Dockerfile_simulation-l4t + cache: false + tag_names: true + workdir: docker diff --git a/.github/workflows/docker_builds.yml b/.github/workflows/x86_builds.yml similarity index 99% rename from .github/workflows/docker_builds.yml rename to .github/workflows/x86_builds.yml index 342b832..61b5234 100644 --- a/.github/workflows/docker_builds.yml +++ b/.github/workflows/x86_builds.yml @@ -6,9 +6,13 @@ on: - '*' branches: - master + paths-ignore: + - docker/Dockerfile_*-l4t pull_request: branches: - master + paths-ignore: + - docker/Dockerfile_*-l4t jobs: px4-dev-base-archlinux: diff --git a/README.md b/README.md index 18a8e43..1adf701 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ License: according to [LICENSE](https://github.com/PX4/Firmware/blob/master/LICE - [px4io/px4-dev-ros2-foxy](https://hub.docker.com/r/px4io/px4-dev-ros2-foxy) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-ros2-foxy.svg)](http://microbadger.com/images/px4io/px4-dev-ros2-foxy) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-ros2-foxy.svg)](https://hub.docker.com/r/px4io/px4-dev-ros2-foxy) - [px4io/px4-dev-ros2-rolling](https://hub.docker.com/r/px4io/px4-dev-ros2-rolling) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-ros2-rolling.svg)](http://microbadger.com/images/px4io/px4-dev-ros2-rolling) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-ros2-rolling.svg)](https://hub.docker.com/r/px4io/px4-dev-ros2-rolling) - [px4io/px4-dev-ros2-galactic](https://hub.docker.com/r/px4io/px4-dev-ros2-galactic) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-ros2-galactic.svg)](http://microbadger.com/images/px4io/px4-dev-ros2-galactic) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-ros2-galactic.svg)](https://hub.docker.com/r/px4io/px4-dev-ros2-galactic) +- [px4io/px4-dev-base-l4t](https://hub.docker.com/r/px4io/px4-dev-base-l4t) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-base-l4t.svg)](http://microbadger.com/images/px4io/px4-dev-base-l4t) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-base-l4t.svg)](https://hub.docker.com/r/px4io/px4-dev-base-l4t) + - [px4io/px4-dev-simulation-l4t](https://hub.docker.com/r/px4io/px4-dev-simulation-l4t) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-simulation-l4t.svg)](http://microbadger.com/images/px4io/px4-dev-simulation-l4t) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-simulation-l4t.svg)](https://hub.docker.com/r/px4io/px4-dev-simulation-l4t) - [px4io/px4-dev-armhf](https://hub.docker.com/r/px4io/px4-dev-armhf) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-armhf.svg)](http://microbadger.com/images/px4io/px4-dev-armhf) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-armhf.svg)](https://hub.docker.com/r/px4io/px4-dev-armhf) - [px4io/px4-dev-aarch64](https://hub.docker.com/r/px4io/px4-dev-aarch64) [![](https://images.microbadger.com/badges/image/px4io/px4-dev-aarch64.svg)](http://microbadger.com/images/px4io/px4-dev-aarch64) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-dev-aarch64.svg)](https://hub.docker.com/r/px4io/px4-dev-aarch64) - [px4io/px4-docs](https://hub.docker.com/r/px4io/px4-docs) [![](https://images.microbadger.com/badges/image/px4io/px4-docs.svg)](http://microbadger.com/images/px4io/px4-docs) [![Docker Pulls](https://img.shields.io/docker/pulls/px4io/px4-docs.svg)](https://hub.docker.com/r/px4io/px4-docs) diff --git a/docker/Dockerfile_base-l4t b/docker/Dockerfile_base-l4t new file mode 100644 index 0000000..a41c805 --- /dev/null +++ b/docker/Dockerfile_base-l4t @@ -0,0 +1,135 @@ +# +# PX4 base development environment based on NVidia L4T distribution for Jetson boards +# + +FROM nvcr.io/nvidia/l4t-base:r32.5.0 +LABEL maintainer="Dom Raniszewski" + +ENV DEBIAN_FRONTEND noninteractive +ENV LANG C.UTF-8 +ENV LC_ALL C.UTF-8 + +RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ + bzip2 \ + build-essential \ + ca-certificates \ + ccache \ + cmake \ + cppcheck \ + curl \ + dirmngr \ + doxygen \ + file \ + gdb \ + git \ + gnupg \ + gosu \ + lcov \ + libfreetype6-dev \ + libgtest-dev \ + libpng-dev \ + libpcap-dev \ + libpq-dev \ + libssl-dev \ + lsb-release \ + ninja-build \ + openjdk-8-jdk \ + openjdk-8-jre \ + openssh-client \ + pkg-config \ + python3-dev \ + python3-pip \ + python3-matplotlib \ + rsync \ + shellcheck \ + tzdata \ + unzip \ + valgrind \ + wget \ + xsltproc \ + zip \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* + +# gtest +RUN cd /usr/src/gtest \ + && mkdir build && cd build \ + && cmake .. && make -j$(nproc) \ + && cp *.a /usr/lib \ + && cd .. && rm -rf build + +# Install Python 3 pip build dependencies first. +RUN pip3 install --upgrade setuptools + +# Python 3 dependencies installed by pip +RUN pip3 install argparse argcomplete jinja2 kconfiglib \ + nunavut>=1.1.0 packaging pkgconfig pyros-genmsg pyulog \ + requests serial six toml pyulog wheel jsonschema + +RUN pip3 install --no-cache-dir coverage +RUN pip3 install --no-cache-dir cerberus +RUN pip3 install --no-cache-dir empy +RUN pip3 install --no-cache-dir numpy +RUN pip3 install --no-cache-dir pyyaml + +RUN pip3 install matplotlib==3.0.* + +# manual ccache setup +RUN ln -s /usr/bin/ccache /usr/lib/ccache/cc \ + && ln -s /usr/bin/ccache /usr/lib/ccache/c++ + +# astyle v3.1 +RUN wget -q https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1/astyle_3.1_linux.tar.gz -O /tmp/astyle.tar.gz \ + && cd /tmp && tar zxf astyle.tar.gz && cd astyle/src \ + && make -f ../build/gcc/Makefile -j$(nproc) && cp bin/astyle /usr/local/bin \ + && rm -rf /tmp/* + +# Gradle (Required to build Fast-RTPS-Gen) +RUN wget -q "https://services.gradle.org/distributions/gradle-6.3-rc-4-bin.zip" -O /tmp/gradle-6.3-rc-4-bin.zip \ + && mkdir /opt/gradle \ + && cd /tmp \ + && unzip -d /opt/gradle gradle-6.3-rc-4-bin.zip \ + && rm -rf /tmp/* + +ENV PATH "/opt/gradle/gradle-6.3-rc-4/bin:$PATH" + +# Fast-RTPS 1.8.4 +RUN git clone --recursive https://github.com/eProsima/Fast-DDS.git -b v1.8.4 /tmp/FastRTPS-1.8.4 \ + && cd /tmp/FastRTPS-1.8.4 \ + && mkdir build && cd build \ + && cmake -DTHIRDPARTY=ON -DSECURITY=ON .. \ + && cmake --build . --target install -- -j $(nproc) \ + && rm -rf /tmp/* + +# Fast-RTPS-Gen 1.0.4 +RUN git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git -b v1.0.4 /tmp/Fast-RTPS-Gen-1.0.4 \ + && cd /tmp/Fast-RTPS-Gen-1.0.4 \ + && gradle assemble \ + && gradle install \ + && rm -rf /tmp/* + +# create user with id 1001 (jenkins docker workflow default) +RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user + +# setup virtual X server +RUN mkdir /tmp/.X11-unix && \ + chmod 1777 /tmp/.X11-unix && \ + chown -R root:root /tmp/.X11-unix +ENV DISPLAY :99 + +ENV CCACHE_UMASK=000 +ENV FASTRTPSGEN_DIR="/usr/local/bin/" +ENV PATH="/usr/lib/ccache:$PATH" +ENV TERM=xterm +ENV TZ=UTC + +# SITL UDP PORTS +EXPOSE 14556/udp +EXPOSE 14557/udp + +# create and start as LOCAL_USER_ID +COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] + +CMD ["/bin/bash"] diff --git a/docker/Dockerfile_simulation-l4t b/docker/Dockerfile_simulation-l4t new file mode 100644 index 0000000..1aa8d32 --- /dev/null +++ b/docker/Dockerfile_simulation-l4t @@ -0,0 +1,35 @@ +# +# PX4 Gazebo 9 development environment in Nvidia L4T +# + +FROM px4io/px4-dev-base-l4t:latest +LABEL maintainer="Dom Raniszewski" + +RUN wget --quiet http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - \ + && sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -sc` main" > /etc/apt/sources.list.d/gazebo-stable.list' \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \ + ant \ + bc \ + gazebo9 \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-ugly \ + libeigen3-dev \ + libgazebo9-dev \ + libgstreamer-plugins-base1.0-dev \ + libimage-exiftool-perl \ + libopencv-dev \ + libxml2-utils \ + protobuf-compiler \ + ignition-edifice \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* + +# Some QT-Apps/Gazebo don't not show controls without this +ENV QT_X11_NO_MITSHM 1 + +# Use UTF8 encoding in java tools (needed to compile jMAVSim) +ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 diff --git a/docker/Makefile b/docker/Makefile index 41e6350..7a08bc8 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,18 +1,18 @@ .PHONY: px4-dev-armhf, px4-dev-base-archlinux, px4-dev-base-bionic, \ - px4-dev-base-focal, px4-dev-clang, px4-dev-nuttx-bionic, \ + px4-dev-base-focal, px4-dev-base-l4t, px4-dev-clang, px4-dev-nuttx-bionic, \ px4-dev-nuttx-focal, px4-dev-nuttx-clang, px4-dev-raspi, \ px4-dev-ros-melodic, px4-dev-ros-noetic, px4-dev-ros2-dashing, \ px4-dev-ros2-eloquent, px4-dev-ros2-foxy, px4-dev-ros2-galactic, \ px4-dev-ros2-rolling, px4-dev-simulation-bionic, px4-dev-simulation-focal, \ - px4-docs + px4-dev-simulation-l4t, px4-docs all: px4-dev-armhf, px4-dev-base-archlinux, px4-dev-base-bionic, \ - px4-dev-base-focal, px4-dev-clang, px4-dev-nuttx-bionic, \ + px4-dev-base-focal, px4-dev-base-l4t, px4-dev-clang, px4-dev-nuttx-bionic, \ px4-dev-nuttx-focal, px4-dev-nuttx-clang, px4-dev-raspi, \ px4-dev-ros-melodic, px4-dev-ros-noetic, px4-dev-ros2-dashing,\ px4-dev-ros2-eloquent, px4-dev-ros2-foxy, px4-dev-ros2-galactic, \ px4-dev-ros2-rolling, px4-dev-simulation-bionic, px4-dev-simulation-focal, \ - px4-docs + px4-dev-simulation-l4t, px4-docs px4-dev-armhf: docker build -t px4io/px4-dev-armhf . -f Dockerfile_armhf @@ -29,6 +29,9 @@ px4-dev-base-bionic: px4-dev-base-focal: docker build -t px4io/px4-dev-base-focal . -f Dockerfile_base-focal +px4-dev-base-l4t: + docker buildx build --platform linux/arm64 -t px4io/px4-dev-base-l4t . -f Dockerfile_base-l4t --load + px4-dev-clang: px4-dev-base-bionic docker build -t px4io/px4-dev-clang . -f Dockerfile_clang @@ -71,5 +74,8 @@ px4-dev-simulation-bionic: px4-dev-base-bionic px4-dev-simulation-focal: px4-dev-base-focal docker build -t px4io/px4-dev-simulation-focal . -f Dockerfile_simulation-focal +px4-dev-simulation-l4t: px4-dev-base-l4t + docker buildx build --platform linux/arm64 -t px4io/px4-dev-simulation-l4t . -f Dockerfile_simulation-l4t --load + px4-docs: docker build -t px4io/px4-dev-docs . -f Dockerfile_docs