Skip to content

Commit b23149f

Browse files
committed
Create a dev env with the cheri llvm toolchain
Signed-off-by: Douglas Reis <[email protected]>
1 parent 7f60f7f commit b23149f

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
libffi
114114
];
115115
};
116+
llvm_cheri = pkgs.mkShell {
117+
name = "llvm_cheri";
118+
packages = with lowrisc_pkgs; [llvm_cheri];
119+
};
116120
};
117121
formatter = pkgs.alejandra;
118122
});

pkgs/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
cheriot-sim = pkgs.callPackage ./cheriot-sim.nix {};
2424
cheriot-audit = pkgs.callPackage ./cheriot-audit.nix {};
2525

26+
# Cheri
27+
llvm_cheri = pkgs.callPackage ./llvm_cheri.nix {};
28+
2629
verilator_caliptra = pkgs.callPackage ./verilator_caliptra.nix {};
2730

2831
# IT packages

pkgs/llvm_cheri.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright lowRISC contributors.
2+
#
3+
# SPDX-License-Identifier: MIT
4+
{
5+
fetchzip,
6+
stdenv,
7+
zlib,
8+
zstd,
9+
ncurses6,
10+
autoPatchelfHook,
11+
}:
12+
stdenv.mkDerivation rec {
13+
name = "cheri-llvm";
14+
version = "17.0.1.r01";
15+
src = fetchzip {
16+
# We build the toolchain in another repository because derivations don't allow internert connections, which is required by cheribuild.
17+
url = "https://github.com/engdoreis/cheribuild/releases/download/v${version}/cheri-std093-sdk.tar.gz";
18+
hash = "sha256-/6FGm1Ot9sFZ71FIThtLV2KFjhSfnc5w32OucCZmDfc=";
19+
};
20+
21+
dontConfigure = true;
22+
dontBuild = true;
23+
24+
buildInputs = [
25+
stdenv.cc.cc.lib
26+
ncurses6
27+
zlib
28+
zstd
29+
];
30+
nativeBuildInputs = [autoPatchelfHook];
31+
32+
installPhase = ''
33+
mkdir -p $out
34+
cp -R ./cheri-std093-sdk/* $out
35+
'';
36+
37+
meta = {
38+
platforms = ["x86_64-linux"];
39+
};
40+
}

0 commit comments

Comments
 (0)