GRUB2 + VS2010 Bare bones

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Solar »

gedd wrote:VC 2010 convert automaticaly VC2008 project and it take few seconds.
Leaving you with two sets of project files. And if anyone touches the properties - e.g. changing a certain compiler flag but only in the 64bit debug version without ICU support - and checks in the project file by accident, you are bound for a world of pain. 8)

I will not claim that I did not recieve my share of pain from automake / configure, too - but that was thanks to ancient AIX 5.1 and a couple of admins who could not install a GNU toolchain properly. 8)
Every good solution is obvious once you've found it.
User avatar
Ameise
Member
Member
Posts: 61
Joined: Fri Jul 16, 2010 7:46 am
Location: Chicago

Re: GRUB2 + VS2010 Bare bones

Post by Ameise »

VS12 can convert, but can also natively load VS2010 project files without conversion. It includes a full copy of the VS2010 toolchain, and Microsoft claims that all future versions will have direct backwards compatibility until VS2010.

RE: Combuster,

Here's something that GCC cannot do, and the necessity of it is irrelevant: it cannot make naked functions in x86 mode. Visual C++ can. Not only that, VC++ supplies you with a _LOCAL_SIZE immediate so you can set up the stack of an ISR, so that you can use it as an actual C/++ function. The only portable way to do ISRs in GCC is to use assembly and call C++ -- VC++ can do it all from within C++, with one less call, too. Important? No, but it is a difference. Clang can do naked functions as well, but lacks an equivalent of _LOCAL_SIZE. I've actually requested naked support in GCC, but was flat out told "no" -- if it isn't needed in Linux, it isn't needed in GCC.

As per "If you care about performance, use ICC" -- yes, it's not as though ICC does not cost a relatively exorbitant amount, particularly when you can get various versions of VC++ for free via the various programs (bizspark, etc).

Visual C++ Steps:
  • Set up projects for loading vhd, compiling kernel, expanding kernel, and closing vhd
    write kernel expander
    write kernel
It really isn't that complex. Using build order settings, this is quite trivial and extremely painless, particularly in VS2010 or VS2012. Nobody cares about <= VS2008 anymore.

GCC isn't the right tool for building kernels, any more than VC or ICC are. GCC is the right tool for building Linux, because that's what GCC is pretty much designed to do - Linux and Linux Apps. Anything else is just an added bonus: it is designed for Linux and to make Linux faster these days. The developers don't care about other OSen because they don't have to. If you want actual portability, follow the Clang project, particularly since Clang is also trying to integrate Visual C++ compatibility as well as features that GCC developers won't add (like naked functions).

The only limitation that I've ever run into with VC is the inability to prevent SSE code generation for 64-bit targets. That's it. A simple reworking of part of my design (and not a significant part) meant that that was fine. In fact, it may actually speed up the system in general in the end. But claiming that the only reason that someone would use VC is for "a few comfy features" or "bragging rights" is just as ridiculous a statement as "the only reason someone would use GCC is so they can turn off SSE code generation". Not everyone cares about C support - I certainly don't. I use C++ exclusively - I have no reason not to, because anything I could write in C, I could also write in C++. MSVC could drop C support altogether and I wouldn't even notice. MSVC is most certainly catching up in regards to standards support - the only things I still have wanting of in VC are const_expr and variadic templates. I don't really care that GCC is 10% the size of VC -- is this the mid-90s and hard drive space matters? I don't care that GCC supports all output formats - my toolchain can parse and work with PE binaries directly. I don't care that GCC works everywhere, because my primary system is Windows. I don't care that GCC works for everywhere, because anywhere I'm going to build for, VC can also build for (x86, x86-64, PPC, ARM).

Your rant is pointless because it is based on your desires. Fine, VC isn't appropriate for you. That doesn't mean that it isn't appropriate for everyone else, too.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Brynet-Inc »

You're clueless. gcc predates Linux.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Ameise
Member
Member
Posts: 61
Joined: Fri Jul 16, 2010 7:46 am
Location: Chicago

Re: GRUB2 + VS2010 Bare bones

Post by Ameise »

Brynet-Inc wrote:You're clueless. gcc predates Linux.
No, you just have difficulty with reading comprehension; it appears as though you have difficulty understanding "these days":
it is designed for Linux and to make Linux faster these days.
If you aren't even going to bother to entirely read what I wrote, well, why did you bother at all, if not just to lob baseless insults?

Unless you did actually read and understand it, in which case, Visual C++ must not these days be oriented towards x86-64, since it predates it. :wink:
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by neon »

