Page 3 of 3

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 5:14 am
by gerryg400
Read this wiki page. It discourages use of mingw. It even mentions the error that you are getting. I've not used mingw or Cygwin so cannot say anything about them. However, my advice is to move away from Mingw so that you can follow the tutorials more closely.

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 5:33 am
by Payn3
All tutorials were created using linux. I'm using windows 7 x64 and there are no tools for building the os but mingw.

If someone can recommend me some good tutorials under windows i will be grateful.

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 5:36 am
by gerryg400
Actually many of the tutorials were created under Cygwin. Does Cygwin work under windows 7 ?

I'm sure Linux has the best tools but not everyone uses it. I use Mac.

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 5:46 am
by Creature
Payn3 wrote:All tutorials were created using linux. I'm using windows 7 x64 and there are no tools for building the os but mingw.
Lies.
gerryg400 wrote:Actually many of the tutorials were created under Cygwin. Does Cygwin work under windows 7 ?

I'm sure Linux has the best tools but not everyone uses it. I use Mac.
I've used Cygwin before on Windows 7 x64 and had no problems with it. I've used MinGW to build a cross-compiler as well, which gave me no problems either (that was some time ago, though).

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 5:53 am
by Payn3
Ok, i have a virtualized ubuntu. I've rebuilded all the stuff and i get no errors or warnings. The entry point is the same and the format of the kernel was set to flat binary.

But the kernel is freezeing at the same point.

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 7:12 am
by gerryg400
Ok, i have a virtualized ubuntu.
That's a very good start.
The entry point is the same and the format of the kernel was set to flat binary.
You don't say but is your entry point still 0x100000 ?

If it is you need to do a few things, including at least the following.

1. Enable A20

2. Load your kernel to 0x100000. This is actually quiet difficult in real mode because addresses above 1MB are not normally available. You either need to switch to big real mode (un-real mode) or load the kernel below 1MB in real mode and copy to 1MB after switching to 32 bit mode. Actually there is another way but those 2 are easiest.

3. Make sure that the very first byte of your binary file is the entry point.

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 8:04 am
by Payn3
What's wrong with..
You don't say but is your entry point still 0x100000 ?
?

BTW, can anyone explain me the linker.ld file?

How i load the kernel below 1 mb? I suppose that the memory copy will be made with a custom memcpy.

First i'll try to load an asm kernel in real mode, if someone explains me ^.

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 3:35 pm
by Combuster

Re: Kernel loading from cd

Posted: Sun Aug 15, 2010 11:28 pm
by Candy
Creature wrote:
gerryg400 wrote:Actually many of the tutorials were created under Cygwin. Does Cygwin work under windows 7 ?
I've used Cygwin before on Windows 7 x64 and had no problems with it.
I've used cygwin for the first four iterations of my current rewrite (about a month long). The only real downside is that it's slow. I switched because the Cygwin e2fsimage doesn't support 4k blocks.

A full compile on one core in Windows takes about 30 seconds; 3 of those are reading the make file and 6 are building the filesystem image. That same full build takes 6.3 seconds on a virtualized Linux (that's running on the very same Windows). Make -j 16 used to cut it down to 13 seconds on Windows, on Linux (and I don't know if it's actually getting all 4 cores!) it cuts it down to 4.32 seconds.


Functionally speaking though, no problem with anything in Windows.

Re: Kernel loading from cd

Posted: Mon Aug 16, 2010 4:18 am
by Candy
berkus wrote:If you're compiling C code, the compiler would by default prepend "_" (underscore) to C symbols. This is what is the problem here. So either use _kernel_main in linker script or tell the compiler the equivalent of gcc's -fno-underscore option.
Not necessarily - it depends on what platform your compiler targets. Another good reason to use a cross-compiler targeted for *your OS* or generic elf - it doesn't make assumptions that don't hold.