> 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
 16:26:21  up 4 days  3:32,  2 users,  load average: 0.85, 0.91, 0.95
This commit is contained in:
tracer-ysyx 2024-03-24 16:26:21 +08:00 committed by xinyangli
parent a210694e82
commit d08c2860da
415 changed files with 44314 additions and 11 deletions

View file

@ -0,0 +1,31 @@
ARCH_SPLIT = $(subst -, ,$(ARCH))
ISA = $(word 1,$(ARCH_SPLIT))
PLATFORM = $(word 2,$(ARCH_SPLIT))
ifneq ($(PLATFORM), nemu)
$(error Only support with NEMU)
endif
TMPDEFCONFIG = tmp_defconfig
TMPDEFCONFIG_FILE = $(NEMU_HOME)/configs/$(TMPDEFCONFIG)
all:
$(MAKE) save_config
$(MAKE) build_am
$(MAKE) restore_config
$(MAKE) -C $(NEMU_HOME) run IMG=$(NEMU_HOME)/build/$(ISA)-nemu-interpreter-$(ARCH).bin
save_config:
$(MAKE) -C $(NEMU_HOME) savedefconfig
mv $(NEMU_HOME)/configs/defconfig $(TMPDEFCONFIG_FILE)
build_am:
$(MAKE) -C $(NEMU_HOME) $(ISA)-am_defconfig
$(MAKE) -C $(NEMU_HOME) ARCH=$(ARCH) mainargs=$(mainargs) || \
($(MAKE) restore_config; false)
restore_config:
$(MAKE) -C $(NEMU_HOME) ARCH=$(ARCH) $(TMPDEFCONFIG)
rm $(TMPDEFCONFIG_FILE)
.PHONY: all save_config build_am restore_config