This script automatically builds the cross-compiler needed to build FENIX at
this stage in time. It sets up a cross-compiler for i686-elf in ~/opt/cross.
This version of the script, suitable for building current, unversioned
pre-releases of FENIX, uses GCC 9.2.0 and Binutils 2.32. You'll need to
download these from the GNU website:
Binutils: https://ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz
GCC: https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
Download these tarballs into the same folder as build_cross_compiler.sh
Additionally, you'll need the following:
- A suitable C compiler (probably GCC)
- make
- Bison
- Flex
- GMP
- MPC
- MPFR
- Texinfo
These correspond to these Fedora packages:
- gcc (or whatever C compiler you use, like Clang)
- make
- bison
- flex
- gmp-devel
- libmpc-devel
- mpfr-devel
- texinfo
Once you're ready, simply run build_cross_compiler.sh. (You may first need
to run `chmod +x build_cross_compiler.sh` in order to make it executable.
Once done, you'll probably want to add ~/opt/cross/bin to your PATH. You'll
probably also want to verify that it worked. To do so, you can start by
checking if it runs using:
`i686-elf-gcc --version`
You can also try compiling a small test kernel included in cross_compiler_test.
Simply run `make`. If everything worked, it should successfully compile. You can
then run `make test` to open the kernel in QEMU. (Note: You'll need
qemu-system-i386 to test the test kernel.