Page 1 of 1

Compiling the demo with GCC..

Posted: Mon Mar 09, 2009 11:00 am
by praveenraj1987
Hey how do i compile the demo source with gcc..
any ideas..

Posted: Mon Mar 09, 2009 11:01 am
by praveenraj1987
i have DJGPP for Windows..
so just any help with that..

Posted: Mon Mar 09, 2009 12:24 pm
by Andyhhp
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

Posted: Mon Mar 09, 2009 1:28 pm
by praveenraj1987
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..

Posted: Mon Mar 09, 2009 1:30 pm
by praveenraj1987
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..

Posted: Mon Mar 09, 2009 1:41 pm
by Andyhhp
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

Posted: Mon Mar 09, 2009 1:44 pm
by praveenraj1987
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..

Posted: Mon Mar 09, 2009 1:47 pm
by Andyhhp
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

Posted: Mon Mar 09, 2009 1:49 pm
by praveenraj1987
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..!!!

Posted: Mon Mar 09, 2009 1:52 pm
by praveenraj1987
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..

Posted: Mon Mar 09, 2009 1:58 pm
by Andyhhp
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.