grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* Re: grub2 boot root-on-zfs errors
@ 2013-11-24  9:14 Beeblebrox
  2013-11-24 15:08 ` Andrey Borzenkov
  2013-11-24 17:21 ` [PATCH] Explicitly check for linking format to use for efiemu64 module Andrey Borzenkov
  0 siblings, 2 replies; 20+ messages in thread
From: Beeblebrox @ 2013-11-24  9:14 UTC (permalink / raw)
  To: The development of GNU GRUB

* Is there a way to compile without docs? This does not work:
./configure --disable-werror --disable-nls --disable-docs

* I disabled the docs section manually in grub/Makefile. gmake
completed but still with warning:
/usr/bin/ld: unrecognised emulation mode: elf_x86_64
Supported emulations: elf_x86_64_fbsd elf_i386_fbsd
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: [efiemu64.o] Error 1 (ignored)
gmake[3]: Leaving directory `/asp/git/grub/grub-core'

* I proceeded with "gmake install" and previous error now causes a problem:
 /usr/bin/install -c -m 644 all_video.mod gdb.mod testspeed.mod tr.mod
progress.mod gcry_arcfour.mod gcry_blowfish.mod gcry_camellia.mod
gcry_cast5.mod gcry_crc.mod gcry_des.mod gcry_dsa.mod gcry_idea.mod
gcry_md4.mod gcry_md5.mod gcry_rfc2268.mod gcry_rijndael.mod
gcry_rmd160.mod gcry_rsa.mod gcry_seed.mod gcry_serpent.mod
gcry_sha1.mod gcry_sha256.mod gcry_sha512.mod gcry_tiger.mod
gcry_twofish.mod gcry_whirlpool.mod modinfo.sh efiemu32.o ./efiemu64.o
'/usr/local/lib/grub/i386-pc'
install: ./efiemu64.o: No such file or directory
gmake[4]: *** [install-platformDATA] Error 71
gmake[4]: Leaving directory `/asp/git/grub/grub-core'
gmake[3]: *** [install-am] Error 2
gmake[3]: Leaving directory `/asp/git/grub/grub-core'
gmake[2]: *** [install] Error 2


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: grub2 boot root-on-zfs errors
  2013-11-24  9:14 grub2 boot root-on-zfs errors Beeblebrox
@ 2013-11-24 15:08 ` Andrey Borzenkov
  2013-11-25 11:08   ` Beeblebrox
  2013-11-24 17:21 ` [PATCH] Explicitly check for linking format to use for efiemu64 module Andrey Borzenkov
  1 sibling, 1 reply; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-24 15:08 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: zaphod

В Sun, 24 Nov 2013 11:14:11 +0200
Beeblebrox <zaphod@berentweb.com> пишет:

> * Is there a way to compile without docs? This does not work:
> ./configure --disable-werror --disable-nls --disable-docs
> 
> * I disabled the docs section manually in grub/Makefile. gmake
> completed but still with warning:
> /usr/bin/ld: unrecognised emulation mode: elf_x86_64
> Supported emulations: elf_x86_64_fbsd elf_i386_fbsd
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> gmake[3]: [efiemu64.o] Error 1 (ignored)
> gmake[3]: Leaving directory `/asp/git/grub/grub-core'
> 
> * I proceeded with "gmake install" and previous error now causes a problem:
>  /usr/bin/install -c -m 644 all_video.mod gdb.mod testspeed.mod tr.mod
> progress.mod gcry_arcfour.mod gcry_blowfish.mod gcry_camellia.mod
> gcry_cast5.mod gcry_crc.mod gcry_des.mod gcry_dsa.mod gcry_idea.mod
> gcry_md4.mod gcry_md5.mod gcry_rfc2268.mod gcry_rijndael.mod
> gcry_rmd160.mod gcry_rsa.mod gcry_seed.mod gcry_serpent.mod
> gcry_sha1.mod gcry_sha256.mod gcry_sha512.mod gcry_tiger.mod
> gcry_twofish.mod gcry_whirlpool.mod modinfo.sh efiemu32.o ./efiemu64.o
> '/usr/local/lib/grub/i386-pc'
> install: ./efiemu64.o: No such file or directory

As a workaround build with --disable-efiemu. You probably do not need
it anyway unless booting OS X.

> gmake[4]: *** [install-platformDATA] Error 71
> gmake[4]: Leaving directory `/asp/git/grub/grub-core'
> gmake[3]: *** [install-am] Error 2
> gmake[3]: Leaving directory `/asp/git/grub/grub-core'
> gmake[2]: *** [install] Error 2
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] Explicitly check for linking format to use for efiemu64 module
  2013-11-24  9:14 grub2 boot root-on-zfs errors Beeblebrox
  2013-11-24 15:08 ` Andrey Borzenkov
