From c600aaa73226d8d8c49e5485c6a8e110a99fa4d0 Mon Sep 17 00:00:00 2001 From: Honggang Li Date: Feb 12 2019 03:39:07 +0000 Subject: Rebase mstflint to latest upstream release v4.11.0-3 Resolves: 1676338 Signed-off-by: Honggang Li --- diff --git a/.gitignore b/.gitignore index 1791409..863e77a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ noarch/ /mstflint-4.8.0.tar.gz /mstflint-4.10.0.tar.gz /mstflint-4.11.0-2.tar.gz +/mstflint-4.11.0-3.tar.gz diff --git a/0001-Fix-shebang-for-python-scripts.patch b/0001-Fix-shebang-for-python-scripts.patch index 3176bbb..22bd73b 100644 --- a/0001-Fix-shebang-for-python-scripts.patch +++ b/0001-Fix-shebang-for-python-scripts.patch @@ -1,6 +1,6 @@ -From f12533225483f8c9bdc0d1ef7e7a04214571fab2 Mon Sep 17 00:00:00 2001 +From f355d4902890e5b4db15b87903a299697764bc8a Mon Sep 17 00:00:00 2001 From: Honggang Li -Date: Fri, 1 Feb 2019 04:07:13 -0500 +Date: Fri, 8 Feb 2019 21:26:39 -0500 Subject: [PATCH] Fix shebang for python scripts rhel-8 does not support python2. User '#!/usr/bin/python3' for all @@ -75,15 +75,15 @@ index 4971b00..1f34925 100755 # Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved. # diff --git a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py -index 36b82ff..6587e6a 100755 +index 1d614ac..153c87b 100755 --- a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py +++ b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py @@ -1,4 +1,4 @@ --#!/usr/bin/python +-#!/usr/bin/python +#!/usr/bin/python3 - - # Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved. - # + + # Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved. + # diff --git a/small_utils/mlxfwresetlib/mlxfwreset_utils.py b/small_utils/mlxfwresetlib/mlxfwreset_utils.py index 9b07328..2c64044 100755 --- a/small_utils/mlxfwresetlib/mlxfwreset_utils.py @@ -115,5 +115,5 @@ index 6d45200..f764de3 100755 # Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved. # -- -2.18.1 +2.20.1 diff --git a/convert-format-for-mlxfwreset_status_checker.patch b/convert-format-for-mlxfwreset_status_checker.patch new file mode 100644 index 0000000..52a8f39 --- /dev/null +++ b/convert-format-for-mlxfwreset_status_checker.patch @@ -0,0 +1,180 @@ +diff --git a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py +index 36b82ff..1d614ac 100755 +--- a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py ++++ b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py +@@ -1,87 +1,87 @@ +-#!/usr/bin/python +- +-# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved. +-# +-# This software is available to you under a choice of one of two +-# licenses. You may choose to be licensed under the terms of the GNU +-# General Public License (GPL) Version 2, available from the file +-# COPYING in the main directory of this source tree, or the +-# OpenIB.org BSD license below: +-# +-# Redistribution and use in source and binary forms, with or +-# without modification, are permitted provided that the following +-# conditions are met: +-# +-# - Redistributions of source code must retain the above +-# copyright notice, this list of conditions and the following +-# disclaimer. +-# +-# - Redistributions in binary form must reproduce the above +-# copyright notice, this list of conditions and the following +-# disclaimer in the documentation and/or other materials +-# provided with the distribution. +-# +-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +-# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +-# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +-# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-# SOFTWARE. +-#-- +- +-""" +-* $Id : fwreset_status_checker.py 2017-11-28 +-* $Authors : Ahmad Soboh (ahmads@mellanox.com) +-""" +- +-###################################################################### +-# Description: FirmwareResetStatusChecker +-# OS Support : Linux/Windows. +-###################################################################### +- +- +-class FirmwareResetStatusChecker(object): +- +- FirmwareUptimeStatusInit = 0x0 +- FirmwareUptimeStatusBeforeDone = 0x1 +- FirmwareUptimeStatusAfterDone = 0x2 +- FirmwareUptimeStatusError = 0x3 +- +- FirmwareResetStatusDone = 0x0 +- FirmwareResetStatusFailed = 0x1 +- FirmwareResetStatusUnknown = 0x2 +- +- def __init__(self, regAccessObj): +- self._RegAccessObj = regAccessObj +- self._UptimeBeforeReset = 0x0 +- self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit +- self._UptimeAfterReset = 0x0 +- self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit +- +- def UpdateUptimeBeforeReset(self): +- try: +- self._UptimeBeforeReset = self._RegAccessObj.getFWUptime() +- self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone +- except Exception as e: +- self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError +- +- def UpdateUptimeAfterReset(self): +- try: +- self._UptimeAfterReset = self._RegAccessObj.getFWUptime() +- self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone +- except Exception as e: +- self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError +- +- def GetStatus(self): +- if self._UptimeBeforeStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone and\ +- self._UptimeAfterStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone: +- if self._UptimeAfterReset < self._UptimeBeforeReset: +- return FirmwareResetStatusChecker.FirmwareResetStatusDone +- else: +- if self._UptimeBeforeReset > 5: #5 seconds +- return FirmwareResetStatusChecker.FirmwareResetStatusFailed +- else: +- return FirmwareResetStatusChecker.FirmwareResetStatusUnknown +- return FirmwareResetStatusChecker.FirmwareResetStatusUnknown +\ No newline at end of file ++#!/usr/bin/python ++ ++# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved. ++# ++# This software is available to you under a choice of one of two ++# licenses. You may choose to be licensed under the terms of the GNU ++# General Public License (GPL) Version 2, available from the file ++# COPYING in the main directory of this source tree, or the ++# OpenIB.org BSD license below: ++# ++# Redistribution and use in source and binary forms, with or ++# without modification, are permitted provided that the following ++# conditions are met: ++# ++# - Redistributions of source code must retain the above ++# copyright notice, this list of conditions and the following ++# disclaimer. ++# ++# - Redistributions in binary form must reproduce the above ++# copyright notice, this list of conditions and the following ++# disclaimer in the documentation and/or other materials ++# provided with the distribution. ++# ++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++# SOFTWARE. ++#-- ++ ++""" ++* $Id : fwreset_status_checker.py 2017-11-28 ++* $Authors : Ahmad Soboh (ahmads@mellanox.com) ++""" ++ ++###################################################################### ++# Description: FirmwareResetStatusChecker ++# OS Support : Linux/Windows. ++###################################################################### ++ ++ ++class FirmwareResetStatusChecker(object): ++ ++ FirmwareUptimeStatusInit = 0x0 ++ FirmwareUptimeStatusBeforeDone = 0x1 ++ FirmwareUptimeStatusAfterDone = 0x2 ++ FirmwareUptimeStatusError = 0x3 ++ ++ FirmwareResetStatusDone = 0x0 ++ FirmwareResetStatusFailed = 0x1 ++ FirmwareResetStatusUnknown = 0x2 ++ ++ def __init__(self, regAccessObj): ++ self._RegAccessObj = regAccessObj ++ self._UptimeBeforeReset = 0x0 ++ self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit ++ self._UptimeAfterReset = 0x0 ++ self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusInit ++ ++ def UpdateUptimeBeforeReset(self): ++ try: ++ self._UptimeBeforeReset = self._RegAccessObj.getFWUptime() ++ self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone ++ except Exception as e: ++ self._UptimeBeforeStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError ++ ++ def UpdateUptimeAfterReset(self): ++ try: ++ self._UptimeAfterReset = self._RegAccessObj.getFWUptime() ++ self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone ++ except Exception as e: ++ self._UptimeAfterStatus = FirmwareResetStatusChecker.FirmwareUptimeStatusError ++ ++ def GetStatus(self): ++ if self._UptimeBeforeStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusBeforeDone and\ ++ self._UptimeAfterStatus == FirmwareResetStatusChecker.FirmwareUptimeStatusAfterDone: ++ if self._UptimeAfterReset < self._UptimeBeforeReset: ++ return FirmwareResetStatusChecker.FirmwareResetStatusDone ++ else: ++ if self._UptimeBeforeReset > 5: #5 seconds ++ return FirmwareResetStatusChecker.FirmwareResetStatusFailed ++ else: ++ return FirmwareResetStatusChecker.FirmwareResetStatusUnknown ++ return FirmwareResetStatusChecker.FirmwareResetStatusUnknown diff --git a/mstflint.spec b/mstflint.spec index d2de483..d4cfd4d 100644 --- a/mstflint.spec +++ b/mstflint.spec @@ -3,12 +3,15 @@ Name: mstflint Summary: Mellanox firmware burning tool Version: 4.11.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ or BSD -Source: https://github.com/Mellanox/mstflint/releases/download/v4.11.0-2/mstflint-4.11.0-2.tar.gz -Patch1: extend-buffer.patch -Patch2: add-default-link-flags-for-shared-libraries.patch -Patch3: 0001-Fix-shebang-for-python-scripts.patch +Group: Applications/System +Source: https://github.com/Mellanox/mstflint/releases/download/v4.11.0-3/mstflint-4.11.0-3.tar.gz +Patch1: convert-format-for-mlxfwreset_status_checker.patch +Patch2: 0001-Fix-shebang-for-python-scripts.patch +Patch3: extend-buffer.patch +Patch4: add-default-link-flags-for-shared-libraries.patch +Patch6: replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch Url: https://github.com/Mellanox/mstflint BuildRequires: libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc BuildRequires: libcurl-devel, boost-devel, libxml2-devel, openssl-devel @@ -28,12 +31,12 @@ for network adapters based on Mellanox Technologies chips. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch6 -p1 find . -type f -iname '*.[ch]' -exec chmod a-x '{}' ';' find . -type f -iname '*.cpp' -exec chmod a-x '{}' ';' %build -export CFLAGS="$RPM_OPT_FLAGS" -export CXXFLAGS="$RPM_OPT_FLAGS" %if %{__remake_config} ./autogen.sh %endif @@ -46,6 +49,15 @@ make DESTDIR=%{buildroot} install rm -fr %{buildroot}%{_includedir} find %{buildroot} -type f -name '*.la' -delete find %{buildroot} -type f -name '*.a' -delete +# python scripts with shebang should be installed as executable +find %{buildroot} -type f -name test.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name mstfwreset.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name mlxfwreset_mlnxdriver.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name mlnx_peripheral_components.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name mlxfwreset_status_checker.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name mcra.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name mlxfwreset_utils.py -exec chmod -v a+x '{}' ';' +find %{buildroot} -type f -name pci_device.py -exec chmod -v a+x '{}' ';' %files %doc README @@ -57,6 +69,10 @@ find %{buildroot} -type f -name '*.a' -delete %{_mandir}/man1/* %changelog +* Tue Feb 12 2019 Honggang Li - 4.11.0-3 +- Rebase mstflint to latest upstream release v4.11.0-3 +- Resolves: 1676338 + * Fri Feb 1 2019 Honggang Li - 4.11.0-2 - Rebase mstflint to latest upstream release v4.11.0-2 - Resolves: bz1671710 diff --git a/replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch b/replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch new file mode 100644 index 0000000..ca4201f --- /dev/null +++ b/replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch @@ -0,0 +1,26 @@ +diff --git a/flint/subcommands.cpp b/flint/subcommands.cpp +index 8c85e55..0822e8b 100644 +--- a/flint/subcommands.cpp ++++ b/flint/subcommands.cpp +@@ -2997,7 +2997,7 @@ FlintStatus SgSubCommand::sgFs2() + return FLINT_SUCCESS; + } + +-#define FW_RESET_MSG "To load new configuration run mlxfwreset or reboot machine" ++#define FW_RESET_MSG "To load new configuration run mstfwreset or reboot machine" + + FlintStatus SgSubCommand::sgFs3() + { +diff --git a/mlxfwops/lib/flint_base.h b/mlxfwops/lib/flint_base.h +index eb434dc..e851085 100644 +--- a/mlxfwops/lib/flint_base.h ++++ b/mlxfwops/lib/flint_base.h +@@ -394,7 +394,7 @@ struct BOARD_ID { + #define TLV_FORMAT_SECT "TLVs format section" + #define TRACER_HASH_SECT "Tracer Hash section" + #define REBOOT_REQUIRED_STR "To load new FW run reboot machine." +-#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mlxfwreset or reboot machine." ++#define REBOOT_OR_FWRESET_REQUIRED_STR "To load new FW run mstfwreset or reboot machine." + #define numbel(x) (sizeof(x) / sizeof((x)[0])) + + void report(const char *format, ...); diff --git a/sources b/sources index 1dcd91f..66955ea 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mstflint-4.11.0-2.tar.gz) = 0fa0152a427401bb9ff39c4d27f28dbfc9218c69f9bc0db003ceb3cd696d8875c90fd3bd0cd46c75719a4694c624fccfe7fcd0655c5d1d307f7c917a5b40a876 +SHA512 (mstflint-4.11.0-3.tar.gz) = a7482442df08f97a6e225f8352ce17d361abda1ebe1cff6e9350ece31aaa36c1a7fb1d28751acef7a40ef9f53801aa9b4bfe97f210a9a97c3d2030961dc99da3