summaryrefslogtreecommitdiff
path: root/Meta/BuildInstructions.md
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-05 03:54:40 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-05 03:54:40 +0200
commit667b4ad13b97986a35b094d6cdc7dbdd712bc265 (patch)
tree204f0353523ed168d219cbc4174b04fd39fa43e4 /Meta/BuildInstructions.md
parente19d38e7420a6240354aae345a0770abbe09d6db (diff)
downloadserenity-667b4ad13b97986a35b094d6cdc7dbdd712bc265.zip
Meta: Add build instructions.
Diffstat (limited to 'Meta/BuildInstructions.md')
-rw-r--r--Meta/BuildInstructions.md93
1 files changed, 93 insertions, 0 deletions
diff --git a/Meta/BuildInstructions.md b/Meta/BuildInstructions.md
new file mode 100644
index 0000000000..8cd7844574
--- /dev/null
+++ b/Meta/BuildInstructions.md
@@ -0,0 +1,93 @@
+# Building an i686-pc-serenity toolchain
+
+Here's a quick guide to building the i686-pc-serenity toolchain. I keep my toolchain in /opt/cross (so /opt/cross/bin needs to be in $PATH) and my Serenity sources are in /home/andreas/src/serenity
+
+You need to adjust these so they fit your system.
+
+## Dependencies:
+
+First off, GCC needs MPFR, MPC and GMP. On Ubuntu, this is as simple as:
+
+ sudo apt install libmpfr-dev libmpc-dev libgmp-dev
+
+For Serenity, we will need nasm, e2fsprogs and QEMU:
+
+ sudo apt install nasm e2fsprogs qemu-system-i386
+
+
+## Binutils:
+
+Download GNU binutils-2.32 and apply the patch serenity/Meta/binutils-2.32-serenity.patch
+
+Make a build directory next to the binutils source directory.
+
+In the build directory, run configure:
+
+ ../binutils-2.32/configure \
+ --prefix=/opt/cross \
+ --target=i686-pc-serenity \
+ --with-sysroot=/home/andreas/src/serenity/Root \
+ --disable-nls
+
+
+Then build and install:
+
+ make
+ sudo make install
+
+## Serenity LibC (part 1):
+
+Before we can build GCC, we need to put the Serenity LibC headers where GCC can find them. So go into serenity/LibC/ and install them:
+
+ ./install.sh
+
+Don't worry about any error messages from the above command. We only care about copying the headers to the right place at this time.
+
+## GCC (part 1):
+
+Okay, then let's build GCC.
+
+Download GNU GCC-8.3.0 and apply the patch serenity/Meta/gcc-8.3.0-serenity.patch
+
+Make a build directory next to the GCC source directory.
+
+In the build directory, run configure:
+
+ ../gcc-8.3.0/configure \
+ --prefix=/opt/cross \
+ --target=i686-pc-serenity \
+ --with-sysroot=/home/andreas/src/serenity/Root \
+ --enable-languages=c,c++
+
+Then build and install:
+
+ make all-gcc all-target-libgcc
+ sudo make install-gcc install-target-libgcc
+
+## Serenity LibC (part 2):
+
+Now let's go into serenity/LibC/ and build the C library. This is required in order to complete the GCC build.
+
+ make
+ ./install.sh
+
+The C library is now installed in serenity/Root/ and we can build GCC's libstdc++...
+
+## GCC (part 2):
+
+Go back to the GCC build directory and finish building libstdc++:
+
+ make all-target-libstdc++-v3
+ sudo make install-target-libstdc++-v3
+
+## Serenity
+
+If everything worked out, you now have the i686-pc-serenity toolchain ready and we can build Serenity.
+
+Go into serenity/Kernel and build it:
+
+ ./makeall.sh
+
+Then take it for a spin:
+
+ ./run