mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			810 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			810 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
{ lib
 | 
						|
, stdenv
 | 
						|
, fetchFromGitHub
 | 
						|
, python3
 | 
						|
, withPlatform ? "generic"
 | 
						|
, withPayload ? null
 | 
						|
, withFDT ? null
 | 
						|
}:
 | 
						|
 | 
						|
stdenv.mkDerivation rec {
 | 
						|
  pname = "opensbi";
 | 
						|
  version = "1.3-git-2868f26";
 | 
						|
 | 
						|
  src = fetchFromGitHub {
 | 
						|
    owner = "riscv-software-src";
 | 
						|
    repo = "opensbi";
 | 
						|
    rev = "2868f26131308ff345382084681ea89c5b0159f1";
 | 
						|
    sha256 = "sha256-E+nVFLSpH6lQ2nVmMlVRTr7qYRVY0ULW7gUvAyTr90I=";
 | 
						|
  };
 | 
						|
 | 
						|
  postPatch = ''
 | 
						|
    patchShebangs ./scripts
 | 
						|
  '';
 | 
						|
 | 
						|
  nativeBuildInputs = [ python3 ];
 | 
						|
 | 
						|
  installFlags = [
 | 
						|
    "I=$(out)"
 | 
						|
  ];
 | 
						|
 | 
						|
  makeFlags = [
 | 
						|
    "PLATFORM=${withPlatform}"
 | 
						|
    "FW_TEXT_START=0x40000000"
 | 
						|
  ] ++ lib.optionals (withPayload != null) [
 | 
						|
    "FW_PAYLOAD_PATH=${withPayload}"
 | 
						|
  ] ++ lib.optionals (withFDT != null) [
 | 
						|
    "FW_FDT_PATH=${withFDT}"
 | 
						|
  ];
 | 
						|
 | 
						|
  dontStrip = true;
 | 
						|
  dontPatchELF = true;
 | 
						|
}
 |