Skip to content

Commit

Permalink
Merge pull request #4639 from taocy001/arm64_buster_build
Browse files Browse the repository at this point in the history
1. On the ARM architecture, python-j2cli is installed from source code,  depends on python-setuptools and python-wheel.
2. On the ARM architecture, install python-cryptography from source code(from azure-storage==0.36.0) depends on libffi-dev and libssl-dev.
3. install crossbuild in buster slave for arm arch kernel compile.
4. Versions before 18.09 do not install docker-ce-cli.
5. umount /proc after dockerfs.
6. change image apt source list from stretch to buster for arm.
  • Loading branch information
lguohan authored May 26, 2020
2 parents 3d0b65d + 4cd3617 commit 961d980
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 28 deletions.
7 changes: 6 additions & 1 deletion build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
9 changes: 5 additions & 4 deletions dockers/docker-base-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions dockers/docker-base-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -461,14 +463,14 @@ 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
sudo kill -9 `sudo $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS_PID` || true
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/
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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

7 changes: 6 additions & 1 deletion sonic-slave-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}
Expand Down Expand Up @@ -414,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
2 changes: 1 addition & 1 deletion sonic-slave-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 961d980

Please sign in to comment.