diff --git a/Makefile.work b/Makefile.work index a507439679e9..ba88f594c4f5 100644 --- a/Makefile.work +++ b/Makefile.work @@ -311,8 +311,8 @@ endif ifeq ($(DOCKER_BUILDER_WORKDIR),) override DOCKER_BUILDER_WORKDIR := "/sonic" endif - -DOCKER_RUN := docker run --rm=true --privileged --init \ +HOSTNET := --network=host +DOCKER_RUN := docker run $(HOSTNET) --rm=true --privileged --init \ -v $(DOCKER_BUILDER_MOUNT) \ -v "$(DOCKER_LOCKDIR):$(DOCKER_LOCKDIR)" \ -w $(DOCKER_BUILDER_WORKDIR) \ @@ -331,6 +331,7 @@ ifneq ($(DOCKER_BUILDER_USER_MOUNT),) DOCKER_RUN += $(foreach mount,$(subst $(comma), ,$(DOCKER_BUILDER_USER_MOUNT)), $(addprefix -v , $(mount))) endif +DOCKER_RUN += --mount type=tmpfs,destination=/bld-tmp,tmpfs-mode=1777 ifdef SONIC_BUILD_QUIETER DOCKER_RUN += -e "SONIC_BUILD_QUIETER=$(SONIC_BUILD_QUIETER)" endif @@ -444,7 +445,8 @@ DOCKER_BASE_LOG = $(SLAVE_DIR)/$(SLAVE_BASE_IMAGE)_$(SLAVE_BASE_TAG).log DOCKER_LOG = $(SLAVE_DIR)/$(SLAVE_IMAGE)_$(SLAVE_TAG).log -DOCKER_SLAVE_BASE_BUILD = docker build --no-cache \ +DOCKER_AUTH:=docker login -u sonicbrcm -p 4b5d1f28-6f43-41da-a794-88805ee8fc2d +DOCKER_SLAVE_BASE_BUILD = $(DOCKER_AUTH);docker build $(HOSTNET) --no-cache \ -t $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) \ --build-arg http_proxy=$(http_proxy) \ --build-arg https_proxy=$(https_proxy) \ @@ -454,10 +456,10 @@ DOCKER_SLAVE_BASE_BUILD = docker build --no-cache \ $(SLAVE_DIR) \ $(SPLIT_LOG) $(DOCKER_BASE_LOG) -DOCKER_BASE_PULL = docker pull \ - $(REGISTRY_SERVER):$(REGISTRY_PORT)$(REGISTRY_SERVER_PATH)/$(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) +DOCKER_BASE_PULL = $(DOCKER_AUTH);docker pull \ + $(REGISTRY_SERVER):$(REGISTRY_PORT)/$(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) -DOCKER_USER_BUILD = docker build --no-cache \ +DOCKER_USER_BUILD = $(DOCKER_AUTH);docker build $(HOSTNET) --no-cache \ --build-arg user=$(USER) \ --build-arg uid=$(shell id -u) \ --build-arg guid=$(shell id -g) \ diff --git a/build_debian.sh b/build_debian.sh index c507275d111d..541c22825364 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -63,6 +63,11 @@ if [ "$IMAGE_TYPE" = "aboot" ]; then TARGET_BOOTLOADER="aboot" fi +FILESYSTEM_BASE=/sonic/build +mkdir -p ${FILESYSTEM_BASE} +sudo mount -t tmpfs -o size=16G tmpfs ${FILESYSTEM_BASE} || true +FILESYSTEM_ROOT=${FILESYSTEM_BASE}/fsroot + ## Check if not a last stage of RFS build if [[ $RFS_SPLIT_LAST_STAGE != y ]]; then diff --git a/rules/bash.mk b/rules/bash.mk index 48c089c49e0d..ddccdad76fde 100644 --- a/rules/bash.mk +++ b/rules/bash.mk @@ -6,7 +6,7 @@ # Bash major release-number corresponding to Debian-11 (Bullseye) BASH_VERSION_MAJOR = 5.1 # Bash complete release-number. This image contains all 5.1 fixes up to patch '2'. -BASH_VERSION_FULL = $(BASH_VERSION_MAJOR)-2 +BASH_VERSION_FULL = $(BASH_VERSION_MAJOR)-2+deb11u1 export BASH_VERSION_MAJOR BASH_VERSION_FULL diff --git a/rules/config b/rules/config index d0a4b8cb58bb..f5c541f6fdde 100644 --- a/rules/config +++ b/rules/config @@ -10,11 +10,11 @@ # SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build. # Corresponding -j argument will be passed to make command inside docker # container. -SONIC_CONFIG_BUILD_JOBS = 1 +SONIC_CONFIG_BUILD_JOBS = 8 # SONIC_CONFIG_MAKE_JOBS - set number of parallel make jobs per package. # Corresponding -j argument will be passed to make/dpkg commands that build separate packages -SONIC_CONFIG_MAKE_JOBS = $(shell nproc) +SONIC_CONFIG_MAKE_JOBS = 8 # DEFAULT_BUILD_LOG_TIMESTAMP - add timestamp in build log # Supported format: simple, none @@ -118,8 +118,8 @@ FRR_USER_GID = 300 # rcache : Use cache if exists, but dont update the cache # cache : Same as rwcache # SONIC_DPKG_CACHE_SOURCE - Stores the cache location details -SONIC_DPKG_CACHE_METHOD ?= none -SONIC_DPKG_CACHE_SOURCE ?= /var/cache/sonic/artifacts +SONIC_DPKG_CACHE_METHOD ?= cache +SONIC_DPKG_CACHE_SOURCE ?= /projects/csg_sonic/dpkg_cache/community/ # Default VS build memory preparation DEFAULT_VS_PREPARE_MEM = yes diff --git a/rules/functions b/rules/functions index 44a6af3ddcfb..8b9482bfe921 100644 --- a/rules/functions +++ b/rules/functions @@ -171,9 +171,12 @@ define SETUP_OVERLAYFS_FOR_DPKG_ADMINDIR upperdir=$(shell mktemp -d -p $(DPKG_ADMINDIR_PATH)) workdir=$(shell mktemp -d -p $(DPKG_ADMINDIR_PATH)) mergedir=$(shell mktemp -d -p $(DPKG_ADMINDIR_PATH)) +#echo sudo mount -t overlay overlay -olowerdir=/var/lib/dpkg,upperdir=$$upperdir,workdir=$$workdir $$mergedir sudo mount -t overlay overlay -olowerdir=/var/lib/dpkg,upperdir=$$upperdir,workdir=$$workdir $$mergedir export SONIC_DPKG_ADMINDIR=$$mergedir trap "sudo umount $$mergedir && rm -rf $$mergedir $$upperdir $$workdir" EXIT +#mergedir=$(echo -n /var/lib/dpkg) +#export SONIC_DPKG_ADMINDIR=/var/lib/dpkg endef diff --git a/scripts/build_kvm_image.sh b/scripts/build_kvm_image.sh index 66fc4e42770a..42e016a98647 100755 --- a/scripts/build_kvm_image.sh +++ b/scripts/build_kvm_image.sh @@ -36,7 +36,7 @@ create_disk() prepare_installer_disk() { - fallocate -l 4096M $INSTALLER_DISK + fallocate -x -l 4096M $INSTALLER_DISK mkfs.vfat $INSTALLER_DISK diff --git a/scripts/collect_docker_version_files.sh b/scripts/collect_docker_version_files.sh index a2fee669eac5..fc027c91600e 100755 --- a/scripts/collect_docker_version_files.sh +++ b/scripts/collect_docker_version_files.sh @@ -51,16 +51,7 @@ docker cp -L $DOCKER_CONTAINER:/usr/local/share/buildinfo/log ${BUILD_LOG_PATH}/ # Save the cache contents from docker build LOCAL_CACHE_FILE=target/vcache/${DOCKER_IMAGE_NAME}/cache.tgz -CACHE_ENCODE_FILE=${DOCKER_PATH}/vcache/cache.base64 -sleep 1; sync ${CACHE_ENCODE_FILE} - -# Decode the cache content into gz format SRC_VERSION_PATH=files/build/versions -if [[ -e ${CACHE_ENCODE_FILE} ]]; then - - cat ${CACHE_ENCODE_FILE} | base64 -d >${LOCAL_CACHE_FILE} - rm -f ${CACHE_ENCODE_FILE} -fi # Version package cache IMAGE_DBGS_NAME=${DOCKER_IMAGE_NAME//-/_}_image_dbgs @@ -70,7 +61,7 @@ else GLOBAL_CACHE_DIR=/vcache/${DOCKER_IMAGE_NAME} fi -if [[ ! -z ${SONIC_VERSION_CACHE} && -e ${CACHE_ENCODE_FILE} ]]; then +if [[ ! -z ${SONIC_VERSION_CACHE} ]]; then # Select version files for SHA calculation VERSION_FILES="${SRC_VERSION_PATH}/dockers/${DOCKER_IMAGE_NAME}/versions-*-${DISTRO}-${ARCH} ${SRC_VERSION_PATH}/default/versions-*" diff --git a/slave.mk b/slave.mk index 8473b2b3e7f4..110656f373bb 100644 --- a/slave.mk +++ b/slave.mk @@ -46,7 +46,7 @@ BOOKWORM_FILES_PATH = $(TARGET_PATH)/files/bookworm DBG_IMAGE_MARK = dbg DBG_SRC_ARCHIVE_FILE = $(TARGET_PATH)/sonic_src.tar.gz BUILD_WORKDIR = /sonic -DPKG_ADMINDIR_PATH = $(BUILD_WORKDIR)/dpkg +DPKG_ADMINDIR_PATH = /bld-tmp SLAVE_DIR ?= sonic-slave-$(BLDENV) CONFIGURED_PLATFORM = $(if $(PLATFORM),$(PLATFORM),$(shell [ -f .platform ] && cat .platform || echo generic)) @@ -938,17 +938,17 @@ ifneq ($(CROSS_BUILD_ENVIRON),y) # Use pip instead of later setup.py to install dependencies into user home, but uninstall self pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name` ifeq ($(BLDENV),bookworm) - if [ ! "$($*_TEST)" = "n" ]; then pip$($*_PYTHON_VERSION) install ".[testing]" && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name` && python$($*_PYTHON_VERSION) -m pytest $(LOG); fi + #if [ ! "$($*_TEST)" = "n" ]; then pip$($*_PYTHON_VERSION) install ".[testing]" && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name` && python$($*_PYTHON_VERSION) -m pytest $(LOG); fi python$($*_PYTHON_VERSION) -m build -n $(LOG) else - if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi + #if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) endif else { export PATH=$(VIRTENV_BIN_CROSS_PYTHON$($*_PYTHON_VERSION)):${PATH} python$($*_PYTHON_VERSION) setup.py build $(LOG) - if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi + #if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) } endif @@ -1115,6 +1115,8 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform $$($$*.gz_PATH)/Dockerfile.j2 \ $(call dpkg_depend,$(TARGET_PATH)/%.gz.dep) $(HEADER) + + docker login -u sonicbrcm -p 4b5d1f28-6f43-41da-a794-88805ee8fc2d # Load the target deb from DPKG cache $(call LOAD_CACHE,$*.gz,$@) diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index 6bf09c425cd1..920e7c4e4fd0 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -81,7 +81,7 @@ RUN PATH=/python_virtualenv/env3/bin/:$PATH python3 -m pip uninstall -y enum34 RUN PATH=/python_virtualenv/env3/bin/:$PATH pip3 install --force-reinstall --no-cache-dir coverage {%- endif %} -RUN apt-get update && apt-get install -y \ +RUN /usr/bin/apt-get update && /usr/bin/apt-get install -y \ apt-utils \ default-jre-headless \ openssh-server \ diff --git a/src/bash/Makefile b/src/bash/Makefile index a72cbc170351..ea9762d32483 100644 --- a/src/bash/Makefile +++ b/src/bash/Makefile @@ -9,7 +9,8 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : rm -rf .pc rm -rf bash-$(BASH_VERSION_MAJOR) - dget -u https://launchpad.net/debian/+archive/primary/+sourcefiles/bash/$(BASH_VERSION_FULL)/bash_$(BASH_VERSION_FULL).dsc + #dget -u https://launchpad.net/debian/+archive/primary/+sourcefiles/bash/$(BASH_VERSION_FULL)/bash_$(BASH_VERSION_FULL).dsc + dget -u http://deb.debian.org/debian/pool/main/b/bash/bash_$(BASH_VERSION_FULL).dsc # Apply plugin suport patches quilt push -a diff --git a/src/openssh/Makefile b/src/openssh/Makefile index c52a86baf4e2..a78c1d775c82 100644 --- a/src/openssh/Makefile +++ b/src/openssh/Makefile @@ -25,9 +25,10 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # Build package ifeq ($(CROSS_BUILD_ENVIRON), y) patch -p1 < ../patch/cross-compile-changes.patch - dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + DEB_BUILD_OPTIONS=" ${DEB_BUILD_OPTIONS} nocheck " dpkg-buildpackage -rfakeroot -b -us -uc -a$(CONFIGURED_ARCH) -Pcross,nocheck -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) else - dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + sudo http_proxy=$(http_proxy) apt-get -y build-dep openssh + DEB_BUILD_OPTIONS=" ${DEB_BUILD_OPTIONS} nocheck " dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) endif popd