Verified Commit 44388796 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Merge remote-tracking branch 'origin/freebsd'

parents 71ab2107 6fa84e73
#! /bin/bash
#!/usr/bin/env bash
##########################################################
# This function is simply a banner to introduce the script
......@@ -12,12 +12,12 @@ banner()
###################################################################################
# This function takes care of installing a dependency via package manager of choice
# for building redox on MacOS.
# for building redox on BSDs (MacOS, FreeBSD, etc.).
# @params: $1 package manager
# $2 package name
# $3 binary name (optional)
###################################################################################
install_macos_pkg()
install_bsd_pkg()
{
PKG_MANAGER=$1
PKG_NAME=$2
......@@ -37,17 +37,22 @@ install_macos_pkg()
install_macports_pkg()
{
install_macos_pkg "sudo port" "$1" "$2"
install_bsd_pkg "sudo port" "$1" "$2"
}
install_brew_pkg()
{
install_macos_pkg "brew" $@
install_bsd_pkg "brew" $@
}
install_brew_cask_pkg()
{
install_macos_pkg "brew cask" $@
install_bsd_pkg "brew cask" $@
}
install_freebsd_pkg()
{
install_bsd_pkg "sudo pkg" $@
}
###############################################################################
......@@ -136,6 +141,43 @@ osx_homebrew()
install_brew_pkg "redox-os/gcc_cross_compilers/x86_64-elf-gcc" "x86_64-elf-gcc"
}
###############################################################################
# This function takes care of installing all dependencies using pkg
# for building redox on FreeBSD
# @params: $1 the emulator to install, virtualbox or qemu
###############################################################################
freebsd()
{
set -xe
echo "FreeBSD detected!"
echo "Installing missing packages..."
install_freebsd_pkg "git"
if [ "$1" == "qemu" ]; then
install_freebsd_pkg "qemu" "qemu-system-x86_64"
else
install_freebsd_pkg "virtualbox"
fi
install_freebsd_pkg "coreutils"
install_freebsd_pkg "findutils"
install_freebsd_pkg "gcc"
install_freebsd_pkg "nasm"
install_freebsd_pkg "pkgconf"
install_freebsd_pkg "fusefs-libs"
install_freebsd_pkg "cmake"
install_freebsd_pkg "gmake"
install_freebsd_pkg "wget"
install_freebsd_pkg "texinfo"
install_freebsd_pkg "python"
install_freebsd_pkg "automake"
install_freebsd_pkg "gettext"
install_freebsd_pkg "bison"
install_freebsd_pkg "gperf"
set +xe
}
###############################################################################
# This function takes care of installing all dependencies for building redox on
# Arch linux
......@@ -506,8 +548,13 @@ boot()
statusCheck
echo "Run the following commands to build redox:"
echo "cd redox"
echo "make all"
echo "make virtualbox or qemu"
MAKE="make"
if [[ "$(uname)" -eq FreeBSD ]]; then
MAKE="gmake"
echo "kldload fuse.ko # This loads the kernel module for fuse"
fi
echo "$MAKE all"
echo "$MAKE virtualbox or qemu"
echo
echo " Good luck!"
......@@ -574,6 +621,12 @@ else
# Arch linux
elif hash 2>/dev/null pacman; then
archLinux "$emulator"
# FreeBSD
elif hash 2>/dev/null pkg; then
freebsd "$emulator"
# Unsupported platform
else
printf "\e[31;1mFatal error: \e[0;31mUnsupported platform, please open an issue\[0m"
fi
fi
......
......@@ -86,7 +86,7 @@ logd = {}
#ncursesw = {}
netdb = {}
netstack = {}
netsurf = {}
#netsurf = {}
netutils = {}
#neverball = {}
#newlib = {}
......
Subproject commit 50c3f8642cce2f541da9854a8e2c3bf677604269
Subproject commit 5097c70245514908477c1d032f7399390c089292
......@@ -15,12 +15,21 @@ UNAME := $(shell uname)
ifeq ($(UNAME),Darwin)
FUMOUNT=sudo umount
export NPROC=sysctl -n hw.ncpu
export REDOX_MAKE=make
PREFIX_BINARY=0
VB_AUDIO=coreaudio
VBM=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
else ifeq ($(UNAME),FreeBSD)
FUMOUNT=sudo umount
export NPROC=sysctl -n hw.ncpu
export REDOX_MAKE=gmake
PREFIX_BINARY=0
VB_AUDIO=pulse # To check, will probaly be OSS on most setups
VBM=VBoxManage
else
FUMOUNT=fusermount -u
export NPROC=nproc
export REDOX_MAKE=make
VB_AUDIO=pulse
VBM=VBoxManage
endif
......
......@@ -38,8 +38,8 @@ $(PREFIX)/relibc-install: $(ROOT)/relibc | $(PREFIX)/gcc-install
cd "$<" && \
export PATH="$(ROOT)/$@.partial/bin:$$PATH" && \
export CARGO="env -u CARGO xargo" && \
make -j `$(NPROC)` all && \
make -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial/$(TARGET)"
$(MAKE) -j `$(NPROC)` all && \
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial/$(TARGET)"
cd "$@.partial" && $(PREFIX_STRIP)
touch "$@.partial"
mv "$@.partial" "$@"
......@@ -67,9 +67,9 @@ $(PREFIX)/rust-install: $(ROOT)/rust | $(PREFIX)/relibc-install
--tools=cargo \
--target="$(TARGET)" \
&& \
make -j `$(NPROC)` && \
$(MAKE) -j `$(NPROC)` && \
rm -rf "$(ROOT)/$@.partial/lib/rustlib" "$(ROOT)/$@.partial/share/doc/rust" && \
make -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
rm -rf "$(PREFIX)/rust-build"
mkdir -p "$@.partial/lib/rustlib/x86_64-unknown-linux-gnu/bin"
cd "$@.partial" && find . -name *.old -exec rm {} ';' && $(PREFIX_STRIP)
......@@ -122,8 +122,8 @@ $(PREFIX)/binutils-install: $(PREFIX)/binutils
--prefix="" \
--disable-werror \
&& \
make -j `$(NPROC)` all && \
make -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
$(MAKE) -j `$(NPROC)` all && \
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
rm -rf "$<-build"
cd "$@.partial" && $(PREFIX_STRIP)
touch "$@.partial"
......@@ -155,8 +155,8 @@ $(PREFIX)/gcc-freestanding-install: $(PREFIX)/gcc | $(PREFIX)/binutils-install
--enable-languages=c,c++ \
--without-headers \
&& \
make -j `$(NPROC)` all-gcc && \
make -j `$(NPROC)` install-gcc DESTDIR="$(ROOT)/$@.partial"
$(MAKE) -j `$(NPROC)` all-gcc && \
$(MAKE) -j `$(NPROC)` install-gcc DESTDIR="$(ROOT)/$@.partial"
rm -rf "$<-freestanding-build"
cd "$@.partial" && $(PREFIX_STRIP)
touch "$@.partial"
......@@ -176,8 +176,8 @@ $(PREFIX)/rust-freestanding-install: $(ROOT)/rust | $(PREFIX)/binutils-install
--enable-llvm-static-stdcpp \
--tools=cargo \
&& \
make -j `$(NPROC)` && \
make -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
$(MAKE) -j `$(NPROC)` && \
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial"
rm -rf "$(PREFIX)/rust-freestanding-build"
mkdir -p "$@.partial/lib/rustlib/x86_64-unknown-linux-gnu/bin"
cd "$@.partial" && $(PREFIX_STRIP)
......@@ -191,8 +191,8 @@ $(PREFIX)/relibc-freestanding-install: $(ROOT)/relibc | $(PREFIX_BASE_INSTALL) $
export PATH="$(PREFIX_BASE_INSTALL):$(PREFIX_FREESTANDING_PATH):$$PATH" && \
export CARGO="env -u CARGO xargo" && \
export CC_$(subst -,_,$(TARGET))="$(TARGET)-gcc -isystem $(ROOT)/$@.partial/$(TARGET)/include" && \
make -j `$(NPROC)` all && \
make -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial/$(TARGET)"
$(MAKE) -j `$(NPROC)` all && \
$(MAKE) -j `$(NPROC)` install DESTDIR="$(ROOT)/$@.partial/$(TARGET)"
cd "$@.partial" && $(PREFIX_STRIP)
touch "$@.partial"
mv "$@.partial" "$@"
......@@ -217,8 +217,8 @@ $(PREFIX)/gcc-install: $(PREFIX)/gcc | $(PREFIX)/relibc-freestanding-install
--enable-shared \
--enable-threads=posix \
&& \
make -j `$(NPROC)` all-gcc all-target-libgcc all-target-libstdc++-v3 && \
make -j `$(NPROC)` install-gcc install-target-libgcc install-target-libstdc++-v3 DESTDIR="$(ROOT)/$@.partial" && \
$(MAKE) -j `$(NPROC)` all-gcc all-target-libgcc all-target-libstdc++-v3 && \
$(MAKE) -j `$(NPROC)` install-gcc install-target-libgcc install-target-libstdc++-v3 DESTDIR="$(ROOT)/$@.partial" && \
rm $(ROOT)/$@.partial/$(TARGET)/lib/*.la
rm -rf "$<-build"
cd "$@.partial" && $(PREFIX_STRIP)
......
......@@ -45,8 +45,13 @@ endif
#,int,pcall
#-device intel-iommu
ifeq ($(UNAME),Linux)
build/extra.bin:
fallocate --posix --length 1G $@
else
build/extra.bin:
truncate -s 1g $@
endif
qemu: build/harddrive.bin build/extra.bin
$(QEMU) $(QEMUFLAGS) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment