Forum > General >

[How to make your own OS] #2 Implementing C

Posts: 123

Threads: 26

Joined: Feb, 2021

Reputation: 3

Posted

In this episode of making your own OS, we will now start implementing C into our OS. Make sure to check out their wiki, as it is loaded with information on how to make your own OS.

 

Now, you will need the packages GCC and LD from MinGW, https://sourceforge.net/projects/mingw/ (If you're a linux user, everything will already be set up and you will be able to use the terminal with all of the commands already there, and if you're a Mac user, just install XCode and then use the terminal to compile things)

 

This thread will be a little different, as we will start new all over again (sorry for the ones who did everything step-by-step in the last episode)

 

All operating systems use bootloaders. Most of the bootloaders are made in ASM, known as Assembly. Assembly is an extreme Low-level programming language, but it gives you the most freedom, despite all of the other programming languages.

 

Remember the file bootsector.asm from the last episode? Well, now we will make a new file called kernel.c. But first, we will add some new code to bootsector.asm.

 

extern kernel_main
loop:
	call kernel_main
	jmp loop

times 510-($-$$) db 0

dw 0xaa55

The extern kernel_main part of the code says that there will be another file in the future that has a function named kernel_main. Later on you will find out how the two different programming languages interact with each other.

 

the call kernel_main part of the code simply calls the function from another file.

 

Now, we will make a new file called kernel.c.

 

Inside kernel.c, you will want to add this following code:

void kernel_main() {
	/* We will start building the kernel in Part 3! */
}

 

Now, you will want to do on cmd prompt / terminal:

 

nasm bootsector.asm -o boot.o

gcc kernel.c -o kernel.o

ld boot.o kernel.o -o OS.bin

 

Part 3 coming very soon...

also pls join my discord it rilly helps me feed my children: https://discord.com/invite/nKwasWa62z

 

  • 0

Contribute to Express, an open-source ROBLOX exploit written fully in C.

Explanation

Outflown

Posts: 714

Threads: 138

Joined: Nov, 2020

Reputation: 6

Replied

 i made byte os now

 

is just a regular os but it has byte roblox exploit automatically installed

  • 0

I am an artist.

Posts: 123

Threads: 26

Joined: Feb, 2021

Reputation: 3

Replied

@Laxion working on it

  • 0

Contribute to Express, an open-source ROBLOX exploit written fully in C.

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )