1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 21:11:34 +03:00
mobile-nixos/devices/pine64-pinephone/overlay/crust-firmware/default.nix
2021-02-02 05:51:18 -05:00

53 lines
1.1 KiB
Nix

{ stdenv, lib, fetchFromGitHub
, flex, yacc, or1k-toolchain }:
stdenv.mkDerivation rec {
pname = "crust-firmware";
version = "0.3";
src = fetchFromGitHub {
owner = "crust-firmware";
repo = "crust";
rev = "v${version}";
sha256 = "1ncn2ncmkj1cjk68zrgr5yk7b9x1xxcrcmk9jf188svjgk0cq2m5";
};
depsBuildBuild = [
stdenv.cc
];
nativeBuildInputs = [
flex
yacc
] ++ (with or1k-toolchain; [
binutils
gcc
]);
postPatch = ''
substituteInPlace Makefile --replace "= lex" '= ${flex}/bin/flex'
'';
buildPhase = ''
export CROSS_COMPILE=or1k-elf-
export HOST_COMPILE=${stdenv.cc}/bin/${stdenv.cc.bintools.targetPrefix}
make pinephone_defconfig
make scp
'';
installPhase = ''
mkdir -p $out/bin
cp -v build/scp/scp.bin $out
'';
meta = with lib; {
description = "Libre SCP firmware for Allwinner sunxi SoCs";
homepage = "https://github.com/crust-firmware/crust";
license = with licenses; [ bsd3 gpl2Only mit ];
maintainers = [ maintainers.noneucat ];
platforms = platforms.all;
};
}