Skip to content

Commit

Permalink
Merge pull request #16 from corigan01/Drive
Browse files Browse the repository at this point in the history
Drive
  • Loading branch information
corigan01 authored Mar 5, 2021
2 parents 50e3feb + dc3e4fb commit 30c8e48
Show file tree
Hide file tree
Showing 40 changed files with 971 additions and 870 deletions.
Binary file modified ISO/FluxedOS.iso
Binary file not shown.
Binary file removed src/Diskimg.img
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Kernal/BUILD.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD 1521
#define BUILD 1727
40 changes: 32 additions & 8 deletions src/Kernal/CppKern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ class KernelEntry {
public:

KernelEntry() {
//asm volatile("sti");
asm volatile("sti");
VGA::INIT_DISPLAY();

VGA::SET_COLOR(VGA::COLORS::GREEN, VGA::COLORS::BLACK);
VGA::kprintf("Fluxed OS ====== BUILD %d\n", BUILD);
}

~KernelEntry() {
VGA::PRINT_STR("\n\n");
VGA::SET_COLOR(VGA::COLORS::RED, VGA::COLORS::BLACK);
VGA::PRINT_STR("Kernel has exited!");

VGA::PRINT_STR("\nKernel Exitting...");
}


void Test() {
VGA::SET_COLOR(VGA::COLORS::MAGENTA, VGA::COLORS::BLACK);
Expand All @@ -37,18 +38,41 @@ class KernelEntry {

console.Handle();


//VGA::PRINT_STR(">\n\n\n\n\n\n>\n>\nline\n>test\n>wut\nthis is a lot of printing on this line oh yea");

//while(1);


}
};

int KernStart() {
KernelEntry krnl;
{
KernelEntry krnl;

krnl.Test();
krnl.kern();
}



print_string("System stopped for: ", YELLOW, BLACK);

int i = 1;
while(1){
i++;

asm volatile("nop");

print_hold_int( ( (i / 5000)) );
};







krnl.Test();
krnl.kern();
while(1);

return 0;
}
23 changes: 5 additions & 18 deletions src/Kernal/Kernal.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//#include "CppKern.h"
#include "../lib/Term/Term.h"
#include "../cpu/cpu.h"
#include "../lib/core/core.h"


int kernal_entry() {
Expand All @@ -17,26 +18,12 @@ int kernal_entry() {
print_string("Starting C++ Kernel entry point...", YELLOW, BLACK);
print_string("If you see this screen for more then a few seconds, your build is broken", YELLOW, BLACK);

//ThrowISR(1);

KernStart();



print_new_line();
print_string("System stopped for: ", YELLOW, BLACK);

int i = 1;
while((i / 50000) < 100){
i++;

asm volatile("nop");

print_hold_int( ( (i / 50000)) );
};

__asm__ __volatile__("cli");

print_new_line();
print_string("Goodbye!", RED, WHITE);
return 0;

KernStart();
}

2 changes: 1 addition & 1 deletion src/Kernal/Kernal.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#include "../lib/IO/Keyboard.h"
#include "../lib/DisplayOut/displayout.h"




Expand Down
174 changes: 38 additions & 136 deletions src/autocompile.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

source func.sh

# Display the welcome
tis=$(date +%s%N)
echo " ________ __ ______ "
Expand All @@ -11,140 +15,36 @@ echo -e " A \e[0;35mMain Menu\e[0;34m aka \e[0;35mcorigan01\e[0;34m p
echo


addToBuild() {
# add one to the build number
echo "---------------- ADDING TO BUILD ----------------"
awk '{if ($1 == $1) print $1, $2, $3 + 1;}' Kernal/BUILD.h > temp.txt
cp temp.txt Kernal/BUILD.h
rm temp.txt
printf "%s" "$(<Kernal/BUILD.h)"
echo
}

addToBuild &



#clean up files
clean() {
echo -e "\e[0;33m---------------- CLEANED UP FILES ---------------"
rm -r isodir &> /dev/null
rm FluxedOS.* &> /dev/null
rm G++OUTPUT.txt &> /dev/null
rm $(find ./ -type f -iregex '.*/.*\.\(gch\)$') &> /dev/null
rm *.o &> /dev/null
rm boot/boot.o &> /dev/null
rm -r obj &> /dev/null

}

#assemble boot.s file
compilea() {
OUTPUT="$1"

if nasm -f elf $OUTPUT.s -o boot.o &> "log/A++OUTPUT.txt"; then
echo -e "$OUTPUT \t\t\t\t \e[0;32mDONE\e[0;34m"
else
addToBuild

#ouput the errors
echo -e "\e[0;31m ------------------ ASM FAILED! ------------------ "
printf "%s" "$(<log/A++OUTPUT.txt)"
echo ""
echo -e "\e[0;31m ------------------- ASM DONE! ------------------- "
#rm temp.txt

clean

exit
fi

}

#compile .c , .cpp , and .h file
mkdir obj &> /dev/null

echo "---------------- BUILDING ASM -------------------"
# Compile the asm files
compilea boot/boot

compileProc() {
OUTPUT="$1"
OUTNAME="$2"

mkdir log &> /dev/null

if g++ -m32 -elf_i386 -nostdinc -nostartfiles -lgcc_s $OUTPUT -o "$FILES.exc" -ffreestanding -O2 -Wall -Wextra -fdiagnostics-color=always -lstdc++ &> "log/G++OUTPUT.txt"; then
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${OUTPUT:0:40}" " "
else

#ouput the errors
echo -e "\e[0;31m ------------------ CPP FAILED! ------------------ "
printf "%s" "$(<log/G++OUTPUT.txt)"
echo ""
echo -e "\e[0;31m ------------------- CPP DONE! ------------------- "
#rm temp.txt

clean

exit
fi

mv "$FILES.exc" ../../bin/
}

#compile the given file with g++
compilec_() {
OUTPUT="$1"

mkdir log &> /dev/null
local ts=$(date +%s%N)

if gcc -m32 -elf_i386 -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c $OUTPUT -fdiagnostics-color=always &> "log/G++COUTPUT.txt"; then
local PFD=$((($(date +%s%N) - $ts)/1000000))
printf "%-40s%-4s\e[0;32mDONE - $PFD ms\e[0;34m\n" "${OUTPUT:0:40}" " "
else

#ouput the errors
echo -e "\e[0;31m ------------------ C FAILED! -------------------- "
printf "%s" "$(<log/G++COUTPUT.txt)"
echo ""
echo -e "\e[0;31m ------------------- C DONE! --------------------- "
#rm temp.txt

clean

exit
fi
}
cd boot
for OUTPUT in $(find ./ -type f -iregex '.*/.*\.\(s\)$')
do
compilea $OUTPUT
done
mv *.o ../obj
cd ..

#compile the given file with g++
compilec() {
OUTPUT="$1"

mkdir log &> /dev/null
local ts=$(date +%s%N)

if g++ -m32 -elf_i386 -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c $OUTPUT -fdiagnostics-color=always &> "log/G++OUTPUT.txt"; then
local PFD=$((($(date +%s%N) - $ts)/1000000))
printf "%-40s%-4s\e[0;32mDONE - $PFD ms\e[0;34m\n" "${OUTPUT:0:40}" " "
else
printf "%-40s%-4s\e[0;31mFAILED\e[0;34m\n" "${OUTPUT:0:40}" " "
#ouput the errors

g++ -m32 -elf_i386 -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c $OUTPUT -fdiagnostics-color=always &> "log/G++OUTPUT.txt"
printf "%s" "$(<log/G++OUTPUT.txt)"
echo ""
#rm temp.txt

clean

exit

fi
}

echo "---------------- BUILDING PROC ------------------"

#compile .c , .cpp , and .h file
mkdir obj &> /dev/null


cd Proc
for FILES in $(dir)
Expand Down Expand Up @@ -186,15 +86,15 @@ wait

echo "---------------- LINKING BUILDS -----------------"

TEx="Moving object files"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Moving object files"

mv *.o obj/ > /dev/null
rm temp.txt &> /dev/null

ts=$(date +%s%N)
#linking the kernel with kernel.o and boot.o files
if g++ -m32 -lstdc++ -nostartfiles -T linker.ld obj/*.o -o FluxedOS.bin &> "log/LINKOUTPUT.txt"; then
TEx="Linking FluxedOS.bin"
DisDone "Linking FluxedOS.bin"
PFD=$((($(date +%s%N) - $ts)/1000000))
printf "%-40s%-4s\e[0;32mDONE - $PFD ms\e[0;34m\n" "${TEx:0:40}" " "
else
Expand All @@ -215,8 +115,8 @@ fi
echo "---------------- BUILDING ISO -------------------"
#check FluxedOS.bin file is x86 multiboot file or not
if grub-file --is-x86-multiboot FluxedOS.bin &> "log/GRUB.txt"; then
TEx="Generating grub files"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Generating grub files"

else

#ouput the errors
Expand All @@ -233,36 +133,38 @@ fi


#building the iso file
TEx="Making boot/grub"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Making boot/grub"
mkdir -p isodir/boot/grub &> "log/isoLOG.txt"
TEx="Making boot/programs"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Making boot/programs"
mkdir -p isodir/programs &> "log/isoLOG.txt"
TEx="Moving programs"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Moving programs"
cp bin/* isodir/programs &> "log/isoLOG.txt"
TEx="Moving FluxedOS.bin"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Moving FluxedOS.bin"
cp FluxedOS.bin isodir/boot/FluxedOS.bin &>> "log/isoLOG.txt"
TEx="Copying grub.cfg"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Copying grub.cfg"
cp grub.cfg isodir/boot/grub/grub.cfg &>> "log/isoLOG.txt"
TEx="Generating ISO"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Generating ISO"
grub-mkrescue -o FluxedOS.iso isodir &>> "log/isoLOG.txt"


TEx="Moving ISO to ISO/"
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
DisDone "Moving ISO to ISO/"

mkdir ../ISO/ &> /dev/null &
cp FluxedOS.iso ../ISO/ &

echo "BUILD IN $((($(date +%s%N) - $tis)/1000000)) ms" &
#run
echo "---------------- RUNNING BUILD ------------------"
qemu-system-x86_64 -cdrom FluxedOS.iso -vga std -display gtk
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
qemu-img create Diskimg.img 50m &> "log/imgcreate.txt"
DisDone "Creating Diskimg.img"


qemu-system-x86_64 -cdrom FluxedOS.iso -vga std -display gtk -drive file=Diskimg.img,if=ide,format=raw
DisDone "Running qemu"
rm -r Diskimg.img

DisDone "Removing Diskimg.img"




Expand Down
Loading

0 comments on commit 30c8e48

Please sign in to comment.