Skip to content

Commit b0955c4

Browse files
committed
Create a dev env with the cheri llvm toolchain
We build the toolchain in another repository because derivations doesn't allow internet connection, which is required by cheribuild. In the future we may want to build the toolchain using cmake directly from the llvm repository. Signed-off-by: Douglas Reis <[email protected]>
1 parent 0f1a9bc commit b0955c4

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 doesn't allow internet
17+
# connection, which is required by cheribuild.
18+
url = "https://github.com/engdoreis/cheribuild/releases/download/v${version}/cheri-std093-sdk.tar.gz";
19+
hash = "sha256-/6FGm1Ot9sFZ71FIThtLV2KFjhSfnc5w32OucCZmDfc=";
20+
};
21+
22+
dontConfigure = true;
23+
dontBuild = true;
24+
25+
buildInputs = [
26+
stdenv.cc.cc.lib
27+
ncurses6
28+
zlib
29+
zstd
30+
];
31+
nativeBuildInputs = [autoPatchelfHook];
32+
33+
installPhase = ''
34+
mkdir -p $out
35+
cp -R ./cheri-std093-sdk/* $out
36+
'';
37+
38+
meta = {
39+
platforms = ["x86_64-linux"];
40+
};
41+
}

0 commit comments

Comments
 (0)