Bug #90
open
GRUB fails to build under Debian testing
Added by Nathaniel Roach almost 8 years ago.
Updated over 7 years ago.
Description
Debain did something funny with the toolchain a while back, but apparently coreboot had worked around it. I rebuilt crossgcc with -b last night and that didn't solve the issue.
config.status: creating grub-reboot
Making all in grub-core
/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status
If I tweak payloads/external/GRUB2/Makefile such that line 43 has CFLAGS="-O2 -fno-pie" TARGET_CFLAGS="-Os -no-pie" it builds but then SeaBIOS won't run the grub payload:
Booting from CBFS...
Run img/grub
Segment 464c457f 16777216@0xff9291b8 -> 8519680@0x02000300
No support for compression type 10101
enter handle_18:
NULL
Booting from Hard Disk...
Files
Commit a3e9da05 (configure: add check for -no-pie if the compiler default to -fPIE) should have fixed the build issue in GRUB.
commit a3e9da054d00260f274cfd9d1b9611c32ecd437c
Author: Magnus Granberg <>
AuthorDate: Wed Dec 14 20:44:41 2016 +0300
Commit: Andrei Borzenkov <>
CommitDate: Wed Dec 14 20:44:41 2016 +0300
configure: add check for -no-pie if the compiler default to -fPIE
When Grub is compile with gcc 6.1 that have --enable-defult-pie set.
It fail with.
-ffreestanding -m32 -Wl,-melf_i386 -Wl,--build-id=none -nostdlib -Wl,-N -Wl,-r,-d -
o trig.module trig_module-trigtables.o
grep 'MARKER' gcry_whirlpool.marker.new > gcry_whirlpool.marker; rm -f
gcry_whirlpool.marker.new
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and -
shared may not be used together
collect2: error: ld returned 1 exit status
Makefile:26993: recipe for target 'trig.module' failed
Check that compiler supports -no-pie and add it to linker flags.
With that I can successfully build the master branch from GRUB with the toolchain from Debian (Sid/unstable).
Please create a separate ticket for the other issue, and add how you add the GRUB ELF file to the CBFS image.
$ git log --oneline -1
970af16 vgasrc: Increase debug level
$ git grep "No support for com"
src/fw/coreboot.c: dprintf(1, "No support for compression type %x\n"
I created a new copy of the git tree and built from scratch in there - it all seemed to work fine. I'm a little confused as I did rebuild the toolchain, but it works now so I'm not fussed.
Cheers for your time.
I'm still getting this issue with the latest coreboot code on Debian Stretch, when adding GRUB as primary payload. Is there a workaround?
- Status changed from New to In Progress
SGS IT, are you using GRUB master? Please post your configuration file (.config
).
Thanks for replying so quickly, Paul. Yes I am - config file attached.
Indeed, GRUB master is used. Just to be sure, could you please delete the folder grub
(?) in payloads/external/GRUB2/
, and rerun the build. If it doesn’t work, please paste the build error.
PS: Also please note, coreboot is officially written all lowercase.
Apologies for the incorrect casing. I still get the following error after deleting the grub2 folder (same as OP)
config.status: creating grub-reboot
Making all in grub-core
/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status
Makefile:24260: recipe for target 'disk.module' failed
make[5]: *** [disk.module] Error 1
Makefile:23531: recipe for target 'all' failed
make[4]: *** [all] Error 2
Makefile:10897: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
Makefile:3123: recipe for target 'all' failed
make[2]: *** [all] Error 2
Makefile:49: recipe for target 'grub2' failed
make[1]: *** [grub2] Error 2
payloads/external/Makefile.inc:134: recipe for target 'grub2' failed
make: *** [grub2] Error 2
No idea right now. More next week.
Maybe one more thing. cd payloads/external/GRUB2/grub2
and then please post the output of git status
, and git log --oneline -1
.
Also, can you build GRUB manually?
$ ./autogen.sh
$ ./configure --with-platform=coreboot
$ make
$ make default_payload.elf
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
build/
nothing added to commit but untracked files present (use "git add" to track)
$ git log --oneline -1
bcf3c5553 xen: Fix wrong register in relocator.
A manual build of GRUB completes successfully.
Also available in: Atom
PDF