Hello,

For informational purposes, I agree with Combuster on a lot of the points regarding GCC: for OS development GCC is the better choice on reliability, output binary support, and portability. Some people choose the Microsoft toolchain for varies of different reasons; one of mine being that there isnt any good port of GCC for Windows. DJGPP is terrible and installing Cygwin for just GCC is a bottleneck. Its important to realize however that by definition, both GCC and MSVC tool chains support the capability of producing stand alone software or cross compilation to other target OSs. MSVC cross compilers do exist.

Also, we should not be comparing a compiler (GCC) with an IDE (MSVC). It is more fair to compare GCC with CL. By this some of the points are invalidated.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
Ameise
Member
Member
Posts: 61
Joined: Fri Jul 16, 2010 7:46 am
Location: Chicago

Re: GRUB2 + VS2010 Bare bones

Post by Ameise »

neon wrote:Hello,

For informational purposes, I agree with Combuster on a lot of the points regarding GCC: for OS development GCC is the better choice on reliability, output binary support, and portability. Some people choose the Microsoft toolchain for varies of different reasons; one of mine being that there isnt any good port of GCC for Windows. DJGPP is terrible and installing Cygwin for just GCC is a bottleneck. Its important to realize however that by definition, both GCC and MSVC tool chains support the capability of producing stand alone software or cross compilation to other target OSs. MSVC cross compilers do exist.

Also, we should not be comparing a compiler (GCC) with an IDE (MSVC). It is more fair to compare GCC with CL. By this some of the points are invalidated.
It is not trivial to force Visual Studio to use GCC, and it never fully integrates. CL is quite integrated into MSVC.

But in regards to:

Reliability : In what fashion is GCC more reliable?
Output Binary Support : Why do I need this?
Portability : Not everyone needs to support platforms other than x86, PPC, and ARM. In fact, most people don't.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Brynet-Inc »

Ameise wrote:
Brynet-Inc wrote:You're clueless. gcc predates Linux.
No, you just have difficulty with reading comprehension; it appears as though you have difficulty understanding "these days":
it is designed for Linux and to make Linux faster these days.
Baseless insults, the irony eludes you. It may be true that the developers consider Linux the primary target, but the compiler is still developed portability.. I'm not aware of any "Linux-specific" features, several people here have ported it to their OS to become self-hosting.
Ameise wrote:Unless you did actually read and understand it, in which case, Visual C++ must not these days be oriented towards x86-64, since it predates it. :wink:
I don't see the point you're trying to make here.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Ameise
Member
Member
Posts: 61
Joined: Fri Jul 16, 2010 7:46 am
Location: Chicago

Re: GRUB2 + VS2010 Bare bones

Post by Ameise »

Brynet-Inc wrote:
Ameise wrote:
Brynet-Inc wrote:You're clueless. gcc predates Linux.
No, you just have difficulty with reading comprehension; it appears as though you have difficulty understanding "these days":
it is designed for Linux and to make Linux faster these days.
Baseless insults, the irony alludes you. It may be true that the developers consider Linux the primary target, but the compiler is still developed portability.. I'm not aware of any "Linux-specific" feature, several people here have ported it to their OS to become self-hosting.
Ameise wrote:Unless you did actually read and understand it, in which case, Visual C++ must not these days be oriented towards x86-64, since it predates it. :wink:
I don't see the point you're trying to make here.
*eludes. Other typos aside, you began the string of insults with a baseless accusation due to your not having actually read what I wrote, or at least having not understood it.

My point was the same as yours - you claimed that GCC doesn't target Linux because it predates it, therefore, it must be impossible for MSVC to target x86-64 as it predates it as well.

I suggest you actually reread what I wrote and return with a response that actually makes sense within the context of it.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Brynet-Inc »

Ameise wrote:*eludes. Other typos aside, you began the string of insults with a baseless accusation due to your not having actually read what I wrote, or at least having not understood it.
Nitpicking.
Ameise wrote:My point was the same as yours - you claimed that GCC doesn't target Linux because it predates it, therefore, it must be impossible for MSVC to target x86-64 as it predates it as well.
Ameise wrote:GCC is the right tool for building Linux, because that's what GCC is pretty much designed to do - Linux and Linux Apps. Anything else is just an added bonus: it is designed for Linux and to make Linux faster these days.
No, your point really wasn't the same. And again, No, gcc was not designed for Linux. It still supports other OS's and architectures, it even supported 64-bit architectures before x86-64.

