davidcallanan / os-series

825 stars 121 forks source link

NON-DOCKER BUILD ENVIROMENT #61

Open Andrej123456789 opened 2 years ago

Andrej123456789 commented 2 years ago

This is a tutorial how to compile OS without installing Docker - works for native Linux and WSL

Direct link

Type all commands in terminal:

sudo apt update
sudo apt install build-essential
sudo apt install bison
sudo apt install flex
sudo apt install libgmp3-dev
sudo apt install libmpc-dev
sudo apt install libmpfr-dev
sudo apt install texinfo
sudo apt install xorriso
sudo apt install nasm
export PREFIX="/usr/local/x86_64elfgcc"
export TARGET=x86_64-elf
export PATH="$PREFIX/bin:$PATH"
mkdir /tmp/src
cd /tmp/src
curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.35.1.tar.gz
tar xf binutils-2.35.1.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-2.35.1/configure --target=$TARGET --enable-interwork --enable-multilib --disable-nls --disable-werror --prefix=$PREFIX 2>&1 | tee configure.log
sudo make all install 2>&1 | tee make.log
cd /tmp/src
curl -O https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz
tar xf gcc-10.2.0.tar.gz
mkdir gcc-build
cd gcc-build
../gcc-10.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-libssp --enable-languages=c++ --without-headers
sudo make all-gcc
sudo make all-target-libgcc
sudo make install-gcc
sudo make install-target-libgcc

Now you need add folder to variable.

Type sudo nano ~/.bashrc

Scroll to end of file and type: export PATH="$PATH:/usr/local/x86_64/elfgcc/bin" save it and restart system (if you are using native Linux) or WSL.

Check if it was successful with: x86_64-elf-gcc.

I hope it's works

Andrej123456789 commented 2 years ago

Sometimes work, can someone help why GRUB bootloader fail to load

davidcallanan commented 2 years ago

@Andrej123456789 Thank you for this post.

The link you gave says 404 not found. Is this a private repository?

Andrej123456789 commented 2 years ago

@davidcallanan It was wrong branch, this is working link.

When you compile OS outside Docker you can't run on real hardware, but in Qemu normally

ElectroBoy404NotFound commented 2 years ago

Sometimes work, can someone help why GRUB bootloader fail to load

On my local computer, the grub files just dont exist!! idk why