Skip to content

Commit 30c8e48

Browse files
authored
Merge pull request #16 from corigan01/Drive
Drive
2 parents 50e3feb + dc3e4fb commit 30c8e48

40 files changed

+971
-870
lines changed

ISO/FluxedOS.iso

-2 KB
Binary file not shown.

src/Diskimg.img

-50 MB
Binary file not shown.

src/Kernal/BUILD.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD 1521
1+
#define BUILD 1727

src/Kernal/CppKern.cpp

+32-8
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ class KernelEntry {
1010
public:
1111

1212
KernelEntry() {
13-
//asm volatile("sti");
13+
asm volatile("sti");
1414
VGA::INIT_DISPLAY();
1515

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

2020
~KernelEntry() {
21-
VGA::PRINT_STR("\n\n");
2221
VGA::SET_COLOR(VGA::COLORS::RED, VGA::COLORS::BLACK);
23-
VGA::PRINT_STR("Kernel has exited!");
22+
23+
VGA::PRINT_STR("\nKernel Exitting...");
2424
}
25+
2526

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

3839
console.Handle();
3940

41+
4042
//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");
4143

42-
//while(1);
44+
4345

4446
}
4547
};
4648

4749
int KernStart() {
48-
KernelEntry krnl;
50+
{
51+
KernelEntry krnl;
52+
53+
krnl.Test();
54+
krnl.kern();
55+
}
56+
57+
58+
59+
print_string("System stopped for: ", YELLOW, BLACK);
60+
61+
int i = 1;
62+
while(1){
63+
i++;
64+
65+
asm volatile("nop");
66+
67+
print_hold_int( ( (i / 5000)) );
68+
};
69+
70+
71+
72+
73+
74+
4975

50-
krnl.Test();
51-
krnl.kern();
76+
while(1);
5277

53-
return 0;
5478
}

src/Kernal/Kernal.c

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//#include "CppKern.h"
22
#include "../lib/Term/Term.h"
33
#include "../cpu/cpu.h"
4+
#include "../lib/core/core.h"
45

56

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

21+
//ThrowISR(1);
2022

21-
KernStart();
2223

24+
2325

24-
print_new_line();
25-
print_string("System stopped for: ", YELLOW, BLACK);
26-
27-
int i = 1;
28-
while((i / 50000) < 100){
29-
i++;
30-
31-
asm volatile("nop");
32-
33-
print_hold_int( ( (i / 50000)) );
34-
};
35-
36-
__asm__ __volatile__("cli");
37-
38-
print_new_line();
39-
print_string("Goodbye!", RED, WHITE);
40-
return 0;
26+
27+
KernStart();
4128
}
4229

src/Kernal/Kernal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
#include "../lib/IO/Keyboard.h"
6-
#include "../lib/DisplayOut/displayout.h"
6+
77

88

99

src/autocompile.sh

+38-136
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#!/bin/bash
2+
3+
source func.sh
4+
15
# Display the welcome
26
tis=$(date +%s%N)
37
echo " ________ __ ______ "
@@ -11,140 +15,36 @@ echo -e " A \e[0;35mMain Menu\e[0;34m aka \e[0;35mcorigan01\e[0;34m p
1115
echo
1216

1317

14-
addToBuild() {
15-
# add one to the build number
16-
echo "---------------- ADDING TO BUILD ----------------"
17-
awk '{if ($1 == $1) print $1, $2, $3 + 1;}' Kernal/BUILD.h > temp.txt
18-
cp temp.txt Kernal/BUILD.h
19-
rm temp.txt
20-
printf "%s" "$(<Kernal/BUILD.h)"
21-
echo
22-
}
23-
24-
addToBuild &
25-
26-
27-
28-
#clean up files
29-
clean() {
30-
echo -e "\e[0;33m---------------- CLEANED UP FILES ---------------"
31-
rm -r isodir &> /dev/null
32-
rm FluxedOS.* &> /dev/null
33-
rm G++OUTPUT.txt &> /dev/null
34-
rm $(find ./ -type f -iregex '.*/.*\.\(gch\)$') &> /dev/null
35-
rm *.o &> /dev/null
36-
rm boot/boot.o &> /dev/null
37-
rm -r obj &> /dev/null
38-
39-
}
4018

41-
#assemble boot.s file
42-
compilea() {
43-
OUTPUT="$1"
4419

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

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

56-
clean
5723

58-
exit
59-
fi
6024

61-
}
6225

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

