Skip to content

Commit d95265c

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 1a2a37d commit d95265c

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
@@ -114,6 +114,10 @@
114114
libffi
115115
];
116116
};
117+
llvm_cheri = pkgs.mkShell {
118+
name = "llvm_cheri";
119+
packages = with lowrisc_pkgs; [llvm_cheri];
120+
};
117121
};
118122
formatter = pkgs.alejandra;
119123
});

pkgs/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
verilator_caliptra = pkgs.callPackage ./verilator_caliptra.nix {inherit inputs;};
2626

27+
# Cheri
28+
llvm_cheri = pkgs.callPackage ./llvm_cheri.nix {};
29+
2730
# IT packages
2831
gcsfuse = pkgs.callPackage ./gcsfuse {};
2932
gcs-fuse-csi-driver-sidecar-mounter = pkgs.callPackage ./gcs-fuse-csi-driver-sidecar-mounter.nix {inherit gcsfuse;};

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)