Skip to content

Commit

Permalink
feat(openSBI): add recipe to build OpenSBI
Browse files Browse the repository at this point in the history
Signed-off-by: Diogo Costa <diogoandreveigacosta@gmail.com>
  • Loading branch information
Diogo21Costa authored and miguelafsilva5 committed Feb 16, 2024
1 parent 1c2fe06 commit 5bfdbec
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions pkgs/firmware/openSBI/openSBI.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) Bao Project and Contributors. All rights reserved.

{ stdenv
, fetchFromGitHub
, toolchain
, openssl
, platform
, bao_build
, bash
}:

stdenv.mkDerivation rec {
pname = "openSBI";
version = "bao/demo";

src = fetchFromGitHub {
owner = "bao-project";
repo = "opensbi";
rev = "4489876e933d8ba0d8bc6c64bae71e295d45faac"; #branch: bao/demos
sha256 = "sha256-k6f4/lWY/f7qqk0AFY4tdEi4cDilSv/jngaJYhKFlnY=";
};

nativeBuildInputs = [ toolchain openssl bash ]; #build time dependencies

postPatch = ''
patchShebangs ./scripts
'';

buildPhase = ''
export CROSS_COMPILE=riscv64-unknown-elf-
make PLATFORM=generic \
FW_PAYLOAD=y \
FW_PAYLOAD_FDT_ADDR=0x80100000
'';

installPhase = ''
mkdir -p $out/build/
cp -r ./build/platform/generic/firmware/fw_jump.elf $out/build/opensbi.elf
'';

}

0 comments on commit 5bfdbec

Please sign in to comment.