diff options
author | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2017-01-26 17:52:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-26 17:52:28 +0200 |
commit | e2a2f6d595d7df5ddeecbfed830692fd8ee68697 (patch) | |
tree | 10ffdaab98bac12bd6afd82c42d497d50667b04a /nixos | |
parent | bca9bcb3c3dd3b2e46f8e07db9a8326de01697c7 (diff) | |
parent | 32643dc07db92ed989c496f23037138802927dea (diff) | |
download | nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.tar nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.tar.gz nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.tar.bz2 nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.tar.lz nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.tar.xz nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.tar.zst nixlib-e2a2f6d595d7df5ddeecbfed830692fd8ee68697.zip |
Merge pull request #22117 from dezgeg/aarch64-for-merge
Aarch64 (ARM64) support
Diffstat (limited to 'nixos')
3 files changed, 68 insertions, 1 deletions
diff --git a/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix b/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix new file mode 100644 index 000000000000..8cf349fbd078 --- /dev/null +++ b/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix @@ -0,0 +1,63 @@ +# To build, use: +# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-aarch64.nix -A config.system.build.sdImage +{ config, lib, pkgs, ... }: + +let + extlinux-conf-builder = + import ../../system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix { + inherit pkgs; + }; +in +{ + imports = [ + ../../profiles/minimal.nix + ../../profiles/installation-device.nix + ./sd-image.nix + ]; + + assertions = lib.singleton { + assertion = pkgs.stdenv.system == "aarch64-linux"; + message = "sd-image-aarch64.nix can be only built natively on Aarch64 / ARM64; " + + "it cannot be cross compiled"; + }; + + # Needed by RPi firmware + nixpkgs.config.allowUnfree = true; + + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelParams = ["console=ttyS0,115200n8" "console=tty0"]; + boot.consoleLogLevel = 7; + + # FIXME: this probably should be in installation-device.nix + users.extraUsers.root.initialHashedPassword = ""; + + sdImage = { + populateBootCommands = let + # Contains a couple of fixes for booting a Linux kernel, will hopefully appear upstream soon. + patchedUboot = pkgs.ubootRaspberryPi3_64bit.overrideAttrs (oldAttrs: { + src = pkgs.fetchFromGitHub { + owner = "dezgeg"; + repo = "u-boot"; + rev = "baab53ec244fe44def01948a0f10e67342d401e6"; + sha256 = "0r5j2pc42ws3w3im0a9c6bh01czz5kapqrqp0ik9ra823cw73lxr"; + }; + }); + + configTxt = pkgs.writeText "config.txt" '' + kernel=u-boot-rpi3.bin + arm_control=0x200 + enable_uart=1 + ''; + in '' + for f in bootcode.bin fixup.dat start.elf; do + cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/ + done + cp ${patchedUboot}/u-boot.bin boot/u-boot-rpi3.bin + cp ${configTxt} boot/config.txt + ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot + ''; + }; +} diff --git a/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix b/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix index 456ef7c9f541..76f5d4bf6472 100644 --- a/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix +++ b/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix @@ -1,3 +1,5 @@ +# To build, use: +# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix -A config.system.build.sdImage { config, lib, pkgs, ... }: let @@ -46,7 +48,7 @@ in cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/ done cp ${pkgs.ubootRaspberryPi2}/u-boot.bin boot/u-boot-rpi2.bin - cp ${pkgs.ubootRaspberryPi3}/u-boot.bin boot/u-boot-rpi3.bin + cp ${pkgs.ubootRaspberryPi3_32bit}/u-boot.bin boot/u-boot-rpi3.bin cp ${configTxt} boot/config.txt ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot ''; diff --git a/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix b/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix index e7163f10a3c3..c7915b578d8a 100644 --- a/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix +++ b/nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix @@ -1,3 +1,5 @@ +# To build, use: +# nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-raspberrypi.nix -A config.system.build.sdImage { config, lib, pkgs, ... }: let |