@ 2013-11-24 17:21 ` Andrey Borzenkov
  2013-11-25  3:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25  4:22   ` Vladimir 'φ-coder/phcoder' Serbinenko
  1 sibling, 2 replies; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-24 17:21 UTC (permalink / raw)
  To: grub-devel; +Cc: Beeblebrox

Similar to check for target linking format, also check for efiemu64
instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
variants. We cannot easily reuse main target check because platforms
are different (main target is 32 bit and efiemu64 - 64 bit).

This commit adds EFIEMU64_LINK_FORMAT that contains detected
link option and is used in efiemu64.o linking instead of hardcoded
value.

Reported-By: Beeblebrox <zaphod@berentweb.com>
---

Could you test this patch?

 configure.ac          | 29 +++++++++++++++++++++++++++--
 grub-core/Makefile.am |  2 +-
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8619a67..be558de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -654,6 +654,30 @@ if test x"$efiemu_excuse" = x ; then
      efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
   fi
 fi
+if test x"$efiemu_excuse" = x ; then
+  AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
+    grub_cv_target_cc_efiemu64_link_format=unknown
+    for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -mx86_64pe -arch,x86_64; do
+      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
+      LDFLAGS="-m64 -Wl,$format -nostdlib"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+      asm (".globl start; start:");
+      asm (".globl _start; _start:");
+      asm (".globl __start; __start:");
+      void __main (void);
+      void __main (void) {}
+      ]], [[]])], [flag=1], [flag=0])
+      if test x"$flag" = x1; then
+        grub_cv_target_cc_efiemu64_link_format="$format"
+	break;
+      fi
+    done])
+  if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
+    efiemu_excuse="no suitable link format for efiemu64 found"
+  else
+    EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
+  fi
+fi
 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
   AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
 fi
@@ -663,11 +687,12 @@ else
 enable_efiemu=no
 fi
 AC_SUBST([enable_efiemu])
+AC_SUBST([EFIEMU64_LINK_FORMAT])
 
 CFLAGS="$TARGET_CFLAGS"
 
 if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
-  AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
+  AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
     grub_cv_target_cc_link_format=unknown
     for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
       if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
@@ -681,7 +706,7 @@ if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
       asm (".globl __start; __start:");
       void __main (void);
       void __main (void) {}
-      ]], [[]])], [flag=1], [])
+      ]], [[]])], [flag=1], [flag=0])
       if test x"$flag" = x1; then
         grub_cv_target_cc_link_format="$format"
 	break;
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index e2da083..e6862b7 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -421,7 +421,7 @@ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
 	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
 	  rm -f $@.bin; \
 	else \
-	  $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
+	  $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^ || exit 1; \
 	  if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
 	fi
 
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] Explicitly check for linking format to use for efiemu64 module
  2013-11-24 17:21 ` [PATCH] Explicitly check for linking format to use for efiemu64 module Andrey Borzenkov
@ 2013-11-25  3:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25  4:22   ` Vladimir 'φ-coder/phcoder' Serbinenko
  1 sibling, 0 replies; 20+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-11-25  3:59 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

On 24.11.2013 18:21, Andrey Borzenkov wrote:
> +    for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -mx86_64pe -arch,x86_64; do
Remove x86_64pe. We skip it in first check as well since we have no
converter for 64-bit windows binaries and the format is name i386pep,
not x86_64pe
> +      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
> +      LDFLAGS="-m64 -Wl,$format -nostdlib"
It should be -nostdlib -static. (see my other thread)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] Explicitly check for linking format to use for efiemu64 module
  2013-11-24 17:21 ` [PATCH] Explicitly check for linking format to use for efiemu64 module Andrey Borzenkov
  2013-11-25  3:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-11-25  4:22   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25 17:42     ` Andrey Borzenkov
  1 sibling, 1 reply; 20+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-11-25  4:22 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 4377 bytes --]

On 24.11.2013 18:21, Andrey Borzenkov wrote:
> Similar to check for target linking format, also check for efiemu64
> instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
> variants. We cannot easily reuse main target check because platforms
> are different (main target is 32 bit and efiemu64 - 64 bit).
> 
> This commit adds EFIEMU64_LINK_FORMAT that contains detected
> link option and is used in efiemu64.o linking instead of hardcoded
> value.
> 
> Reported-By: Beeblebrox <zaphod@berentweb.com>
> ---
> 
> Could you test this patch?
> 
>  configure.ac          | 29 +++++++++++++++++++++++++++--
>  grub-core/Makefile.am |  2 +-
>  2 files changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 8619a67..be558de 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -654,6 +654,30 @@ if test x"$efiemu_excuse" = x ; then
>       efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
>    fi
>  fi
> +if test x"$efiemu_excuse" = x ; then
> +  AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
> +    grub_cv_target_cc_efiemu64_link_format=unknown
> +    for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -mx86_64pe -arch,x86_64; do
As in other mail: remove -mx86_64pe
> +      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
> +      LDFLAGS="-m64 -Wl,$format -nostdlib"
You need -static as otherwise on Apple systems it will try to pull in
the dynamic linker which we don't want (scratch comment about other
thread, I though of adding -static everywhere but it's no necessarry
after all)
> +      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
> +      asm (".globl start; start:");
> +      asm (".globl _start; _start:");
> +      asm (".globl __start; __start:");
> +      void __main (void);
> +      void __main (void) {}
> +      ]], [[]])], [flag=1], [flag=0])
> +      if test x"$flag" = x1; then
> +        grub_cv_target_cc_efiemu64_link_format="$format"
> +	break;
> +      fi
> +    done])
> +  if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
> +    efiemu_excuse="no suitable link format for efiemu64 found"
> +  else
> +    EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
> +  fi
> +fi
>  if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
>    AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
>  fi
> @@ -663,11 +687,12 @@ else
>  enable_efiemu=no
>  fi
>  AC_SUBST([enable_efiemu])
> +AC_SUBST([EFIEMU64_LINK_FORMAT])
>  
>  CFLAGS="$TARGET_CFLAGS"
>  
>  if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
> -  AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
> +  AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
>      grub_cv_target_cc_link_format=unknown
>      for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
>        if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
> @@ -681,7 +706,7 @@ if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
>        asm (".globl __start; __start:");
>        void __main (void);
>        void __main (void) {}
> -      ]], [[]])], [flag=1], [])
> +      ]], [[]])], [flag=1], [flag=0])
>        if test x"$flag" = x1; then
>          grub_cv_target_cc_link_format="$format"
>  	break;
> diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
> index e2da083..e6862b7 100644
> --- a/grub-core/Makefile.am
> +++ b/grub-core/Makefile.am
> @@ -421,7 +421,7 @@ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
>  	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
>  	  rm -f $@.bin; \
Here the check for apple linker has to be adjusted as
x$(EFIEMU64_LINK_FORMAT) = x-arch,x86_64
>  	else \
> -	  $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
> +	  $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^ || exit 1; \
>  	  if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
Remove TARGET_OBJ2ELF part as it's for 32-bit and we don't use PE here.
>  	fi
>  
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: grub2 boot root-on-zfs errors
  2013-11-24 15:08 ` Andrey Borzenkov
@ 2013-11-25 11:08   ` Beeblebrox
  2013-11-25 11:14     ` Vladimir 'φ-coder/phcoder' Serbinenko
                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Beeblebrox @ 2013-11-25 11:08 UTC (permalink / raw)
  To: The development of GNU GRUB

Hello.
I have built and installed Grub from trunk (lbeit without docs and
efiemu, which I don't need). I have also installed the boot code and
have booted from grub. Here are my results:
* grub-probe correctly identifies partitions as ZFS.
* grub-mkconfig correctly generates a config file and has the correct
path, insmod code for zfs-booting.
* grub-mkconfig does not detect an ubuntu linux (btrfs) install on separate HDD.
* At boot time, grub menu comes up, and starts to boot normally into
the ZFS pool. However boot stops at mounting root because "no such
file system", and BTX (the FreeBSD loader) is very unresponsive. This
is probably because I have newcons installed as patch in
FreeBSD-current (11).
* Modified grub.cfg to include menu item having "kfreebsd
//@/boot/loader" for chain-loading into BTX. Chain-load method
successfully boots into zfs-based root and mounts all FS. Difference
between direct-boot and chainload seems to be access to zpool.cache,
which is actually different and maybe even a little buggy at this date
in 11 (I had some problems with automatically bringing up non-root
zpools and had to make some modifications in order to get it working)

Advise if any other info is required.
Thanks and Regards.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: grub2 boot root-on-zfs errors
  2013-11-25 11:08   ` Beeblebrox
@ 2013-11-25 11:14     ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25 17:29     ` Andrey Borzenkov
  2013-11-25 22:12     ` Vladimir 'phcoder' Serbinenko
  2 siblings, 0 replies; 20+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-11-25 11:14 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

