Skip to content

aazeem7/custom_os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Building the gcc

For GCC cross compiler

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

Binutils

cd $HOME/src
mkdir build-binutils
cd build-binutils
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install

GCC

cd $HOME/src

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

$ 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

$ i686-elf-as boot.s -o boot.o

$ i686-elf-gcc -c kernel.c -o kernel.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra

linker Command

$ i686-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc

$ grub-file --is-x86-multiboot myos.bin

if grub-file --is-x86-multiboot myos.bin; then echo multiboot confirmed else echo the file is not multiboot fi

grub.cfg

menuentry "myos" { multiboot /boot/myos.bin }

$ mkdir -p isodir/boot/grub $ cp myos.bin isodir/boot/myos.bin $ cp grub.cfg isodir/boot/grub/grub.cfg $ grub-mkrescue -o myos.iso isodir

Run the Emulator

$qemu-system-i386 -cdrom myos.iso

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published