Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported Marvell armhf build on amd64 host for debian buster to use cross-comp… #8035

Merged
merged 37 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b8e21f6
Ported Marvell armhf build on x86 for debian buster to use cross-comp…
Jun 30, 2021
c090db1
Fixed final Sonic image build with dockers inside
Aug 15, 2021
0575054
Update Dockerfile.j2
gregshpit Aug 26, 2021
eba55b6
Update cross-build-arm-python-reqirements.sh
gregshpit Sep 12, 2021
1acb980
Update Makefile
gregshpit Sep 14, 2021
3da08d9
Reviewer's @qiluo-msft requests done
Nov 17, 2021
fcb2b8b
Added new radius/pam patch for arm64 support
Nov 21, 2021
1e079dc
Update slave.mk
gregshpit Nov 21, 2021
c66756d
Added libgtest-dev: libgmock-dev: to the buster Dockerfile.j2. Fixed …
Dec 2, 2021
e153741
Merged with the upstream
Dec 2, 2021
a8e69e5
Added missing armhf/arm64 entries in /etc/apt/sources.list
Dec 6, 2021
b4376b2
Merge remote-tracking branch 'upstream/master'
Dec 9, 2021
6a912bb
fix libc-bin core dump issue from xumia:fix-libc-bin-install-issue co…
Dec 16, 2021
3e32281
Merge branch 'master' into master
gregshpit Dec 16, 2021
a5c6ba3
Removed unnecessary 'apt-get update' from sonic-slave-buster/Dockerfi…
Dec 19, 2021
cedf62c
Fixed saiarcot895 reviewer's requests
Mar 7, 2022
3ef6968
Fixed README and replaced 'sed/awk' with patches
Mar 17, 2022
4f69553
Fixed ntp build to use openssl
Mar 27, 2022
80446dd
Unuse sonic-slave-buster/cross-build-arm-python-reqirements.sh script…
Apr 5, 2022
c095ecd
Merged with the upstream
Apr 24, 2022
e44472e
Clean armhf cross-compilation build fixes
May 3, 2022
bdc6c47
Ported cross-compilation armhf build to bullseye
Jun 16, 2022
6d37a00
Additional change for bullseye
Jun 21, 2022
c38b5d0
Merged with Azure upstream
Jun 21, 2022
d10c812
Set CROSS_BUILD_ENVIRON default value n
Jun 21, 2022
db50dbf
Removed python2 references
Jun 22, 2022
ec639e8
Fixes after merge with the upstream
Jun 26, 2022
9d7ab8c
Deleted unused sonic-slave-buster/cross-build-arm-python-reqirements.…
Jun 27, 2022
544993d
Fixed 2 @saiarcot895 requests
Jun 29, 2022
e7d1fa5
Fixed @saiarcot895 reviewer's requests
Jun 30, 2022
844a2d9
Removed use of prebuilt python wheels
Jul 6, 2022
ca07e21
Merge branch 'master' into master
gregshpit Jul 6, 2022
5290e07
Incorporated saiarcot895 CC/CXX and other simplification/generalizati…
Jul 13, 2022
ca03d67
Fixed saiarcot895 reviewer's additional requests
Jul 18, 2022
f6ef895
merge with the upstream
Jul 18, 2022
26f479e
src/libyang/patch/debian-packaging-files.patch
Jul 18, 2022
c20e081
Removed --no-deps option when installing wheels. Removed unnecessary …
Jul 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,21 @@ endif
ifeq ($(CONFIGURED_ARCH),amd64)
SLAVE_BASE_IMAGE = $(SLAVE_DIR)
MULTIARCH_QEMU_ENVIRON = n
CROSS_BUILD_ENVIRON = n
else
ifeq ($(CONFIGURED_ARCH), $(COMPILE_HOST_ARCH))
SLAVE_BASE_IMAGE = $(SLAVE_DIR)
MULTIARCH_QEMU_ENVIRON = n
CROSS_BUILD_ENVIRON = n
else ifneq ($(CONFIGURED_ARCH),)
SLAVE_BASE_IMAGE = $(SLAVE_DIR)-march-$(CONFIGURED_ARCH)
saiarcot895 marked this conversation as resolved.
Show resolved Hide resolved
ifneq ($(CROSS_BLDENV),)
MULTIARCH_QEMU_ENVIRON = n
CROSS_BUILD_ENVIRON = y
Copy link
Collaborator

