From c3b894d4f9d76585b966eb7cd082626383264468 Mon Sep 17 00:00:00 2001 From: Anlai Lu Date: Sat, 10 Oct 2026 08:13:39 +0000 Subject: [PATCH 1/3] fix(build): move `all` back to the first target in Makefile --- Makefile | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index ecc2247f4..c159478b2 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,29 @@ kconfig_python := tools/kconfig/.venv/bin/python # Targets .PHONY: all elf disa run gdb monitor clean tools rootfs vscode ci-run defconfig menuconfig savedefconfig ensure_config clean_check kconfig_venv link_board check-hv-mem-overlap + +# `all` must stay the first target: a bare `make` runs the first target in this file. +all: ensure_config gen_cargo_config vscode $(hvisor_bin) check-hv-mem-overlap + @printf "\n" + @printf "$(COLOR_GREEN)$(COLOR_BOLD)hvisor build summary:$(COLOR_RESET)\n" + @printf "%-10s %s\n" "ARCH =" "$(COLOR_BOLD)$(ARCH)$(COLOR_RESET)" + @printf "%-10s %s\n" "BOARD =" "$(COLOR_BOLD)$(BOARD)$(COLOR_RESET)" + @printf "%-10s %s\n" "BID =" "$(COLOR_BOLD)$(BID)$(COLOR_RESET)" + @printf "%-10s %s\n" "LOG =" "$(COLOR_BOLD)$(LOG)$(COLOR_RESET)" + @printf "%-10s %s\n" "DEFCONFIG =" "$(COLOR_BOLD)platform/$(ARCH)/$(BOARD)/kconfig/defconfig$(COLOR_RESET)" + @printf "%-10s %s\n" "RUSTC_TARGET =" "$(COLOR_BOLD)$(RUSTC_TARGET)$(COLOR_RESET)" + @printf "%-10s %s\n" "BUILD_PATH =" "$(COLOR_BOLD)$(build_path)$(COLOR_RESET)" + @printf "%-10s %s\n" "HVISON_BIN_SIZE =" "$(COLOR_BOLD)$(shell du -h $(hvisor_bin) | cut -f1)$(COLOR_RESET)" + @start_addr=$$(rust-nm $(hvisor_elf) | grep skernel | awk '{print $$1}'); \ + end_addr=$$(rust-nm $(hvisor_elf) | grep __hv_end | awk '{print $$1}'); \ + size=$$(echo "obase=16; ibase=16; $$(echo $$end_addr | tr 'a-z' 'A-Z') - $$(echo $$start_addr | tr 'a-z' 'A-Z')" | bc | tr 'A-Z' 'a-z'); \ + printf "%-10s %s\n" "START_ADDR =" "$(COLOR_BOLD)0x$$start_addr$(COLOR_RESET)"; \ + printf "%-10s %s\n" "MEM_SIZE =" "$(COLOR_BOLD)0x$$size$(COLOR_RESET)"; \ + printf "%-10s %s\n" "END_ADDR =" "$(COLOR_BOLD)0x$$end_addr$(COLOR_RESET)" + @printf "%-10s %s\n" "BUILD TIME =" "$(COLOR_BOLD)$(shell date)$(COLOR_RESET)" + @printf "\n" + @printf "$(COLOR_GREEN)$(COLOR_BOLD)hvisor build success!$(COLOR_RESET)\n" + kconfig_venv: @if [ ! -x $(kconfig_python) ]; then \ echo "$(COLOR_YELLOW)Creating tools/kconfig/.venv (kconfiglib)...$(COLOR_RESET)"; \ @@ -118,27 +141,6 @@ menuconfig: kconfig_venv savedefconfig: @./tools/kconfig/save_defconfig.sh "$(ARCH)" "$(BOARD)" -all: ensure_config gen_cargo_config vscode $(hvisor_bin) check-hv-mem-overlap - @printf "\n" - @printf "$(COLOR_GREEN)$(COLOR_BOLD)hvisor build summary:$(COLOR_RESET)\n" - @printf "%-10s %s\n" "ARCH =" "$(COLOR_BOLD)$(ARCH)$(COLOR_RESET)" - @printf "%-10s %s\n" "BOARD =" "$(COLOR_BOLD)$(BOARD)$(COLOR_RESET)" - @printf "%-10s %s\n" "BID =" "$(COLOR_BOLD)$(BID)$(COLOR_RESET)" - @printf "%-10s %s\n" "LOG =" "$(COLOR_BOLD)$(LOG)$(COLOR_RESET)" - @printf "%-10s %s\n" "DEFCONFIG =" "$(COLOR_BOLD)platform/$(ARCH)/$(BOARD)/kconfig/defconfig$(COLOR_RESET)" - @printf "%-10s %s\n" "RUSTC_TARGET =" "$(COLOR_BOLD)$(RUSTC_TARGET)$(COLOR_RESET)" - @printf "%-10s %s\n" "BUILD_PATH =" "$(COLOR_BOLD)$(build_path)$(COLOR_RESET)" - @printf "%-10s %s\n" "HVISON_BIN_SIZE =" "$(COLOR_BOLD)$(shell du -h $(hvisor_bin) | cut -f1)$(COLOR_RESET)" - @start_addr=$$(rust-nm $(hvisor_elf) | grep skernel | awk '{print $$1}'); \ - end_addr=$$(rust-nm $(hvisor_elf) | grep __hv_end | awk '{print $$1}'); \ - size=$$(echo "obase=16; ibase=16; $$(echo $$end_addr | tr 'a-z' 'A-Z') - $$(echo $$start_addr | tr 'a-z' 'A-Z')" | bc | tr 'A-Z' 'a-z'); \ - printf "%-10s %s\n" "START_ADDR =" "$(COLOR_BOLD)0x$$start_addr$(COLOR_RESET)"; \ - printf "%-10s %s\n" "MEM_SIZE =" "$(COLOR_BOLD)0x$$size$(COLOR_RESET)"; \ - printf "%-10s %s\n" "END_ADDR =" "$(COLOR_BOLD)0x$$end_addr$(COLOR_RESET)" - @printf "%-10s %s\n" "BUILD TIME =" "$(COLOR_BOLD)$(shell date)$(COLOR_RESET)" - @printf "\n" - @printf "$(COLOR_GREEN)$(COLOR_BOLD)hvisor build success!$(COLOR_RESET)\n" - gen_cargo_config: @printf "$(COLOR_GREEN)$(COLOR_BOLD)generating .cargo/config.toml...$(COLOR_RESET)\n" @chmod +x tools/kconfig/host_config.sh 2>/dev/null || true From eab957a0a25b94ffd99470d6e5115f746fe5b381 Mon Sep 17 00:00:00 2001 From: Anlai Lu Date: Sat, 10 Oct 2026 08:13:58 +0000 Subject: [PATCH 2/3] fix(build): set .DEFAULT_GOAL explicitly in Makefile --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index c159478b2..38120ab82 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,17 @@ BOARD ?= qemu-gicv3 BID ?= ptest ?= +# `make` builds everything by default; `make ptest=` runs that +# benchmark instead. Set explicitly so that adding a target above `all` cannot +# silently change what a bare `make` does. ifeq ($(origin ptest),command line) ifneq ($(strip $(ptest)),) .DEFAULT_GOAL := ptest +else +.DEFAULT_GOAL := all endif +else +.DEFAULT_GOAL := all endif # if user uses `make ID=aarch64/qemu-gicv2`, we parse it into ARCH and BOARD From 86f41fd9ab1e44c5452a4112999acc4e5cbbb290 Mon Sep 17 00:00:00 2001 From: Anlai Lu Date: Sat, 10 Oct 2026 08:14:06 +0000 Subject: [PATCH 3/3] chore(build): drop unused clean_check target --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 38120ab82..5b472f76b 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ COLOR_RESET := $(shell tput sgr0) kconfig_python := tools/kconfig/.venv/bin/python # Targets -.PHONY: all elf disa run gdb monitor clean tools rootfs vscode ci-run defconfig menuconfig savedefconfig ensure_config clean_check kconfig_venv link_board check-hv-mem-overlap +.PHONY: all elf disa run gdb monitor clean tools rootfs vscode ci-run defconfig menuconfig savedefconfig ensure_config kconfig_venv link_board check-hv-mem-overlap # `all` must stay the first target: a bare `make` runs the first target in this file. all: ensure_config gen_cargo_config vscode $(hvisor_bin) check-hv-mem-overlap @@ -132,8 +132,6 @@ ensure_config: $(MAKE) --no-print-directory defconfig; \ fi -clean_check: ensure_config - link_board: @mkdir -p src/platform @ln -sfn ../../platform/$(ARCH)/$(BOARD)/board.rs src/platform/__board.rs