diff --git a/Makefile b/Makefile
index d744c470cf1a35f31957e4e575284c6bc9056c02..a236fd4a996a8071181d739afdc4e57e2a4e1caa 100644
--- a/Makefile
+++ b/Makefile
@@ -29,8 +29,12 @@ endif
 K210_SERIALPORT := /dev/ttyUSB0
 k210_BURNER := ./tools/kflash.py
 
+env:
+(rustup target list | grep "riscv64gc-unknown-none-elf (installed)") || rustup target add $(TARGET)
+rustup component add rust-src
+rustup component add llvm-tools-preview
 
-all: switch-check fs-img
+all: env switch-check fs-img
 	@echo Platform: $(BOARD)
 	@cp os/link-$(BOARD).ld os/link.ld
 	@cd ./os && cargo build --release --features "board_$(BOARD)"