From b4d03a3cc19ada8091e12d278430844ade92cc95 Mon Sep 17 00:00:00 2001 From: doupengda Date: Fri, 10 May 2024 14:54:39 +0800 Subject: [PATCH] add support for loongarch64 --- ...t-4.24.0-add-support-for-loongarch64.patch | 89 +++++++++++++++++++ mstflint.spec | 7 +- 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 0001-mstflint-4.24.0-add-support-for-loongarch64.patch diff --git a/0001-mstflint-4.24.0-add-support-for-loongarch64.patch b/0001-mstflint-4.24.0-add-support-for-loongarch64.patch new file mode 100644 index 0000000..c6199e8 --- /dev/null +++ b/0001-mstflint-4.24.0-add-support-for-loongarch64.patch @@ -0,0 +1,89 @@ +From 31746e50a69db0dff7b5c2f1bff2a2723d4fe229 Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Fri, 10 May 2024 06:47:57 +0000 +Subject: [PATCH] mstflint 4.24.0 add support for loongarch64 + +--- + common/compatibility.h | 6 ++++-- + mtcr_ul/packets_common.h | 4 +++- + tools_layouts/adb_to_c_utils.h | 4 +++- + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/common/compatibility.h b/common/compatibility.h +index e5991c2..ba1a9be 100644 +--- a/common/compatibility.h ++++ b/common/compatibility.h +@@ -41,7 +41,7 @@ + + #include + +-#if defined(__ia64__) || defined(__x86_64__) || defined(__PPC64__) || defined(__arm__) ++#if defined(__ia64__) || defined(__x86_64__) || defined(__PPC64__) || defined(__arm__) || defined(__loongarch64) + #define U64L "l" + #else + #define U64L "ll" +@@ -69,6 +69,8 @@ + #define ARCH_arm6l + #elif defined(__riscv) + #define ARCH_riscv ++#elif defined(__loongarch64) ++#define ARCH_loongarch + #else + #error Unknown CPU architecture using the linux OS + #endif +@@ -116,7 +118,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) || defined(ARCH_riscv) ++#elif defined(ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_riscv) || defined(ARCH_loongarch) + #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 2ab255f..42ed5e9 100644 +--- a/mtcr_ul/packets_common.h ++++ b/mtcr_ul/packets_common.h +@@ -152,6 +152,8 @@ + #define ARCH_arm6l + #elif defined(__riscv) + #define ARCH_riscv ++#elif defined(__loongarch64) ++#define ARCH_loongarch + #else + #error Unknown CPU architecture using the linux OS + #endif +@@ -166,7 +168,7 @@ + //#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__) +- || defined(ARCH_riscv)) # define U64H_FMT "0x%016lx" # define U64D_FMT "%lu" # define U32H_FMT "0x%08x" # define ++ || defined(ARCH_riscv) || defined(ARCH_loongarch)) # define U64H_FMT "0x%016lx" # define U64D_FMT "%lu" # define U32H_FMT "0x%08x" # define + U16H_FMT "0x%04x" # define U8H_FMT "0x%02x" # define U32D_FMT "%u" # define STR_FMT "%s" #elif defined(ARCH_x86) + || defined(ARCH_ppc) || defined(__MINGW32__) || defined(UEFI_BUILD) || defined(ARCH_arm6l) defined(ARCH_m68k) || + defined(ARCH_hppa) # define U64H_FMT "0x%016llx" # define U64D_FMT "%llu" # define U32H_FMT "0x%08x" # define +diff --git a/tools_layouts/adb_to_c_utils.h b/tools_layouts/adb_to_c_utils.h +index 720ed1c..966f14f 100644 +--- a/tools_layouts/adb_to_c_utils.h ++++ b/tools_layouts/adb_to_c_utils.h +@@ -146,6 +146,8 @@ extern "C" + #define ARCH_arm6l + #elif defined(__riscv) + #define ARCH_riscv ++#elif defined(__loongarch64) ++#define ARCH_loongarch + #else + #error Unknown CPU architecture using the linux OS + #endif +@@ -188,7 +190,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) || defined(ARCH_riscv) ++#elif defined(ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) || defined(ARCH_riscv) || defined(ARCH_loongarch) + #define U64D_FMT "%lu" + #define U64H_FMT "0x%016lx" + #define U48H_FMT "0x%012lx" +-- +2.41.0 + diff --git a/mstflint.spec b/mstflint.spec index 5e1d15f..b7dd205 100644 --- a/mstflint.spec +++ b/mstflint.spec @@ -1,13 +1,14 @@ Summary: Mellanox firmware burning tool Name: mstflint Version: 4.24.0 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ or BSD Url: https://github.com/Mellanox/%{name} Source0: %{url}/releases/download/v%{version}-1/%{name}-%{version}-1.tar.gz Patch3000: add-default-link-flags-for-shared-libraries.patch Patch3001: replace-mlxfwreset-with-mstfwreset-in-mstflint-message.patch +Patch3002: 0001-mstflint-4.24.0-add-support-for-loongarch64.patch BuildRequires: libstdc++-devel zlib-devel libibmad-devel gcc-c++ gcc make BuildRequires: libcurl-devel boost-devel libxml2-devel openssl-devel libtool autoconf automake @@ -46,6 +47,10 @@ find %{buildroot} -type f -name '*.a' -delete %{_mandir}/man1/* %changelog +* Fri May 10 2024 Pengda Dou - 4.24.0-5 +- [Type] other +- [DESC] add support for loongarch64 + * Thu Oct 12 2023 Miaojun Dong - 4.24.0-4 - Rebuild for curl-8.4.0 -- Gitee