Skip to content

wanted: (updated?) crosscompile sd-aarch64 hints #441

@coderofsalvation

Description

@coderofsalvation

I'm on x86_64 nixos, trying to generate a rpi image.
Like mentioned in the README.md I've added this to my host configuration.nix:

{
  # Enable binfmt emulation of aarch64-linux.
  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
}

First attempt:

$ nixos-generate -f iso -c server.nix # works no problems here
$ nixos-generate -f sd-aarch64 -c server.nix
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:34:12:
           33|
           34|   strict = derivationStrict drvAttrs;
             |            ^
           35|

       … while evaluating derivation 'nixos-sd-image-23.11.7761.4a1e67352334-x86_64-linux.img'
         whose name attribute is located at /nix/store/7v1w7191pad8rz4v9dj7xlfcs2kz2m08-nixos-23.11/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'nixos-sd-image-23.11.7761.4a1e67352334-x86_64-linux.img'
         at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/installer/sd-card/sd-image.nix:1:6380:
       … while evaluating the option `sdImage.populateFirmwareCommands':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/installer/sd-card/sd-image-aarch64.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Package ‘uboot-rpi_3_defconfig-2023.07.02’ in /nix/store/7v1w7191pad8rz4v9dj7xlfcs2kz2m08-nixos-23.11/nixos/pkgs/misc/uboot/default.nix:127 is not available on the requested hostPlatform:
         hostPlatform.config = "x86_64-unknown-linux-gnu"
         package.meta.platforms = [
           "aarch64-linux"
         ]
         package.meta.badPlatforms = [ ]
       , refusing to evaluate.

       a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnsupportedSystem = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnsupportedSystem = true; }
       to ~/.config/nixpkgs/config.nix.

second attempt

$ NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nixos-generate -f sd-aarch64 -c server.nix
these 5 derivations will be built:
  /nix/store/3clskg2h9f75iq79bjji0q2xi49lkpvz-uboot-rpi_3_defconfig-2023.07.02.drv
  /nix/store/8l8z4gxlc9s17wbxd0as4bkdkzjvx18i-uboot-rpi_4_defconfig-2023.07.02.drv
  /nix/store/9xw7inmcyr0bymnigfmzb157h8pvpim8-ext4-fs.img.zst.drv
  /nix/store/nmg6pl0d8zyj6rbgivffafdxw52g914y-raspberrypi-armstubs-unstable-2022-07-11.drv
  /nix/store/8l8c7agbp71zpynsymnydmqjccxqpasb-nixos-sd-image-23.11.7761.4a1e67352334-x86_64-linux.img.drv
building '/nix/store/9xw7inmcyr0bymnigfmzb157h8pvpim8-ext4-fs.img.zst.drv'...
building '/nix/store/nmg6pl0d8zyj6rbgivffafdxw52g914y-raspberrypi-armstubs-unstable-2022-07-11.drv'...
building '/nix/store/3clskg2h9f75iq79bjji0q2xi49lkpvz-uboot-rpi_3_defconfig-2023.07.02.drv'...
building '/nix/store/8l8z4gxlc9s17wbxd0as4bkdkzjvx18i-uboot-rpi_4_defconfig-2023.07.02.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/pk49zldffnjsg9fh9fd5awq3j8lqcyb7-source
/nix/store/9zmr4jlsifabhmr1asbx2dkydkiqp7dn-extlinux-conf-builder.sh: line 138: cd: /nix/var/nix/profiles: No such file or directory
Preparing store paths for image...
Running phase: unpackPhase
unpacking source archive /nix/store/bvzli4m66fv7s3h9yb3ra37r2fbcrdjw-u-boot-2023.07.02.tar.bz2
Running phase: unpackPhase
unpacking source archive /nix/store/bvzli4m66fv7s3h9yb3ra37r2fbcrdjw-u-boot-2023.07.02.tar.bz2
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
build flags: SHELL=/nix/store/yisjp6hkqc1qz8lmgnc0dklx0hgg9w2x-bash-5.2-p15/bin/bash CC8=cc LD8=ld OBJCOPY8=objcopy OBJDUMP8=objdump CC7=cc LD7=ld OBJCOPY7=objcopy OBJDUMP7=objdump
cc -DBCM2710=0 -c armstub.S -o armstub.o
cc1: error: bad value 'armv8-a+crc' for '-march=' switch
cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 btver1 btver2 native
make: *** [Makefile:36: armstub.o] Error 1
error: builder for '/nix/store/nmg6pl0d8zyj6rbgivffafdxw52g914y-raspberrypi-armstubs-unstable-2022-07-11.drv' failed with exit code 2;
       last 10 log lines:
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > build flags: SHELL=/nix/store/yisjp6hkqc1qz8lmgnc0dklx0hgg9w2x-bash-5.2-p15/bin/bash CC8=cc LD8=ld OBJCOPY8=objcopy OBJDUMP8=objdump CC7=cc LD7=ld OBJCOPY7=objcopy OBJDUMP7=objdump
       > cc -DBCM2710=0 -c armstub.S -o armstub.o
       > cc1: error: bad value 'armv8-a+crc' for '-march=' switch
       > cc1: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 btver1 btver2 native
       > make: *** [Makefile:36: armstub.o] Error 1
       For full logs, run 'nix log /nix/store/nmg6pl0d8zyj6rbgivffafdxw52g914y-raspberrypi-armstubs-unstable-2022-07-11.drv'.
error (ignored): error: cannot unlink '/tmp/nix-build-uboot-rpi_4_defconfig-2023.07.02.drv-1/build/u-boot-2023.07.02/drivers': Directory not empty
error (ignored): error: cannot unlink '/tmp/nix-build-uboot-rpi_3_defconfig-2023.07.02.drv-1/build/u-boot-2023.07.02/drivers': Directory not empty
error: 1 dependencies of derivation '/nix/store/8l8c7agbp71zpynsymnydmqjccxqpasb-nixos-sd-image-23.11.7761.4a1e67352334-x86_64-linux.img.drv' failed to build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions