summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorjoshua stein <jcs@jcs.org>2020-01-01 20:06:14 -0600
committerAndreas Kling <awesomekling@gmail.com>2020-01-02 21:03:53 +0100
commit5e430e4eb4cc00bf7a7c4a047ef15e7bc737d32a (patch)
tree4d6c24f46efeec50d8e4857f0edd395884e4974c /Kernel
parentd61131945d15e64cdf7ab0a2cbe584a915599428 (diff)
downloadserenity-5e430e4eb4cc00bf7a7c4a047ef15e7bc737d32a.zip
Build: add support for building on OpenBSD
This requires gcc8 from ports to build the Toolchain.
Diffstat (limited to 'Kernel')
-rwxr-xr-xKernel/build-image-qemu.sh17
-rwxr-xr-xKernel/build-root-filesystem.sh8
-rwxr-xr-xKernel/makeall.sh14
3 files changed, 29 insertions, 10 deletions
diff --git a/Kernel/build-image-qemu.sh b/Kernel/build-image-qemu.sh
index 760b75da60..41b9e35710 100755
--- a/Kernel/build-image-qemu.sh
+++ b/Kernel/build-image-qemu.sh
@@ -10,7 +10,7 @@ die() {
if [ "$(id -u)" != 0 ]; then
die "this script needs to run as root"
fi
-if [ "$(uname)" = "Darwin" ]; then
+if [ "$(uname -s)" = "Darwin" ]; then
export PATH="/usr/local/opt/e2fsprogs/bin:$PATH"
export PATH="/usr/local/opt/e2fsprogs/sbin:$PATH"
fi
@@ -20,13 +20,21 @@ chown "$build_user":"$build_group" _disk_image || die "couldn't adjust permissio
echo "done"
printf "creating new filesystem... "
-mke2fs -q -I 128 _disk_image || die "couldn't create filesystem"
+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 "couldn't create filesystem"
+else
+ mke2fs -q -I 128 _disk_image || die "couldn't create filesystem"
+fi
echo "done"
printf "mounting filesystem... "
mkdir -p mnt
-if [ "$(uname)" = "Darwin" ]; then
+if [ "$(uname -s)" = "Darwin" ]; then
fuse-ext2 _disk_image mnt -o rw+,allow_other,uid=501,gid=20 || die "couldn't mount filesystem"
+elif [ "$(uname -s)" = "OpenBSD" ]; then
+ mount -t ext2fs /dev/${VND}i mnt/ || die "couldn't mount filesystem"
else
mount _disk_image mnt/ || die "couldn't mount filesystem"
fi
@@ -37,6 +45,9 @@ cleanup() {
printf "unmounting filesystem... "
umount mnt || ( sleep 1 && sync && umount mnt )
rm -rf mnt
+ if [ "$(uname -s)" = "OpenBSD" ]; then
+ vnconfig -u $VND
+ fi
echo "done"
fi
}
diff --git a/Kernel/build-root-filesystem.sh b/Kernel/build-root-filesystem.sh
index b5dceb740f..f0c607f6da 100755
--- a/Kernel/build-root-filesystem.sh
+++ b/Kernel/build-root-filesystem.sh
@@ -77,10 +77,12 @@ echo "done"
printf "installing userland... "
-if [ "$(uname)" != "Darwin" ]; then
-find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;
+if [ "$(uname -s)" = "Darwin" ]; then
+ find ../Userland/ -type f -perm +111 -exec cp {} mnt/bin/ \;
+elif [ "$(uname -s)" = "OpenBSD" ]; then
+ find ../Userland/ -type f -perm -555 -exec cp {} mnt/bin/ \;
else
-find ../Userland/ -type f -perm +111 -exec cp {} mnt/bin/ \;
+ find ../Userland/ -type f -executable -exec cp {} mnt/bin/ \;
fi
chmod 4755 mnt/bin/su
chmod 4755 mnt/bin/ping
diff --git a/Kernel/makeall.sh b/Kernel/makeall.sh
index e529255504..5eec01557c 100755
--- a/Kernel/makeall.sh
+++ b/Kernel/makeall.sh
@@ -12,8 +12,14 @@ export build_group
sudo id
-make -C ../ clean && \
- make -C ../ && \
- make -C ../ test && \
- make -C ../ install &&
+MAKE=make
+
+if [ "$(uname -s)" = "OpenBSD" ]; then
+ MAKE=gmake
+fi
+
+$MAKE -C ../ clean && \
+ $MAKE -C ../ && \
+ $MAKE -C ../ test && \
+ $MAKE -C ../ install &&
sudo -E PATH="$PATH" ./build-image-qemu.sh