瀏覽代碼

Build: Add FreeBSD support (#1492)

BenJilks 5 年之前
父節點
當前提交
c64b5e73f5
共有 5 個文件被更改,包括 18 次插入3 次删除
  1. 8 1
      Kernel/build-image-qemu.sh
  2. 1 1
      Kernel/build-root-filesystem.sh
  3. 1 1
      Kernel/makeall.sh
  4. 4 0
      Toolchain/BuildIt.sh
  5. 4 0
      Toolchain/BuildIt_x86_64.sh

+ 8 - 1
Kernel/build-image-qemu.sh

@@ -24,6 +24,9 @@ if [ "$(uname -s)" = "OpenBSD" ]; then
     VND=$(vnconfig _disk_image)
     (echo "e 0"; echo 83; echo n; echo 0; echo "*"; echo "quit") | fdisk -e "$VND"
     mkfs.ext2 -I 128 -F "/dev/${VND}i" || die "could not create filesystem"
+elif [ "$(uname -s)" = "FreeBSD" ]; then
+    MD=$(mdconfig _disk_image)
+    mke2fs -q -I 128 _disk_image || die "could not create filesystem"
 else
     if [ -x /sbin/mke2fs ]; then
         /sbin/mke2fs -q -I 128 _disk_image || die "could not create filesystem"
@@ -39,6 +42,8 @@ if [ "$(uname -s)" = "Darwin" ]; then
     fuse-ext2 _disk_image mnt -o rw+,allow_other,uid=501,gid=20 || die "could not mount filesystem"
 elif [ "$(uname -s)" = "OpenBSD" ]; then
     mount -t ext2fs "/dev/${VND}i" mnt/ || die "could not mount filesystem"
+elif [ "$(uname -s)" = "FreeBSD" ]; then
+    fuse-ext2 -o rw+ "/dev/${MD}" mnt/ || die "could not mount filesystem"
 else
     mount _disk_image mnt/ || die "could not mount filesystem"
 fi
@@ -50,7 +55,9 @@ cleanup() {
         umount mnt || ( sleep 1 && sync && umount mnt )
         rm -rf mnt
         if [ "$(uname -s)" = "OpenBSD" ]; then
-           vnconfig -u "$VND"
+            vnconfig -u "$VND"
+        elif [ "$(uname -s)" = "FreeBSD" ]; then
+            mdconfig -d -u "$MD"
         fi
         echo "done"
     fi

+ 1 - 1
Kernel/build-root-filesystem.sh

@@ -105,7 +105,7 @@ printf "installing userland... "
 
 if [ "$(uname -s)" = "Darwin" ]; then
     find ../Userland/ -type f -perm +111 -exec cp {} mnt/bin/ \;
-elif [ "$(uname -s)" = "OpenBSD" ]; then
+elif [ "$(uname -s)" = "OpenBSD" ] || [ "$(uname -s)" = "FreeBSD" ]; then
     find ../Userland/ -type f -perm -555 -exec cp {} mnt/bin/ \;
 else
     find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;

+ 1 - 1
Kernel/makeall.sh

@@ -20,7 +20,7 @@ sudo id
 
 MAKE="make"
 
-if [ "$(uname -s)" = "OpenBSD" ]; then
+if [ "$(uname -s)" = "OpenBSD" ] || [ "$(uname -s)" = "FreeBSD" ]; then
 	MAKE="gmake"
 fi
 

+ 4 - 0
Toolchain/BuildIt.sh

@@ -26,6 +26,10 @@ if [ `uname -s` = "OpenBSD" ]; then
     export CXX=eg++
     export with_gmp=/usr/local
     export LDFLAGS=-Wl,-z,notext
+elif [ `uname -s` = "FreeBSD" ]; then
+    MAKE=gmake
+    MD5SUM="md5 -q"
+    NPROC="sysctl -n hw.ncpu"
 fi
 
 echo PREFIX is "$PREFIX"

+ 4 - 0
Toolchain/BuildIt_x86_64.sh

@@ -24,6 +24,10 @@ if [ `uname -s` = "OpenBSD" ]; then
     export CXX=eg++
     export with_gmp=/usr/local
     export LDFLAGS=-Wl,-z,notext
+elif [ `uname -s` = "FreeBSD" ]; then
+    MAKE=gmake
+    MD5SUM="md5 -q"
+    NPROC="sysctl -n hw.ncpu"
 fi
 
 echo PREFIX is "$PREFIX"