Page 2 of 2

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 10:08 am
by engine252
forgot the attachement

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 10:38 am
by Kevin McGuire
@engine252:
You have two of the best methods to getting MSVC++ to boot using GRUB, and you still have problems --- then you need to take a step back and actually understand what you are trying to do so you can better diagnose your problem.

It took me weeks to get that STUB working all by myself! So a couple of people basicaly hand you code that lets you skip all the flustration and failure of trying to boot a kernel, let alone write one, and you still need a project template?

If the answer is "Yes" then you need to wait a little while before you attempt to write a kernel, and learn more about other concepts.

You will not find any posts from me asking questions, because I had to figure everything out from documentation, specifications, and tutorials just like almost everyone else here and that is the best suggestion I can give you due to the fact that it is actually quicker than asking questions.

Since in this case you are having trouble just copying a os independant executable image for booting with GRUB. >:(

And do not misunderstand me. I do not care if someone copy and pastes code since it is their own affair. You however made no mention of attempting to use the STUB, and nill about the compiler and linker options you used so to help someone guide you in the right direction. If you want to copy and paste code just come out and say it instead of talking about comparing code. How are you going to know what it does anyhow? ::)

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 10:54 am
by Candy
jolson88 wrote: Hey all, I'm a new guy here. I'm also new to OS Development.
Hey there, welcome aboard.
If an "intro to OS development" tutorial can be written using VC2005 Express, Bochs, and the pre-built Grub disk image, it might be a promising "head start" to people.
---------------------------------------------
I do have to admit that there are certain aspects from the blog posts that I don't understand, so I'm going to do some more research and learning before I move on (that old "understand everything that is going on" adage, don't cha' know).
I'm still a strong proponent of the "know what you're doing to the bone" thing. You should not just get it to work, you should also understand why it works, how to make it not work in various ways and know how to identify and fix them. Bonus points for people who try to remember common constants for debugging, so you can easily determine what a random hex number is most likely to mean.

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 11:12 am
by engine252
kmcguire wrote: @engine252:
You have two of the best methods to getting MSVC++ to boot using GRUB, and you still have problems --- then you need to take a step back and actually understand what you are trying to do so you can better diagnose your problem.

It took me weeks to get that STUB working all by myself! So a couple of people basicaly hand you code that lets you skip all the flustration and failure of trying to boot a kernel, let alone write one, and you still need a project template?

If the answer is "Yes" then you need to wait a little while before you attempt to write a kernel, and learn more about other concepts.

You will not find any posts from me asking questions, because I had to figure everything out from documentation, specifications, and tutorials just like almost everyone else here and that is the best suggestion I can give you due to the fact that it is actually quicker than asking questions.

Since in this case you are having trouble just copying a os independant executable image for booting with GRUB. >:(

And do not misunderstand me. I do not care if someone copy and pastes code since it is their own affair. You however made no mention of attempting to use the STUB, and nill about the compiler and linker options you used so to help someone guide you in the right direction. If you want to copy and paste code just come out and say it instead of talking about comparing code. How are you going to know what it does anyhow? ::)
Ok i think i should say something here.

First off i do a LOT of research before asking anything here.
i don't know wath your problem is but please if you can't help don't stop anyone else from helping by assuming or indicating things that you are not sure off.

I sayd i followed the blog so yes i copied the code from it aswell. I uploaded the project, if i didn't want you to know i copied it i wouldn't upload it wright.

Wath you are saying is "if it dousn't work, give it up and don't ask for help" well sorry but i can't agree with you.

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 12:28 pm
by Kevin McGuire
You want a zipped up MSVC open and compile a kernel from template --- here you go. The produced file can be loaded by bochs, and will load at 16MB.

You got bochs working and the premade GRUB disk, so replace that kernel image with the ktemplate.dll this project produces.

Now, you will most likely bork this too? ::)

And, do not screw with anything on the first run. I installed windows, and the express edition of MSVC++ cleanly so nothing should go bonkers.

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 12:55 pm
by jolson88
Candy wrote: I'm still a strong proponent of the "know what you're doing to the bone" thing. You should not just get it to work, you should also understand why it works, how to make it not work in various ways and know how to identify and fix them. Bonus points for people who try to remember common constants for debugging, so you can easily determine what a random hex number is most likely to mean.
I couldn't agree with you more :). Hence the reason I still have some more research to do before I write any more code.

