From bcf617369b223d1d25d5f3973660d5b78c256716 Mon Sep 17 00:00:00 2001 From: Josef Melkus Date: Thu, 4 Apr 2024 16:21:40 +0200 Subject: [PATCH 1/3] aarch64 image --- example/docker/ubuntu1804-aarch64/Dockerfile | 49 +++++++++++++++++ .../ubuntu1804-aarch64/init_toolchain.sh | 54 +++++++++++++++++++ .../docker/ubuntu1804-aarch64/lsb_release.txt | 2 + example/docker/ubuntu1804-aarch64/uname.txt | 1 + .../fleet_protocol_debug.json | 3 +- .../fleet_protocol_release.json | 3 +- .../internal_client_debug.json | 11 ++-- .../internal_client_release.json | 11 ++-- .../protobuf/protobuf_debug_v21.12.json | 3 +- .../protobuf/protobuf_release_v21.12.json | 3 +- example/package/zlib/zlib_debug.json | 3 +- example/package/zlib/zlib_release.json | 3 +- 12 files changed, 132 insertions(+), 14 deletions(-) create mode 100644 example/docker/ubuntu1804-aarch64/Dockerfile create mode 100644 example/docker/ubuntu1804-aarch64/init_toolchain.sh create mode 100644 example/docker/ubuntu1804-aarch64/lsb_release.txt create mode 100644 example/docker/ubuntu1804-aarch64/uname.txt diff --git a/example/docker/ubuntu1804-aarch64/Dockerfile b/example/docker/ubuntu1804-aarch64/Dockerfile new file mode 100644 index 0000000..bf4e83c --- /dev/null +++ b/example/docker/ubuntu1804-aarch64/Dockerfile @@ -0,0 +1,49 @@ +FROM ubuntu:18.04 + +USER root +RUN echo root:1234 | chpasswd + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential make libssl-dev coreutils lsb-release wget g++-8 gcc-8 gcc-8-aarch64-linux-gnu g++-8-aarch64-linux-gnu patchelf unzip && \ + rm -rf /var/lib/apt/lists/* + +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 + +RUN wget "https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-x86_64.sh" -O cmake.sh && \ + chmod +x cmake.sh && \ + ./cmake.sh --skip-license --prefix=/usr/local && \ + rm ./cmake.sh + +RUN apt-get update && \ + apt-get purge -y \ + wget && \ + rm -rf /var/lib/apt/lists/* + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + openssh-server git && \ + rm -rf /var/lib/apt/lists/* + +RUN git clone https://github.com/cmakelib/cmakelib.git /cmakelib +RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc + +RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config +RUN mkdir -p /run/sshd + +COPY init_toolchain.sh /root/ +RUN chmod +x /root/init_toolchain.sh && \ + /root/init_toolchain.sh /root/toolchain /root/tools +COPY lsb_release.txt /root/tools/ +COPY uname.txt /root/tools/ + +ENV CXX=aarch64-linux-gnu-g++-8 +ENV CC=aarch64-linux-gnu-gcc-8 + +RUN sed -ri 's/#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config +RUN mkdir /root/.ssh && \ + echo "CXX=${CXX}" > /root/.ssh/environment && \ + echo "CC=${CC}" >> /root/.ssh/environment + +ENTRYPOINT ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"] + diff --git a/example/docker/ubuntu1804-aarch64/init_toolchain.sh b/example/docker/ubuntu1804-aarch64/init_toolchain.sh new file mode 100644 index 0000000..42254c7 --- /dev/null +++ b/example/docker/ubuntu1804-aarch64/init_toolchain.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +set -e + +INSTALL_DIR="$1" +TOOLS_INSTALL_DIR="$2" +TMP_DIR="/tmp/toolchain-install" + +TOOLS_PACKAGE_URI="https://github.com/bringauto/packager/releases/download/v0.3.0/bringauto-packager-tools_v0.3.0_x86-64-linux.zip" + +if [[ ${INSTALL_DIR} = "" ]] +then + echo "Specify toolchain absolute install dir path as a first argument!" >&2 + exit 1 +fi + +if [[ ${TOOLS_INSTALL_DIR} = "" ]] +then + echo "Specify tools install dir absolute path as a second argument!" >&2 + exit 1 +fi + +if ! [[ -d ${INSTALL_DIR} ]] +then + echo "Install dir '${INSTALL_DIR}' does not exist" +fi + + +function install_tools() { + if [[ -d ${TMP_DIR} ]] + then + echo "TMP dir '${TMP_DIR}' exist" + fi + mkdir -p "${TMP_DIR}" + mkdir -p "${TOOLS_INSTALL_DIR}" + + pushd "${TMP_DIR}" + wget ${TOOLS_PACKAGE_URI} \ + -O "bringauto-packager-tools.zip" + unzip bringauto-packager-tools.zip + rm bringauto-packager-tools.zip + directory_name="$(echo ./*)" + mv "${directory_name}"/* "${TOOLS_INSTALL_DIR}" + rm -r "${directory_name}" + popd + rm -r "${TMP_DIR}" + + chmod +x "${TOOLS_INSTALL_DIR}/lsb_release" + chmod +x "${TOOLS_INSTALL_DIR}/uname" + echo 'PATH='"${TOOLS_INSTALL_DIR}"'/:$PATH' >> /root/.bashrc +} + + +install_tools diff --git a/example/docker/ubuntu1804-aarch64/lsb_release.txt b/example/docker/ubuntu1804-aarch64/lsb_release.txt new file mode 100644 index 0000000..ddda268 --- /dev/null +++ b/example/docker/ubuntu1804-aarch64/lsb_release.txt @@ -0,0 +1,2 @@ +Distributor ID: Ubuntu +Release: 18.04 diff --git a/example/docker/ubuntu1804-aarch64/uname.txt b/example/docker/ubuntu1804-aarch64/uname.txt new file mode 100644 index 0000000..b7ff4cb --- /dev/null +++ b/example/docker/ubuntu1804-aarch64/uname.txt @@ -0,0 +1 @@ +Linux e25e113786d6 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 aarch64 GNU/Linux diff --git a/example/package/fleet-protocol-interface/fleet_protocol_debug.json b/example/package/fleet-protocol-interface/fleet_protocol_debug.json index 0ca3536..3c1abeb 100644 --- a/example/package/fleet-protocol-interface/fleet_protocol_debug.json +++ b/example/package/fleet-protocol-interface/fleet_protocol_debug.json @@ -33,7 +33,8 @@ "debian12", "debian11", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/fleet-protocol-interface/fleet_protocol_release.json b/example/package/fleet-protocol-interface/fleet_protocol_release.json index 4cbf6ce..4e8a060 100644 --- a/example/package/fleet-protocol-interface/fleet_protocol_release.json +++ b/example/package/fleet-protocol-interface/fleet_protocol_release.json @@ -33,7 +33,8 @@ "debian12", "debian11", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/fleet-protocol-internal-client/internal_client_debug.json b/example/package/fleet-protocol-internal-client/internal_client_debug.json index 0c9a51d..4529f44 100644 --- a/example/package/fleet-protocol-internal-client/internal_client_debug.json +++ b/example/package/fleet-protocol-internal-client/internal_client_debug.json @@ -1,11 +1,13 @@ { "Env": {}, "DependsOn": [ - "pahomqttc" + "protobuf", + "fleet-protocol-interface", + "zlib" ], "Git": { "URI": "https://github.com/bringauto/internal-client-cpp.git", - "Revision": "v1.0.0" + "Revision": "v1.1.0" }, "Build": { "CMake": { @@ -19,7 +21,7 @@ }, "Package": { "Name": "internal-client", - "VersionTag": "v1.0.0", + "VersionTag": "v1.1.0", "PlatformString": { "Mode": "auto" }, @@ -34,7 +36,8 @@ "debian12", "debian11", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/fleet-protocol-internal-client/internal_client_release.json b/example/package/fleet-protocol-internal-client/internal_client_release.json index 165a6ac..67fca13 100644 --- a/example/package/fleet-protocol-internal-client/internal_client_release.json +++ b/example/package/fleet-protocol-internal-client/internal_client_release.json @@ -1,11 +1,13 @@ { "Env": {}, "DependsOn": [ - "pahomqttc" + "protobuf", + "fleet-protocol-interface", + "zlib" ], "Git": { "URI": "https://github.com/bringauto/internal-client-cpp.git", - "Revision": "v1.0.0" + "Revision": "v1.1.0" }, "Build": { "CMake": { @@ -19,7 +21,7 @@ }, "Package": { "Name": "internal-client", - "VersionTag": "v1.0.0", + "VersionTag": "v1.1.0", "PlatformString": { "Mode": "auto" }, @@ -33,7 +35,8 @@ "debian12", "debian11", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/protobuf/protobuf_debug_v21.12.json b/example/package/protobuf/protobuf_debug_v21.12.json index a384b2f..06a8f2f 100644 --- a/example/package/protobuf/protobuf_debug_v21.12.json +++ b/example/package/protobuf/protobuf_debug_v21.12.json @@ -33,7 +33,8 @@ "debian12", "fleet-os-2", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/protobuf/protobuf_release_v21.12.json b/example/package/protobuf/protobuf_release_v21.12.json index 32b8413..c3bbb93 100644 --- a/example/package/protobuf/protobuf_release_v21.12.json +++ b/example/package/protobuf/protobuf_release_v21.12.json @@ -33,7 +33,8 @@ "debian12", "fleet-os-2", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/zlib/zlib_debug.json b/example/package/zlib/zlib_debug.json index 8725cc0..4804517 100644 --- a/example/package/zlib/zlib_debug.json +++ b/example/package/zlib/zlib_debug.json @@ -29,7 +29,8 @@ "fleet-os-2", "debian12", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } diff --git a/example/package/zlib/zlib_release.json b/example/package/zlib/zlib_release.json index 7bcd673..4a842b1 100644 --- a/example/package/zlib/zlib_release.json +++ b/example/package/zlib/zlib_release.json @@ -29,7 +29,8 @@ "fleet-os-2", "debian12", "ubuntu2304", - "ubuntu2310" + "ubuntu2310", + "ubuntu1804-aarch64" ] } } From f0ff9b6f996b4af0fe601e10256c6cb64c0bac9e Mon Sep 17 00:00:00 2001 From: Josef Melkus Date: Fri, 5 Apr 2024 16:40:42 +0200 Subject: [PATCH 2/3] fix aarch image --- example/docker/ubuntu1804-aarch64/Dockerfile | 24 ++++++------------- .../ubuntu1804-aarch64/init_toolchain.sh | 21 ++++------------ 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/example/docker/ubuntu1804-aarch64/Dockerfile b/example/docker/ubuntu1804-aarch64/Dockerfile index bf4e83c..e8563ac 100644 --- a/example/docker/ubuntu1804-aarch64/Dockerfile +++ b/example/docker/ubuntu1804-aarch64/Dockerfile @@ -5,7 +5,7 @@ RUN echo root:1234 | chpasswd RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ - build-essential make libssl-dev coreutils lsb-release wget g++-8 gcc-8 gcc-8-aarch64-linux-gnu g++-8-aarch64-linux-gnu patchelf unzip && \ + build-essential make libssl-dev coreutils lsb-release wget g++-8 gcc-8 gcc-8-aarch64-linux-gnu g++-8-aarch64-linux-gnu patchelf unzip openssh-server git && \ rm -rf /var/lib/apt/lists/* RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 @@ -15,35 +15,25 @@ RUN wget "https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28. ./cmake.sh --skip-license --prefix=/usr/local && \ rm ./cmake.sh -RUN apt-get update && \ - apt-get purge -y \ - wget && \ - rm -rf /var/lib/apt/lists/* - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - openssh-server git && \ - rm -rf /var/lib/apt/lists/* - RUN git clone https://github.com/cmakelib/cmakelib.git /cmakelib RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config RUN mkdir -p /run/sshd +RUN sed -ri 's/#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config +RUN mkdir /root/.ssh && \ + echo "CXX=${CXX}" > /root/.ssh/environment && \ + echo "CC=${CC}" >> /root/.ssh/environment + COPY init_toolchain.sh /root/ RUN chmod +x /root/init_toolchain.sh && \ - /root/init_toolchain.sh /root/toolchain /root/tools + /root/init_toolchain.sh /root/tools COPY lsb_release.txt /root/tools/ COPY uname.txt /root/tools/ ENV CXX=aarch64-linux-gnu-g++-8 ENV CC=aarch64-linux-gnu-gcc-8 -RUN sed -ri 's/#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config -RUN mkdir /root/.ssh && \ - echo "CXX=${CXX}" > /root/.ssh/environment && \ - echo "CC=${CC}" >> /root/.ssh/environment - ENTRYPOINT ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"] diff --git a/example/docker/ubuntu1804-aarch64/init_toolchain.sh b/example/docker/ubuntu1804-aarch64/init_toolchain.sh index 42254c7..838598b 100644 --- a/example/docker/ubuntu1804-aarch64/init_toolchain.sh +++ b/example/docker/ubuntu1804-aarch64/init_toolchain.sh @@ -2,17 +2,10 @@ set -e -INSTALL_DIR="$1" -TOOLS_INSTALL_DIR="$2" +TOOLS_INSTALL_DIR="$1" TMP_DIR="/tmp/toolchain-install" -TOOLS_PACKAGE_URI="https://github.com/bringauto/packager/releases/download/v0.3.0/bringauto-packager-tools_v0.3.0_x86-64-linux.zip" - -if [[ ${INSTALL_DIR} = "" ]] -then - echo "Specify toolchain absolute install dir path as a first argument!" >&2 - exit 1 -fi +TOOLS_PACKAGE_URI="https://github.com/bringauto/packager/releases/download/v0.3.2/bringauto-packager-tools_v0.3.2_x86-64-linux.zip" if [[ ${TOOLS_INSTALL_DIR} = "" ]] then @@ -20,12 +13,6 @@ then exit 1 fi -if ! [[ -d ${INSTALL_DIR} ]] -then - echo "Install dir '${INSTALL_DIR}' does not exist" -fi - - function install_tools() { if [[ -d ${TMP_DIR} ]] then @@ -47,7 +34,9 @@ function install_tools() { chmod +x "${TOOLS_INSTALL_DIR}/lsb_release" chmod +x "${TOOLS_INSTALL_DIR}/uname" - echo 'PATH='"${TOOLS_INSTALL_DIR}"'/:$PATH' >> /root/.bashrc + TMP_PATH=$PATH + echo 'PATH='"${TOOLS_INSTALL_DIR}"'/:'"${TMP_PATH}"'' >> /root/.ssh/environment + } From ce52a3ec2365bd2a0f828068ad94a2025b4077b1 Mon Sep 17 00:00:00 2001 From: Josef Melkus Date: Fri, 5 Apr 2024 16:44:40 +0200 Subject: [PATCH 3/3] fix CXX variable line --- example/docker/ubuntu1804-aarch64/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/docker/ubuntu1804-aarch64/Dockerfile b/example/docker/ubuntu1804-aarch64/Dockerfile index e8563ac..56eb645 100644 --- a/example/docker/ubuntu1804-aarch64/Dockerfile +++ b/example/docker/ubuntu1804-aarch64/Dockerfile @@ -21,6 +21,9 @@ RUN echo "export CMLIB_DIR=/cmakelib" >> /root/.bashrc RUN sed -ri 's/#?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config RUN mkdir -p /run/sshd +ENV CXX=aarch64-linux-gnu-g++-8 +ENV CC=aarch64-linux-gnu-gcc-8 + RUN sed -ri 's/#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config RUN mkdir /root/.ssh && \ echo "CXX=${CXX}" > /root/.ssh/environment && \ @@ -32,8 +35,5 @@ RUN chmod +x /root/init_toolchain.sh && \ COPY lsb_release.txt /root/tools/ COPY uname.txt /root/tools/ -ENV CXX=aarch64-linux-gnu-g++-8 -ENV CC=aarch64-linux-gnu-gcc-8 - ENTRYPOINT ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]