@qiluo-msft qiluo-msft Sep 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CROSS_BUILD_ENVIRON

The 2 variable names are confusing: CROSS_BUILD_ENVIRON vs CROSS_BLDENV. What is the difference? Can we use one? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CROSS_BLDENV is used only on the building/configuring command line to trigger cross-compilation build instead of the default qemu build. Like this:
NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make target/sonic-marvell-armhf.bin

CROSS_BUILD_ENVIRON is internal variabled used everywhere in the Makefiles.

Please see the PR description above for more info.

else
MULTIARCH_QEMU_ENVIRON = y
CROSS_BUILD_ENVIRON = n
endif
endif
endif
SLAVE_IMAGE = $(SLAVE_BASE_IMAGE)-$(USER_LC)
Expand All @@ -157,8 +165,8 @@ $(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
scripts/generate_buildinfo_config.sh)

# Generate the slave Dockerfile, and prepare build info for it
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user)
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) ENABLE_FIPS_FEATURE=$(ENABLE_FIPS_FEATURE) DOCKER_EXTRA_OPTS=$(DOCKER_EXTRA_OPTS) DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user)
$(shell BUILD_SLAVE=y DEFAULT_CONTAINER_REGISTRY=$(DEFAULT_CONTAINER_REGISTRY) scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV))

# Add the versions in the tag, if the version change, need to rebuild the slave
Expand Down Expand Up @@ -260,7 +268,7 @@ ifneq ($(MULTIARCH_QEMU_ENVIRON), y)
endif
endif

ifeq ($(MULTIARCH_QEMU_ENVIRON), y)
ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)
Copy link
Contributor

@vivekrnv vivekrnv Sep 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gregshpit,

Why should the slave container be using /var/run/march/docker.sock, /var/run/march/docker.pid instead of /var/run/docker.sock & /var/run/docker.pid as it seems you were pulling the slave docker FROM debian:buster as opposed to the qemu compilation which uses FROM multiarch/debian-debootstrap:arm64-buster

My build server (amd64), which i've traditionally used to compile amd64 targets doesn't have /var/run/march/docker.sock & /var/run/march/docker.pid and is failing when trying to build any DOCKER_TARGETS using cross compilation.

But it is working, when i'm restoring this condition to the original i.e. using the /var/run/docker.sock & /var/run/docker.pid even when doing the cross compilation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/var/run/march/docker.sock docker daemon should start automatically. But there is a bug in Makefile.work. To make the automation work in cross-compilation mode please replace line 297 in Makefile.work:
-ifeq ($(MULTIARCH_QEMU_ENVIRON), y)

with
+ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)

This should start the march docker daemon automatically.
Let me know if it helped.

Copy link
Contributor

@vivekrnv vivekrnv Oct 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case though, it didn't work with the new condition. i.e using this command:

docker run --rm=true --privileged --init -v <build_dir>/sonic-buildimage:/sonic -w /sonic -e http_proxy= -e https_proxy= -e no_proxy= -it -v /var/cache/sonic/artifacts:/dpkg_cache:rw -v /var/run/march/docker.sock:/var/run/docker.sock -v /var/run/march/docker.pid:/var/run/docker.pid -v /var/run/march/docker:/var/run/docker -v /var/lib/march/docker:/var/lib/docker

probably because i didn't have the /var/run/march/docker.sock setup. I've raised a query in the community. if you have some pointers on this, please do share.

#8898

