Merge pull request #119711 from delroth/grub2-cross
grub2_efi: fix cross-compilation
This commit is contained in:
commit
c89ff38c8b
@ -1,6 +1,6 @@
|
|||||||
{ lib, stdenv, fetchgit, flex, bison, python3, autoconf, automake, gnulib, libtool
|
{ lib, stdenv, fetchgit, flex, bison, python3, autoconf, automake, gnulib, libtool
|
||||||
, gettext, ncurses, libusb-compat-0_1, freetype, qemu, lvm2, unifont, pkg-config
|
, gettext, ncurses, libusb-compat-0_1, freetype, qemu, lvm2, unifont, pkg-config
|
||||||
, pkgsBuildBuild
|
, buildPackages
|
||||||
, nixosTests
|
, nixosTests
|
||||||
, fuse # only needed for grub-mount
|
, fuse # only needed for grub-mount
|
||||||
, runtimeShell
|
, runtimeShell
|
||||||
@ -64,7 +64,8 @@ stdenv.mkDerivation rec {
|
|||||||
echo 'echo "Compile grub2 with { kbdcompSupport = true; } to enable support for this command."' >> util/grub-kbdcomp.in
|
echo 'echo "Compile grub2 with { kbdcompSupport = true; } to enable support for this command."' >> util/grub-kbdcomp.in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ bison flex python3 pkg-config autoconf automake gettext ];
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||||
|
nativeBuildInputs = [ bison flex python3 pkg-config autoconf automake gettext freetype ];
|
||||||
buildInputs = [ ncurses libusb-compat-0_1 freetype lvm2 fuse libtool ]
|
buildInputs = [ ncurses libusb-compat-0_1 freetype lvm2 fuse libtool ]
|
||||||
++ optional doCheck qemu
|
++ optional doCheck qemu
|
||||||
++ optional zfsSupport zfs;
|
++ optional zfsSupport zfs;
|
||||||
@ -105,9 +106,18 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--enable-grub-mount" # dep of os-prober
|
"--enable-grub-mount" # dep of os-prober
|
||||||
"BUILD_CC=${pkgsBuildBuild.stdenv.cc}/bin/cc"
|
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
]
|
# grub doesn't do cross-compilation as usual and tries to use unprefixed
|
||||||
++ optional zfsSupport "--enable-libzfs"
|
# tools to target the host. Provide toolchain information explicitly for
|
||||||
|
# cross builds.
|
||||||
|
#
|
||||||
|
# Ref: # https://github.com/buildroot/buildroot/blob/master/boot/grub2/grub2.mk#L108
|
||||||
|
"TARGET_CC=${stdenv.cc.targetPrefix}cc"
|
||||||
|
"TARGET_NM=${stdenv.cc.targetPrefix}nm"
|
||||||
|
"TARGET_OBJCOPY=${stdenv.cc.targetPrefix}objcopy"
|
||||||
|
"TARGET_RANLIB=${stdenv.cc.targetPrefix}ranlib"
|
||||||
|
"TARGET_STRIP=${stdenv.cc.targetPrefix}strip"
|
||||||
|
] ++ optional zfsSupport "--enable-libzfs"
|
||||||
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}" "--program-prefix=" ]
|
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}" "--program-prefix=" ]
|
||||||
++ optionals xenSupport [ "--with-platform=xen" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}"];
|
++ optionals xenSupport [ "--with-platform=xen" "--target=${efiSystemsBuild.${stdenv.hostPlatform.system}.target}"];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user