[1/1] grub-efi-native: workaround for fedora 29

Submitted by Kang Kai on Dec. 20, 2018, 1:33 a.m. | Patch ID: 157347

Details

Message ID fd734daa1ab5738f5064fde9d9810014aac258f9.1545269541.git.kai.kang@windriver.com
State New
Headers show

Commit Message

Kang Kai Dec. 20, 2018, 1:33 a.m.
From: Kai Kang <kai.kang@windriver.com>

grub-efi-native fails to run do_configure on Fedora 29 host:

| checking for options to compile assembly...
| Assembler messages:
| Fatal error: The input and output files must be distinct

because the host 'as' in binutils-3.31 breaks if using two filesystems.
See:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=2a50366

Work-around this issue by forcing the configure time assembler check to
use a temp file in the src dir.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 ...workaround-for-as-from-binutils-2.31.patch | 43 +++++++++++++++++++
 meta/recipes-bsp/grub/grub-efi_2.02.bb        |  2 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta/recipes-bsp/grub/files/workaround-for-as-from-binutils-2.31.patch

Patch hide | download patch | download mbox

diff --git a/meta/recipes-bsp/grub/files/workaround-for-as-from-binutils-2.31.patch b/meta/recipes-bsp/grub/files/workaround-for-as-from-binutils-2.31.patch
new file mode 100644
index 0000000000..75dae16095
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/workaround-for-as-from-binutils-2.31.patch
@@ -0,0 +1,43 @@ 
+When /dev and $srcdir are not in a same file system, it may trigger a flaw of
+binutils 2.31 and cause grub-efi-native configure error:
+
+| checking for options to compile assembly...
+| Assembler messages:
+| Fatal error: The input and output files must be distinct
+
+Replace /dev/null with a temporary file during assemble check to avoid such
+failure.
+
+This is a workaround for binutils 2.31. When it is fixed on Fedora 29, this
+patch could be removed.
+
+Ref:
+https://bugzilla.redhat.com/show_bug.cgi?id=1660279
+
+Upstream-Status: Inappropriate [native]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+
+diff --git a/configure.ac b/configure.ac
+index 44a67a7..6eb28fe 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -696,8 +696,9 @@ if test x"$test_program" = x ; then
+   grub_cv_cc_target_asm_compile=
+ else
+   found=no
++  tmpfile="$(mktemp $srcdir/asm-tests/XXXXXX)"
+   for arg in "" "-no-integrated-as"; do
+-    cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S"
++    cmdline="$TARGET_CC -c -o $tmpfile $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S"
+     echo "Running $cmdline" >&AS_MESSAGE_LOG_FD
+     if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
+       grub_cv_cc_target_asm_compile="$arg"
+@@ -705,6 +706,7 @@ else
+       break
+     fi
+   done
++  rm -f $tmpfile
+   if test x"$found" = xno ; then
+     AC_MSG_ERROR([could not compile assembly])
+   fi
diff --git a/meta/recipes-bsp/grub/grub-efi_2.02.bb b/meta/recipes-bsp/grub/grub-efi_2.02.bb
index 14fce97ff0..fc91864421 100644
--- a/meta/recipes-bsp/grub/grub-efi_2.02.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.02.bb
@@ -9,6 +9,8 @@  SRC_URI += " \
            file://cfg \
           "
 
+SRC_URI_append_class-native = " file://workaround-for-as-from-binutils-2.31.patch"
+
 S = "${WORKDIR}/grub-${PV}"
 
 # Determine the target arch for the grub modules