From c11e57400c8e84c3565328ab79ca9f5abd3bd437 Mon Sep 17 00:00:00 2001 From: panchenbo Date: Wed, 13 Mar 2024 09:16:42 +0800 Subject: [PATCH 1/6] modify openEuler to %{_vendor} --- fwupd.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fwupd.spec b/fwupd.spec index 4a3cec1..1f7fbae 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -43,7 +43,7 @@ Name: fwupd Version: 1.8.17 -Release: 1 +Release: 2 License: LGPLv2+ Summary: Make updating firmware on Linux automatic, safe and reliable URL: https://github.com/fwupd/fwupd @@ -279,7 +279,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/fwupd mkdir -p %{buildroot}%{_datadir}/doc mkdir -p %{buildroot}%{_datadir}/doc/fwupd cp -r libfwupd* %{buildroot}%{_datadir}/doc/ -cp -r *openEuler-linux*/libfwupd* %{buildroot}%{_datadir}/doc/fwupd/ +cp -r *%{_vendor}-linux*/libfwupd* %{buildroot}%{_datadir}/doc/fwupd/ sed -i '/DynamicUser=yes/d' %{buildroot}/usr/lib/systemd/system/fwupd-refresh.service @@ -471,6 +471,9 @@ done %{_datadir}/man/man1/* %changelog +* Wed Mar 13 2024 panchenbo - 1.8.17-2 +- modify openEuler to %{_vendor} + * Wed Oct 18 2023 yaoxin - 1.8.17-1 - Upgrade to 1.8.17 -- Gitee From e875944f3736e8119adb0d200305c057548726ed Mon Sep 17 00:00:00 2001 From: jchzhou Date: Wed, 13 Mar 2024 15:57:28 +0800 Subject: [PATCH 2/6] fix the conditional to skip packaging fwupd-detect-cet when building with clang --- fwupd.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fwupd.spec b/fwupd.spec index 1f7fbae..ba65f2b 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -43,7 +43,7 @@ Name: fwupd Version: 1.8.17 -Release: 2 +Release: 3 License: LGPLv2+ Summary: Make updating firmware on Linux automatic, safe and reliable URL: https://github.com/fwupd/fwupd @@ -343,7 +343,7 @@ done %{_libexecdir}/fwupd/fwupd # depending on compiler behavior # currently skipped from building if compiled by llvm -%if "%toolchain" == "llvm" +%if "%toolchain" == "clang" %else %ifarch i686 x86_64 %{_libexecdir}/fwupd/fwupd-detect-cet @@ -471,6 +471,9 @@ done %{_datadir}/man/man1/* %changelog +* Wed Mar 13 2024 jchzhou - 1.8.17-3 +- Fix the conditional at L346: replace expected toolchain value to 'clang' + * Wed Mar 13 2024 panchenbo - 1.8.17-2 - modify openEuler to %{_vendor} -- Gitee From b9b4b0c68fb809954c12d483e42c614eb809a60a Mon Sep 17 00:00:00 2001 From: chendexi Date: Tue, 7 May 2024 18:08:29 +0800 Subject: [PATCH 3/6] Modify the unsupported macro python3 to __python3 (cherry picked from commit 6ad7bde15f89ed33fc45d256793f7737946c4395) --- fwupd.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fwupd.spec b/fwupd.spec index ba65f2b..80edc66 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -6,7 +6,7 @@ %global systemd_version 231 %global json_glib_version 1.1.1 -%global __requires_exclude ^%{python3}$ +%global __requires_exclude ^%{__python3}$ %global enable_tests 1 %global enable_dummy 1 @@ -43,7 +43,7 @@ Name: fwupd Version: 1.8.17 -Release: 3 +Release: 4 License: LGPLv2+ Summary: Make updating firmware on Linux automatic, safe and reliable URL: https://github.com/fwupd/fwupd @@ -471,6 +471,9 @@ done %{_datadir}/man/man1/* %changelog +* Tue May 07 2024 chendexi - 1.8.17-4 +- Modify the unsupported macro python3 to __python3 + * Wed Mar 13 2024 jchzhou - 1.8.17-3 - Fix the conditional at L346: replace expected toolchain value to 'clang' -- Gitee From 0155ea0797e983564985334434cbaa0435c0cae9 Mon Sep 17 00:00:00 2001 From: Huang Yang Date: Mon, 13 May 2024 07:20:17 +0000 Subject: [PATCH 4/6] add loongarch64 support --- crt0-efi-loongarch64.S | 847 +++++++++++++++++++++++++++++ elf_loongarch64_efi.lds | 847 +++++++++++++++++++++++++++++ fwupd-add-loongarch64-spoort.patch | 49 ++ fwupd.spec | 20 +- 4 files changed, 1759 insertions(+), 4 deletions(-) create mode 100644 crt0-efi-loongarch64.S create mode 100644 elf_loongarch64_efi.lds create mode 100644 fwupd-add-loongarch64-spoort.patch diff --git a/crt0-efi-loongarch64.S b/crt0-efi-loongarch64.S new file mode 100644 index 0000000..59c0c6d --- /dev/null +++ b/crt0-efi-loongarch64.S @@ -0,0 +1,847 @@ + + + + + + + + + gnu-efi / Code / + [74bd9b] + /gnuefi/crt0-efi-loongarch64.S + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + +
+ +Menu + + + + + +
+