On 25.11.2013 12:08, Beeblebrox wrote:
> * At boot time, grub menu comes up, and starts to boot normally into
> the ZFS pool. However boot stops at mounting root because "no such
> file system", and BTX (the FreeBSD loader) is very unresponsive.
What do you mean by BTX? The standard GRUB entries for FReeBSD
circumvent BTX altogether.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: grub2 boot root-on-zfs errors
  2013-11-25 11:08   ` Beeblebrox
  2013-11-25 11:14     ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-11-25 17:29     ` Andrey Borzenkov
  2013-11-25 22:12     ` Vladimir 'phcoder' Serbinenko
  2 siblings, 0 replies; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-25 17:29 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: zaphod

В Mon, 25 Nov 2013 13:08:45 +0200
Beeblebrox <zaphod@berentweb.com> пишет:

> * grub-mkconfig does not detect an ubuntu linux (btrfs) install on separate HDD.

Detection of other systems is implemented outside of grub2; it is done
by os-prober. grub-mkconfig will launch os-prober if it is found and
interpret its output, that's all. It is done as part of /etc/grub.d framework, so any custom code is possible instead of os-prober.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] Explicitly check for linking format to use for efiemu64 module
  2013-11-25  4:22   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-11-25 17:42     ` Andrey Borzenkov
  2013-11-25 17:51       ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-25 17:42 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

В Mon, 25 Nov 2013 05:22:58 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:

> > +      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
> > +      LDFLAGS="-m64 -Wl,$format -nostdlib"
> You need -static as otherwise on Apple systems it will try to pull in
> the dynamic linker which we don't want (scratch comment about other
> thread, I though of adding -static everywhere but it's no necessarry
> after all)

I used the same flags as in Makefile. If -static is needed here should
not it be added to grub-core/Makefile.am as well?

> > diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
> > index e2da083..e6862b7 100644
> > --- a/grub-core/Makefile.am
> > +++ b/grub-core/Makefile.am
> > @@ -421,7 +421,7 @@ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
> >  	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
> >  	  rm -f $@.bin; \
> Here the check for apple linker has to be adjusted as
> x$(EFIEMU64_LINK_FORMAT) = x-arch,x86_64

Mmm ... but I assume apple linker case *did* work before and it broke
only for the case !TARGET_APPLE_LINKER. Should $(EFIEMU64_LINK_FORMAT)
be added for apple linker case as well? I have no way to test it.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] Explicitly check for linking format to use for efiemu64 module
  2013-11-25 17:42     ` Andrey Borzenkov
@ 2013-11-25 17:51       ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25 18:13         ` [PATCH v2] " Andrey Borzenkov
  0 siblings, 1 reply; 20+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-11-25 17:51 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