ifeq ($(DOCKER_DATA_ROOT_FOR_MULTIARCH),)
DOCKER_DATA_ROOT_FOR_MULTIARCH := /var/lib/march/docker
endif
Expand Down Expand Up @@ -332,6 +340,7 @@ SONIC_BUILD_INSTRUCTION := make \
PLATFORM=$(PLATFORM) \
PLATFORM_ARCH=$(PLATFORM_ARCH) \
MULTIARCH_QEMU_ENVIRON=$(MULTIARCH_QEMU_ENVIRON) \
CROSS_BUILD_ENVIRON=$(CROSS_BUILD_ENVIRON) \
BUILD_NUMBER=$(BUILD_NUMBER) \
BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) \
SONIC_IMAGE_VERSION=$(SONIC_IMAGE_VERSION) \
Expand Down Expand Up @@ -391,7 +400,7 @@ SONIC_BUILD_INSTRUCTION := make \
.DEFAULT_GOAL := all

%::
ifeq ($(MULTIARCH_QEMU_ENVIRON), y)
ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)
@$(DOCKER_MULTIARCH_CHECK)
ifneq ($(BLDENV), )
@$(DOCKER_SERVICE_MULTIARCH_CHECK)
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ To build Arm32 bit for (ARMHF) platform

make target/sonic-marvell-armhf.bin

To build Arm32 bit for (ARMHF) Marvell platform on amd64 host for debian buster using cross-compilation run the following commands:

# Execute make configure once to configure ASIC and ARCH for cross-compilation build

NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make configure PLATFORM=marvell-armhf PLATFORM_ARCH=armhf

# Execute Arm32 build using cross-compilation environment

NOJESSIE=1 NOSTRETCH=1 BLDENV=buster CROSS_BLDENV=1 make target/sonic-marvell-armhf.bin
Copy link
Contributor

@saiarcot895 saiarcot895 Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated for Bullseye, I think?


Running the above Arm32 build using cross-compilation instead of qemu emulator drastically reduces the build time.


To build Arm64 bit for platform
Expand Down
6 changes: 5 additions & 1 deletion build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ echo 'Dir::Bin::dpkg "/usr/local/bin/dpkg";' | sudo tee $FILESYSTEM_ROOT/etc/apt
echo '[INFO] Install packages for building image'
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install makedev psmisc

if [[ $CROSS_BUILD_ENVIRON == y ]]; then
sudo LANG=C chroot $FILESYSTEM_ROOT dpkg --add-architecture $CONFIGURED_ARCH
fi

