From 00e7e14927196d7e3d526fe319ee0780413fb8e2 Mon Sep 17 00:00:00 2001 From: taocy Date: Thu, 21 May 2020 07:22:19 +0000 Subject: [PATCH 1/5] Install the libraries that j2cli relies on from source, for arm arch. --- dockers/docker-base-buster/Dockerfile.j2 | 9 +++++---- dockers/docker-base-stretch/Dockerfile.j2 | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dockers/docker-base-buster/Dockerfile.j2 b/dockers/docker-base-buster/Dockerfile.j2 index 5056d9c724..fcf9832295 100644 --- a/dockers/docker-base-buster/Dockerfile.j2 +++ b/dockers/docker-base-buster/Dockerfile.j2 @@ -62,12 +62,13 @@ RUN apt-get update && \ libpython2.7 \ libdaemon0 \ libdbus-1-3 \ - libjansson4 - + libjansson4 \ # ip and ifconfig utility missing in docker for arm arch -RUN apt-get -y install \ iproute2 \ - net-tools + net-tools \ +# for arm arch: Installing j2cli dependency package MarkupSafe from source relies on weeksetuptools and wheel + python-setuptools \ + python-wheel # For templating RUN pip install j2cli diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index 8907a77e6b..30e59eccf7 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -60,12 +60,13 @@ RUN apt-get update && \ libpython2.7 \ libdaemon0 \ libdbus-1-3 \ - libjansson4 - + libjansson4 \ # ip and ifconfig utility missing in docker for arm arch -RUN apt-get -y install \ iproute2 \ - net-tools + net-tools \ +# for arm arch: Installing j2cli dependency package MarkupSafe from source relies on weeksetuptools and wheel + python-setuptools \ + python-wheel # For templating RUN pip install j2cli From dc0f01006620b86dedc554864a8a25c4fd28a1bc Mon Sep 17 00:00:00 2001 From: taocy Date: Thu, 21 May 2020 07:37:07 +0000 Subject: [PATCH 2/5] install crossbuild in buster slave for arm arch kernel compile --- sonic-slave-buster/Dockerfile.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index cdf2476ca5..c855521374 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -315,6 +315,11 @@ RUN sudo augtool --autosave "set /files/etc/dpkg/dpkg.cfg/force-confold" # For linux build RUN apt-get -y build-dep linux +# For march kernel compile +RUN apt-get install -y crossbuild-essential-amd64 \ + crossbuild-essential-arm64 \ + crossbuild-essential-armhf + # For gobgp and telemetry build RUN export VERSION=1.14.2 \ {%- if CONFIGURED_ARCH == "armhf" %} From 3be2fc56ba12aa0e6f6b8349581a12325885b81e Mon Sep 17 00:00:00 2001 From: taocy Date: Thu, 21 May 2020 12:09:06 +0000 Subject: [PATCH 3/5] Versions before 18.09 do not install docker-ce-cli --- build_debian.sh | 7 ++++++- sonic-slave-buster/Dockerfile.j2 | 2 +- sonic-slave-stretch/Dockerfile.j2 | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index a805d34b93..8d1db8ca37 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -204,7 +204,12 @@ sudo LANG=C chroot $FILESYSTEM_ROOT rm /tmp/docker.gpg sudo LANG=C chroot $FILESYSTEM_ROOT add-apt-repository \ "deb [arch=$CONFIGURED_ARCH] https://download.docker.com/linux/debian $IMAGE_DISTRO stable" sudo LANG=C chroot $FILESYSTEM_ROOT apt-get update -sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} +if dpkg --compare-versions ${DOCKER_VERSION} ge "18.09"; then + sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION} +else + sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install docker-ce=${DOCKER_VERSION} +fi + sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y remove software-properties-common gnupg2 if [ "$INSTALL_KUBERNETES" == "y" ] diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index c855521374..315befbd2b 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -419,7 +419,7 @@ RUN apt-get update {%- if CONFIGURED_ARCH == "amd64" %} RUN apt-get install -y docker-ce=5:18.09.5~3-0~debian-buster docker-ce-cli=5:18.09.5~3-0~debian-buster {%- else %} -RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian docker-ce-cli=18.06.3~ce~3-0~debian +RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian {%- endif %} RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker RUN update-alternatives --set iptables /usr/sbin/iptables-legacy diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index 1844053d52..2f700a024a 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -429,6 +429,6 @@ RUN apt-get update {%- if CONFIGURED_ARCH == "amd64" %} RUN apt-get install -y docker-ce=5:18.09.5~3-0~debian-stretch docker-ce-cli=5:18.09.5~3-0~debian-stretch {%- else %} -RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian docker-ce-cli=18.06.3~ce~3-0~debian +RUN apt-get install -y docker-ce=18.06.3~ce~3-0~debian {%- endif %} RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker From ea2dd9541d502ec4761ebd7c815be8c55712651d Mon Sep 17 00:00:00 2001 From: taocy Date: Sat, 23 May 2020 18:21:28 +0000 Subject: [PATCH 4/5] change image apt source list from stretch to buster for arm --- .../arm64/debian_mirror_arm64.list | 16 ++++++++-------- .../armhf/debian_mirror_armhf.list | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list b/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list index 773f58882a..9e7dec92d3 100644 --- a/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list +++ b/files/image_config/apt/sources.list.d/arm64/debian_mirror_arm64.list @@ -1,9 +1,9 @@ -deb [arch=arm64] http://deb.debian.org/debian stretch main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian stretch main contrib non-free -deb [arch=arm64] http://deb.debian.org/debian stretch-updates main contrib non-free -deb-src [arch=arm64] http://deb.debian.org/debian stretch-updates main contrib non-free -deb [arch=arm64] http://security.debian.org stretch/updates main contrib non-free -deb-src [arch=arm64] http://security.debian.org stretch/updates main contrib non-free -deb [arch=arm64] https://download.docker.com/linux/debian stretch stable -deb [arch=arm64] http://ftp.debian.org/debian stretch-backports main +deb [arch=arm64] http://deb.debian.org/debian buster main contrib non-free +deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free +deb [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free +deb-src [arch=arm64] http://deb.debian.org/debian buster-updates main contrib non-free +deb [arch=arm64] http://security.debian.org buster/updates main contrib non-free +deb-src [arch=arm64] http://security.debian.org buster/updates main contrib non-free +deb [arch=arm64] https://download.docker.com/linux/debian buster stable +deb [arch=arm64] http://ftp.debian.org/debian buster-backports main diff --git a/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list b/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list index 501419c673..a7b831ef30 100644 --- a/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list +++ b/files/image_config/apt/sources.list.d/armhf/debian_mirror_armhf.list @@ -1,9 +1,9 @@ -deb [arch=armhf] http://deb.debian.org/debian stretch main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian stretch main contrib non-free -deb [arch=armhf] http://deb.debian.org/debian stretch-updates main contrib non-free -deb-src [arch=armhf] http://deb.debian.org/debian stretch-updates main contrib non-free -deb [arch=armhf] http://security.debian.org stretch/updates main contrib non-free -deb-src [arch=armhf] http://security.debian.org stretch/updates main contrib non-free -deb [arch=armhf] https://download.docker.com/linux/debian stretch stable -deb [arch=armhf] http://ftp.debian.org/debian stretch-backports main +deb [arch=armhf] http://deb.debian.org/debian buster main contrib non-free +deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free +deb [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free +deb-src [arch=armhf] http://deb.debian.org/debian buster-updates main contrib non-free +deb [arch=armhf] http://security.debian.org buster/updates main contrib non-free +deb-src [arch=armhf] http://security.debian.org buster/updates main contrib non-free +deb [arch=armhf] https://download.docker.com/linux/debian buster stable +deb [arch=armhf] http://ftp.debian.org/debian buster-backports main From 4cd36175ceb450b752313c6f0db90991e30f332c Mon Sep 17 00:00:00 2001 From: taocy Date: Sun, 24 May 2020 02:37:24 +0000 Subject: [PATCH 5/5] arm arch: 1. install required libraries; 2. umount /proc after dockerfs. --- files/build_templates/sonic_debian_extension.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 81463d2073..398fa173e3 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -268,6 +268,8 @@ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable core_uploader.service sudo cp $IMAGE_CONFIGS/corefile_uploader/core_uploader.py $FILESYSTEM_ROOT/usr/bin/ sudo cp $IMAGE_CONFIGS/corefile_uploader/core_analyzer.rc.json $FILESYSTEM_ROOT_ETC_SONIC/ sudo chmod og-rw $FILESYSTEM_ROOT_ETC_SONIC/core_analyzer.rc.json + +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install libffi-dev libssl-dev sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install azure-storage==0.36.0 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install watchdog==0.10.2 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install futures==3.3.0 @@ -461,7 +463,6 @@ echo "docker images pull complete" sudo umount $FILESYSTEM_ROOT/target sudo rm -r $FILESYSTEM_ROOT/target -sudo umount /proc || true if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then sudo umount $FILESYSTEM_ROOT/dockerfs sudo rm -fr $FILESYSTEM_ROOT/dockerfs @@ -469,6 +470,7 @@ if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then else sudo chroot $FILESYSTEM_ROOT service docker stop fi +sudo umount /proc || true sudo rm $FILESYSTEM_ROOT/etc/init.d/docker {% for script in installer_start_scripts.split(' ') -%} sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/