From f032e7b4aa6d835960123e4338571d7ed80d41da Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 20 Dec 2021 02:36:23 +0000 Subject: [PATCH] Add experimental Raspbian aarch64 build --- .gitmodules | 3 +++ Dockerfile.rpi.buster64 | 26 ++++++++++++++++++++++++++ appveyor.yml | 2 ++ build-rpi64.sh | 24 ++++++++++++++++++++++++ do-release.sh | 3 +++ push-images.sh | 2 ++ rpi-userland | 1 + scripts/build-deps.sh | 17 +++++++++++++++-- scripts/build-package.sh | 3 +++ scripts/install-base-deps.sh | 2 +- 10 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.rpi.buster64 create mode 100755 build-rpi64.sh create mode 160000 rpi-userland diff --git a/.gitmodules b/.gitmodules index 5dd9c08..a2ce733 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "FFmpeg-rpi"] path = FFmpeg-rpi url = https://github.com/cgutman/FFmpeg.git +[submodule "rpi-userland"] + path = rpi-userland + url = https://github.com/cgutman/userland.git diff --git a/Dockerfile.rpi.buster64 b/Dockerfile.rpi.buster64 new file mode 100644 index 0000000..9207404 --- /dev/null +++ b/Dockerfile.rpi.buster64 @@ -0,0 +1,26 @@ +FROM arm64v8/debian:buster + +ENV TARGET=rpi64 + +COPY scripts/install-base-deps.sh /opt/scripts/ +RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ + apt-get install -y --no-install-recommends gnupg && \ + echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list && \ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 82B129927FA3303E && \ + apt-get update && \ + apt-get install -y --no-install-recommends linux-libc-dev && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +COPY rpi-userland /opt/rpi-userland +COPY FFmpeg-rpi /opt/FFmpeg +COPY SDL2 /opt/SDL2 +COPY SDL_ttf /opt/SDL_ttf + +COPY scripts/build-deps.sh /opt/scripts/ +RUN /bin/bash -c /opt/scripts/build-deps.sh + +COPY scripts/build-package.sh /opt/scripts/ + +VOLUME "/out" +ENTRYPOINT [ "/bin/bash", "-c", "/opt/scripts/build-package.sh" ] diff --git a/appveyor.yml b/appveyor.yml index e9306c0..ce2819f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,8 @@ environment: BUILD_SCRIPT: ./build-amd64.sh - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 BUILD_SCRIPT: ./build-rpi.sh + - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 + BUILD_SCRIPT: ./build-rpi64.sh - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 BUILD_SCRIPT: ./build-l4t.sh diff --git a/build-rpi64.sh b/build-rpi64.sh new file mode 100755 index 0000000..43cdf79 --- /dev/null +++ b/build-rpi64.sh @@ -0,0 +1,24 @@ +TARGET_NAME="rpi-buster64" +DOCKERFILE="Dockerfile.rpi.buster64" + +TAG_UNIQUE_ID=`git ls-tree HEAD | sha256sum | cut -c-16` +TAG_NAME="${TARGET_NAME}_${TAG_UNIQUE_ID}" +OUT_DIR="out_$TARGET_NAME" + +docker pull cgutman/moonlight-packaging:$TAG_NAME +PULL_EXIT_CODE=$? + +rm -rf $OUT_DIR + +set -e +mkdir $OUT_DIR + +if [ $PULL_EXIT_CODE -eq 0 ]; then + echo Using pre-built Docker image - cgutman/moonlight-packaging:$TAG_NAME +else + echo Pre-built image not available - building cgutman/moonlight-packaging:$TAG_NAME + docker build -f $DOCKERFILE -t cgutman/moonlight-packaging:$TAG_NAME . + echo Built Docker image - cgutman/moonlight-packaging:$TAG_NAME +fi + +docker run --rm --mount type=bind,source="$(pwd)"/$OUT_DIR,target=/out --mount type=bind,source="$(pwd)"/debian,target=/opt/debian -e COMMIT="$1" cgutman/moonlight-packaging:$TAG_NAME diff --git a/do-release.sh b/do-release.sh index 2ff1ada..6b309ad 100755 --- a/do-release.sh +++ b/do-release.sh @@ -14,11 +14,14 @@ set -e # Build the packages ./build-l4t.sh ./build-rpi.sh +./build-rpi64.sh # Push the moonlight-qt packages to Cloudsmith repos cloudsmith push deb moonlight-game-streaming/moonlight-l4t/ubuntu/bionic out_l4t-bionic/moonlight-qt_*.deb cloudsmith push deb moonlight-game-streaming/moonlight-qt/raspbian/buster out_rpi-buster/moonlight-qt_*.deb +#cloudsmith push deb moonlight-game-streaming/moonlight-qt/raspbian/buster out_rpi-buster64/moonlight-qt_*.deb # Push the moonlight-qt-dbgsym packages to Cloudsmith repos cloudsmith push deb moonlight-game-streaming/moonlight-l4t/ubuntu/bionic out_l4t-bionic/moonlight-qt-dbgsym_*.ddeb cloudsmith push deb moonlight-game-streaming/moonlight-qt/raspbian/buster out_rpi-buster/moonlight-qt-dbgsym_*.deb +#cloudsmith push deb moonlight-game-streaming/moonlight-qt/raspbian/buster out_rpi-buster64/moonlight-qt-dbgsym_*.deb diff --git a/push-images.sh b/push-images.sh index 9c0671d..4431c04 100755 --- a/push-images.sh +++ b/push-images.sh @@ -3,9 +3,11 @@ set -e TAG_UNIQUE_ID=`git ls-tree HEAD | sha256sum | cut -c-16` docker build -f Dockerfile.rpi.buster -t cgutman/moonlight-packaging:rpi-buster_$TAG_UNIQUE_ID . +docker build -f Dockerfile.rpi.buster64 -t cgutman/moonlight-packaging:rpi-buster64_$TAG_UNIQUE_ID . docker build -f Dockerfile.amd64.buster -t cgutman/moonlight-packaging:amd64-buster_$TAG_UNIQUE_ID . docker build -f Dockerfile.l4t.bionic -t cgutman/moonlight-packaging:l4t-bionic_$TAG_UNIQUE_ID . docker push cgutman/moonlight-packaging:rpi-buster_$TAG_UNIQUE_ID +docker push cgutman/moonlight-packaging:rpi-buster64_$TAG_UNIQUE_ID docker push cgutman/moonlight-packaging:amd64-buster_$TAG_UNIQUE_ID docker push cgutman/moonlight-packaging:l4t-bionic_$TAG_UNIQUE_ID diff --git a/rpi-userland b/rpi-userland new file mode 160000 index 0000000..5c051a9 --- /dev/null +++ b/rpi-userland @@ -0,0 +1 @@ +Subproject commit 5c051a9208846b37206f7743f44c0c9a6dacfef2 diff --git a/scripts/build-deps.sh b/scripts/build-deps.sh index 2f3f766..92617f5 100755 --- a/scripts/build-deps.sh +++ b/scripts/build-deps.sh @@ -3,11 +3,24 @@ set -e BASE_FFMPEG_ARGS="--enable-pic --enable-static --disable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-libdrm --enable-decoder=h264_v4l2m2m --enable-decoder=hevc_v4l2m2m --extra-cflags=-I/usr/include/libdrm" echo "Building dependencies for $TARGET" -if [ "$TARGET" == "rpi" ]; then +if [ "$TARGET" == "rpi" ] || [ "$TARGET" == "rpi64" ]; then + # We have to build MMAL libraries for aarch64 + if [ "$TARGET" == "rpi64" ]; then + cd /opt/rpi-userland + mkdir build + cd build + cmake -DARM64=ON -DLIBRARY_TYPE=STATIC -DVCOS_PTHREADS_BUILD_SHARED=OFF .. + make -j$(nproc) + make install + + # We also have to patch the FFmpeg configure script since it doesn't use pkg-config + sed -i 's|add_ldflags -L/opt/vc/lib/|add_ldflags -L/opt/vc/lib/ -pthread|g' /opt/FFmpeg/configure + fi + # Copy libraspberrypi-dev pkgconfig files into the default location mkdir -p /usr/local/lib/pkgconfig cp /opt/vc/lib/pkgconfig/* /usr/local/lib/pkgconfig/ - # Enable MMAL decoders + # Enable MMAL and VL42 stateless decoders EXTRA_FFMPEG_ARGS="--enable-mmal --enable-decoder=h264_mmal --disable-rpi --enable-sand --enable-libudev --enable-v4l2-request --enable-hwaccel=h264_v4l2request --enable-hwaccel=hevc_v4l2request" elif [ "$TARGET" == "l4t" ]; then # Enable NVMPI decoders diff --git a/scripts/build-package.sh b/scripts/build-package.sh index ba26cbf..c601bc8 100755 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -16,6 +16,9 @@ VERSION=`cat app/version.txt` if [ "$TARGET" == "rpi" ]; then EXTRA_BUILD_DEPS="libraspberrypi-dev | rbp-userland-dev-osmc" EXTRA_DEPS="libraspberrypi0 | rbp-userland-osmc" +elif [ "$TARGET" == "rpi64" ]; then + EXTRA_BUILD_DEPS="" + EXTRA_DEPS="" elif [ "$TARGET" == "l4t" ]; then EXTRA_BUILD_DEPS="libnvmpi1.0.0" elif [ "$TARGET" == "desktop" ]; then diff --git a/scripts/install-base-deps.sh b/scripts/install-base-deps.sh index 424e45e..884c3bb 100755 --- a/scripts/install-base-deps.sh +++ b/scripts/install-base-deps.sh @@ -1,5 +1,5 @@ set -e export DEBIAN_FRONTEND=noninteractive apt-get update -apt-get install -y curl g++ make devscripts fakeroot debhelper git nasm libgbm-dev libdrm-dev libfreetype6-dev libasound2-dev libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev +apt-get install -y curl g++ make devscripts fakeroot debhelper git nasm libgbm-dev libdrm-dev libfreetype6-dev libasound2-dev libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev cmake apt-get install -y --no-install-recommends libssl-dev qtbase5-dev qtquickcontrols2-5-dev qtdeclarative5-dev libqt5svg5-dev libopus-dev