Git Product home page Git Product logo

kfs1-42's Introduction

KFS1-42

Setup

KVM

source website

sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm xorriso mtools
sudo kvm-ok

# Should output
# INFO: /dev/kvm exists
# KVM acceleration can be used

You will have to enable virtualisation in your bios if kvm-ok says nope.

KFS

Source

1. Making a cross compiler

source website

Env

export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
export INSTALL_NUM_CORES=8

Dependencies

APT

sudo apt install bison flex libgmp3-dev libmpc-dev libmpfr-dev  texinfo

Download & Extract GCC and binutils

mkdir CrossCompiler
cd    CrossCompiler

wget https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.gz
tar -xf binutils-2.34.tar.gz
rm      binutils-2.34.tar.gz

wget https://ftp.gnu.org/gnu/gcc/gcc-9.4.0/gcc-9.4.0.tar.gz
tar -xf gcc-9.4.0.tar.gz
rm      gcc-9.4.0.tar.gz

wget https://ftp.gnu.org/gnu/gdb/gdb-9.2.tar.gz
tar -xf gdb-9.2.tar.gz
rm gdb-9.2.tar.gz

Build

Binutils
cd CrossCompiler
 
mkdir build-binutils
cd build-binutils

../binutils-2.34/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make         -j $INSTALL_NUM_CORES
make install -j $INSTALL_NUM_CORES
GDB

Maybe gdb useless ?

cd CrossCompiler
cd build-binutils

../gdb.9.2/configure --target=$TARGET --prefix="$PREFIX" --disable-werror
make all-gdb     -j $INSTALL_NUM_CORES
make install-gdb -j $INSTALL_NUM_CORES
GCC

The $PREFIX/bin dir MUST be in the PATH. We did that above.

cd CrossCompiler
 
which -- $TARGET-as || echo $TARGET-as is not in the PATH
 
mkdir build-gcc
cd build-gcc
../gcc-9.4.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc               -j $INSTALL_NUM_CORES
make all-target-libgcc     -j $INSTALL_NUM_CORES
make install-gcc           -j $INSTALL_NUM_CORES
make install-target-libgcc -j $INSTALL_NUM_CORES

Test

$HOME/opt/cross/bin/$TARGET-gcc --version
------------------------------------------------------------------------------
i686-elf-gcc (GCC) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Add to PATH

export PATH="$HOME/opt/cross/bin:$PATH"

❯ which i686-elf-gcc
/home/joep/opt/cross/bin/i686-elf-gcc

kfs1-42's People

Contributors

jbarmentlo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.