Instead of installing cross compiler, you could install Zig and use it as a build tool (and if you have zig you may as well write your kernel in it ;) )
One thing that I don't understand is why everyone still uses the #ifndef style preprocessor macros. Yes, this is how K&R did it when they carved C into some stone plates. But for the last 20 years at least, all relevant compilers supported #pragma once as the first line in the .h file as a much cleaner alternative. Every C tutorial lists this as "yeah, you can do this, but it's not widely supported"... Yes, this may have been true at some point, but it no longer is. The big advantage of #pragma once is that you don't create arbitrary C preprocessor defines, which clutter up your global preprocessor namespace. It gets even rose, when you imagine, your project grows, and you end up with two haders using the same #define. Let's say, you gut a defs.h file in two parts of your project, both use #ifndef DEFS_H... all works well, until somehow due to massive include chains, both end up being included by one compilation unit. And then you start to figure out why it doesn't work. With #pragma once you don't need to worry about it, as the preprocessor will keep track of what has been included and what hasn't so far.
BIOS leaves boot drive id in DL register. By replacing it with your own value (0x80) you break boot process if boot drive id is anything other than 0x80.
Instead of calling nasm for each and every .asm file it's better to define %.o: %.asm rule and add .asm to .SUFFIXES. Same goes for .c files (though GNU make has some builtin rules for those) as well as final binary. The way you do it is no different that calling it from .sh or .bat file. Also, it is a good practice to declare clean as .PHONY. This way it's always processed, no matter what. CTRL + ` opens vscode builtin terminal.
Yo what'sup bro it's not working in arch, I am on arch the qemu-system-x86_64 command what it does starts a vnc server at a port, and I have to use remmina to get to the port, why no gtk and sdl display backend's ? help needed
@@Rsparingahh no it was kind of easy I just removed qemu and qemu system x86 from my arch and again I installed qemu but when prompted I chose qemu-full and yeah it was good to go
Because I had the error: -bash: ../binutils-2.43/configure: Permission denied I had to make configure excecutable with: chmod +x ../binutils-2.43/configure Took me a long second to realize, might just happened to me because I use ubuntu through wsl.
for gcc I had to do the same thing but after chmod -x ../gcc-14.2.0/configure and ../gcc-14.2.0/*/configure still gave me permission error i didn't cared an chmod +x everything
ok just at the end I have ld segmentation fault at the line i686-elf-gcc $(FLAGS) -T ./src/linkerScript.ld -o ./bin/kernel.bin -ffreestanding -O0 -nostdlib ./build/completeKernel.o everything else worked fine now
These are the best OS Dev tutorials on TH-cam, please make more !
This is the best video till now which i have found for OS development i wanted to make my own OS in my current semester. Please continue this series
Instead of installing cross compiler, you could install Zig and use it as a build tool (and if you have zig you may as well write your kernel in it ;) )
i think changing the BitRate in OBS will help with the Pixelation in the video
BTW Nice Series
One thing that I don't understand is why everyone still uses the #ifndef style preprocessor macros. Yes, this is how K&R did it when they carved C into some stone plates. But for the last 20 years at least, all relevant compilers supported #pragma once as the first line in the .h file as a much cleaner alternative.
Every C tutorial lists this as "yeah, you can do this, but it's not widely supported"... Yes, this may have been true at some point, but it no longer is. The big advantage of #pragma once is that you don't create arbitrary C preprocessor defines, which clutter up your global preprocessor namespace. It gets even rose, when you imagine, your project grows, and you end up with two haders using the same #define. Let's say, you gut a defs.h file in two parts of your project, both use #ifndef DEFS_H... all works well, until somehow due to massive include chains, both end up being included by one compilation unit. And then you start to figure out why it doesn't work. With #pragma once you don't need to worry about it, as the preprocessor will keep track of what has been included and what hasn't so far.
BIOS leaves boot drive id in DL register. By replacing it with your own value (0x80) you break boot process if boot drive id is anything other than 0x80.
I get the error: ./src/kernel.asm:4: error: parser: instruction expected
Please help
Instead of calling nasm for each and every .asm file it's better to define %.o: %.asm rule and add .asm to .SUFFIXES. Same goes for .c files (though GNU make has some builtin rules for those) as well as final binary. The way you do it is no different that calling it from .sh or .bat file. Also, it is a good practice to declare clean as .PHONY. This way it's always processed, no matter what.
CTRL + ` opens vscode builtin terminal.
Some issue I found: when you show the output of dd, the second output is 518 bytes, not 512. And all you os.bin file is 4 bytes greater than 5kB.
💖💖💖💖
gdb timeout when I use the "target-remote"
Yo what'sup bro it's not working in arch, I am on arch the qemu-system-x86_64 command what it does starts a vnc server at a port, and I have to use remmina to get to the port, why no gtk and sdl display backend's ? help needed
maybe use -net none?
Uninstall qemu and install again and select qemu-full from the package choices it gives you
you might also need to install them seperately
In Arch you get to choose which backends you want. qemu-ui-* packages are what you need.
@@Rsparingahh no it was kind of easy I just removed qemu and qemu system x86 from my arch and again I installed qemu but when prompted I chose qemu-full and yeah it was good to go
Continue please
Can we use c++?
Yes. With some caveats. I have ports of my OS in C, C++, D, Rust, C#, my own custom D-like language and C3. C3 being the latest one.
please upload faster I cannot waait for next part.
Because I had the error:
-bash: ../binutils-2.43/configure: Permission denied
I had to make configure excecutable with:
chmod +x ../binutils-2.43/configure
Took me a long second to realize, might just happened to me because I use ubuntu through wsl.
for gcc I had to do the same thing but after chmod -x ../gcc-14.2.0/configure and ../gcc-14.2.0/*/configure still gave me permission error i didn't cared an chmod +x everything
U could show how it boots
KENREL_H vs KERNEL_H in kernel.h
ok just at the end I have ld segmentation fault at the line
i686-elf-gcc $(FLAGS) -T ./src/linkerScript.ld -o ./bin/kernel.bin -ffreestanding -O0 -nostdlib ./build/completeKernel.o
everything else worked fine now