Move other tools to tools/

This commit is contained in:
Rodrigo Arias 2024-09-06 08:11:24 +02:00
parent 08a304a711
commit e2c770208e
8 changed files with 31 additions and 68 deletions

View File

@ -36,5 +36,5 @@
}; };
#environment.systemPackages = with pkgs; [ vim gdb neofetch gcc bintools ]; #environment.systemPackages = with pkgs; [ vim gdb neofetch gcc bintools ];
#environment.systemPackages = with pkgs; [ rvb unalignedCheck ]; #environment.systemPackages = with pkgs; [ rvb riscv-tools ];
} }

View File

@ -261,12 +261,9 @@
''; '';
}; };
# Add the csrtool to the initrd so we can change the # Add riscv-tools to initrd
# in-order/out-of-order, and memtool to stress the memory.
extraUtilsCommands = '' extraUtilsCommands = ''
cp -a ${pkgs.csrtool}/bin/csrtool $out/bin cp -a ${pkgs.riscv-tools}/bin/* $out/bin
cp -a ${pkgs.memtool}/bin/memtool $out/bin
cp -a ${pkgs.plictool}/bin/plictool $out/bin
''; '';
# Write a counter to the DMA region, so we can check the kernel is not # Write a counter to the DMA region, so we can check the kernel is not

View File

@ -21,68 +21,10 @@ final: prev:
]; ];
}); });
unalignedCheck = prev.stdenv.mkDerivation { riscv-tools = prev.pkgsStatic.stdenv.mkDerivation {
name = "unaligned-check"; name = "riscv-tools";
src = ./unalign.c; src = ./tools;
unpackPhase = '' makeFlags = [ "PREFIX=${placeholder "out"}" ];
cp ${./unalign.c} unalign.c
'';
dontConfigure = true;
buildPhase = ''
$CC unalign.c -o unalign_check
'';
installPhase = ''
mkdir -p $out/bin
cp unalign_check $out/bin/
'';
};
csrtool = prev.pkgsStatic.stdenv.mkDerivation {
name = "csrtool";
src = ./csrtool.c;
unpackPhase = ''
cp ${./csrtool.c} csrtool.c
'';
dontConfigure = true;
buildPhase = ''
$CC -static csrtool.c -o csrtool
'';
installPhase = ''
mkdir -p $out/bin
cp csrtool $out/bin/
'';
};
memtool = prev.pkgsStatic.stdenv.mkDerivation {
name = "memtool";
src = ./memtool.c;
unpackPhase = ''
cp ${./memtool.c} memtool.c
'';
dontConfigure = true;
buildPhase = ''
$CC -static memtool.c -o memtool
'';
installPhase = ''
mkdir -p $out/bin
cp memtool $out/bin/
'';
};
plictool = prev.pkgsStatic.stdenv.mkDerivation {
name = "plictool";
src = ./tools/plictool.c;
unpackPhase = ''
cp ${./tools/plictool.c} plictool.c
'';
dontConfigure = true;
buildPhase = ''
$CC -static plictool.c -o plictool
'';
installPhase = ''
mkdir -p $out/bin
cp plictool $out/bin/
'';
}; };
bitstreams = builtins.fetchGit { bitstreams = builtins.fetchGit {

4
tools/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
plictool
csrtool
memtool
*.bin

20
tools/Makefile Normal file
View File

@ -0,0 +1,20 @@
CFLAGS=-static
PREFIX?=/usr/local
bin=plictool csrtool memtool unalign
all: $(bin)
clean:
rm -f $(bin)
install:
mkdir -p $(PREFIX)/bin
cp -a $(bin) $(PREFIX)/bin
plictool: plictool.c
csrtool: csrtool.c
memtool: memtool.c
unalign: unalign.c