On 25.11.2013 18:42, Andrey Borzenkov wrote:
> В Mon, 25 Nov 2013 05:22:58 +0100
> Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:
> 
>>> +      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
>>> +      LDFLAGS="-m64 -Wl,$format -nostdlib"
>> You need -static as otherwise on Apple systems it will try to pull in
>> the dynamic linker which we don't want (scratch comment about other
>> thread, I though of adding -static everywhere but it's no necessarry
>> after all)
> 
> I used the same flags as in Makefile. If -static is needed here should
> not it be added to grub-core/Makefile.am as well?
> 
>>> diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
>>> index e2da083..e6862b7 100644
>>> --- a/grub-core/Makefile.am
>>> +++ b/grub-core/Makefile.am
>>> @@ -421,7 +421,7 @@ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
>>>  	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
>>>  	  rm -f $@.bin; \
>> Here the check for apple linker has to be adjusted as
>> x$(EFIEMU64_LINK_FORMAT) = x-arch,x86_64
> 
> Mmm ... but I assume apple linker case *did* work before and it broke
> only for the case !TARGET_APPLE_LINKER. Should $(EFIEMU64_LINK_FORMAT)
> be added for apple linker case as well? I have no way to test it.
> 
What I mean is that TARGET_APPLE_LINKER is conditioned on link_format.
And in this case we should check for efiemu64_link_format. As for the
exact command, don't worry too much about it, I'll clean it up and unify
the two cases after your patch is merged.
> 
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2] Explicitly check for linking format to use for efiemu64 module
  2013-11-25 17:51       ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-11-25 18:13         ` Andrey Borzenkov
  2013-11-25 18:19           ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-25 18:13 UTC (permalink / raw)
  To: grub-devel; +Cc: Beeblebrox

Similar to check for target linking format, also check for efiemu64
instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
variants. We cannot easily reuse main target check because platforms
are different (main target is 32 bit and efiemu64 - 64 bit).

This commit adds EFIEMU64_LINK_FORMAT that contains detected
link option and is used in efiemu64.o linking instead of hardcoded
value.

Reported-By: Beeblebrox <zaphod@berentweb.com>
---
 configure.ac          | 29 +++++++++++++++++++++++++++--
 grub-core/Makefile.am |  9 ++++-----
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index d1292c9..1989f87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -654,6 +654,30 @@ if test x"$efiemu_excuse" = x ; then
      efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
   fi
 fi
+if test x"$efiemu_excuse" = x ; then
+  AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
+    grub_cv_target_cc_efiemu64_link_format=unknown
+    for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
+      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
+      LDFLAGS="-m64 -Wl,$format -nostdlib -static"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+      asm (".globl start; start:");
+      asm (".globl _start; _start:");
+      asm (".globl __start; __start:");
+      void __main (void);
+      void __main (void) {}
+      ]], [[]])], [flag=1], [flag=0])
+      if test x"$flag" = x1; then
+        grub_cv_target_cc_efiemu64_link_format="$format"
+	break;
+      fi
+    done])
+  if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
+    efiemu_excuse="no suitable link format for efiemu64 found"
+  else
+    EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
+  fi
+fi
 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
   AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
 fi
@@ -663,11 +687,12 @@ else
 enable_efiemu=no
 fi
 AC_SUBST([enable_efiemu])
+AC_SUBST([EFIEMU64_LINK_FORMAT])
 
 CFLAGS="$TARGET_CFLAGS"
 
 if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
-  AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
+  AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
     grub_cv_target_cc_link_format=unknown
     for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
       if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
@@ -681,7 +706,7 @@ if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
       asm (".globl __start; __start:");
       void __main (void);
       void __main (void) {}
-      ]], [[]])], [flag=1], [])
+      ]], [[]])], [flag=1], [flag=0])
       if test x"$flag" = x1; then
         grub_cv_target_cc_link_format="$format"
 	break;
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index e2da083..3ca52ea 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -399,7 +399,7 @@ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
 	fi
 
 efiemu64_c.o: efiemu/runtime/efiemu.c
-	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
+	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
 	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
 	else \
 	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
@@ -407,7 +407,7 @@ efiemu64_c.o: efiemu/runtime/efiemu.c
 
 efiemu64_s.o: efiemu/runtime/efiemu.S
 	-rm -f $@
-	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
+	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
 	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
 	else \
 	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
@@ -415,14 +415,13 @@ efiemu64_s.o: efiemu/runtime/efiemu.S
 
 efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
 	-rm -f $@; \
-	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
+	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
 	  rm -f $@.bin; \
 	  $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
 	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
 	  rm -f $@.bin; \
 	else \
-	  $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
-	  if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
+	  $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^ || exit 1; \
 	fi
 
 platform_DATA += efiemu32.o efiemu64.o
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
  2013-11-25 18:13         ` [PATCH v2] " Andrey Borzenkov
