* Re: rEFInd won't cross-compile for aarch64 (glibc and musl)
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
@ 2024-03-07 14:43 ` sgn
2024-03-07 14:48 ` binutils update breaks refind sgn
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: sgn @ 2024-03-07 14:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 375 bytes --]
New comment by sgn on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1983654801
Comment:
It's not about cross. It's about `objcopy` not knowing how to deal with EFI format on arm64.
On arm64, `objcopy` uses `-O binary`, unlike the specific `--target=efi-app-x86_64` for amd64.
Update to `binutils` breaks `refind` build.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
2024-03-07 14:43 ` sgn
@ 2024-03-07 14:48 ` sgn
2024-03-07 14:51 ` sgn
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: sgn @ 2024-03-07 14:48 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
New comment by sgn on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1983664881
Comment:
https://wiki.debian.org/SecureBoot#arm64_problems
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
2024-03-07 14:43 ` sgn
2024-03-07 14:48 ` binutils update breaks refind sgn
@ 2024-03-07 14:51 ` sgn
2024-03-07 14:55 ` sgn
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: sgn @ 2024-03-07 14:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 218 bytes --]
New comment by sgn on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1983672755
Comment:
It may work if we patch `-O binary` with `--target=efi-app-aarch64`, :shrug:
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
` (2 preceding siblings ...)
2024-03-07 14:51 ` sgn
@ 2024-03-07 14:55 ` sgn
2024-03-07 14:57 ` sgn
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: sgn @ 2024-03-07 14:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
New comment by sgn on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1983680158
Comment:
```diff
Index: refind-0.14.0.2/Make.common
===================================================================
--- refind-0.14.0.2.orig/Make.common
+++ refind-0.14.0.2/Make.common
@@ -140,8 +140,6 @@ endif
ifeq ($(ARCH), aarch64)
GNUEFI_CFLAGS += -DEFIAARCH64
- FORMAT = -O binary
- FORMAT_DRIVER = -O binary
SUBSYSTEM_LDFLAG = -defsym=EFI_SUBSYSTEM=0xa
LDFLAGS += --warn-common --no-undefined --fatal-warnings
```
Built, not tested in anyway
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
` (3 preceding siblings ...)
2024-03-07 14:55 ` sgn
@ 2024-03-07 14:57 ` sgn
2024-03-07 15:58 ` slymattz
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: sgn @ 2024-03-07 14:57 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
New comment by sgn on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1983654801
Comment:
**It's not about cross.**
It's about `objcopy` not knowing how to deal with EFI format on arm64 in the past.
On arm64, `objcopy` uses `-O binary`, unlike the specific `--target=efi-app-x86_64` for amd64.
Update to `binutils` breaks `refind` build.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
` (4 preceding siblings ...)
2024-03-07 14:57 ` sgn
@ 2024-03-07 15:58 ` slymattz
2024-03-08 12:07 ` slymattz
2024-03-11 11:23 ` slymattz
7 siblings, 0 replies; 9+ messages in thread
From: slymattz @ 2024-03-07 15:58 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]
New comment by slymattz on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1983830948
Comment:
For me, the below patch works (I combined https://github.com/void-linux/void-packages/blob/master/srcpkgs/refind/patches/add-cross-compile-support.patch and your proposed changes)
fix_aarch64.patch
```
--- a/Make.common
+++ b/Make.common
@@ -40,21 +40,13 @@
# Note: TIANOBASE is defined in master Makefile and exported
GENFW = $(TIANOBASE)/BaseTools/Source/C/bin/GenFw
prefix = /usr/bin/
-ifeq ($(ARCH),aarch64)
- CC = $(prefix)aarch64-linux-gnu-gcc
- AS = $(prefix)aarch64-linux-gnu-as
- LD = $(prefix)aarch64-linux-gnu-ld
- AR = $(prefix)aarch64-linux-gnu-ar
- RANLIB = $(prefix)aarch64-linux-gnu-ranlib
- OBJCOPY = $(prefix)aarch64-linux-gnu-objcopy
-else
- CC = $(prefix)gcc
- AS = $(prefix)as
- LD = $(prefix)ld
- AR = $(prefix)ar
- RANLIB = $(prefix)ranlib
- OBJCOPY = $(prefix)objcopy
-endif
+
+CC = $(prefix)$(CROSS_COMPILE)gcc
+AS = $(prefix)$(CROSS_COMPILE)as
+LD = $(prefix)$(CROSS_COMPILE)ld
+AR = $(prefix)$(CROSS_COMPILE)ar
+RANLIB = $(prefix)$(CROSS_COMPILE)ranlib
+OBJCOPY = $(prefix)$(CROSS_COMPILE)objcopy
ifeq ($(MAKEWITH),TIANO)
# Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, GCC46, or GCC47)
@@ -148,8 +140,8 @@
ifeq ($(ARCH), aarch64)
GNUEFI_CFLAGS += -DEFIAARCH64
- FORMAT = -O binary
- FORMAT_DRIVER = -O binary
+ FORMAT = --target=efi-app-aarch64
+ FORMAT_DRIVER = --target=efi-app-aarch64
SUBSYSTEM_LDFLAG = -defsym=EFI_SUBSYSTEM=0xa
LDFLAGS += --warn-common --no-undefined --fatal-warnings
```
It builds on my system. However, I have no way of checking whether it works natively.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
` (5 preceding siblings ...)
2024-03-07 15:58 ` slymattz
@ 2024-03-08 12:07 ` slymattz
2024-03-11 11:23 ` slymattz
7 siblings, 0 replies; 9+ messages in thread
From: slymattz @ 2024-03-08 12:07 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
New comment by slymattz on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1985581788
Comment:
> ```diff
> Index: refind-0.14.0.2/Make.common
> ===================================================================
> --- refind-0.14.0.2.orig/Make.common
> +++ refind-0.14.0.2/Make.common
> @@ -140,8 +140,6 @@ endif
>
> ifeq ($(ARCH), aarch64)
> GNUEFI_CFLAGS += -DEFIAARCH64
> - FORMAT = -O binary
> - FORMAT_DRIVER = -O binary
> SUBSYSTEM_LDFLAG = -defsym=EFI_SUBSYSTEM=0xa
> LDFLAGS += --warn-common --no-undefined --fatal-warnings
>
> ```
>
> Built, not tested in anyway
Just wanted to confirm that removing these two lines also enables refind to build successfully for aarch64-glibc and aarch64-musl.
BTW, let me post a link to your patch upstream, just for the record:
https://sourceforge.net/p/refind/discussion/general/thread/3ca1db9256/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: binutils update breaks refind
2024-03-07 12:34 [ISSUE] rEFInd won't cross-compile for aarch64 (glibc and musl) slymattz
` (6 preceding siblings ...)
2024-03-08 12:07 ` slymattz
@ 2024-03-11 11:23 ` slymattz
7 siblings, 0 replies; 9+ messages in thread
From: slymattz @ 2024-03-11 11:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]
New comment by slymattz on void-packages repository
https://github.com/void-linux/void-packages/issues/49170#issuecomment-1988214496
Comment:
Let me recap this bug report.
Context:
https://lists.gnu.org/archive/html/info-gnu/2022-02/msg00009.html
**GNU Binutils 2.38**
```
* Support for efi-app-aarch64, efi-rtdrv-aarch64 and
efi-bsdrv-aarch64 has been added to objcopy in order to enable
UEFI development using binutils.
```
Solution by @sgn (see @@ -148,8 +140,10 @@):
https://github.com/void-linux/void-packages/blob/8f60d7410c76cd192636349b19231eb07a082e4c/srcpkgs/refind/patches/add-cross-compile-support-and-fix-binutils-aarch64.patch
Successful workflow aarch64 builds after applying the patch:
```
/usr/bin/aarch64-linux-gnu-objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
-j .reloc --target=efi-app-aarch64 refind_aa64.so refind_aa64.efi
```
```
/usr/bin/aarch64-linux-musl-objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
-j .reloc --target=efi-app-aarch64 refind_aa64.so refind_aa64.efi
```
Do we need native aarch64 testing or would you consider this bug resolved?
^ permalink raw reply [flat|nested] 9+ messages in thread