It is a reproducible environment, binutils+gcc are available in source and binary form for a wide variety of platforms.. you could cross-compile your 64-bit PE kernel on a 32-bit ARM system running iOS.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Ameise
Member
Member
Posts: 61
Joined: Fri Jul 16, 2010 7:46 am
Location: Chicago

Re: GRUB2 + VS2010 Bare bones

Post by Ameise »

So, asking you to read/understand what I wrote is being nitpicky?

GCC is designed for Linux. Whether or not it supports other things is irrelevant - their primary target is Linux. A car is designed to run on roads. Does that mean that it cannot work offroad? No, but that's its primary target.

Why would I want to cross-compile my 64-bit PE kernel on a 32-bit ARM system running iOS? What possible benefit would that grant me?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Brynet-Inc »

Ameise wrote:So, asking you to read/understand what I wrote is being nitpicky?
No, mentioning the typo which I quickly corrected just before you posted.
Ameise wrote:GCC is designed for Linux. Whether or not it supports other things is irrelevant - their primary target is Linux. A car is designed to run on roads. Does that mean that it cannot work offroad? No, but that's its primary target.
No, it's a portable compiler. Originally developed on a 68k running some flavour of Unix. And it has been continuously ported to other systems over the years.
Ameise wrote:Why would I want to cross-compile my 64-bit PE kernel on a 32-bit ARM system running iOS? What possible benefit would that grant me?
Because you can. It means, that you can always continue to work on your OS, regardless of the platform you're on. It also means that people not using Windows can contribute.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Combuster »

Brynet-Inc beat me to the point of content.

At any rate, as long as you appear to talk out of ignorance, there will be people correcting you. I got the impression you're sticking to MSVC because of some propaganda, and not because it actually works better for you. All the posts you make only seem to confirm that suspicion. Especially when you start claiming that something was designed for something released only four years in its future.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Ameise
Member
Member
Posts: 61
Joined: Fri Jul 16, 2010 7:46 am
Location: Chicago

Re: GRUB2 + VS2010 Bare bones

Post by Ameise »

Combuster wrote:Solar beat me to the point of content.

At any rate, as long as you appear to talk out of ignorance, there will be people correcting you. I got the impression you're sticking to MSVC because of some propaganda, and not because it actually works better for you. All the posts you make only seem to confirm that suspicion.
You seem to be of the impression, again, that I've never used GCC or am ignorant of the alternatives. I was a professional Android developer for a year, and my original kernel was written using a GCC toolchain. I switches to MSVC _because the toolchain works better for what I'm doing).

I have yet to see where I'm talking out of ignorance, nor has anyone actually 'corrected' it. Brynet here suggested that I'd said that GCC only works on Linux (which is not what I said). I don't appreciate straw men. Particularly since he began his post with an insult, I feel very little motivation to take what he says with anything more than a grain of salt.
User avatar
Griwes
Member
Member
Posts: 374
Joined: Sat Jul 30, 2011 10:07 am
Libera.chat IRC: Griwes
Location: Wrocław/Racibórz, Poland
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Griwes »

Ameise wrote:GCC is designed for Linux. Whether or not it supports other things is irrelevant - their primary target is Linux. A car is designed to run on roads. Does that mean that it cannot work offroad? No, but that's its primary target.
You do know that GCC was there before Linux, don't you? GCC initial release: 1987; Linux initial release: 1991. I think that you are claiming that GCC devs do have some kind of time machine out there...
Ameise wrote:You seem to be of the impression, again, that I've never used GCC or am ignorant of the alternatives. I was a professional Android developer for a year, and my original kernel was written using a GCC toolchain. I switches to MSVC (because the toolchain works better for what I'm doing).
switched*. You do know that you can port GCC/LLVM to your OS, but not MSVC, making you dependent on MS Windows?
Ameise wrote:I have yet to see where I'm talking out of ignorance, nor has anyone actually 'corrected' it. Brynet here suggested that I'd said that GCC only works on Linux (which is not what I said). I don't appreciate straw men. Particularly since he began his post with an insult, I feel very little motivation to take what he says with anything more than a grain of salt.
You said that it was designed for Linux, which is just bullshit.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: GRUB2 + VS2010 Bare bones

Post by Brynet-Inc »

Ameise wrote:I feel very little motivation to take what he says with anything more than a grain of salt.
Fortunately, I can live with that. You've sufficiently demonstrated your lack of clue, without my assistance.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Locked