+ +[74bd9b]: + / +gnuefi / +crt0-efi-loongarch64.S + + + + Maximize + Restore + History + + +

+
+

Download this file

+
+

+61 lines (52 with data), 1.9 kB +

+
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
/* +
* crt0-efi-loongarch64.S - PE/COFF header for LoongArch64 EFI applications +
* +
* Copyright (C) 2021 Loongson Technology Corporation Limited. <zhoumingtao@loongson.cn> +
* Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> +
* +
* Redistribution and use in source and binary forms, with or without +
* modification, are permitted provided that the following conditions +
* are met: +
* 1. Redistributions of source code must retain the above copyright +
* notice and this list of conditions, without modification. +
* 2. The name of the author may not be used to endorse or promote products +
* derived from this software without specific prior written permission. +
* +
* Alternatively, this software may be distributed under the terms of the +
* GNU General Public License as published by the Free Software Foundation; +
* either version 2 of the License, or (at your option) any later version. +
*/ +
+
.text +
.align 12 +
.globl _start +
.type _start, @function +
_start: +
addi.d $sp, $sp, -24 +
st.d $ra, $sp, 0 +
st.d $a0, $sp, 8 +
st.d $a1, $sp, 16 +
+
move $a2, $a0 // a2: ImageHandle +
move $a3, $a1 // a3: SystemTable +
la.local $a0, ImageBase // a0: ImageBase +
la.local $a1, _DYNAMIC // a1: DynamicSection +
bl _relocate +
bnez $a0, 0f +
+
ld.d $a0, $sp, 8 +
ld.d $a1, $sp, 16 +
bl _entry +
+
0: ld.d $ra, $sp, 0 +
addi.d $sp, $sp, 24 +
jr $ra +
+
// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: +
+
.data +
dummy: .4byte 0 +
+
#define IMAGE_REL_ABSOLUTE 0 +
.section .reloc, "a" +
label1: +
.4byte dummy-label1 // Page RVA +
.4byte 12 // Block Size (2*4+2*2), must be aligned by 32 Bits +
.2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy +
.2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy +
+
#if defined(__ELF__) && defined(__linux__) +
.section .note.GNU-stack,"",%progbits +
#endif +
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/elf_loongarch64_efi.lds b/elf_loongarch64_efi.lds new file mode 100644 index 0000000..da684dd --- /dev/null +++ b/elf_loongarch64_efi.lds @@ -0,0 +1,847 @@ + + + + + + + + + gnu-efi / Code / + [74bd9b] + /gnuefi/elf_loongarch64_efi.lds + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ + +
+ +Menu + + + + + +
+

+ +[74bd9b]: + / +gnuefi / +elf_loongarch64_efi.lds + + + + Maximize + Restore + History + + +

+
+

Download this file

+
+

+120 lines (113 with data), 2.4 kB +

+
OUTPUT_FORMAT("elf64-loongarch", "elf64-loongarch", "elf64-loongarch")
+OUTPUT_ARCH(loongarch)
+ENTRY(_start)
+SECTIONS
+{
+  . = 0;
+  ImageBase = .;
+  /* .hash and/or .gnu.hash MUST come first! */
+  .hash : { *(.hash) }
+  .gnu.hash : { *(.gnu.hash) }
+  . = ALIGN(4096);
+  .eh_frame : { *(.eh_frame) }
+  .gcc_except_table : { *(.gcc_except_table*) }
+  . = ALIGN(4096);
+  .text : {
+    _text = .;
+    *(.text)
+    *(.text.*)
+    *(.gnu.linkonce.t.*)
+    *(.plt)
+    . = ALIGN(16);
+  }
+  _etext = .;
+  _text_size = _etext - _text;
+  . = ALIGN(4096);
+  .reloc :
+  {
+    KEEP (*(.reloc))
+  }
+  . = ALIGN(65536);
+  .dynamic  : { *(.dynamic) }
+  . = ALIGN(4096);
+  .data :
+  {
+   _data = .;
+   *(.sdata)
+   *(.data)
+   *(.data1)
+   *(.data.*)
+   *(.got.plt)
+   *(.got)
+
+   /*
+    * Note that these aren't the using the GNU "CONSTRUCTOR" output section
+    * command, so they don't start with a size.  Because of p2align and the
+    * end/END definitions, and the fact that they're mergeable, they can also
+    * have NULLs which aren't guaranteed to be at the end.
+    */
+   . = ALIGN(16);
+   __init_array_start = .;
+   *(SORT(.init_array.*))
+   *(.init_array)
+   __init_array_end = .;
+  . = ALIGN(16);
+   __CTOR_LIST__ = .;
+   *(SORT(.ctors.*))
+   *(.ctors)
+   __CTOR_END__ = .;
+  . = ALIGN(16);
+   __DTOR_LIST__ = .;
+   *(SORT(.dtors.*))
+   *(.dtors)
+   __DTOR_END__ = .;
+   . = ALIGN(16);
+   __fini_array_start = .;
+   *(SORT(.fini_array.*))
+   *(.fini_array)
+   __fini_array_end = .;
+
+   /* the EFI loader doesn't seem to like a .bss section, so we stick
+      it all into .data: */
+   . = ALIGN(16);
+   _bss = .;
+   *(.sbss)
+   *(.scommon)
+   *(.dynbss)
+   *(.bss*)
+   *(COMMON)
+   *(.rel.local)
+   . = ALIGN(16);
+
+   _bss_end = .;
+  }
+
+  . = ALIGN(4096);
+  .rela :
+  {
+    *(.rela.text*)
+    *(.rela.data*)
+    *(.rela.got)
+    *(.rela.dyn)
+    *(.rela.stab)
+    *(.rela.init_array*)
+    *(.rela.fini_array*)
+    *(.rela.ctors*)
+    *(.rela.dtors*)
+
+  }
+  . = ALIGN(4096);
+  .rela.plt : { *(.rela.plt) }
+  . = ALIGN(4096);
+  .rodata : { *(.rodata*) }
+  . = ALIGN(512);
+  _edata = .;
+  _data_size = _edata - _data;
+
+  . = ALIGN(4096);
+  .dynsym   : { *(.dynsym) }
+  . = ALIGN(4096);
+  .dynstr   : { *(.dynstr) }
+  . = ALIGN(4096);
+  .note.gnu.build-id : { *(.note.gnu.build-id) }
+  .ignored.reloc :
+  {
+    *(.rela.reloc)
+    *(.note.GNU-stack)
+  }
+  .comment 0 : { *(.comment) }
+}
+
+
+
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fwupd-add-loongarch64-spoort.patch b/fwupd-add-loongarch64-spoort.patch new file mode 100644 index 0000000..fec8ea5 --- /dev/null +++ b/fwupd-add-loongarch64-spoort.patch @@ -0,0 +1,49 @@ +diff --git a/subprojects/fwupd-efi/efi/generate_binary.py b/subprojects/fwupd-efi/efi/generate_binary.py +index a8a4437..9af5853 100755 +--- a/subprojects/fwupd-efi/efi/generate_binary.py ++++ b/subprojects/fwupd-efib/efi/generate_binary.py +@@ -36,7 +36,7 @@ def _run_objcopy(args): + + # aarch64 and arm32 don't have an EFI capable objcopy + # Use 'binary' instead, and add required symbols manually +- if args.arch in ["aarch64", "arm"]: ++ if args.arch in ["aarch64", "arm", "loongarch64"]: + argv.extend(["-O", "binary"]) + elif args.os == "freebsd": + # `--target` option is missing and --input-target doesn't recognize +diff --git a/subprojects/fwupd-efi/efi/meson.build b/subprojects/fwupd-efi/efi/meson.build +index 68ea4aa..26ba42c 100644 +--- a/subprojects/fwupd-efi/efi/meson.build ++++ b/subprojects/fwupd-efi/efi/meson.build +@@ -18,7 +18,7 @@ endif + + efi_libdir = get_option('efi-libdir') + if efi_libdir == '' +- cmd = 'cd /usr/lib/$(@0@ -print-multi-os-directory) && pwd'.format(efi_cc) ++ cmd = 'cd /usr/lib64/$(@0@ -print-multi-os-directory) && pwd'.format(efi_cc) + ret = run_command('sh', '-c', cmd) + if ret.returncode() == 0 + efi_libdir = ret.stdout().strip() +@@ -79,7 +79,7 @@ if get_option('efi_sbat_distro_id') != '' + endif + + # is the system crt0 for arm and aarch64 new enough to know about SBAT? +-if host_cpu == 'aarch64' or host_cpu == 'arm' ++if host_cpu == 'aarch64' or host_cpu == 'arm' or host_cpu == 'loongarch64' + if get_option('efi_sbat_distro_id') != '' + arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch) + cmd = run_command('grep', '-q', 'sbat', join_paths(efi_crtdir, arch_crt_source)) +diff --git a/subprojects/fwupd-efi/meson.build b/subprojects/fwupd-efi/meson.build +index 1753411..8d23a50 100644 +--- a/subprojects/fwupd-efi/meson.build ++++ b/subprojects/fwupd-efi/meson.build +@@ -27,6 +27,9 @@ elif host_cpu == 'arm' + elif host_cpu == 'aarch64' + EFI_MACHINE_TYPE_NAME = 'aa64' + gnu_efi_arch = 'aarch64' ++elif host_cpu == 'loongarch64' ++ EFI_MACHINE_TYPE_NAME = 'loongarch64' ++ gnu_efi_arch = 'loongarch64' + else + error('Unknown host_cpu ' + host_cpu) + endif diff --git a/fwupd.spec b/fwupd.spec index 80edc66..3390923 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -12,17 +12,17 @@ %global enable_dummy 1 # fwupd.efi is only available on these arches -%ifarch x86_64 aarch64 riscv64 +%ifarch x86_64 aarch64 riscv64 loongarch64 %global have_uefi 1 %endif # gpio.h is only available on these arches -%ifarch x86_64 aarch64 riscv64 +%ifarch x86_64 aarch64 riscv64 loongarch64 %global have_gpio 1 %endif # flashrom is only available on these arches -%ifarch i686 x86_64 armv7hl aarch64 ppc64le riscv64 +%ifarch i686 x86_64 armv7hl aarch64 ppc64le riscv64 loongarch64 %global have_flashrom 0 %endif @@ -43,7 +43,7 @@ Name: fwupd Version: 1.8.17 -Release: 4 +Release: 5 License: LGPLv2+ Summary: Make updating firmware on Linux automatic, safe and reliable URL: https://github.com/fwupd/fwupd @@ -61,11 +61,14 @@ Source11: http://people.redhat.com/rhughes/dbx/DBXUpdate-20200729-ia32.cab Source12: http://people.redhat.com/rhughes/dbx/DBXUpdate-20200729-x64.cab Source13: https://sourceforge.net/p/gnu-efi/code/ci/3.0.14/tree/gnuefi/crt0-efi-riscv64.S?format=raw#/crt0-efi-riscv64.S Source14: https://sourceforge.net/p/gnu-efi/code/ci/3.0.14/tree/gnuefi/elf_riscv64_efi.lds?format=raw#/elf_riscv64_efi.lds +Source15: https://sourceforge.net/p/gnu-efi/code/ci/3.0.18/tree/gnuefi/crt0-efi-loongarch64.S?format=raw#/crt0-efi-loongarch64.S +Source16: https://sourceforge.net/p/gnu-efi/code/ci/3.0.18/tree/gnuefi/elf_loongarch64_efi.lds?format=raw#/elf_loongarch64_efi.lds Patch0: fwupd-efi.patch %ifarch riscv64 Patch1: https://raw.githubusercontent.com/GNOME/gnome-build-meta/37bc8931517261e359e02b2b14bffab0501e79d9/files/fwupd/riscv64.patch %endif +Patch2: fwupd-add-loongarch64-spoort.patch BuildRequires: libcbor libcbor-devel BuildRequires: efi-srpm-macros @@ -179,6 +182,12 @@ cp %{SOURCE13} subprojects/fwupd-efi/efi/crt0 cp %{SOURCE14} subprojects/fwupd-efi/efi/lds %endif +%ifarch loongarch64 +%patch2 -p1 +cp %{SOURCE15} subprojects/fwupd-efi/efi/crt0 +cp %{SOURCE16} subprojects/fwupd-efi/efi/lds +%endif + sed -ri '1s=^#!/usr/bin/(env )?python3=#!%{__python3}=' \ contrib/ci/*.py \ contrib/firmware_packager/*.py \ @@ -471,6 +480,9 @@ done %{_datadir}/man/man1/* %changelog +* Mon May 13 2024 Huang Yang - 1.8.17-5 +- add loongarch64 support + * Tue May 07 2024 chendexi - 1.8.17-4 - Modify the unsupported macro python3 to __python3 -- Gitee From 44404653288c61def613bb1df4cdc0d1b1699d3f Mon Sep 17 00:00:00 2001 From: cherry530 <707078654@qq.com> Date: Thu, 15 Aug 2024 16:55:26 +0800 Subject: [PATCH 5/6] Remove rpath for libfwupdengine.so and libfwupdutil.so. Signed-off-by: cherry530 <707078654@qq.com> (cherry picked from commit d7cf0cff7bb38331dcd5c32edf969f8952a1575b) --- fwupd.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fwupd.spec b/fwupd.spec index 3390923..7888b0c 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -43,7 +43,7 @@ Name: fwupd Version: 1.8.17 -Release: 5 +Release: 6 License: LGPLv2+ Summary: Make updating firmware on Linux automatic, safe and reliable URL: https://github.com/fwupd/fwupd @@ -304,6 +304,9 @@ chrpath -d %{buildroot}/usr/share/doc/fwupd/libfwupd/fwupd-thread-test chrpath -d %{buildroot}/usr/libexec/fwupd/fwupd chrpath -d %{buildroot}/usr/libexec/fwupd/fwupdoffline +chrpath -d %{buildroot}/%{_libdir}/fwupd-%{version}/libfwupdengine.so +chrpath -d %{buildroot}/%{_libdir}/fwupd-%{version}/libfwupdutil.so + for b in $(ls %{buildroot}/usr/bin/ ); do chrpath -d %{buildroot}/usr/bin/$b ;done @@ -480,6 +483,9 @@ done %{_datadir}/man/man1/* %changelog +* Thu Aug 15 2024 xu_ping <707078654@qq.com> - 1.8.17-6 +- Remove rpath for libfwupdengine.so and libfwupdutil.so. + * Mon May 13 2024 Huang Yang - 1.8.17-5 - add loongarch64 support -- Gitee From 210e88c28bb9b79b355d1f7a09bdac90d7873ff7 Mon Sep 17 00:00:00 2001 From: laokz Date: Wed, 25 Sep 2024 11:37:49 +0800 Subject: [PATCH 6/6] let valgrind depend on system arch macro --- fwupd.spec | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fwupd.spec b/fwupd.spec index 7888b0c..281b41f 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -43,7 +43,7 @@ Name: fwupd Version: 1.8.17 -Release: 6 +Release: 7 License: LGPLv2+ Summary: Make updating firmware on Linux automatic, safe and reliable URL: https://github.com/fwupd/fwupd @@ -65,9 +65,8 @@ Source15: https://sourceforge.net/p/gnu-efi/code/ci/3.0.18/tree/gnuefi/crt0-efi Source16: https://sourceforge.net/p/gnu-efi/code/ci/3.0.18/tree/gnuefi/elf_loongarch64_efi.lds?format=raw#/elf_loongarch64_efi.lds Patch0: fwupd-efi.patch -%ifarch riscv64 -Patch1: https://raw.githubusercontent.com/GNOME/gnome-build-meta/37bc8931517261e359e02b2b14bffab0501e79d9/files/fwupd/riscv64.patch -%endif +#https://raw.githubusercontent.com/GNOME/gnome-build-meta/37bc8931517261e359e02b2b14bffab0501e79d9/files/fwupd/riscv64.patch +Patch1: riscv64.patch Patch2: fwupd-add-loongarch64-spoort.patch BuildRequires: libcbor libcbor-devel @@ -88,8 +87,10 @@ BuildRequires: libarchive-devel BuildRequires: gobject-introspection-devel BuildRequires: gcab meson >= 0.61.0 BuildRequires: protobuf-c protobuf-c-devel tpm2-tss-devel +%ifarch %{valgrind_arches} BuildRequires: valgrind BuildRequires: valgrind-devel +%endif BuildRequires: python3 ninja-build python3-jinja2 python3-toml python BuildRequires: gnutls-devel BuildRequires: gnutls-utils @@ -483,6 +484,9 @@ done %{_datadir}/man/man1/* %changelog +* Wed Sep 25 2024 laokz - 1.8.17-7 +- Let valgrind depend on system architecture macro + * Thu Aug 15 2024 xu_ping <707078654@qq.com> - 1.8.17-6 - Remove rpath for libfwupdengine.so and libfwupdutil.so. -- Gitee