1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-30 06:49:43 +01:00
nixos-hardware/starfive/visionfive/v2
2023-05-23 20:31:37 +02:00
..
default.nix starfive visionfive2: update kernel 2023-04-29 16:50:43 +02:00
firmware.nix starfive visionfive2: Fix cross compilation 2023-04-23 18:11:02 +02:00
linux-6.3.nix starfive visionfive2: replace 8GB memory patch with overlay 2023-05-23 20:31:37 +02:00
opensbi.nix Init starfive visionfive 2 2023-04-16 23:18:18 +02:00
README.md starfive visionfive2: replace 8GB memory patch with overlay 2023-05-23 20:31:37 +02:00
sd-image-installer.nix Init starfive visionfive 2 2023-04-16 23:18:18 +02:00
sd-image.nix Init starfive visionfive 2 2023-04-16 23:18:18 +02:00
spl-tool.nix starfive visionfive2: Update spl_tool 2023-04-18 09:19:48 +02:00
uboot.nix starfive visionfive2: update u-boot 2023-04-29 16:50:06 +02:00
visionfive-2-v1.2a-8GB.dts starfive visionfive2: replace 8GB memory patch with overlay 2023-05-23 20:31:37 +02:00
visionfive-2-v1.3b-8GB.dts starfive visionfive2: replace 8GB memory patch with overlay 2023-05-23 20:31:37 +02:00

Creating a SD-Image

Create and configure the flake.nix file:

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.nixos-hardware.url = "github:nixos/nixos-hardware";

  # Some dependencies of this flake are not yet available on non linux systems
  inputs.systems.url = "github:nix-systems/x86_64-linux";
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.flake-utils.inputs.systems.follows = "systems";

  outputs = { self, nixpkgs, nixos-hardware, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      rec {
        packages.default = packages.sd-image;
        packages.sd-image = (import "${nixpkgs}/nixos" {
          configuration =
            { config, ... }: {
              imports = [
                "${nixos-hardware}/starfive/visionfive/v2/sd-image-installer.nix"
              ];

              # If you want to use ssh set a password
              # users.users.nixos.password = "super secure password";
              # OR add your public ssh key
              # users.users.nixos.openssh.authorizedKeys.keys = [ "ssh-rsa ..." ];

              # AND configure networking
              # networking.interfaces.end0.useDHCP = true;
              # networking.interfaces.end1.useDHCP = true;

              # Additional configuration goes here

              sdImage.compressImage = false;

              nixpkgs.crossSystem = {
                config = "riscv64-unknown-linux-gnu";
                system = "riscv64-linux";
              };

              system.stateVersion = "23.05";
            };
          inherit system;
        }).config.system.build.sdImage;
      });
}

Build the sd image.

nix build .#

Additional configuration

Additional configuration may be needed depending on your specific hardware configuration.

Board rev 1.2A

If you have the 1.2A board revision add the following to your config:

hardware.deviceTree.name =
  lib.mkDefault "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb";

8GB memory

If your board has 8GB of RAM add the following to your config:

Board rev 1.3B

hardware.deviceTree.overlays = [{
  name = "8GB-patch";
  dtsFile =
    "${nixos-hardware}/starfive/visionfive/v2/visionfive-2-v1.3b-8GB.dts";
}];

Board rev 1.2A

hardware.deviceTree.overlays = [{
  name = "8GB-patch";
  dtsFile =
    "${nixos-hardware}/starfive/visionfive/v2/visionfive-2-v1.2a-8GB.dts";
}];