rust-hypervisor-firmware: init at 0.4.2

This commit is contained in:
Astro 2023-03-26 01:29:36 +01:00
parent 0fc009e24c
commit 5cc9cef25d
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,57 @@
{ lib
, fetchFromGitHub
, makeRustPlatform
, hostPlatform
, targetPlatform
, lld
}:
let
arch = targetPlatform.qemuArch;
target = ./. + "/${arch}-unknown-none.json";
cross = import ../../../.. {
system = hostPlatform.system;
crossSystem = lib.systems.examples."${arch}-embedded" // {
rustc.config = "${arch}-unknown-none";
rustc.platform = lib.importJSON target;
};
};
inherit (cross) rustPlatform;
in
rustPlatform.buildRustPackage rec {
pname = "rust-hypervisor-firmware";
version = "0.4.2";
src = fetchFromGitHub {
owner = "cloud-hypervisor";
repo = pname;
rev = version;
sha256 = "sha256-hKk5pcop8rb5Q+IVchcl+XhMc3DCBBPn5P+AkAb9XxI=";
};
cargoSha256 = "sha256-edi6/Md6KebKM3wHArZe1htUCg0/BqMVZKA4xEH25GI=";
RUSTC_BOOTSTRAP = 1;
nativeBuildInputs = [
lld
];
RUSTFLAGS = "-C linker=lld -C linker-flavor=ld.lld";
# Tests don't work for `no_std`. See https://os.phil-opp.com/testing/
doCheck = false;
meta = with lib; {
homepage = "https://github.com/cloud-hypervisor/rust-hypervisor-firmware";
description = "A simple firmware that is designed to be launched from anything that supports loading ELF binaries and running them with the PVH booting standard";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ astro ];
platforms = [ "x86_64-none" ];
};
}

View File

@ -0,0 +1,20 @@
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"executables": true,
"linker": "rust-lld",
"linker-flavor": "ld.lld",
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float",
"code-model": "small",
"relocation-model": "pic",
"pre-link-args": {
"ld.lld": ["--script=x86_64-unknown-none.ld"]
}
}

View File

@ -25399,6 +25399,8 @@ with pkgs;
qboot = pkgsi686Linux.callPackage ../applications/virtualization/qboot { };
rust-hypervisor-firmware = callPackage ../applications/virtualization/rust-hypervisor-firmware { };
OVMF = callPackage ../applications/virtualization/OVMF { };
OVMFFull = callPackage ../applications/virtualization/OVMF {
secureBoot = true;