> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.6.19 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar  1 12:35:11 UTC 2024 x86_64 GNU/Linux
 20:24:59  up   7:30,  2 users,  load average: 0.45, 0.71, 0.94
This commit is contained in:
tracer-ysyx 2024-03-20 20:24:59 +08:00 committed by xinyangli
parent 00898f6264
commit f64392eedc

View file

@ -17,12 +17,52 @@
}; };
in in
{ {
packages.nemu = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels; }; packages.nemu = pkgs.callPackage ./nemu { am-kernels = self.packages.${system}.am-kernels-rv32; };
packages.am-kernels = crossPkgs.stdenv.mkDerivation rec { packages.am-kernels = pkgs.stdenv.mkDerivation rec {
pname = "am-kernels"; pname = "am-kernels";
version = "2024.02.18"; version = "2024.02.18";
buildInputs = [
pkgs.SDL2
];
src = pkgs.fetchFromGitHub {
owner = "NJU-ProjectN";
repo = "am-kernels";
rev = "bb725d6f8223dd7de831c3b692e8c4531e9d01af";
hash = "sha256-ZHdrw28TN8cMvhhzM469OV7cp0Yp+8yao855HP4+P4A=";
};
AM_HOME = pkgs.fetchFromGitHub {
owner = "xinyangli";
repo = "abstract-machine";
rev = "788595aac61c6b2f3b78ca8aa7d08dc33911bca4";
hash = "sha256-YvWHIBP9tz3HL2TyibftvvQrpkWUDPnviCF4oyLmdjg=";
};
ARCH = "native";
patchPhase = ''
sed -i 's/\/bin\/echo/echo/' tests/cpu-tests/Makefile
'';
buildPhase = ''
AS=$CC make -C tests/cpu-tests BUILD_DIR=$(pwd)/build ARCH=$ARCH
'';
installPhase = ''
mkdir -p $out/bin/
cp build/riscv32-nemu/*.elf $out/bin/
'';
# dontFixup = true;
};
packages.am-kernels-rv32 = crossPkgs.stdenv.mkDerivation rec {
pname = "am-kernels-rv32";
version = "2024.02.18";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "NJU-ProjectN"; owner = "NJU-ProjectN";
repo = "am-kernels"; repo = "am-kernels";