From e98c720d0b4f5025ab4a310d80bcf8163aaed798 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Sat, 13 Jan 2024 14:05:09 +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.1.71=20#1-Nix?= =?UTF-8?q?OS=20SMP=20PREEMPT=5FDYNAMIC=20Fri=20Jan=20=205=2014:18:41=20UT?= =?UTF-8?q?C=202024=20x86=5F64=20GNU/Linux=20=2014:05:09=20=20up=20=20=202?= =?UTF-8?q?:59,=20=202=20users,=20=20load=20average:=200.49,=200.83,=200.7?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/configs/defconfig | 74 ++++++++++++++++++++++++++++++++++ nemu/flake.nix | 9 +++++ nemu/scripts/build.mk | 6 ++- nemu/src/monitor/sdb/addrexp.y | 2 +- 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 nemu/configs/defconfig diff --git a/nemu/configs/defconfig b/nemu/configs/defconfig new file mode 100644 index 0000000..aa26803 --- /dev/null +++ b/nemu/configs/defconfig @@ -0,0 +1,74 @@ +# +# Automatically generated file; DO NOT EDIT. +# NEMU Configuration Menu +# +# CONFIG_ISA_x86 is not set +# CONFIG_ISA_mips32 is not set +CONFIG_ISA_riscv=y +# CONFIG_ISA_loongarch32r is not set +CONFIG_ISA="riscv32" + +# +# ISA-dependent Options for riscv +# +# CONFIG_RV64 is not set +# CONFIG_RVE is not set +# end of ISA-dependent Options for riscv + +CONFIG_ENGINE_INTERPRETER=y +CONFIG_ENGINE="interpreter" +CONFIG_MODE_SYSTEM=y +CONFIG_TARGET_NATIVE_ELF=y +# CONFIG_TARGET_SHARE is not set +# CONFIG_TARGET_AM is not set + +# +# Build Options +# +CONFIG_CC_GCC=y +# CONFIG_CC_GPP is not set +# CONFIG_CC_CLANG is not set +CONFIG_CC="gcc" +# CONFIG_CC_O0 is not set +# CONFIG_CC_O1 is not set +CONFIG_CC_O2=y +# CONFIG_CC_O3 is not set +CONFIG_CC_OPT="-O2" +# CONFIG_CC_LTO is not set +# CONFIG_CC_DEBUG is not set +CONFIG_CC_ASAN=y +# end of Build Options + +# +# Testing and Debugging +# +CONFIG_TRACE=y +CONFIG_TRACE_START=0 +CONFIG_TRACE_END=10000 +CONFIG_ITRACE=y +CONFIG_ITRACE_COND="true" +# CONFIG_DIFFTEST is not set +CONFIG_DIFFTEST_REF_PATH="none" +CONFIG_DIFFTEST_REF_NAME="none" +# end of Testing and Debugging + +# +# Memory Configuration +# +CONFIG_MBASE=0x80000000 +CONFIG_MSIZE=0x8000000 +CONFIG_PC_RESET_OFFSET=0 +# CONFIG_PMEM_MALLOC is not set +CONFIG_PMEM_GARRAY=y +CONFIG_MEM_RANDOM=y +# end of Memory Configuration + +# CONFIG_DEVICE is not set + +# +# Miscellaneous +# +CONFIG_TIMER_GETTIMEOFDAY=y +# CONFIG_TIMER_CLOCK_GETTIME is not set +CONFIG_RT_CHECK=y +# end of Miscellaneous diff --git a/nemu/flake.nix b/nemu/flake.nix index 47bb216..64632c6 100644 --- a/nemu/flake.nix +++ b/nemu/flake.nix @@ -50,6 +50,15 @@ libllvm ]; + bulidPhase = '' + make defconfig + make app + ''; + + installPhase = '' + cp + ''; + NEMU_HOME = src; meta = with lib; { diff --git a/nemu/scripts/build.mk b/nemu/scripts/build.mk index b3ba734..55edd75 100644 --- a/nemu/scripts/build.mk +++ b/nemu/scripts/build.mk @@ -67,7 +67,7 @@ $(OBJ_DIR)/%.yy.o: $(OBJ_DIR)/%.yy.c # Some convenient rules -.PHONY: app clean +.PHONY: app install clean app: $(BINARY) @@ -75,5 +75,9 @@ $(BINARY):: $(OBJS) $(ARCHIVES) @echo + LD $@ @$(LD) -o $@ $(OBJS) $(LDFLAGS) $(ARCHIVES) $(LIBS) +install: $(BINARY) + @mkdir -p $(PREFIX)/bin + @cp $(BINARY) $(PREFIX)/bin/ + clean: -rm -rf $(BUILD_DIR) diff --git a/nemu/src/monitor/sdb/addrexp.y b/nemu/src/monitor/sdb/addrexp.y index 43d6c35..9e296ba 100644 --- a/nemu/src/monitor/sdb/addrexp.y +++ b/nemu/src/monitor/sdb/addrexp.y @@ -1,4 +1,4 @@ -%code requires { +%code requires { #include #include #include