Skip to main content
3 of 5
mardown fix
janos
  • 111.7k
  • 15
  • 152
  • 391

An Operating System in C++

So I recently started following the James M Kernel Dev and was able to create an Operating System in C++ .

Here is the Source on Github : Just Another OS

I have a couple of questions:

  1. Is my coding style ok ?
  2. It it wrong to have same name for standard Library Functions since I am making my own ?
  3. Is it wrong to write bash Scripts for building the project ?
  4. Thanks in Advance for Pointing out the flaws in my design :D

JOSBuid.sh

#
# Build File for JOS
#
# To Build
#    bash build.sh
# To Run
#   bash run.sh

# ----------------------------------------------------------------------------------------------
# JOS uses assembly to build the bootsector
# Compile the boot Sectors in boot
echo "==============================================="
echo "-------- Building Boot Sectors ----------------"
cd boot
# Run the Make Script inside the boot directory
bash buildboot.sh
cd ..
echo "==============================================="
# ----------------------------------------------------------------------------------------------

# ----------------------------------------------------------------------------------------------
# Compile the C++ Sources into Respective Objects
# Compile main.cc
echo "==============================================="
echo "--------- Compiling C++ Sources --------------"
g++ -c -nostdlib -nostdinc -fno-builtin -fno-stack-protector -ffreestanding -m32 -o main.o main.cc
mv main.o build
# Run scons to build the Entire Lbrary of C++ Files
cd include
rm *.o
scons
# Move all Object Files into Build Directory
cp *.o ../build
cd ..
echo "==============================================="
# ----------------------------------------------------------------------------------------------

# ----------------------------------------------------------------------------------------------
## When Everything is Finished Link together the Objects into a Kernel File
echo "==============================================="
echo "--------- Linking ----------------"
cd build
# require ld , link.ld
ld  -T '../link.ld' -m elf_i386 -o  kernel.jos *.o
# Clean Up After Build
#rm *.o
echo "==============================================="
# ----------------------------------------------------------------------------------------------

# ----------------------------------------------------------------------------------------------
## When Everything is Finished Run the Kernel
qemu-system-i386 -kernel kernel.jos
# -----------------------------------------------------------------------------------------