Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross Compiling linux_latest fails with 'crossDrv' missing. #24388

Closed
TomSmeets opened this issue Mar 27, 2017 · 12 comments
Closed

Cross Compiling linux_latest fails with 'crossDrv' missing. #24388

TomSmeets opened this issue Mar 27, 2017 · 12 comments
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on

Comments

@TomSmeets
Copy link
Contributor

Issue description

I want to cross-compile the linux kernel for my raspberry-pi 3
But it fails with the error: attribute ‘crossDrv’ missing.

Steps to reproduce

> nix-build -A linux_latest cross-aarch64.nix
error: attribute ‘crossDrv’ missing, at /etc/nixos/nixpkgs-rpi/pkgs/os-specific/linux/kernel/generic.nix:74:18
(use ‘--show-trace’ to show detailed location information)

cross-aarch64.nix

let
  aarch64-multiplatform = {
    name = "aarch64-multiplatform";
    kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
    kernelHeadersBaseConfig = "defconfig";
    kernelBaseConfig = "defconfig";
    kernelArch = "arm64";
    kernelDTB = true;
    kernelAutoModules = true;
    kernelPreferBuiltin = true;
    kernelExtraConfig = ''
      # Raspberry Pi 3 stuff. Not needed for kernels >= 4.10.
      ARCH_BCM2835 y
      BCM2835_MBOX y
      BCM2835_WDT y
      RASPBERRYPI_FIRMWARE y
      RASPBERRYPI_POWER y
      SERIAL_8250_BCM2835AUX y
      SERIAL_8250_EXTENDED y
      SERIAL_8250_SHARE_IRQ y
      # Cavium ThunderX stuff.
      PCI_HOST_THUNDER_ECAM y
    '';
    uboot = null;
    kernelTarget = "Image";
    gcc = {
      arch = "armv8-a";
    };
  };
in import ./default.nix {
  crossSystem = rec {
    config = "aarch64-linux";
    bigEndian = false;
    arch = "aarch64";
    withTLS = true;
    libc = "glibc";
    platform = aarch64-multiplatform;

    float = "hard";
    fpu = "vfp";
    openssl.system = "linux-generic32";
    gcc = {
      arch = "aarch64";
      fpu = "vfp";
      float = "softfp";
      abi = "aapcs-linux";
    };
  };
}

Technical details

  • System: (NixOS: nixos-version, Ubuntu/Fedora: lsb_release -a, ...)
  • Nix version: (run nix-env --version)
  • Nixpkgs version: (run nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion)
@globin
Copy link
Member

globin commented Mar 27, 2017

cc @Ericson2314 who was working on cross compiling stuff and should know "everything" ;)

@Ericson2314
Copy link
Member

Try just removing .crossDrv from that line. CrossDrv is now the default.

@TomSmeets
Copy link
Contributor Author

@Ericson2314
What line do you mean?

@copumpkin
Copy link
Member

copumpkin commented Mar 28, 2017

@TomSmeets probably means changing this line (from your original error message) from

inherit (kernel.crossDrv) src patches preUnpack;

to

inherit (kernel) src patches preUnpack;

@TomSmeets
Copy link
Contributor Author

Yes, it started compiling.

There were also some errors in my cryssSystem definition.
I changed my crossSystem.gcc to:

    gcc = {
      arch = "armv8-a;
      abi = "lp64";
    };

Thanks for your help. 👍

@Ericson2314
Copy link
Member

Can somebody make a PR for this?

@Ericson2314 Ericson2314 reopened this Apr 4, 2017
@Ericson2314
Copy link
Member

Reopening until somebody confirms this is fixed on master.

@TomSmeets
Copy link
Contributor Author

I just want to say that I never managed to finish the compilation.
It fails with this error message:

unpacking source archive /nix/store/kj202br6bkh4xhd1i42p9rmlmbs5frhd-kmod-24.tar.xz
/nix/store/fylfd4fpibv5s2c01sq7m777qn8r7jz9-stdenv/setup: line 533: /nix/store/396q89s7wp2mhi94hfxyzll5y6ly4rx7-xz-5.2.2-aarch64-linux-gnu-bin/bin/xz: cannot execute binary file: Exec format error

@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label May 18, 2017
@Ericson2314
Copy link
Member

#26805 will take non-runnable binaries off the path, which should fix that. https://github.com/obsidiansystems/nixpkgs/tree/linux-cross-overhaul is a WIP branch to fix other linux stuff.

telent added a commit to telent/nixpkgs that referenced this issue Dec 25, 2017
@Ericson2314
Copy link
Member

Ericson2314 commented Mar 15, 2018

@shlevy I think we can build linux now? 😀

@shlevy
Copy link
Member

shlevy commented Mar 15, 2018

I already built Linux fine on staging...

@Ericson2314
Copy link
Member

(I didn't forget, just being tongue in cheek :). Great work, again!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on
Projects
None yet
Development

No branches or pull requests

5 participants