1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-23 19:39:42 +01:00
nixos-hardware/milkv/pioneer
Jörg Thalheim 218ab789fd milkv/pioneer: fix u-root cross-compilation
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
2024-04-08 06:34:49 +02:00
..
default.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
fip.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
firmware.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
linux.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
linuxboot-initrd.nix milkv/pioneer: fix u-root cross-compilation 2024-04-08 06:34:49 +02:00
linuxboot-kernel.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
opensbi.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
README.md milkv/pioneer: init 2024-04-05 13:35:18 +00:00
sd-image-installer.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
sd-image.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00
zsbl-increase-timeout.patch milkv/pioneer: init 2024-04-05 13:35:18 +00:00
zsbl.nix milkv/pioneer: init 2024-04-05 13:35:18 +00:00

Creating an installation SD card image

Create and customize a flake.nix file:

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

  outputs = { nixpkgs, nixos-hardware, ... }:
    let
      supportedSystems = [
        "x86_64-linux"
        "aarch64-linux"
        "riscv64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];
      forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
    in
    {
      packages = forAllSupportedSystems (system: rec {
        default = sd-image;
        sd-image = (import "${nixpkgs}/nixos" {
          configuration = {
            imports = [
              "${nixos-hardware}/milkv/pioneer/sd-image-installer.nix"
            ];

            nixpkgs.buildPlatform.system = system;
            nixpkgs.hostPlatform.system = "riscv64-linux";

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

Then build the image by running nix build .# in the same folder.

Known issues

LinuxBoot will not output the boot menu on the serial console, only on the graphical console. Unfortuately, it might also pick up boot options from other devices, e.g. an nvme or sata drive. It might end up booting by default from those instead of booting from the SD card.