@ 2013-11-25 18:19           ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25 18:34             ` Andrey Borzenkov
  0 siblings, 1 reply; 20+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-11-25 18:19 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 5382 bytes --]

On 25.11.2013 19:13, Andrey Borzenkov wrote:
> Similar to check for target linking format, also check for efiemu64
> instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
> variants. We cannot easily reuse main target check because platforms
> are different (main target is 32 bit and efiemu64 - 64 bit).
> 
> This commit adds EFIEMU64_LINK_FORMAT that contains detected
> link option and is used in efiemu64.o linking instead of hardcoded
> value.
Go ahead
> 
> Reported-By: Beeblebrox <zaphod@berentweb.com>
> ---
>  configure.ac          | 29 +++++++++++++++++++++++++++--
>  grub-core/Makefile.am |  9 ++++-----
>  2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index d1292c9..1989f87 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -654,6 +654,30 @@ if test x"$efiemu_excuse" = x ; then
>       efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
>    fi
>  fi
> +if test x"$efiemu_excuse" = x ; then
> +  AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
> +    grub_cv_target_cc_efiemu64_link_format=unknown
> +    for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
> +      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
> +      LDFLAGS="-m64 -Wl,$format -nostdlib -static"
> +      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
> +      asm (".globl start; start:");
> +      asm (".globl _start; _start:");
> +      asm (".globl __start; __start:");
> +      void __main (void);
> +      void __main (void) {}
> +      ]], [[]])], [flag=1], [flag=0])
> +      if test x"$flag" = x1; then
> +        grub_cv_target_cc_efiemu64_link_format="$format"
> +	break;
> +      fi
> +    done])
> +  if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
> +    efiemu_excuse="no suitable link format for efiemu64 found"
> +  else
> +    EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
> +  fi
> +fi
>  if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
>    AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
>  fi
> @@ -663,11 +687,12 @@ else
>  enable_efiemu=no
>  fi
>  AC_SUBST([enable_efiemu])
> +AC_SUBST([EFIEMU64_LINK_FORMAT])
>  
>  CFLAGS="$TARGET_CFLAGS"
>  
>  if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
> -  AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
> +  AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
>      grub_cv_target_cc_link_format=unknown
>      for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
>        if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
> @@ -681,7 +706,7 @@ if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
>        asm (".globl __start; __start:");
>        void __main (void);
>        void __main (void) {}
> -      ]], [[]])], [flag=1], [])
> +      ]], [[]])], [flag=1], [flag=0])
>        if test x"$flag" = x1; then
>          grub_cv_target_cc_link_format="$format"
>  	break;
> diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
> index e2da083..3ca52ea 100644
> --- a/grub-core/Makefile.am
> +++ b/grub-core/Makefile.am
> @@ -399,7 +399,7 @@ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
>  	fi
>  
>  efiemu64_c.o: efiemu/runtime/efiemu.c
> -	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
> +	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
>  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
>  	else \
>  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
> @@ -407,7 +407,7 @@ efiemu64_c.o: efiemu/runtime/efiemu.c
>  
>  efiemu64_s.o: efiemu/runtime/efiemu.S
>  	-rm -f $@
> -	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
> +	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
>  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
>  	else \
>  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
> @@ -415,14 +415,13 @@ efiemu64_s.o: efiemu/runtime/efiemu.S
>  
>  efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
>  	-rm -f $@; \
> -	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
> +	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
>  	  rm -f $@.bin; \
>  	  $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
>  	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
>  	  rm -f $@.bin; \
>  	else \
> -	  $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
> -	  if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
> +	  $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^ || exit 1; \
>  	fi
>  
>  platform_DATA += efiemu32.o efiemu64.o
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 291 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
  2013-11-25 18:19           ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-11-25 18:34             ` Andrey Borzenkov
  0 siblings, 0 replies; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-25 18:34 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 5827 bytes --]

В Mon, 25 Nov 2013 19:19:00 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:

> On 25.11.2013 19:13, Andrey Borzenkov wrote:
> > Similar to check for target linking format, also check for efiemu64
> > instead of hardcoding -melf_x86_64. This fixes compilation on *BSD
> > variants. We cannot easily reuse main target check because platforms
> > are different (main target is 32 bit and efiemu64 - 64 bit).
> > 
> > This commit adds EFIEMU64_LINK_FORMAT that contains detected
> > link option and is used in efiemu64.o linking instead of hardcoded
> > value.
> Go ahead

Committed with additional comment in grub-core/Makefile.am that
-arch,x86_64 == Apple linker

