From 60f4ddd234b074224fd7d4c27c8cb05d219a204e Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Thu, 9 Aug 2018 18:35:13 +0300 Subject: [PATCH] [mellanox]: Update recipe for hw-mgmt according to latest changes Signed-off-by: Volodymyr Samotiy --- .gitmodules | 4 +- files/build_templates/swss.service.j2 | 4 +- platform/mellanox/hw-management.mk | 2 +- .../Add-systemd-service-config.patch | 58 +++++++++++++++++++ platform/mellanox/hw-management/Makefile | 14 +++++ .../{hw-management => hw-management/hw-mgmt} | 0 6 files changed, 77 insertions(+), 5 deletions(-) mode change 100755 => 100644 .gitmodules create mode 100644 platform/mellanox/hw-management/Add-systemd-service-config.patch create mode 100644 platform/mellanox/hw-management/Makefile rename platform/mellanox/{hw-management => hw-management/hw-mgmt} (100%) diff --git a/.gitmodules b/.gitmodules old mode 100755 new mode 100644 index 73ab4bf8ba13..c89dfe45fced --- a/.gitmodules +++ b/.gitmodules @@ -68,6 +68,6 @@ [submodule "platform/barefoot/sonic-platform-modules-arista"] path = platform/barefoot/sonic-platform-modules-arista url = https://github.com/aristanetworks/sonic -[submodule "platform/mellanox/hw-management"] - path = platform/mellanox/hw-management +[submodule "platform/mellanox/hw-management/hw-mgmt"] + path = platform/mellanox/hw-management/hw-mgmt url = https://github.com/Mellanox/hw-mgmt/ diff --git a/files/build_templates/swss.service.j2 b/files/build_templates/swss.service.j2 index 1ceb706a175d..289a840d3517 100644 --- a/files/build_templates/swss.service.j2 +++ b/files/build_templates/swss.service.j2 @@ -31,7 +31,7 @@ ExecStartPre=/usr/bin/mst start ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh ExecStartPre=/etc/init.d/sxdkernel start ExecStartPre=/sbin/modprobe i2c-dev -ExecStartPre=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management start" +ExecStartPre=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" {% elif sonic_asic_platform == 'cavium' %} ExecStartPre=/etc/init.d/xpnet.sh start {% endif %} @@ -44,7 +44,7 @@ ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStopPost=/usr/bin/syncd.sh stop {% if sonic_asic_platform == 'mellanox' %} -ExecStopPost=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management stop" +ExecStartPre=/bin/bash -c "/etc/mlnx/mlnx-hw-management stop" ExecStopPost=/etc/init.d/sxdkernel stop ExecStopPost=/usr/bin/mst stop {% elif sonic_asic_platform == 'cavium' %} diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index ee5f923058e5..cd457181268f 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -7,6 +7,6 @@ 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) SONIC_STRETCH_DEBS += $(MLNX_HW_MANAGEMENT) diff --git a/platform/mellanox/hw-management/Add-systemd-service-config.patch b/platform/mellanox/hw-management/Add-systemd-service-config.patch new file mode 100644 index 000000000000..ce16bb712ee1 --- /dev/null +++ b/platform/mellanox/hw-management/Add-systemd-service-config.patch @@ -0,0 +1,58 @@ +From 22fef644b1150677353ab0559828ea45a982d901 Mon Sep 17 00:00:00 2001 +From: Andriy Moroz +Date: Wed, 11 Jul 2018 16:51:07 +0300 +Subject: [PATCH] Add systemd service config + +Signed-off-by: Andriy Moroz +--- + debian/control | 2 +- + debian/hw-management.service | 10 ++++++++++ + debian/rules | 2 +- + 3 files changed, 12 insertions(+), 2 deletions(-) + create mode 100644 debian/hw-management.service + +diff --git a/debian/control b/debian/control +index 048cd61..7e3a545 100644 +--- a/debian/control ++++ b/debian/control +@@ -1,7 +1,7 @@ + Source: hw-management + Priority: extra + Maintainer: MellanoxBSP +-Build-Depends: ++Build-Depends: dh-systemd + Standards-Version: + Section: libs + Homepage: http://www.mellanox.com +diff --git a/debian/hw-management.service b/debian/hw-management.service +new file mode 100644 +index 0000000..d18916d +--- /dev/null ++++ b/debian/hw-management.service +@@ -0,0 +1,10 @@ ++[Unit] ++Description=Mellanox Hardware Management ++ ++[Service] ++Type=oneshot ++EnvironmentFile=/host/machine.conf ++ExecStart=/bin/bash -c "/etc/mlnx/mlnx-hw-management start" ++ ++[Install] ++WantedBy=multi-user.target +diff --git a/debian/rules b/debian/rules +index fc38817..fba4150 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -8,7 +8,7 @@ K_SRC ?= "/lib/modules/$(KVERSION)/build" + pwd=$(shell pwd) + + %: +- dh $@ ++ dh $@ --with systemd + + override_dh_auto_configure: + +-- +1.9.1 + diff --git a/platform/mellanox/hw-management/Makefile b/platform/mellanox/hw-management/Makefile new file mode 100644 index 000000000000..608c94e6b02a --- /dev/null +++ b/platform/mellanox/hw-management/Makefile @@ -0,0 +1,14 @@ +.ONESHELL: +SHELL = /bin/bash + +MAIN_TARGET = hw-management_1.mlnx.$(MLNX_HW_MANAGEMENT_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + + pushd hw-mgmt + git am ../*.patch + chmod +x ./debian/rules + sudo ./debian/rules binary KVERSION=$(KVERSION) + popd + + mv $* $(DEST)/ diff --git a/platform/mellanox/hw-management b/platform/mellanox/hw-management/hw-mgmt similarity index 100% rename from platform/mellanox/hw-management rename to platform/mellanox/hw-management/hw-mgmt