From 50e4cc1579e4b40f48e251fdaa1b67c9619156e2 Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Tue, 16 Mar 2021 18:56:53 +0200 Subject: [PATCH] Backport ethtool to support QSFP-DD (#5725) Backport ethtool debian package version 5.9 to support QSFP-DD cable parsing. Signed-off-by: Shlomi Bitton --- build_debian.sh | 1 - dockers/docker-platform-monitor/Dockerfile.j2 | 1 - rules/docker-platform-monitor.mk | 3 ++- rules/ethtool.dep | 8 ++++++++ rules/ethtool.mk | 13 +++++++++++++ src/ethtool/Makefile | 19 +++++++++++++++++++ 6 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 rules/ethtool.dep create mode 100644 rules/ethtool.mk create mode 100644 src/ethtool/Makefile diff --git a/build_debian.sh b/build_debian.sh index 3559560b1ed4..662efde9f94b 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -297,7 +297,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in squashfs-tools \ grub2-common \ rsyslog \ - ethtool \ screen \ hping3 \ tcptraceroute \ diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index fc46dc6a52b9..e86f4ad0019b 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -22,7 +22,6 @@ RUN apt-get update && \ rrdtool \ python-smbus \ python3-smbus \ - ethtool \ dmidecode \ i2c-tools diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index 547fbf60813f..b650f74a174d 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -6,7 +6,7 @@ DOCKER_PLATFORM_MONITOR_DBG = $(DOCKER_PLATFORM_MONITOR_STEM)-$(DBG_IMAGE_MARK). $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/$(DOCKER_PLATFORM_MONITOR_STEM) -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(PYTHON3_SWSSCOMMON) $(SMARTMONTOOLS) +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(PYTHON3_SWSSCOMMON) $(SMARTMONTOOLS) $(ETHTOOL) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) @@ -66,4 +66,5 @@ $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/bin/sensors $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/smartctl $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/iSmart $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/SmartCmd +$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/bin/ethtool $(DOCKER_PLATFORM_MONITOR)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) diff --git a/rules/ethtool.dep b/rules/ethtool.dep new file mode 100644 index 000000000000..15a96084046e --- /dev/null +++ b/rules/ethtool.dep @@ -0,0 +1,8 @@ +SPATH := $($(ETHTOOL)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/ethtool.mk rules/ethtool.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(SPATH)) + +$(ETHTOOL)_CACHE_MODE := GIT_CONTENT_SHA +$(ETHTOOL)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(ETHTOOL)_DEP_FILES := $(DEP_FILES) diff --git a/rules/ethtool.mk b/rules/ethtool.mk new file mode 100644 index 000000000000..b79eaad7afa9 --- /dev/null +++ b/rules/ethtool.mk @@ -0,0 +1,13 @@ +# ethtool + +ETHTOOL_VERSION_BASE = 5.9 +export ETHTOOL_VERSION_BASE + +ETHTOOL = ethtool_$(ETHTOOL_VERSION_BASE)-1_amd64.deb +$(ETHTOOL)_SRC_PATH = $(SRC_PATH)/ethtool +SONIC_MAKE_DEBS += $(ETHTOOL) + +ETHTOOL_DBG = ethtool-dbgsym_$(ETHTOOL_VERSION_BASE)-1_amd64.deb +$(eval $(call add_extra_package,$(ETHTOOL),$(ETHTOOL_DBG))) + +export ETHTOOL ETHTOOL_DBG diff --git a/src/ethtool/Makefile b/src/ethtool/Makefile new file mode 100644 index 000000000000..2f5a3acc94de --- /dev/null +++ b/src/ethtool/Makefile @@ -0,0 +1,19 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = $(ETHTOOL) +DERIVED_TARGET = $(ETHTOOL_DBG) + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Obtaining the ethtool debian package + rm -rf ethtool* + git clone https://salsa.debian.org/kernel-team/ethtool/ + pushd ethtool + git checkout tags/debian/1%$(ETHTOOL_VERSION_BASE)-1 + # Build package + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR) + popd + mv $(DERIVED_TARGET) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)