blob: 8ee623a3d3cd5f7bdef112652ac246c69a5cbd89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# Building the Serenity operating system
Let's start with 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/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 e2fsprogs and QEMU:
sudo apt install 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/src/serenity/Root \
--disable-nls
Then build and install:
make
sudo make install
## Serenity LibC and LibM headers:
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
Then do the same in serenity/LibM/:
./install.sh
Don't worry about any error messages from the above commands. 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/src/serenity/Root \
--with-newlib \
--enable-languages=c,c++
Then build and install:
make all-gcc all-target-libgcc
sudo make install-gcc install-target-libgcc
## Serenity LibC for GCC:
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 (Full build)
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
|