forked from rarias/nixos-riscv
Boot opensbi without compressed
This commit is contained in:
158
flake.nix
158
flake.nix
@@ -1,63 +1,105 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:matthewcroughan/nixpkgs/mc/riscv-testing";
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
|
||||
# VisionFive ("v1")
|
||||
vendor-kernel = {
|
||||
url = "github:starfive-tech/linux";
|
||||
flake = false;
|
||||
# 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, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
overlay = import ./overlay.nix;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
"${nixos-hardware}/starfive/visionfive/v2/sd-image-installer.nix"
|
||||
];
|
||||
in {
|
||||
overlay = import ./overlay.nix;
|
||||
nixosConfigurations = {
|
||||
# The cross configuration defines a system that runs in the RISC-V
|
||||
# architecture, but is build from an x86 host machine.
|
||||
cross = nixpkgs.lib.nixosSystem {
|
||||
system = "${system}";
|
||||
modules = modules ++ [
|
||||
{
|
||||
nixpkgs.crossSystem = {
|
||||
gcc.arch = "rv64gv";
|
||||
gcc.tune = "rv64gv";
|
||||
system = "riscv64-linux";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
# The native configuration defines the same system, but built from an
|
||||
# RISC-V machine. Not needed for now.
|
||||
#native = nixpkgs.lib.nixosSystem {
|
||||
# system = "riscv64-linux";
|
||||
# modules = modules;
|
||||
#};
|
||||
};
|
||||
|
||||
# A development shell with QEMU ready to boot the RISC-V system in an x86
|
||||
# machine.
|
||||
devShells.x86_64-linux.default =
|
||||
let
|
||||
nixosconf = self.nixosConfigurations.cross;
|
||||
sysconf = nixosconf.config;
|
||||
syspkgs = nixosconf.pkgs;
|
||||
in
|
||||
pkgs.mkShell {
|
||||
pname = "qemu-shell";
|
||||
buildInputs = with pkgs; [ qemu ];
|
||||
# Here we tell the run script where to find the system
|
||||
#NIXOS_SYSTEM_TOPLEVEL = "${sysconfig.system.build.toplevel}";
|
||||
OPENSBI = syspkgs.opensbi;
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, vendor-kernel, ... }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; };
|
||||
modules = [
|
||||
{ nixpkgs.overlays = [ self.overlay ]; }
|
||||
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-riscv64-visionfive-installer.nix"
|
||||
./base.nix
|
||||
./configuration.nix
|
||||
];
|
||||
in
|
||||
{
|
||||
overlay = final: prev: {
|
||||
linuxPackages_visionfive = final.linuxPackagesFor (
|
||||
(
|
||||
final.callPackage ./kernel.nix { inherit vendor-kernel; }
|
||||
).override {
|
||||
patches = [];
|
||||
}
|
||||
);
|
||||
};
|
||||
legacyPackages.${system} =
|
||||
{
|
||||
inherit (pkgs.pkgsCross.riscv64.linux) linuxPackages_visionfive;
|
||||
};
|
||||
images = {
|
||||
visionfive-cross = self.nixosConfigurations.visionfive-cross.config.system.build.sdImage;
|
||||
visionfive-native = self.nixosConfigurations.visionfive-native.config.system.build.sdImage;
|
||||
|
||||
visionfive2-cross = self.nixosConfigurations.visionfive2-cross.config.system.build.sdImage;
|
||||
visionfive2-native = self.nixosConfigurations.visionfive2-native.config.system.build.sdImage;
|
||||
};
|
||||
nixosConfigurations = {
|
||||
visionfive-cross = nixpkgs.lib.nixosSystem {
|
||||
system = "${system}";
|
||||
modules = modules ++ [
|
||||
{
|
||||
nixpkgs.crossSystem = {
|
||||
gcc.arch = "rv64gv";
|
||||
gcc.tune = "rv64gv";
|
||||
system = "riscv64-linux";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
visionfive-native = nixpkgs.lib.nixosSystem {
|
||||
system = "riscv64-linux";
|
||||
modules = modules;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# flake-utils.lib.eachDefaultSystem (system:
|
||||
# rec {
|
||||
#
|
||||
# # .\#nixosConfigurations.visionfive-cross.config.system.build.toplevel
|
||||
# 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 = "test123";
|
||||
# # 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
|
||||
#
|
||||
# #hardware.deviceTree.overlays = [{
|
||||
# # name = "8GB-patch";
|
||||
# # dtsFile = "${nixos-hardware}/starfive/visionfive/v2/8gb-patch.dts";
|
||||
# #}];
|
||||
#
|
||||
# #sdImage.compressImage = false;
|
||||
#
|
||||
# nixpkgs.crossSystem = {
|
||||
# config = "riscv64-unknown-linux-gnu";
|
||||
# system = "riscv64-linux";
|
||||
# };
|
||||
#
|
||||
# system.stateVersion = "24.05";
|
||||
# };
|
||||
# inherit system;
|
||||
# }).config.system.build.toplevel;
|
||||
# });
|
||||
#}
|
||||
|
||||
Reference in New Issue
Block a user