> > 
> > Reported-By: Beeblebrox <zaphod@berentweb.com>
> > ---
> >  configure.ac          | 29 +++++++++++++++++++++++++++--
> >  grub-core/Makefile.am |  9 ++++-----
> >  2 files changed, 31 insertions(+), 7 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index d1292c9..1989f87 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -654,6 +654,30 @@ if test x"$efiemu_excuse" = x ; then
> >       efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
> >    fi
> >  fi
> > +if test x"$efiemu_excuse" = x ; then
> > +  AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
> > +    grub_cv_target_cc_efiemu64_link_format=unknown
> > +    for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
> > +      CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
> > +      LDFLAGS="-m64 -Wl,$format -nostdlib -static"
> > +      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
> > +      asm (".globl start; start:");
> > +      asm (".globl _start; _start:");
> > +      asm (".globl __start; __start:");
> > +      void __main (void);
> > +      void __main (void) {}
> > +      ]], [[]])], [flag=1], [flag=0])
> > +      if test x"$flag" = x1; then
> > +        grub_cv_target_cc_efiemu64_link_format="$format"
> > +	break;
> > +      fi
> > +    done])
> > +  if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
> > +    efiemu_excuse="no suitable link format for efiemu64 found"
> > +  else
> > +    EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
> > +  fi
> > +fi
> >  if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
> >    AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
> >  fi
> > @@ -663,11 +687,12 @@ else
> >  enable_efiemu=no
> >  fi
> >  AC_SUBST([enable_efiemu])
> > +AC_SUBST([EFIEMU64_LINK_FORMAT])
> >  
> >  CFLAGS="$TARGET_CFLAGS"
> >  
> >  if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
> > -  AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
> > +  AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
> >      grub_cv_target_cc_link_format=unknown
> >      for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
> >        if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
> > @@ -681,7 +706,7 @@ if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
> >        asm (".globl __start; __start:");
> >        void __main (void);
> >        void __main (void) {}
> > -      ]], [[]])], [flag=1], [])
> > +      ]], [[]])], [flag=1], [flag=0])
> >        if test x"$flag" = x1; then
> >          grub_cv_target_cc_link_format="$format"
> >  	break;
> > diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
> > index e2da083..3ca52ea 100644
> > --- a/grub-core/Makefile.am
> > +++ b/grub-core/Makefile.am
> > @@ -399,7 +399,7 @@ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
> >  	fi
> >  
> >  efiemu64_c.o: efiemu/runtime/efiemu.c
> > -	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
> > +	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
> >  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
> >  	else \
> >  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
> > @@ -407,7 +407,7 @@ efiemu64_c.o: efiemu/runtime/efiemu.c
> >  
> >  efiemu64_s.o: efiemu/runtime/efiemu.S
> >  	-rm -f $@
> > -	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
> > +	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
> >  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
> >  	else \
> >  	  $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
> > @@ -415,14 +415,13 @@ efiemu64_s.o: efiemu/runtime/efiemu.S
> >  
> >  efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
> >  	-rm -f $@; \
> > -	if test "x$(TARGET_APPLE_LINKER)" = x1; then \
> > +	if test "x$(EFIEMU64_LINK_FORMAT)" = x-arch,x86_64; then \
> >  	  rm -f $@.bin; \
> >  	  $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
> >  	  $(TARGET_OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
> >  	  rm -f $@.bin; \
> >  	else \
> > -	  $(TARGET_CC) -m64 -Wl,-melf_x86_64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
> > -	  if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
> > +	  $(TARGET_CC) -m64 $(EFIEMU64_LINK_FORMAT) -nostdlib -Wl,-r -o $@ $^ || exit 1; \
> >  	fi
> >  
> >  platform_DATA += efiemu32.o efiemu64.o
> > 
> 
> 


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: grub2 boot root-on-zfs errors
  2013-11-25 11:08   ` Beeblebrox
  2013-11-25 11:14     ` Vladimir 'φ-coder/phcoder' Serbinenko
  2013-11-25 17:29     ` Andrey Borzenkov
@ 2013-11-25 22:12     ` Vladimir 'phcoder' Serbinenko
  2 siblings, 0 replies; 20+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2013-11-25 22:12 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]

paste your grub.cfg to give context
On Nov 25, 2013 12:09 PM, "Beeblebrox" <zaphod@berentweb.com> wrote:

