From f64392eedc55116acfaf791c9993415d1eb9c8a6 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Wed, 20 Mar 2024 20:24:59 +0800 Subject: [PATCH] =?UTF-8?q?>=20compile=20NEMU=20ysyx=5F22040000=20?= =?UTF-8?q?=E6=9D=8E=E5=BF=83=E6=9D=A8=20Linux=20calcite=206.6.19=20#1-Nix?= =?UTF-8?q?OS=20SMP=20PREEMPT=5FDYNAMIC=20Fri=20Mar=20=201=2012:35:11=20UT?= =?UTF-8?q?C=202024=20x86=5F64=20GNU/Linux=20=2020:24:59=20=20up=20=20=207?= =?UTF-8?q?:30,=20=202=20users,=20=20load=20average:=200.45,=200.71,=200.9?= =?UTF-8?q?4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 4492e28..3ec9af2 100644 --- a/flake.nix +++ b/flake.nix @@ -17,12 +17,52 @@ }; 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"; 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 { owner = "NJU-ProjectN"; repo = "am-kernels";