Compiling the demo with GCC..

Help and discussing programming in C and C++.

Moderator: Moderators

Post Reply
praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Compiling the demo with GCC..

Post by praveenraj1987 » Mon Mar 09, 2009 11:00 am

Hey how do i compile the demo source with gcc..
any ideas..

praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Post by praveenraj1987 » Mon Mar 09, 2009 11:01 am

i have DJGPP for Windows..
so just any help with that..

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Mon Mar 09, 2009 12:24 pm

Which parts of the tutorial are you trying to compile using GCC?

If it is only the kernel bit, then this link may help http://www.osdever.net/bkerndev/index.php. (Ignore the errors at the top)

That is an example OS using C. While it is rather more basic than what is going on here, it does inculde the specific way of using GCC to compile and link.

Hope it helps,

~Andrew
Image

praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Post by praveenraj1987 » Mon Mar 09, 2009 1:28 pm

Thanx for ur reply..

But i dont want that..
actually i'm reading about memory manager.. and thought of implementing that in a multitasking Kernel..

and i need support for reading or writing the FAT..

can i have libraries which i can include in my build..

praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Post by praveenraj1987 » Mon Mar 09, 2009 1:30 pm

i have downloaded all the demos..
i didnt even try to compile it with GCC.. as it was written for MSVC.. and i dont have MSVC now..

but the last demo 14 one..

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Mon Mar 09, 2009 1:41 pm

You can get MSVC Express edition for free and I would suggest it seeing as you are on windows.

If you dont, you will need to translate all the code into that sutable for DJGPP


As for the floppy controler, I am not aware of any libraries that will do that.

However this link might help http://wiki.osdev.org/Floppy_Disk_Controller or perhaps this one http://forum.osdev.org/viewtopic.php?t=13538.

As for Reading and Writing FAT, there are two seporate tutorials explaining exactly how to do this in the bootloader and stage2 tutorials. It should not be hard to translate them from ASM to C++.

Hope this helps,

~Andrew
Image

praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Post by praveenraj1987 » Mon Mar 09, 2009 1:44 pm

but that was in real mode i guess..

how do i use that in protected mode..

like to load a new executable file from disk.. and run it as a process..

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Mon Mar 09, 2009 1:47 pm

Real mode and protected mode do not affect how the FAT12 filesystem works.

It only affects how you read and write to the disk.

The floppy controler links I sent describe how to write a protected mode floppy controler.

Therefore, when translating from ASM, all you need to do is to replace Int0x13 with floppy_pmode_read_sector(int sectornum) or whatever you call your function
Image

praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Post by praveenraj1987 » Mon Mar 09, 2009 1:49 pm

thats not a issue to get a MSVC..

i'm loading my kernel with GRUB.. and compiling with gcc

i want to implement a multitasking environment.. and a simple memory manager with filesystem support...

multitasking can be done with TSS..
but i want to know about managing Memory and filesystem Support..!!!

praveenraj1987
Posts: 7
Joined: Mon Mar 09, 2009 10:51 am

Post by praveenraj1987 » Mon Mar 09, 2009 1:52 pm

Do i have to read the floppies Sector wise..??

like is it not possible that we read whole file at a time..

just a question.. how do i know how many sectors to read..!!


and can u help me with it..!!
can i have ur mail ID..

Andyhhp
Moderator
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am
Location: 127.0.0.1
Contact:

Post by Andyhhp » Mon Mar 09, 2009 1:58 pm

Because of the structure of FAT12, you can only read a single sector at a time.

http://www.brokenthorn.com/Resources/OSDev11.html is a tutorial about the FAT12 filesystem.

The one difference you have is that you will need to read in sector 0 first to obtain the bpb information before futher trying to parse the data structure, in the way described in the tutorial.
Image

Post Reply