From e3ee91a6e46b1dc8d9bbf689c8f77b30cd112fea Mon Sep 17 00:00:00 2001 From: Junchao Chen Date: Thu, 5 Mar 2020 16:02:22 +0200 Subject: [PATCH 01/12] [Mellanox] Add sdk 4.4.0542 Conflicts: platform/mellanox/fw.mk platform/mellanox/mlnx-sai.mk platform/mellanox/mlnx-sai/SAI-Implementation platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers platform/mellanox/sdk.mk --- platform/mellanox/fw.mk | 20 +++++++++++++++---- platform/mellanox/mlnx-fw-upgrade.j2 | 7 +++++++ platform/mellanox/mlnx-sai.mk | 2 +- platform/mellanox/mlnx-sai/SAI-Implementation | 2 +- platform/mellanox/one-image.mk | 2 +- .../sdk-src/sx-kernel/Switch-SDK-drivers | 2 +- platform/mellanox/sdk.mk | 2 +- 7 files changed, 28 insertions(+), 9 deletions(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index c088fe274b06..4517a647f2da 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -11,20 +11,27 @@ else FW_FROM_URL = n endif -MLNX_SPC_FW_VERSION = 13.2000.2720 +MLNX_SPC_FW_VERSION = 13.2007.0322 MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2000.2720 +MLNX_SPC2_FW_VERSION = 29.2000.0322 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) +MLNX_SPC3_FW_VERSION = 30.2007.0322 +MLNX_SPC3_FW_FILE = fw-SPC3-rel-$(subst .,_,$(MLNX_SPC3_FW_VERSION))-EVB.mfa +$(MLNX_SPC3_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) +$(MLNX_SPC3_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC3_FW_FILE) + +MLNX_FW_FILES = $(MLNX_SPC_FW_FILE) $(MLNX_SPC2_FW_FILE) $(MLNX_SPC3_FW_FILE) + ifeq ($(FW_FROM_URL),n) -SONIC_COPY_FILES += $(MLNX_SPC_FW_FILE) $(MLNX_SPC2_FW_FILE) +SONIC_COPY_FILES += $(MLNX_FW_FILES) else -SONIC_ONLINE_FILES += $(MLNX_SPC_FW_FILE) $(MLNX_SPC2_FW_FILE) +SONIC_ONLINE_FILES += $(MLNX_FW_FILES) endif export MLNX_SPC_FW_VERSION @@ -32,3 +39,8 @@ export MLNX_SPC_FW_FILE export MLNX_SPC2_FW_VERSION export MLNX_SPC2_FW_FILE + +export MLNX_SPC3_FW_VERSION +export MLNX_SPC3_FW_FILE + +export MLNX_FW_FILES diff --git a/platform/mellanox/mlnx-fw-upgrade.j2 b/platform/mellanox/mlnx-fw-upgrade.j2 index 3857244a1504..d0f69c35e0bc 100755 --- a/platform/mellanox/mlnx-fw-upgrade.j2 +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -25,15 +25,18 @@ declare -r QUERY_FILE="/tmp/mlxfwmanager-query.log" declare -r SPC1_ASIC="spc1" declare -r SPC2_ASIC="spc2" +declare -r SPC3_ASIC="spc3" declare -r UNKN_ASIC="unknown" declare -rA FW_FILE_MAP=( \ [$SPC1_ASIC]="/etc/mlnx/fw-SPC.mfa" \ [$SPC2_ASIC]="/etc/mlnx/fw-SPC2.mfa" \ + [$SPC3_ASIC]="/etc/mlnx/fw-SPC3.mfa" \ ) declare -rA FW_REQUIRED_MAP=( \ [$SPC1_ASIC]="{{ MLNX_SPC_FW_VERSION }}" \ [$SPC2_ASIC]="{{ MLNX_SPC2_FW_VERSION }}" \ + [$SPC3_ASIC]="{{ MLNX_SPC3_FW_VERSION }}" \ ) IMAGE_UPGRADE="${NO_PARAM}" @@ -135,6 +138,7 @@ function GetAsicType() { local -r SPC1_PRODUCT_ID="cb84" local -r SPC2_PRODUCT_ID="cf6c" + local -r SPC3_PRODUCT_ID="cf70" if lspci -n | grep "${VENDOR_ID}:${SPC1_PRODUCT_ID}" &>/dev/null; then echo "${SPC1_ASIC}" @@ -142,6 +146,9 @@ function GetAsicType() { elif lspci -n | grep "${VENDOR_ID}:${SPC2_PRODUCT_ID}" &>/dev/null; then echo "${SPC2_ASIC}" exit "${EXIT_SUCCESS}" + elif lspci -n | grep "${VENDOR_ID}:${SPC3_PRODUCT_ID}" &>/dev/null; then + echo "${SPC3_ASIC}" + exit "${EXIT_SUCCESS}" fi echo "${UNKN_ASIC}" diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index baced2780637..4f9e3b292465 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,6 +1,6 @@ # Mellanox SAI -MLNX_SAI_VERSION = SAIRel1.15.5-master +MLNX_SAI_VERSION = SAIRel1.16.1-master export MLNX_SAI_VERSION diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation index 4b40b5191b07..1f1a7f9a1dd9 160000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ b/platform/mellanox/mlnx-sai/SAI-Implementation @@ -1 +1 @@ -Subproject commit 4b40b5191b07118326a29be2d491f4362fc02eee +Subproject commit 1f1a7f9a1dd9c705803b3ab66f66792553664632 diff --git a/platform/mellanox/one-image.mk b/platform/mellanox/one-image.mk index d30e44690991..e4723c3bd1b0 100644 --- a/platform/mellanox/one-image.mk +++ b/platform/mellanox/one-image.mk @@ -11,5 +11,5 @@ $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.g else $(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) endif -$(SONIC_ONE_IMAGE)_FILES += $(MLNX_SPC_FW_FILE) $(MLNX_SPC2_FW_FILE) $(MLNX_FFB_SCRIPT) $(ISSU_VERSION_FILE) $(ONIE_FW_UPDATE) +$(SONIC_ONE_IMAGE)_FILES += $(MLNX_FW_FILES) $(MLNX_FFB_SCRIPT) $(ISSU_VERSION_FILE) $(ONIE_FW_UPDATE) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 026b12e2bd02..07425a0957d1 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 026b12e2bd02b79fdf50eb5f45a161c95ec94837 +Subproject commit 07425a0957d100405e3781f8bb633c462f37a92c diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index f105f6b22f7b..f2af75cccf2b 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -1,5 +1,5 @@ MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/ -MLNX_SDK_VERSION = 4.3.2908 +MLNX_SDK_VERSION = 4.4.0542 MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_DEB_VERSION = $(subst _,.,$(MLNX_SDK_VERSION)) From 64af75544ff44a26c860f64528ab980bf93019d4 Mon Sep 17 00:00:00 2001 From: Junchao Chen Date: Thu, 5 Mar 2020 16:17:18 +0200 Subject: [PATCH 02/12] fix typo --- platform/mellanox/fw.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/fw.mk b/platform/mellanox/fw.mk index 4517a647f2da..dc8243be1e83 100644 --- a/platform/mellanox/fw.mk +++ b/platform/mellanox/fw.mk @@ -16,7 +16,7 @@ MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa $(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) -MLNX_SPC2_FW_VERSION = 29.2000.0322 +MLNX_SPC2_FW_VERSION = 29.2007.0322 MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa $(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) From 0b475ffa34d4b704742c9e4bfd50319d7db823a0 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Mon, 9 Mar 2020 21:58:13 +0800 Subject: [PATCH 03/12] advance hw-mgmt module head --- platform/mellanox/hw-management.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index ff1ea207572d..692a816a0f4f 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -1,6 +1,6 @@ # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = 7.0000.2308 +MLNX_HW_MANAGEMENT_VERSION = 7.0000.3012 export MLNX_HW_MANAGEMENT_VERSION From 5f7f38e48f165accedb268c29d1b968b4864c1eb Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Wed, 11 Mar 2020 16:44:20 +0800 Subject: [PATCH 04/12] [Mellanox]Support buster Currently we port SONiC to buster in a way that building docker-base based on buster and other dockers based on stretch. The benefit is that tasks can be carried out simultaneously. The build procedure can be treated as 2 stages. The first stage is to build the stretch-based debs and dockers and the second stage is to build the buster-based ones. One thing we have to pay attention to is some debs depend on kernel should not be built at stretch stage because the kernel isn't available at that time. The idea is to move that kind of debs out of SONIC_STRETCH_DEBS and SONIC_MAKE_DEBS and add them to SONIC_DPKG_DEBS. Meanwhile, any dependency explicitly put on the stretch based dockers on kernel should be removed. --- platform/mellanox/hw-management.mk | 3 +-- platform/mellanox/mft.mk | 4 +--- platform/mellanox/rules.mk | 3 --- platform/mellanox/sdk.mk | 2 -- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 692a816a0f4f..56044a05c4ee 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -7,6 +7,5 @@ export MLNX_HW_MANAGEMENT_VERSION MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management $(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) -SONIC_STRETCH_DEBS += $(MLNX_HW_MANAGEMENT) +SONIC_DPKG_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index af2192de4543..d4efbc95701f 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -8,12 +8,10 @@ export MFT_VERSION MFT_REVISION MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft $(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_MAKE_DEBS += $(MFT) +SONIC_DPKG_DEBS += $(MFT) KERNEL_MFT = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb $(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) - -SONIC_STRETCH_DEBS += $(KERNEL_MFT) diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index efd0af2c8f4a..d8f65730c1ff 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -28,6 +28,3 @@ $(SYNCD)_RDEPENDS += $(MLNX_SAI) # Inject mlnx sdk libs to platform monitor $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(APPLIBS) $(SX_COMPLIB) $(SXD_LIBS) $(SX_GEN_UTILS) $(PYTHON_SDK_API) $(APPLIBS_DEV) $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(SX_GEN_UTILS_DEV) - -# Inject mlnx mlx libs to platform monitor -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(MFT) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index f2af75cccf2b..cfda53c29759 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -152,8 +152,6 @@ else SONIC_COPY_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) endif -SONIC_STRETCH_DEBS += $(SX_KERNEL) - mlnx-sdk-packages: $(addprefix $(DEBS_PATH)/, $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL)) SONIC_PHONY_TARGETS += mlnx-sdk-packages From 888514a6c9742c66de2902d960d226234240e200 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Thu, 12 Mar 2020 13:39:36 +0800 Subject: [PATCH 05/12] Use SONIC_MAKE_DEBS instead of SONIC_DPKG_DEBS --- platform/mellanox/hw-management.mk | 3 +-- platform/mellanox/mft.mk | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 56044a05c4ee..fe59345e577a 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -7,5 +7,4 @@ export MLNX_HW_MANAGEMENT_VERSION MLNX_HW_MANAGEMENT = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb $(MLNX_HW_MANAGEMENT)_SRC_PATH = $(PLATFORM_PATH)/hw-management $(MLNX_HW_MANAGEMENT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) - -SONIC_DPKG_DEBS += $(MLNX_HW_MANAGEMENT) +SONIC_MAKE_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/mft.mk b/platform/mellanox/mft.mk index d4efbc95701f..cbde5d42ba9c 100644 --- a/platform/mellanox/mft.mk +++ b/platform/mellanox/mft.mk @@ -8,7 +8,7 @@ export MFT_VERSION MFT_REVISION MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft $(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -SONIC_DPKG_DEBS += $(MFT) +SONIC_MAKE_DEBS += $(MFT) KERNEL_MFT = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT))) From 3e105da2a6e85c0eba5f9c78c178300420858129 Mon Sep 17 00:00:00 2001 From: Stephen Date: Sun, 15 Mar 2020 07:31:45 +0000 Subject: [PATCH 06/12] [Mellanox]WA to avoid fsroot being corrupted by "dpkg --extract" --- files/build_templates/sonic_debian_extension.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index ec1c1e4d54f9..0bd9d7afea0d 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -329,7 +329,10 @@ sudo chmod a+x $FILESYSTEM_ROOT/usr/sbin/policy-rc.d {% if installer_debs.strip() -%} {% for deb in installer_debs.strip().split(' ') -%} {% if sonic_asic_platform == "mellanox" %} -sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT +sudo mkdir tmpdir +sudo dpkg --extract {{deb}} tmpdir +for subdir in $(ls tmpdir) ; do sudo cp -R tmpdir/$subdir/* $FILESYSTEM_ROOT/$subdir; done +sudo rm -rf tmpdir {% else %} sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f {% endif %} From f98c0dfaa1965c0f8fb47a0935ff31900d200f7e Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sun, 15 Mar 2020 16:15:08 +0800 Subject: [PATCH 07/12] [docker-wait-any]Use APIClient instead of Client according to API update --- files/image_config/misc/docker-wait-any | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/image_config/misc/docker-wait-any b/files/image_config/misc/docker-wait-any index 3988a9fbdf57..f5b89285765f 100755 --- a/files/image_config/misc/docker-wait-any +++ b/files/image_config/misc/docker-wait-any @@ -17,7 +17,7 @@ import sys import threading -from docker import Client +from docker import APIClient # Instantiate a global event to share among our threads g_thread_exit_event = threading.Event() @@ -40,7 +40,7 @@ def wait_for_container(docker_client, container_name): def main(): thread_list = [] - docker_client = Client(base_url='unix://var/run/docker.sock') + docker_client = APIClient(base_url='unix://var/run/docker.sock') # Ensure we were passed at least one argument if len(sys.argv) < 2: From bea37e429ac88b5fd0d688757981c30b0b3cc60b Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sun, 15 Mar 2020 20:55:47 +0800 Subject: [PATCH 08/12] [Mellanox]Update the kernel version in mft/Makefile to 4.19 --- platform/mellanox/mft/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index e18964dd4b91..2e28536c4fd0 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -27,6 +27,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # fix timestamp because we do not actually build tools, only kernel touch $(MFT_NAME)/DEBS/* - mv $(MFT_NAME)/SDEBS/ubuntu-drivers/4.9.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST) + mv $(MFT_NAME)/SDEBS/ubuntu-drivers/4.19.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST) $(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) From d9bec8bef0ef512daa5e18c736c0c140a24152fc Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Fri, 14 Feb 2020 01:04:58 +0800 Subject: [PATCH 09/12] [sfputil]fix an syntax error (#4141) --- device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 40734349a230..07dbbe1cc21b 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -190,7 +190,7 @@ def get_transceiver_change_event(self, timeout=0): from swsscommon import swsscommon self.state_db = swsscommon.DBConnector("STATE_DB", REDIS_TIMEOUT_USECS, - True)) + True) # Subscribe to state table for SFP change notifications self.db_sel = swsscommon.Select() From 18ddeafa485f0e0d728a4d62291a72139fe4102a Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Tue, 17 Mar 2020 11:59:21 +0800 Subject: [PATCH 10/12] [Mellanox]remove the tmpdir if it already existed before calling dpkg --extract --- files/build_templates/sonic_debian_extension.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index 0bd9d7afea0d..989376cf47d0 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -329,6 +329,10 @@ sudo chmod a+x $FILESYSTEM_ROOT/usr/sbin/policy-rc.d {% if installer_debs.strip() -%} {% for deb in installer_debs.strip().split(' ') -%} {% if sonic_asic_platform == "mellanox" %} +if [ -e tmpdir ] ; +then + rm -rf tmpdir; +fi sudo mkdir tmpdir sudo dpkg --extract {{deb}} tmpdir for subdir in $(ls tmpdir) ; do sudo cp -R tmpdir/$subdir/* $FILESYSTEM_ROOT/$subdir; done From 4d948d8416459d282189ab581bc746f4dadd0576 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Fri, 20 Mar 2020 09:30:00 +0800 Subject: [PATCH 11/12] Install haveged which accelerates the initialization of /dev/random (crng init) which is responsible to random number generation On some devices the system can take very long to start. Eventually we found it is because crng init takes very long to finish. Haveged resolves this problem --- build_debian.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_debian.sh b/build_debian.sh index 67045ee400c2..05019c9b224d 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -274,7 +274,8 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in ndisc6 \ makedumpfile \ conntrack \ - cron + cron \ + haveged if [[ $CONFIGURED_ARCH == amd64 ]]; then From e9cd291c2b77fc724f04a9997c38f50bb1530926 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Fri, 20 Mar 2020 22:33:08 +0800 Subject: [PATCH 12/12] [python-click]Add patch: don't replace underscore with dash in commands --- src/python-click/Makefile | 3 + ...derscore-with-dash-in-order-to-retai.patch | 83 +++++++++++++++++++ src/python-click/patch/series | 1 + 3 files changed, 87 insertions(+) create mode 100644 src/python-click/patch/0001-Don-t-replace-underscore-with-dash-in-order-to-retai.patch create mode 100644 src/python-click/patch/series diff --git a/src/python-click/Makefile b/src/python-click/Makefile index 4deb27257fd2..88773b99e04e 100644 --- a/src/python-click/Makefile +++ b/src/python-click/Makefile @@ -18,6 +18,9 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : # which stg doesn't like, so we use this method instead git reset --hard debian/$(PYTHON_CLICK_VERSION) + stg init + stg import -s ../patch/series + # Build source and Debian packages dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) popd diff --git a/src/python-click/patch/0001-Don-t-replace-underscore-with-dash-in-order-to-retai.patch b/src/python-click/patch/0001-Don-t-replace-underscore-with-dash-in-order-to-retai.patch new file mode 100644 index 000000000000..a5f57759097b --- /dev/null +++ b/src/python-click/patch/0001-Don-t-replace-underscore-with-dash-in-order-to-retai.patch @@ -0,0 +1,83 @@ +From 24fe650a982e502d2ec4f169a8045493fbcd55cf Mon Sep 17 00:00:00 2001 +From: Stephen Sun +Date: Fri, 20 Mar 2020 20:24:37 +0800 +Subject: [PATCH] Don't replace underscore with dash in order to retain + backword compatibility + +Signed-off-by: Stephen Sun +--- + click/decorators.py | 2 +- + tests/test_commands.py | 4 ++-- + tests/test_formatting.py | 8 ++++---- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/click/decorators.py b/click/decorators.py +index c57c530..6ee331e 100644 +--- a/click/decorators.py ++++ b/click/decorators.py +@@ -85,7 +85,7 @@ def _make_command(f, name, attrs, cls): + help = inspect.cleandoc(help) + attrs['help'] = help + _check_for_unicode_literals() +- return cls(name=name or f.__name__.lower().replace('_', '-'), ++ return cls(name=name or f.__name__.lower(), + callback=f, params=params, **attrs) + + +diff --git a/tests/test_commands.py b/tests/test_commands.py +index 9189eca..190854c 100644 +--- a/tests/test_commands.py ++++ b/tests/test_commands.py +@@ -64,7 +64,7 @@ def test_auto_shorthelp(runner): + r'Commands:\n\s+' + r'long\s+This is a long text that is too long to show as short help\.\.\.\n\s+' + r'short\s+This is a short text\.\n\s+' +- r'special-chars\s+Login and store the token in ~/.netrc\.\s*', ++ r'special_chars\s+Login and store the token in ~/.netrc\.\s*', + result.output) is not None + + +@@ -208,7 +208,7 @@ def test_other_command_invoke_with_defaults(runner): + @click.option('--foo', type=click.INT, default=42) + @click.pass_context + def other_cmd(ctx, foo): +- assert ctx.info_name == 'other-cmd' ++ assert ctx.info_name == 'other_cmd' + click.echo(foo) + + result = runner.invoke(cli, []) +diff --git a/tests/test_formatting.py b/tests/test_formatting.py +index 2005f98..7894829 100644 +--- a/tests/test_formatting.py ++++ b/tests/test_formatting.py +@@ -74,11 +74,11 @@ def test_wrapping_long_options_strings(runner): + + # 54 is chosen as a length where the second line is one character + # longer than the maximum length. +- result = runner.invoke(cli, ['a-very-long', 'command', '--help'], ++ result = runner.invoke(cli, ['a_very_long', 'command', '--help'], + terminal_width=54) + assert not result.exception + assert result.output.splitlines() == [ +- 'Usage: cli a-very-long command [OPTIONS] FIRST SECOND', ++ 'Usage: cli a_very_long command [OPTIONS] FIRST SECOND', + ' THIRD FOURTH FIFTH', + ' SIXTH', + '', +@@ -111,11 +111,11 @@ def test_wrapping_long_command_name(runner): + """A command. + """ + +- result = runner.invoke(cli, ['a-very-very-very-long', 'command', '--help'], ++ result = runner.invoke(cli, ['a_very_very_very_long', 'command', '--help'], + terminal_width=54) + assert not result.exception + assert result.output.splitlines() == [ +- 'Usage: cli a-very-very-very-long command ', ++ 'Usage: cli a_very_very_very_long command ', + ' [OPTIONS] FIRST SECOND THIRD FOURTH FIFTH', + ' SIXTH', + '', +-- +2.20.1 + diff --git a/src/python-click/patch/series b/src/python-click/patch/series new file mode 100644 index 000000000000..d514ff8e95f4 --- /dev/null +++ b/src/python-click/patch/series @@ -0,0 +1 @@ +0001-Don-t-replace-underscore-with-dash-in-order-to-retai.patch