Skip to content

MehdiBENSMAIL/OS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Development of a Unix-like operating system for educational training purposes

Mehdi BEN SMAIL, 31/12/2024


Introduction

This project aims to deepen my understanding of operating systems and low-level languages. Given that this project is of considerable scope, it may extend over long periods with varying work times. My current goal is to reproduce files manipulation commands (ls, rm, touch, cat, etc.)

Environment/ressources

  • Host OS : Arch Linux
  • Emulator : QEMU
  • Ressources : OSDev, Reddit

Phase 1 : Beginning

In this phase we will set up a toolchain and create a basic kernel that will become the core of the new operating system.


Setting up a Cross-Toolchain

The first thing you will like to do is set up a cross-compiler for your operating system. The compiler on your local system is not able to produce programs for your operating system because it hasn't been invented yet. At first you would like to do is create a compiler that produces executables that will run directly on your target hardware.

curl -O https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.gz
curl -O https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz

export PREFIX="$HOME/Documents/GitHub/OS/src"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"

# build binutils
mkdir build-binutils
cd build-binutils

../binutils-2.43/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror

make
make install

# build GCC

mkdir build-gcc
cd build-gcc

../gcc-14.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx
make all-gcc
make all-target-libgcc
make all-target-libstdc++-v3
make install-gcc
make install-target-libgcc
make install-target-libstdc++-v3

# checking
./$TARGET-gcc --version
# output :
#   i686-elf-gcc (GCC) 14.2.0
#   Copyright (C) 2024 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.

Since my host machine is based on the x86_64 architecture and my operating system is designed for similar architectures, I do not need to use GDB.


Bare Bones

Releases

No releases published

Packages

No packages published