Arm64 fixes and optimizations (#9274)
* [arm64]: Fix registration of the qemu interpreters The current code doesn't properly run the container that registers the qemu interpreters. It checks to see if the container is "known" by Docker, but that doesn't indicate whether it's been run or not. Therefore, just always register the qemu interpreters in the kernel, to make sure the binary that's in the slave images that we build is used. * [build]: Reduce the number of python calls Modify the BLDENV and PROJECT_ROOT variables in slave.mk to be immediate execution instead of lazy execution. Neither of these variables should be changing for the duration of the build in each slave container, so just run it once instead of every time they're referenced. When running `make configure` for broadcom arm64 (where all of the slave images are already built) on an amd64 host, this reduces the time spent in each slave container from 4.5-5 minutes to 2 minutes. * [sonic-slave]: Upgrade the qemu used for Bullseye arm64 to 6.1.0 Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
This commit is contained in:
parent
b6fad1b67d
commit
9790621198
@ -185,8 +185,10 @@ ifneq ($(SONIC_DPKG_CACHE_SOURCE),)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD), y)
|
ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD), y)
|
||||||
|
ifneq ($(MULTIARCH_QEMU_ENVIRON), y)
|
||||||
DOCKER_RUN += -v /var/run/docker.sock:/var/run/docker.sock
|
DOCKER_RUN += -v /var/run/docker.sock:/var/run/docker.sock
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(MULTIARCH_QEMU_ENVIRON), y)
|
ifeq ($(MULTIARCH_QEMU_ENVIRON), y)
|
||||||
ifeq ($(DOCKER_DATA_ROOT_FOR_MULTIARCH),)
|
ifeq ($(DOCKER_DATA_ROOT_FOR_MULTIARCH),)
|
||||||
@ -206,7 +208,7 @@ endif
|
|||||||
#Override Native config to prevent docker service
|
#Override Native config to prevent docker service
|
||||||
SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=y
|
SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=y
|
||||||
|
|
||||||
DOCKER_MULTIARCH_CHECK := docker inspect --type image multiarch/qemu-user-static:register &> /dev/null || (echo "multiarch docker not found ..."; docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes)
|
DOCKER_MULTIARCH_CHECK := docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
|
||||||
|
|
||||||
DOCKER_SERVICE_SAFE_KILLER := (MARCH_PID=`ps -eo pid,cmd | grep "[0-9] dockerd.*march" | awk '{print $$1}'`; echo "Killing march docker $$MARCH_PID"; [ -z "$$MARCH_PID" ] || sudo kill -9 "$$MARCH_PID";)
|
DOCKER_SERVICE_SAFE_KILLER := (MARCH_PID=`ps -eo pid,cmd | grep "[0-9] dockerd.*march" | awk '{print $$1}'`; echo "Killing march docker $$MARCH_PID"; [ -z "$$MARCH_PID" ] || sudo kill -9 "$$MARCH_PID";)
|
||||||
DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
|
DOCKER_SERVICE_MULTIARCH_CHECK := ($(DOCKER_SERVICE_SAFE_KILLER); sudo rm -fr /var/run/march/; (echo "Starting docker march service..."; sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 2; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
|
||||||
@ -331,6 +333,9 @@ sonic-build-hooks:
|
|||||||
@cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo
|
@cp src/sonic-build-hooks/buildinfo/sonic-build-hooks* $(SLAVE_DIR)/buildinfo
|
||||||
|
|
||||||
sonic-slave-base-build : sonic-build-hooks
|
sonic-slave-base-build : sonic-build-hooks
|
||||||
|
ifeq ($(MULTIARCH_QEMU_ENVIRON), y)
|
||||||
|
@$(DOCKER_MULTIARCH_CHECK)
|
||||||
|
endif
|
||||||
@$(OVERLAY_MODULE_CHECK)
|
@$(OVERLAY_MODULE_CHECK)
|
||||||
@echo Checking sonic-slave-base image: $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG)
|
@echo Checking sonic-slave-base image: $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG)
|
||||||
@docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \
|
@docker inspect --type image $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) &> /dev/null || \
|
||||||
|
4
slave.mk
4
slave.mk
@ -27,12 +27,12 @@ SRC_PATH = src
|
|||||||
RULES_PATH = rules
|
RULES_PATH = rules
|
||||||
TARGET_PATH = target
|
TARGET_PATH = target
|
||||||
DOCKERS_PATH = dockers
|
DOCKERS_PATH = dockers
|
||||||
BLDENV = $(shell lsb_release -cs)
|
BLDENV := $(shell lsb_release -cs)
|
||||||
DEBS_PATH = $(TARGET_PATH)/debs/$(BLDENV)
|
DEBS_PATH = $(TARGET_PATH)/debs/$(BLDENV)
|
||||||
FILES_PATH = $(TARGET_PATH)/files/$(BLDENV)
|
FILES_PATH = $(TARGET_PATH)/files/$(BLDENV)
|
||||||
PYTHON_DEBS_PATH = $(TARGET_PATH)/python-debs/$(BLDENV)
|
PYTHON_DEBS_PATH = $(TARGET_PATH)/python-debs/$(BLDENV)
|
||||||
PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels/$(BLDENV)
|
PYTHON_WHEELS_PATH = $(TARGET_PATH)/python-wheels/$(BLDENV)
|
||||||
PROJECT_ROOT = $(shell pwd)
|
PROJECT_ROOT := $(shell pwd)
|
||||||
JESSIE_DEBS_PATH = $(TARGET_PATH)/debs/jessie
|
JESSIE_DEBS_PATH = $(TARGET_PATH)/debs/jessie
|
||||||
JESSIE_FILES_PATH = $(TARGET_PATH)/files/jessie
|
JESSIE_FILES_PATH = $(TARGET_PATH)/files/jessie
|
||||||
STRETCH_DEBS_PATH = $(TARGET_PATH)/debs/stretch
|
STRETCH_DEBS_PATH = $(TARGET_PATH)/debs/stretch
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
{%- if CONFIGURED_ARCH == "armhf" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
||||||
FROM multiarch/qemu-user-static:x86_64-arm-5.2.0-2 as qemu
|
FROM multiarch/qemu-user-static:x86_64-arm-6.1.0-8 as qemu
|
||||||
FROM multiarch/debian-debootstrap:armhf-bullseye
|
FROM multiarch/debian-debootstrap:armhf-bullseye
|
||||||
COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
|
COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
|
||||||
{%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
{%- elif CONFIGURED_ARCH == "arm64" and MULTIARCH_QEMU_ENVIRON == "y" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user