I suppose one of the things that helped me getting it working is that I went through the process of creating my own bootloader (and following the tutorials) to understand what goes on during boot. I'm also reading Tanenbaum's book, as well as Windows Internals by Rusinnovich. Although, at this point, I must admit that a lot of Grub is "black magic" to me, so I really need to get to know it better.

My personal feeling is that before anyone tries the VC2005 road, they should go through BareBones on the wiki (among many other things). If just following the blog posts on VC2005, a lot of the linker options can be "black magic" since it doesn't really discuss why the options are necessary. Oh, that, and when dealing with PE executables, dumpbin is your friend :).

Re:use visual studio for building os

Posted: Sun Sep 10, 2006 5:47 pm
by engine252
i figured out wath i did wrong.

i created a project file, added source and configured the compiler switches and settings.

but visual c++ always add's it own switches by default and this is where it go's wrong.

when compiling from the command line everything works perfectly but if i want to use the IDE then it dousn't.
i'm now looking if it's possible to create a project file without any compiler switches and add only those settings i need.

/OUT:"Default\kernel_x.exe" /NOLOGO /MANIFEST:NO /NODEFAULTLIB /MAP:"kernel.map" /SUBSYSTEM:CONSOLE /ENTRY:"__multiboot_entry__" /BASE:"0x100000" /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

i can't get rid of these extra linker switches.
i think the only way to acomplish that is to create a custom project template (i'll look in to it).

if someone else knows how to get rid of them pls let me know.

btw kmcguire the sample you uploaded worked perfectly. :)

Re:use visual studio for building os

Posted: Mon Sep 11, 2006 7:35 am
by oswizard
Somewhere there is a Linker Options > Additional Dependencies field: click the (...) button and uncheck "Inherit from Project Defaults". I think that adds a $(NOINHERIT) to the Additional Dependencies field. That will get rid of all the Windows libraries.

[edit]
All the other linker options willshould work - in fact, that's just about the same as what my OS does. Except I rebase later so that I can rebase to 0xC0100000.

If it still doesn't work, what are your compiler options?

I have it working perfectly without creating a custom project template, so I know it is possible. The "Visual C" entry in the Wiki describes my settings precisely.
[/edit]

Mike

Re:use visual studio for building os

Posted: Mon Sep 11, 2006 2:27 pm
by engine252
Somewhere there is a Linker Options > Additional Dependencies field: click the (...) button and uncheck "Inherit from Project Defaults". I think that adds a $(NOINHERIT) to the Additional Dependencies field. That will get rid of all the Windows libraries.
this was the setting indeed.
now everything works perfectly.
But i have created a project template with all the settings alraidy set i'll upload it soon.
i'm just adding some finishing touches. ;D
At the end of this thread i want to have a project file (or template if possible) where i can add classes and code files at will, hit compile and see my result.
so i think my goul is allmost reached

Re:use visual studio for building os

Posted: Mon Sep 11, 2006 3:54 pm
by engine252
Hi again

i attached the kernel project template.
there is a file added on how to install it in vs2005 (i don't know if it would work in vs2003.)

it generates a kernel project with the exact code found on the blog, all compiler and linker swithes are set.

so all you need to do is compile (ignore the warnings),
copy the exe to a floppy (image) with grub installed
and test. ;D

this is a very simply done so pls report all bugs or things that should be changed.

if you change the template pls upload it again so the comunity benefits from it ;)

Re:use visual studio for building os

Posted: Mon Sep 11, 2006 4:05 pm
by engine252
the attachment ;D

Re:use visual studio for building os

Posted: Mon Sep 11, 2006 4:45 pm
by Kevin McGuire
I can not comment on the previous posts since I do not remember enough about the settings, but I do appreciate you letting me know it works. :)

That is a great attitude to have towards goals. It shows you have an amount of motivation, and inspiration for your own personal reason even if it is challenging and resistant to success/completetion.

Re:use visual studio for building os

Posted: Sun Sep 17, 2006 8:52 am
by nightos
Hello,

once i have done a simple OS Starter Kit for Visual Studio 2005. Just open the solution, build the kernel, start BuildCD.bat in the root directory and run TestOS.bat.

http://rapidshare.de/files/33450623/OSStarterKit2.rar.html

Bye !