Selaa lähdekoodia

:wrench: 优化了虚拟机启动脚本

fslongjin 3 vuotta sitten
vanhempi
commit
14374d5faf
3 muutettua tiedostoa jossa 22 lisäystä ja 25 poistoa
  1. 0 3
      kernel/common/glib.h
  2. 12 11
      run_in_bochs.sh
  3. 10 11
      run_in_qemu.sh

+ 0 - 3
kernel/common/glib.h

@@ -4,8 +4,6 @@
 //
 
 #pragma once
-#ifndef GLIB_H
-#define GLIB_H
 
 //引入对bool类型的支持
 #include <stdbool.h>
@@ -102,4 +100,3 @@ static inline int strlen(char *s)
     return __res;
 }
 
-#endif

+ 12 - 11
run_in_bochs.sh

@@ -13,18 +13,19 @@ if [ ! "$1" == "--nobuild" ]; then
 fi
 
 # ==============检查文件是否齐全================
-if [ ! -x "bin/bootloader/boot.bin" ]; then
-  echo "bin/bootloader/boot.bin 不存在!"
-  exit
-fi
-if [ ! -x "bin/bootloader/loader.bin" ]; then
-  echo "bin/bootloader/loader.bin 不存在!"
-  exit
-fi
-if [ ! -x "bin/boot.img" ]; then
-  echo "bin/boot.img 不存在!"
+
+bins[0]=bin/bootloader/boot.bin
+bins[1]=bin/bootloader/loader.bin
+bins[2]=bin/boot.img
+bins[3]=bin/kernel/kernel.bin
+
+for file in ${bins[*]};do
+if [ ! -x $file ]; then
+  echo "$file 不存在!"
   exit
-fi
+  fi
+done
+
 # ===============文件检查完毕===================
 
 

+ 10 - 11
run_in_qemu.sh

@@ -13,18 +13,17 @@ if [ ! "$1" == "--nobuild" ]; then
 fi
 
 # ==============检查文件是否齐全================
-if [ ! -x "bin/bootloader/boot.bin" ]; then
-  echo "bin/bootloader/boot.bin 不存在!"
-  exit
-fi
-if [ ! -x "bin/bootloader/loader.bin" ]; then
-  echo "bin/bootloader/loader.bin 不存在!"
-  exit
-fi
-if [ ! -x "bin/boot.img" ]; then
-  echo "bin/boot.img 不存在!"
+bins[0]=bin/bootloader/boot.bin
+bins[1]=bin/bootloader/loader.bin
+bins[2]=bin/boot.img
+bins[3]=bin/kernel/kernel.bin
+
+for file in ${bins[*]};do
+if [ ! -x $file ]; then
+  echo "$file 不存在!"
   exit
-fi
+  fi
+done
 # ===============文件检查完毕===================