> Hello.
> I have built and installed Grub from trunk (lbeit without docs and
> efiemu, which I don't need). I have also installed the boot code and
> have booted from grub. Here are my results:
> * grub-probe correctly identifies partitions as ZFS.
> * grub-mkconfig correctly generates a config file and has the correct
> path, insmod code for zfs-booting.
> * grub-mkconfig does not detect an ubuntu linux (btrfs) install on
> separate HDD.
> * At boot time, grub menu comes up, and starts to boot normally into
> the ZFS pool. However boot stops at mounting root because "no such
> file system", and BTX (the FreeBSD loader) is very unresponsive. This
> is probably because I have newcons installed as patch in
> FreeBSD-current (11).
> * Modified grub.cfg to include menu item having "kfreebsd
> //@/boot/loader" for chain-loading into BTX. Chain-load method
> successfully boots into zfs-based root and mounts all FS. Difference
> between direct-boot and chainload seems to be access to zpool.cache,
> which is actually different and maybe even a little buggy at this date
> in 11 (I had some problems with automatically bringing up non-root
> zpools and had to make some modifications in order to get it working)
>
> Advise if any other info is required.
> Thanks and Regards.
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 2006 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
@ 2013-11-26  7:19 Beeblebrox
  2013-11-26  7:25 ` Andrey Borzenkov
  0 siblings, 1 reply; 20+ messages in thread
From: Beeblebrox @ 2013-11-26  7:19 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: The development of GNU GRUB

>> Or just update to current trunk, I committed this patch.

Updated to trunk, it all works & gets compiled.
Still have to manually clean out the "docs" references in Makefile however.

Thanks for the swift work.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
  2013-11-26  7:19 Beeblebrox
@ 2013-11-26  7:25 ` Andrey Borzenkov
  0 siblings, 0 replies; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-26  7:25 UTC (permalink / raw)
  To: Raif S. Berent; +Cc: The development of GNU GRUB

On Tue, Nov 26, 2013 at 11:19 AM, Beeblebrox <zaphod@berentweb.com> wrote:

> Still have to manually clean out the "docs" references in Makefile however.
>

Did earlier versions grub.texi compiled? In this case you could try to
bisect it. Setup build tree outside of git checkout and just copy
grub.texi over; it is self contained.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
@ 2013-11-26  7:31 Beeblebrox
  2013-11-26  7:35 ` Andrey Borzenkov
  0 siblings, 1 reply; 20+ messages in thread
From: Beeblebrox @ 2013-11-26  7:31 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: The development of GNU GRUB

> Did earlier versions grub.texi compiled?
Yes, earlier versions of grub.texi did compile.

> Setup build tree outside of git checkout and just copy
> grub.texi over; it is self contained.
It's OK, I don't need it really. Unless you need me to test and get
back to you with results.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
  2013-11-26  7:31 Beeblebrox
@ 2013-11-26  7:35 ` Andrey Borzenkov
  0 siblings, 0 replies; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-26  7:35 UTC (permalink / raw)
  To: Raif S. Berent; +Cc: The development of GNU GRUB

On Tue, Nov 26, 2013 at 11:31 AM, Beeblebrox <zaphod@berentweb.com> wrote:
> It's OK, I don't need it really. Unless you need me to test and get
> back to you with results.

Would be nice; as new release is planned in not so distant future, we
should try to iron out problems.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
@ 2013-11-26  7:53 Beeblebrox
  2013-11-26  8:41 ` Andrey Borzenkov
  0 siblings, 1 reply; 20+ messages in thread
From: Beeblebrox @ 2013-11-26  7:53 UTC (permalink / raw)
  To: Andrey Borzenkov, The development of GNU GRUB

OK, I'll try it. But I need clarification:

* Should I copy the repo and do a git rollback on the copy?
* Easier to copy only grub/docs to another folder, but how do I start
the build then? The Makefile in grub/docs will fail just as when run
from top-level.

>> just copy grub.texi over
From my current repo, or an older ver?


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] Explicitly check for linking format to use for efiemu64 module
  2013-11-26  7:53 Beeblebrox
@ 2013-11-26  8:41 ` Andrey Borzenkov
  0 siblings, 0 replies; 20+ messages in thread
From: Andrey Borzenkov @ 2013-11-26  8:41 UTC (permalink / raw)
  To: Raif S. Berent; +Cc: The development of GNU GRUB

On Tue, Nov 26, 2013 at 11:53 AM, Beeblebrox <zaphod@berentweb.com> wrote:
> OK, I'll try it. But I need clarification:
>
> * Should I copy the repo and do a git rollback on the copy?

Just setup separate tree to perform build. The actual state does not
really matter; you can use current master, ignore doc build error for
now.

> * Easier to copy only grub/docs to another folder, but how do I start
> the build then? The Makefile in grub/docs will fail just as when run
> from top-level.
>
>>> just copy grub.texi over
> From my current repo, or an older ver?

git clone grub-repo
git bisect start
git bisect bad
git bisect good OLD-COMMIT-ID
cp docs/grub.texi /path/to/build/tree/docs/grub.texi
(cd /path/to/build/tree; make)

git bisect good|bad
cp docs/grub.texi /path/to/build/tree/docs/grub.texi
(cd /path/to/build/tree; make)

...

repeat until you find the first bad commit.man git-bisect.


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-11-26  8:41 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-24  9:14 grub2 boot root-on-zfs errors Beeblebrox
2013-11-24 15:08 ` Andrey Borzenkov
2013-11-25 11:08   ` Beeblebrox
2013-11-25 11:14     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-25 17:29     ` Andrey Borzenkov
2013-11-25 22:12     ` Vladimir 'phcoder' Serbinenko
2013-11-24 17:21 ` [PATCH] Explicitly check for linking format to use for efiemu64 module Andrey Borzenkov
2013-11-25  3:59   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-25  4:22   ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-25 17:42     ` Andrey Borzenkov
2013-11-25 17:51       ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-25 18:13         ` [PATCH v2] " Andrey Borzenkov
2013-11-25 18:19           ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-25 18:34             ` Andrey Borzenkov
  -- strict thread matches above, loose matches on Subject: below --
2013-11-26  7:19 Beeblebrox
2013-11-26  7:25 ` Andrey Borzenkov
2013-11-26  7:31 Beeblebrox
2013-11-26  7:35 ` Andrey Borzenkov
2013-11-26  7:53 Beeblebrox
2013-11-26  8:41 ` Andrey Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).