-
Notifications
You must be signed in to change notification settings - Fork 3
Build
Since Silcos 3.02 this kernel has started conforming to proper compilation guidelines - it uses the proper "cross-compiler" for the target-architecture because of the requirement of the C Runtime objects (crt*.o). This wiki guides you through the process of building the cross-compiler and then running the kernel.
For this we will first install the required tools, build binutils, and then finally build the GCC cross-compiler.
The build-process for the cross-compiler requires these (on LINUX hosts) packages :
- A Unix-like environment (Windows users)
- GCC (existing release you wish to replace)
- G++ (if building a version of GCC >= 4.8.0)
- GNU Make
- GNU Bison
- Flex
- GNU GMP
- GNU MPFR
- GNU MPC
- Texinfo
- ISL (optional)
- CLooG (optional)
sudo apt install libgmp3-dev
sudo apt install libmpfr-dev
sudo apt install libisl-dev
sudo apt install libcloog-isl-dev
sudo apt install libmpc-dev
sudo apt install texinfo
You can download the binutils package source (for LINUX hosts) at https://gnu.org/software/binutils/. In this guide we assume the source is downloaded at $HOME/Silcos-CrossCompiler
or '~/Silcos-CrossCompile'.
#
# Here we are installing the binutils & GCC cross-compilers in the ~/opt/cross
# directories. You can install it at /usr/local/cross too for access to other
# users on your host machine.
#
export PREFIX="$HOME/opt/cross
export TARGET=i386-elf
export PATH="$PREFIX/bin:$PATH"
Here comes the real build-process -
# Assumes the source code is at ~/Silcos-CrossCompile/binutils.x.y.z (x,y,z are version numbers)
cd $HOME/Silcos-CrossCompile
mkdir build-binutils # build directory for the package
cd build-binutils
../binutils.x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install
If you have closed your terminal session after building binutils, you must execute the export
commands again. Otherwise, continue as we assume the GCC source is located at ~/Silcos-CrossCompile/binutils-x.y.z
where x
,y
,z
are version numbers.
cd $HOME/Silcos-CrossCompile
#
# The "is not in the PATH" part should not come in the output, okay. If
# it does your binutils-build has got something wrong. Go delete the build-binutils
# directory and redo it.
#
which -- $TARGET-as || echo $TARGET-as is not in the PATH
mkdir build-gcc
cd build-gcc
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
If you haven't installed the cross-compiler stuff at ~opt/cross/bin
as given above, then you have to modify the Makefile of the Silcos kernel-environment.
The variables $(OC) - the C compiler
, $(CC) - the C++ compiler
, $(AS) - the NASM assembler
, and the $(GNU_AS) - the GAS assembler
are required. Just replace the $(HOME)/opt/cross/bin
part with your installation directory.
The kernel uses a automatic build system. All you need to do is create a circuit-iso
folder next to the folder in which you keep the source code. Also, create a boot subfolder & in the boot folder put a "grub" folder. In the grub folder make sure you put the "grub.cfg" configuration file.
set timeout=15
set default=0
menuentry "Silcos"
{
multiboot2 /boot/Initor
module2 /boot/circuitk-1.02 KernelHost
module2 /boot/kernel.silcos.hal kernel.silcos.hal
module2 /boot/kernel.silcos.excmgr kernel.silcos.excmgr
module2 /boot/silcos.obmgr
module2 /boot/silcos.mdfrwk
module2 /boot/silcos.rsmgr
boot
}