From 5cc9cef25d20a4d392a3076808763fcbfa9d0bf7 Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 26 Mar 2023 01:29:36 +0100 Subject: rust-hypervisor-firmware: init at 0.4.2 --- .../rust-hypervisor-firmware/default.nix | 57 ++++++++++++++++++++++ .../x86_64-unknown-none.json | 20 ++++++++ 2 files changed, 77 insertions(+) create mode 100644 pkgs/applications/virtualization/rust-hypervisor-firmware/default.nix create mode 100644 pkgs/applications/virtualization/rust-hypervisor-firmware/x86_64-unknown-none.json (limited to 'pkgs/applications/virtualization') diff --git a/pkgs/applications/virtualization/rust-hypervisor-firmware/default.nix b/pkgs/applications/virtualization/rust-hypervisor-firmware/default.nix new file mode 100644 index 000000000000..a4ab7c0805c8 --- /dev/null +++ b/pkgs/applications/virtualization/rust-hypervisor-firmware/default.nix @@ -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" ]; + }; +} diff --git a/pkgs/applications/virtualization/rust-hypervisor-firmware/x86_64-unknown-none.json b/pkgs/applications/virtualization/rust-hypervisor-firmware/x86_64-unknown-none.json new file mode 100644 index 000000000000..f42155ae32ee --- /dev/null +++ b/pkgs/applications/virtualization/rust-hypervisor-firmware/x86_64-unknown-none.json @@ -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"] + } +} -- cgit 1.4.1