From f64046784f7c3480c09a3fbd9e870b0fe371ef94 Mon Sep 17 00:00:00 2001 From: lvxiaoqian Date: Wed, 28 Jun 2023 16:14:46 +0800 Subject: [PATCH] add riscv64 support from upstream v4.17 --- 0005-Allow-building-on-riscv64.patch | 80 ++++++++++++++++++++++++++++ mstflint.spec | 7 ++- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 0005-Allow-building-on-riscv64.patch diff --git a/0005-Allow-building-on-riscv64.patch b/0005-Allow-building-on-riscv64.patch new file mode 100644 index 0000000..dd662fb --- /dev/null +++ b/0005-Allow-building-on-riscv64.patch @@ -0,0 +1,80 @@ +From 889235fee41dc9b565407ce923e5af100c839b97 Mon Sep 17 00:00:00 2001 +From: Tzafrir Cohen +Date: Fri, 5 Feb 2021 10:36:33 +0200 +Subject: [PATCH] Allow building on riscv64 + +--- + common/compatibility.h | 4 +++- + mtcr_ul/packets_common.h | 4 +++- + tools_layouts/adb_to_c_utils.h | 4 +++- + 3 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/common/compatibility.h b/common/compatibility.h +index f8bc817..d163478 100644 +--- a/common/compatibility.h ++++ b/common/compatibility.h +@@ -63,6 +63,8 @@ + # define ARCH_arm64 + # elif defined(__arm__) + # define ARCH_arm6l ++# elif defined(__riscv) ++# define ARCH_riscv + # else + # error Unknown CPU architecture using the linux OS + # endif +@@ -109,7 +111,7 @@ + # define U48H_FMT "0x%012llx" + # define U64D_FMT_GEN "llu" + # endif +-#elif defined(ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) ++#elif defined(ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_riscv) + # define U64D_FMT "%lu" + # define U64H_FMT "0x%016lx" + # define U48H_FMT "0x%012lx" +diff --git a/mtcr_ul/packets_common.h b/mtcr_ul/packets_common.h +index 4df05ef..7f43b59 100644 +--- a/mtcr_ul/packets_common.h ++++ b/mtcr_ul/packets_common.h +@@ -152,6 +152,8 @@ + # define ARCH_arm64 + # elif defined(__arm__) + # define ARCH_arm6l ++# elif defined(__riscv) ++# define ARCH_riscv + # else + # error Unknown CPU architecture using the linux OS + # endif +@@ -165,7 +167,7 @@ + /* define macros for print fields */ + //#if defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__) + /* +- #if !defined(UEFI_BUILD) && (defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__)) ++ #if !defined(UEFI_BUILD) && (defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__) || defined(ARCH_riscv)) + # define U64H_FMT "0x%016lx" + # define U64D_FMT "%lu" + # define U32H_FMT "0x%08x" +diff --git a/tools_layouts/adb_to_c_utils.h b/tools_layouts/adb_to_c_utils.h +index 2e7a1ef..61af52f 100644 +--- a/tools_layouts/adb_to_c_utils.h ++++ b/tools_layouts/adb_to_c_utils.h +@@ -140,6 +140,8 @@ extern "C" { + # define ARCH_arm64 + # elif defined(__arm__) + # define ARCH_arm6l ++# elif defined(__riscv) ++# define ARCH_riscv + # else + # error Unknown CPU architecture using the linux OS + # endif +@@ -183,7 +185,7 @@ extern "C" { + # define U64H_FMT "0x%016llx" + # define U48H_FMT "0x%012llx" + # endif +-#elif defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) ++#elif defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_riscv) + # define U64D_FMT "%lu" + # define U64H_FMT "0x%016lx" + # define U48H_FMT "0x%012lx" +-- +2.40.1 + diff --git a/mstflint.spec b/mstflint.spec index 715cc13..d4556a1 100644 --- a/mstflint.spec +++ b/mstflint.spec @@ -1,7 +1,7 @@ Name: mstflint Summary: Firmware Burning and Diagnostics Tools Version: 4.10.0 -Release: 12 +Release: 13 License: GPLv2+ or BSD Url: https://github.com/Mellanox/mstflint Source: https://github.com/Mellanox/%{name}/releases/download/v4.10.0-1/%{name}-%{version}.tar.gz @@ -10,6 +10,7 @@ Patch0001: fix-return-local-addr.patch Patch0002: mstflint-4.10.0-sw.patch Patch0003: backport-0001-Title-Fix-error-while-burning-mcc-enabled.patch Patch0004: backport-0001-Title-Fix-errors-found-with-checkpatch-script.patch +Patch0005: 0005-Allow-building-on-riscv64.patch BuildRequires: libstdc++-devel zlib-devel rdma-core-devel gcc-c++ gcc BuildRequires: libcurl-devel boost-devel libxml2-devel openssl-devel @@ -31,6 +32,7 @@ code. Please see the file LICENSE for licensing details. %endif %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build export CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" @@ -55,6 +57,9 @@ strip %{buildroot}/%{_libdir}/mstflint/python_tools/*.so %{_mandir}/man1/* %changelog +* Wed Jun 28 2023 lvxiaoqian - 4.10.0-13 +- Add riscv64 patch from v4.17 + * Fri Jan 06 2023 chenmaodong - 4.10.0-12 - Fix errors found with checkpatch script