6429
echo "---------------- BUILDING ASM -------------------"
6530
# Compile the asm files
66-
compilea boot/boot
67-
68-
compileProc() {
69-
OUTPUT="$1"
70-
OUTNAME="$2"
71-
72-
mkdir log &> /dev/null
73-
74-
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
75-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${OUTPUT:0:40}" " "
76-
else
77-
78-
#ouput the errors
79-
echo -e "\e[0;31m ------------------ CPP FAILED! ------------------ "
80-
printf "%s" "$(<log/G++OUTPUT.txt)"
81-
echo ""
82-
echo -e "\e[0;31m ------------------- CPP DONE! ------------------- "
83-
#rm temp.txt
84-
85-
clean
86-
87-
exit
88-
fi
89-
90-
mv "$FILES.exc" ../../bin/
91-
}
92-
93-
#compile the given file with g++
94-
compilec_() {
95-
OUTPUT="$1"
96-
97-
mkdir log &> /dev/null
98-
local ts=$(date +%s%N)
99-
100-
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
101-
local PFD=$((($(date +%s%N) - $ts)/1000000))
102-
printf "%-40s%-4s\e[0;32mDONE - $PFD ms\e[0;34m\n" "${OUTPUT:0:40}" " "
103-
else
104-
105-
#ouput the errors
106-
echo -e "\e[0;31m ------------------ C FAILED! -------------------- "
107-
printf "%s" "$(<log/G++COUTPUT.txt)"
108-
echo ""
109-
echo -e "\e[0;31m ------------------- C DONE! --------------------- "
110-
#rm temp.txt
111-
112-
clean
113-
114-
exit
115-
fi
116-
}
31+
cd boot
32+
for OUTPUT in $(find ./ -type f -iregex '.*/.*\.\(s\)$')
33+
do
34+
compilea $OUTPUT
35+
done
36+
mv *.o ../obj
37+
cd ..
11738

118-
#compile the given file with g++
119-
compilec() {
120-
OUTPUT="$1"
12139

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

125-
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
126-
local PFD=$((($(date +%s%N) - $ts)/1000000))
127-
printf "%-40s%-4s\e[0;32mDONE - $PFD ms\e[0;34m\n" "${OUTPUT:0:40}" " "
128-
else
129-
printf "%-40s%-4s\e[0;31mFAILED\e[0;34m\n" "${OUTPUT:0:40}" " "
130-
#ouput the errors
13141

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

137-
clean
13843

139-
exit
140-
141-
fi
142-
}
14344

14445
echo "---------------- BUILDING PROC ------------------"
14546

146-
#compile .c , .cpp , and .h file
147-
mkdir obj &> /dev/null
47+
14848

14949
cd Proc
15050
for FILES in $(dir)
@@ -186,15 +86,15 @@ wait
18686

18787
echo "---------------- LINKING BUILDS -----------------"
18888

189-
TEx="Moving object files"
190-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
89+
DisDone "Moving object files"
90+
19191
mv *.o obj/ > /dev/null
19292
rm temp.txt &> /dev/null
19393

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

222122
#ouput the errors
@@ -233,36 +133,38 @@ fi
233133

234134

235135
#building the iso file
236-
TEx="Making boot/grub"
237-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
136+
DisDone "Making boot/grub"
238137
mkdir -p isodir/boot/grub &> "log/isoLOG.txt"
239-
TEx="Making boot/programs"
240-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
138+
DisDone "Making boot/programs"
241139
mkdir -p isodir/programs &> "log/isoLOG.txt"
242-
TEx="Moving programs"
243-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
140+
DisDone "Moving programs"
244141
cp bin/* isodir/programs &> "log/isoLOG.txt"
245-
TEx="Moving FluxedOS.bin"
246-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
142+
DisDone "Moving FluxedOS.bin"
247143
cp FluxedOS.bin isodir/boot/FluxedOS.bin &>> "log/isoLOG.txt"
248-
TEx="Copying grub.cfg"
249-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
144+
DisDone "Copying grub.cfg"
250145
cp grub.cfg isodir/boot/grub/grub.cfg &>> "log/isoLOG.txt"
251-
TEx="Generating ISO"
252-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
146+
DisDone "Generating ISO"
253147
grub-mkrescue -o FluxedOS.iso isodir &>> "log/isoLOG.txt"
254148

255149

256-
TEx="Moving ISO to ISO/"
257-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
150+
DisDone "Moving ISO to ISO/"
151+
258152
mkdir ../ISO/ &> /dev/null &
259153
cp FluxedOS.iso ../ISO/ &
260154

261155
echo "BUILD IN $((($(date +%s%N) - $tis)/1000000)) ms" &
262156
#run
263157
echo "---------------- RUNNING BUILD ------------------"
264-
qemu-system-x86_64 -cdrom FluxedOS.iso -vga std -display gtk
265-
printf "%-40s%-4s\e[0;32mDONE\e[0;34m\n" "${TEx:0:40}" " "
158+
qemu-img create Diskimg.img 50m &> "log/imgcreate.txt"
159+
DisDone "Creating Diskimg.img"
160+
161+
162+
qemu-system-x86_64 -cdrom FluxedOS.iso -vga std -display gtk -drive file=Diskimg.img,if=ide,format=raw
163+
DisDone "Running qemu"
164+
rm -r Diskimg.img
165+
166+
DisDone "Removing Diskimg.img"
167+
266168

267169

268170

0 commit comments

Comments
 (0)