Browse Source

bugfix: 编译错误时仍可启动虚拟机的问题

fslongjin 2 years ago
parent
commit
08df258142
3 changed files with 20 additions and 2 deletions
  1. 9 1
      Makefile
  2. 3 1
      kernel/Makefile
  3. 8 0
      run.sh

+ 9 - 1
Makefile

@@ -29,6 +29,10 @@ kernel:
 				echo "make all in $$subdir";\
 				cd $$subdir;\
 				$(MAKE) all;\
+				if [ "$$?" != "0" ]; then\
+					echo "内核编译失败";\
+					exit 1;\
+				fi;\
 				cd ..;\
 		done
 
@@ -39,7 +43,11 @@ user:
 	@list='./user'; for subdir in $$list; do \
     		echo "make all in $$subdir";\
     		cd $$subdir;\
-    		 $(MAKE) all;\
+    		$(MAKE) all;\
+			if [ "$$?" != "0" ]; then\
+				echo "用户态程序编译失败";\
+				exit 1;\
+			fi;\
     		cd ..;\
 	done
 

+ 3 - 1
kernel/Makefile

@@ -42,6 +42,9 @@ all: kernel
 		cd $$x;\
 		$(MAKE) generate_kallsyms kernel_root_path="$(shell pwd)";\
 		cd ..;\
+		if [ "$$?" != "0" ]; then\
+            exit $$?;\
+        fi;\
 	done
 	
 # 重新链接
@@ -59,7 +62,6 @@ $(kernel_subdirs): ECHO
 
 	$(MAKE) -C $@ all CFLAGS="$(CFLAGS)" ASFLAGS="$(ASFLAGS)" PIC="$(PIC)" kernel_root_path="$(shell pwd)"
 
-
 kernel: head.o main.o $(kernel_subdirs)
 	
 

+ 8 - 0
run.sh

@@ -28,11 +28,19 @@ if [ ! "$1" == "--nobuild" ]; then
         echo "运行在docker内"
         IN_DOCKER=1
         make all -j 16
+        if [ "$?" != "0" ]; then\
+            echo "DragonOS编译失败";\
+            exit 1;\
+        fi;\
         make clean
         GENERATE_ISO=1
     else
         
         make all -j 16
+        if [ "$?" != "0" ]; then\
+            echo "DragonOS编译失败";\
+            exit 1;\
+        fi;\
         make clean
         GENERATE_ISO=1
     fi