## Create device files
echo '[INFO] MAKEDEV'
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
Expand Down Expand Up @@ -637,7 +641,7 @@ fi
# ALERT: This bit of logic tears down the qemu based build environment used to
# perform builds for the ARM architecture. This must be the last step in this
# script before creating the Sonic installer payload zip file.
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
if [[ $MULTIARCH_QEMU_ENVIRON == y || $CROSS_BUILD_ENVIRON == y ]]; then
# Remove qemu arm bin executable used for cross-building
sudo rm -f $FILESYSTEM_ROOT/usr/bin/qemu*static || true
DOCKERFS_PATH=../dockerfs/
Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-base-bullseye/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
{% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
{% if CONFIGURED_ARCH == "armhf" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
FROM {{ prefix }}multiarch/debian-debootstrap:armhf-bullseye
{% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %}
{% elif CONFIGURED_ARCH == "arm64" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
FROM {{ prefix }}multiarch/debian-debootstrap:arm64-bullseye
{% else %}
FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:bullseye
Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-base-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
{% if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
{% if CONFIGURED_ARCH == "armhf" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
FROM {{ prefix }}multiarch/debian-debootstrap:armhf-buster
{% elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %}
{% elif CONFIGURED_ARCH == "arm64" and (MULTIARCH_QEMU_ENVIRON == "y" or CROSS_BUILD_ENVIRON == "y") %}
FROM {{ prefix }}multiarch/debian-debootstrap:arm64-buster
{% else %}
FROM {{ prefix }}{{DOCKER_BASE_ARCH}}/debian:buster
Expand Down
8 changes: 8 additions & 0 deletions dockers/docker-config-engine-bullseye/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ RUN apt-get install -y \
libz-dev
{%- endif %}

{%- if CROSS_BUILD_ENVIRON == "y" %}
RUN mkdir prebuilt-python-wheels
COPY prebuilt-python-wheels/* prebuilt-python-wheels/
RUN pip3 install prebuilt-python-wheels/lxml*cp3*.whl
RUN pip3 install prebuilt-python-wheels/bitarray*cp3*.whl
RUN rm -rf prebuilt-python-wheels
{%- endif %}

# For sonic-config-engine Python 3 package
# Explicitly install pyangbind here, as pyangbind causes enum34 to be installed.
# enum34 causes Python 're' package to not work properly as it redefines an incompatible enum.py module
Expand Down
8 changes: 8 additions & 0 deletions dockers/docker-config-engine-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ RUN apt-get install -y \
libz-dev
{%- endif %}

{%- if CROSS_BUILD_ENVIRON == "y" %}
RUN mkdir prebuilt-python-wheels
COPY prebuilt-python-wheels/* prebuilt-python-wheels/
RUN pip3 install prebuilt-python-wheels/lxml*cp3*.whl
RUN pip3 install prebuilt-python-wheels/bitarray*cp3*.whl
RUN rm -rf prebuilt-python-wheels
{%- endif %}

# For sonic-config-engine Python 3 package
# Explicitly install pyangbind here, as pyangbind causes enum34 to be installed.
# enum34 causes Python 're' package to not work properly as it redefines an incompatible enum.py module
Expand Down
7 changes: 7 additions & 0 deletions dockers/docker-platform-monitor/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ RUN apt-get update && \
python3-jsonschema \
libpci3

{%- if CROSS_BUILD_ENVIRON == "y" %}
RUN mkdir prebuilt-python-wheels
COPY prebuilt-python-wheels/* prebuilt-python-wheels/
RUN pip3 install prebuilt-python-wheels/lxml*cp3*.whl
RUN rm -rf prebuilt-python-wheels
{%- endif %}

# On Arista devices, the sonic_platform wheel is not installed in the container.
# Instead, the installation directory is mounted from the host OS. However, this method
# doesn't ensure all dependencies are installed in the container. So here we
Expand Down
7 changes: 7 additions & 0 deletions dockers/docker-sonic-mgmt-framework/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y g++ python3-dev libxml2 libcurl3-gnutls libcjson-dev

{%- if CROSS_BUILD_ENVIRON == "y" %}
RUN mkdir prebuilt-python-wheels
COPY prebuilt-python-wheels/* prebuilt-python-wheels/
RUN pip3 install prebuilt-python-wheels/grpcio*cp3*.whl
RUN rm -rf prebuilt-python-wheels
{%- endif %}

RUN pip3 install connexion==2.7.0 \
setuptools==21.0.0 \
grpcio-tools==1.20.0 \
Expand Down
6 changes: 3 additions & 3 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sudo bash -c "echo \"DOCKER_OPTS=\"--storage-driver=overlay2\"\" >> $FILESYSTEM_
# Copy docker start script to be able to start docker in chroot
sudo mkdir -p "$FILESYSTEM_ROOT/$DOCKER_CTL_DIR"
sudo cp $DOCKER_SCRIPTS_DIR/docker "$FILESYSTEM_ROOT/$DOCKER_CTL_SCRIPT"
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
if [[ $MULTIARCH_QEMU_ENVIRON == y || $CROSS_BUILD_ENVIRON == y ]]; then
DOCKER_HOST="unix:///dockerfs/var/run/docker.sock"
SONIC_NATIVE_DOCKERD_FOR_DOCKERFS_PID="cat `pwd`/dockerfs/var/run/docker.pid"
else
Expand Down Expand Up @@ -652,7 +652,7 @@ EOF
{% endif %}

## Bind docker path
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
if [[ $MULTIARCH_QEMU_ENVIRON == y || $CROSS_BUILD_ENVIRON == y ]]; then
sudo mkdir -p $FILESYSTEM_ROOT/dockerfs
sudo mount --bind dockerfs $FILESYSTEM_ROOT/dockerfs
fi
Expand Down Expand Up @@ -737,7 +737,7 @@ sudo LANG=C DOCKER_HOST="$DOCKER_HOST" chroot $FILESYSTEM_ROOT sonic-package-man

sudo umount $FILESYSTEM_ROOT/target
sudo rm -r $FILESYSTEM_ROOT/target
if [ $MULTIARCH_QEMU_ENVIRON == y ]; then
if [[ $MULTIARCH_QEMU_ENVIRON == y || $CROSS_BUILD_ENVIRON == y ]]; then
sudo umount $FILESYSTEM_ROOT/dockerfs
sudo rm -fr $FILESYSTEM_ROOT/dockerfs
sudo kill -9 `sudo $SONIC_NATIVE_DOCKERD_FOR_DOCKERFS_PID` || true
Expand Down
2 changes: 2 additions & 0 deletions platform/marvell-armhf/prestera/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
include /usr/share/dpkg/pkg-info.mk

PACKAGE_PRE_NAME := mrvlprestera
ifneq ($(CROSS_BUILD_ENVIRON), y)
KVERSION ?= $(shell uname -r)
endif
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIR := mrvl-prestera/cpssEnabler/linuxNoKernelModule/drivers
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_debian_base_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ generate_version_file()

if [ "$ENABLE_VERSION_CONTROL_DEB" != "y" ] || [ ! -d files/build/versions/host-base-image ]; then
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
if [ $MULTIARCH_QEMU_ENVIRON == "y" ]; then
if [[ $MULTIARCH_QEMU_ENVIRON == y || $CROSS_BUILD_ENVIRON == y ]]; then
# qemu arm bin executable for cross-building
sudo mkdir -p $FILESYSTEM_ROOT/usr/bin
sudo cp /usr/bin/qemu*static $FILESYSTEM_ROOT/usr/bin || true
Expand Down
10 changes: 10 additions & 0 deletions scripts/prepare_docker_buildinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,20 @@ DISTRO=$5
DOCKERFILE_PATH=$(dirname "$DOCKERFILE_TARGE")
BUILDINFO_PATH="${DOCKERFILE_PATH}/buildinfo"
BUILDINFO_VERSION_PATH="${BUILDINFO_PATH}/versions"
if [[ $CROSS_BUILD_ENVIRON == y ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$CROSS_BUILD_ENVIRON

This file is to implement reproducible feature sonic-net/SONiC#684. Why you add here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to copy prebuilt (cross-compiled) python wheels to the dockers directory in order to be installed in the dockers Docker.j2 file. See for example dockers/docker-config-engine-buster/Dockerfile.j2.
Please suggest what and where to do it if this file is inappropriate.
Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you treat them as normal Makefile target and normal dependencies of others?

PREBUILT_PYTHON_WHEELS_PATH="${DOCKERFILE_PATH}/prebuilt-python-wheels"
fi

[ -d $BUILDINFO_PATH ] && rm -rf $BUILDINFO_PATH
mkdir -p $BUILDINFO_VERSION_PATH

if [[ $CROSS_BUILD_ENVIRON == y ]]; then
# Copy pre-compiled (cross-compiled) python wheels used in dockers
[ -d $PREBUILT_PYTHON_WHEELS_PATH ] && rm -rf $PREBUILT_PYTHON_WHEELS_PATH
mkdir -p $PREBUILT_PYTHON_WHEELS_PATH
cp -rf /PRE_BUILT_TARGET/* $PREBUILT_PYTHON_WHEELS_PATH
fi

# Get the debian distribution from the docker base image
if [ -z "$DISTRO" ]; then
DOCKER_BASE_IMAGE=$(grep "^FROM" $DOCKERFILE | head -n 1 | awk '{print $2}')
Expand Down
Loading