Move and update build.sh, add make toolchain
This commit is contained in:
parent
1bf82be8e4
commit
ac849d806f
5
Makefile
5
Makefile
@ -82,7 +82,7 @@ START_VGA = start=--vga
|
||||
START_SINGLE = start=--single
|
||||
WITH_LOGS = logtoserial=1
|
||||
|
||||
.PHONY: all system install test
|
||||
.PHONY: all system install test toolchain
|
||||
.PHONY: clean clean-soft clean-hard clean-bin clean-mods clean-core clean-disk clean-once
|
||||
.PHONY: run vga term headless
|
||||
.PHONY: kvm vga-kvm term-kvm
|
||||
@ -122,6 +122,9 @@ headless: system
|
||||
test: system
|
||||
python2 util/run-tests.py 2>/dev/null
|
||||
|
||||
toolchain:
|
||||
@cd toolchain; ./toolchain-build.sh
|
||||
|
||||
.passed:
|
||||
@util/check-reqs > /dev/null
|
||||
@touch .passed
|
||||
|
56
build.sh
56
build.sh
@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f /etc/debian_version ]; then
|
||||
sudo apt-get install yasm genext2fs build-essential wget libmpfr-dev libmpc-dev libgmp3-dev qemu autoconf automake texinfo pkg-config
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
sudo yum groupinstall 'Development Tools'
|
||||
sudo yum groupinstall 'Development Libraries'
|
||||
sudo yum install yasm mpfr-devel libmpc-devel gmp-devel
|
||||
echo "Warning: Fedora is unsupported in this script. Be careful!"
|
||||
echo "For best results, follow the steps in the script manually."
|
||||
echo "(Script will continue in 5 seconds)"
|
||||
sleep 5
|
||||
else
|
||||
echo "You are on an entirely unsupported system, please ensure you have the following packages:"
|
||||
echo " - essential development packages for your platform (C headers, etc.)"
|
||||
echo " - development headers for mpfr, mpc, and gmp"
|
||||
echo " - clang / LLVM"
|
||||
echo " - YASM"
|
||||
echo " - genext2fs"
|
||||
echo " - autoconf/automake"
|
||||
echo " - wget"
|
||||
echo " - qemu"
|
||||
echo " - texinfo"
|
||||
echo " - pkg-config"
|
||||
echo "(If you are on Arch, install: clang yasm genext2fs base-devel wget mpfr mpc gmp qemu autoconf automake texinfo pkg-config)"
|
||||
echo ""
|
||||
echo "... then comment out the 'exit' below this block of echos in 'build.sh'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Really quick, let's check our genext2fs before we start
|
||||
if [ -z "$(genext2fs --help 2>&1 | grep -- "block-size")" ]; then
|
||||
echo -e "\033[1;31mHold up!\033[0m"
|
||||
echo "Your genext2fs does not support the -B (--block-size) argument."
|
||||
echo "You need to build your own genext2fs with the patch described"
|
||||
echo "in this mailing list post:"
|
||||
echo
|
||||
echo " http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=562999"
|
||||
echo
|
||||
echo "You can get genext2fs sources from sourceforge:"
|
||||
echo
|
||||
echo " http://genext2fs.sourceforge.net/"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build the toolchain:
|
||||
unset PKG_CONFIG_LIBDIR
|
||||
pushd toolchain
|
||||
./prepare.sh
|
||||
./install.sh
|
||||
. activate.sh
|
||||
popd
|
||||
# Build the kernel
|
||||
make system # to build the kernel
|
||||
# XXX: Attempt to boot the kernel with qemu automatically...
|
@ -13,13 +13,13 @@ On Ubuntu and Debian systems, the automated build scripts will attempt to instal
|
||||
|
||||
## Building ##
|
||||
|
||||
Once you have a capable build environment set up and the repository cloned, start by running `./build.sh`. This will either prompt you for your password (using `sudo` to attempt to install a number of development packages) or yell about not knowing what operating system you're on. In the latter case, the script includes a list of packages with both Debian names and Fedora names, and you should attempt to install all of them using your distribution's package manager.
|
||||
Once you have a capable build environment set up and the repository cloned, start by running `make toolchain`. This will either prompt you for your password (using `sudo` to attempt to install a number of development packages) or yell about not knowing what operating system you're on. In the latter case, the script includes a list of packages with both Debian names and Fedora names, and you should attempt to install all of them using your distribution's package manager.
|
||||
|
||||
A complete build with `build.sh` takes about 30 minutes on my hardware, but I have a rather fast Internet connection and a very capable CPU - it could take many hours on less capable hardware.
|
||||
A complete build of the toolchain with `make toolchain` takes about 30 minutes on my hardware, but I have a rather fast Internet connection and a very capable CPU - it could take many hours on less capable hardware.
|
||||
|
||||
If the build process fails, your best bet for support is to sit on my IRC channel (`#toaruos` on Freenode), post your question, and *wait* for me to eventually answer it (if I can). Leaving after five minutes will not get your question answered. If you are not around when I see your question, I won't even attempt to answer it. Do not attempt to report issues with build scripts as bugs - while some issues may actually be bugs in the scripts, they are usually not.
|
||||
|
||||
When the first build has completed, you can use `make` instead of `build.sh` for future builds. This will skip rebuilding the entire toolchain. If you're serious about developing, you may need to run `build.sh` in some cases (such as after making changes to the Newlib glue layer), but for most cases it is a waste of time.
|
||||
After you have the toolchain build has completed, source the toolchain with `. toolchain/activate.sh` and then run `make` to build the kernel and userspace.
|
||||
|
||||
The Makefile also includes some convenience targets for running とあるOS in QEMU. The most important of these is `make kvm`, which will attempt to run a fairly standard graphical environment, with KVM acceleration enabled. If you don't have KVM available, you may use `make run`, but expect the GUI to run poorly as it relies rather heavily on the CPU for compositing.
|
||||
|
||||
|
82
toolchain/toolchain-build.sh
Executable file
82
toolchain/toolchain-build.sh
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
INSTALL_PACKAGES=true
|
||||
|
||||
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-q|--quick)
|
||||
INSTALL_PACKAGES=false
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$INSTALL_PACKAGES" == "false" ]] ; then
|
||||
|
||||
echo "I am going to install some system packages. I will probably need you to provide a password."
|
||||
echo "If you don't want to do this and you're sure you have all of the required system packages, then interrupt the password prompt and run this script again with -q."
|
||||
|
||||
if [ -f /etc/debian_version ]; then
|
||||
sudo apt-get install yasm genext2fs build-essential wget libmpfr-dev libmpc-dev libgmp3-dev qemu autoconf automake texinfo pkg-config
|
||||
elif [ -f /etc/fedora-release ]; then
|
||||
sudo yum groupinstall 'Development Tools'
|
||||
sudo yum groupinstall 'Development Libraries'
|
||||
sudo yum install yasm mpfr-devel libmpc-devel gmp-devel
|
||||
echo "Warning: Fedora is unsupported in this script. Be careful!"
|
||||
echo "For best results, follow the steps in the script manually."
|
||||
echo "(Script will continue in 5 seconds)"
|
||||
sleep 5
|
||||
else
|
||||
echo "You are on an entirely unsupported system, please ensure you have the following packages:"
|
||||
echo " - essential development packages for your platform (C headers, etc.)"
|
||||
echo " - development headers for mpfr, mpc, and gmp"
|
||||
echo " - clang / LLVM"
|
||||
echo " - YASM"
|
||||
echo " - genext2fs"
|
||||
echo " - autoconf/automake"
|
||||
echo " - wget"
|
||||
echo " - qemu"
|
||||
echo " - texinfo"
|
||||
echo " - pkg-config"
|
||||
echo "(If you are on Arch, install: clang yasm genext2fs base-devel wget mpfr mpc gmp qemu autoconf automake texinfo pkg-config)"
|
||||
echo ""
|
||||
echo "... then run this script (toolchain/toolchain-build.sh) again with the -q flag."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Really quick, let's check our genext2fs before we start
|
||||
if [ -z "$(genext2fs --help 2>&1 | grep -- "block-size")" ]; then
|
||||
echo -e "\033[1;31mHold up!\033[0m"
|
||||
echo "Your genext2fs does not support the -B (--block-size) argument."
|
||||
echo "You need to build your own genext2fs with the patch described"
|
||||
echo "in this mailing list post:"
|
||||
echo
|
||||
echo " http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=562999"
|
||||
echo
|
||||
echo "You can get genext2fs sources from sourceforge:"
|
||||
echo
|
||||
echo " http://genext2fs.sourceforge.net/"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build the toolchain:
|
||||
unset PKG_CONFIG_LIBDIR
|
||||
./prepare.sh
|
||||
./install.sh
|
||||
. activate.sh
|
||||
|
||||
echo "Toolchain build is complete."
|
||||
echo "You should now activate the toolchain:"
|
||||
echo ""
|
||||
echo " . toolchain/activate.sh"
|
||||
echo ""
|
||||
echo "And then use Make to build the kernel and userspace:"
|
||||
echo ""
|
||||
echo " make"
|
||||
echo ""
|
Loading…
Reference in New Issue
Block a user