Page 3 of 4

Re: GRUB Error 25

Posted: Fri Jul 06, 2012 12:04 pm
by zhiayang
Combuster wrote:Can't reproduce error. I took the build script, created the missing directories, replaced the harcoded paths to gcc and ld (not good), and replaced qemu with qemu-system-i386. Kernel got started without error but wasn't particularly interesting.

In other words: Go fix your tools.

I used the following tool from my system. Make sure your versions are at least that.
Binutils 2.18
GCC 4.1.2
mkisofs 3.00
qemu 1.0-r3
That... is painful. There's nothing wrong with my tools. I used the same tools for my previous OS. I changed things around and it still works. Bad voodoo. Well either way it's solved, although we didn't get the cause, which I would like to.

Re: GRUB Error 25

Posted: Fri Jul 06, 2012 7:45 pm
by Kazinsal
requimrar wrote:I changed things around and it still works. Bad voodoo. Well either way it's solved, although we didn't get the cause, which I would like to.
That doesn't mean you've fixed it. That just means that something happened to stop the bug from occurring. It could resurface at any time down the road, and when it does, you won't have any idea where it is.

I suggest you un-"fix" it, build yourself a brand new set of tools (because, as Combuster says, they're likely broken), and try again. That way, if it fixes it, you've learned a valuable lesson.

Re: GRUB Error 25

Posted: Mon Jul 09, 2012 6:48 pm
by zhiayang
Blacklight wrote:
requimrar wrote:I changed things around and it still works. Bad voodoo. Well either way it's solved, although we didn't get the cause, which I would like to.
That doesn't mean you've fixed it. That just means that something happened to stop the bug from occurring. It could resurface at any time down the road, and when it does, you won't have any idea where it is.

I suggest you un-"fix" it, build yourself a brand new set of tools (because, as Combuster says, they're likely broken), and try again. That way, if it fixes it, you've learned a valuable lesson.
Bah. I built the cross compiler from scratch, following the wiki page. I had to change some things; I had to direct CC and stuff to the llvm compiler...

Nope. Used GCC 4.7.1 and binutils 2.22. Took a long time, but still, same error.

Re: GRUB Error 25

Posted: Mon Jul 09, 2012 7:08 pm
by piranha
I had to change some things
build yourself a brand new set of tools (because, as Combuster says, they're likely broken).
What exactly did you change?

-JL

Re: GRUB Error 25

Posted: Mon Jul 09, 2012 7:15 pm
by zhiayang
piranha wrote:
I had to change some things
build yourself a brand new set of tools (because, as Combuster says, they're likely broken).
What exactly did you change?

-JL
The wiki says not to use the llvm compiler, but all the gcc-4.2 compilers were just aliases to the llvm compiler. so i pointed CC and CPP and CXX and LD to the llvm ones.

Re: GRUB Error 25

Posted: Tue Jul 10, 2012 2:25 am
by Solar
requimrar wrote:The wiki says not to use the llvm compiler, but all the gcc-4.2 compilers were just aliases to the llvm compiler.
Please be precise: Are you saying that the following part of the Wiki does not indeed work on a Mac?
GCC Cross-Compiler wrote:MacOS users, beware

The makefiles of binutils and GCC use the `$(CC)` variable to invoke the compiler. On MacOS, this resolves to `gcc` by default, which is actually not the "real thing", but `llvm-gcc`. That wouldn't be so bad, but `llvm-gcc` is not able to compile the GCC sources into a functional binary. (Bugs have been reported, but that doesn't help you here and now.)

MacOS does have a "real" GCC installed, too. You just have to tell `make` to use it instead of `llvm-gcc`:

Code: Select all

# This is only necessary for MacOS users.
export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export CPP=/usr/bin/cpp-4.2
export LD=/usr/bin/gcc-4.2

Re: GRUB Error 25

Posted: Tue Jul 10, 2012 2:53 am
by zhiayang
Solar wrote:
requimrar wrote:The wiki says not to use the llvm compiler, but all the gcc-4.2 compilers were just aliases to the llvm compiler.
Please be precise: Are you saying that the following part of the Wiki does not indeed work on a Mac?
GCC Cross-Compiler wrote:MacOS users, beware

The makefiles of binutils and GCC use the `$(CC)` variable to invoke the compiler. On MacOS, this resolves to `gcc` by default, which is actually not the "real thing", but `llvm-gcc`. That wouldn't be so bad, but `llvm-gcc` is not able to compile the GCC sources into a functional binary. (Bugs have been reported, but that doesn't help you here and now.)

MacOS does have a "real" GCC installed, too. You just have to tell `make` to use it instead of `llvm-gcc`:

Code: Select all

# This is only necessary for MacOS users.
export CC=/usr/bin/gcc-4.2
export CXX=/usr/bin/g++-4.2
export CPP=/usr/bin/cpp-4.2
export LD=/usr/bin/gcc-4.2
But... it functions! It does, seriously. I used the llvm compiler in all 4 export's and yes, it does compile.

Re: GRUB Error 25

Posted: Tue Jul 10, 2012 3:01 am
by Solar
requimrar wrote:I used the llvm compiler in all 4 export's and yes, it does compile.
That was never in doubt. The tutorial says:
GCC Cross-Compiler wrote:[...] `llvm-gcc` is not able to compile the GCC sources into a functional binary. (Bugs have been reported, but that doesn't help you here and now.)
So either you have a non-functional GCC binary (i.e., compiling it worked allright, but the GCC binary you got won't work correctly, if at all). Or llvm resolved the bugs. In the former case, you are working from flawed assumptions, in the latter case our Wiki needs updating. Either way, another round of testing your assumptions is in order.

Re: GRUB Error 25

Posted: Tue Jul 10, 2012 3:09 am
by zhiayang
Solar wrote:
requimrar wrote:I used the llvm compiler in all 4 export's and yes, it does compile.
That was never in doubt. The tutorial says:
GCC Cross-Compiler wrote:[...] `llvm-gcc` is not able to compile the GCC sources into a functional binary. (Bugs have been reported, but that doesn't help you here and now.)
So either you have a non-functional GCC binary (i.e., compiling it worked allright, but the GCC binary you got won't work correctly, if at all). Or llvm resolved the bugs. In the former case, you are working from flawed assumptions, in the latter case our Wiki needs updating. Either way, another round of testing your assumptions is in order.
Thank you.

Just in case you want to replicate my setup, I have Xcode 4.3.3 and used GCC 4.7.1 and binutils 2.22. Also OSX 10.7.4.

Re: GRUB Error 25

Posted: Tue Jul 10, 2012 3:48 am
by Solar
requimrar wrote:Just in case you want to replicate my setup...
Can't. I have several x86, one x86_64, one VIA WM8505 ARM926, and hopefully soon a Raspberry Pi, but no Mac. ;-)

Re: GRUB Error 25

Posted: Wed Jul 11, 2012 8:24 am
by zhiayang
berkus wrote:
requimrar wrote:I used the llvm compiler in all 4 export's and yes, it does compile.
You might be lying about gcc-4.2 being llvm-gcc though:

Code: Select all

$ /usr/bin/gcc-4.2 --version
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
What's on yours?
Oh. A quick search for gcc yields a bunch of aliases that all point to a folder:

Code: Select all

/usr/llvm-gcc-4.2/bin/
And even i686-darwin11-llvm-gcc-4.2 and g++ are llvm.
It would appear that I do not have a non-llvm compiler on my system.

running -v on the darwin11 llvm gcc yields:

Code: Select all

Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

Re: GRUB Error 25

Posted: Thu Jul 19, 2012 4:54 am
by zhiayang
Hehe... bump?

On a serious note. It seems I cannot get away with this for long.
I don't know how to do a complete code rewrite when you can't start from scratch... so my first step was to fix dependencies and only compile the core files.

It however, turns out that... I get error 8 and 25 again.

This is the interesting part: When I link the memory management files, (aka heap.c, paging.c, kmalloc.c and ordered_list.c [from JamesM tutorial V1), it works. Fine and dandy.

All I did in there was some formatting changes and name changes. Other than that, it's a complete rip-off of the tutorial (sorry...)

What gives? I cannot identify, within my limited identification skills, any code that the rest of the kernel would not work without... There's no linking errors or anything, no compilation errors... nothing. It works, then it doesn't.

If someone has the time... and is using OSX (I think berkus?) I don't think that it's the tools that are causing it, but just to make sure, can someone else test them for me? I only have one machine. :/

Re: GRUB Error 25

Posted: Thu Jul 19, 2012 4:58 am
by Kazinsal
requimrar wrote:If someone has the time... and is using OSX (I think berkus?)
I haven't seen any of his posts (or PMs or his forum profile -- I think you get the point) lately. Good luck getting a hold of him.
I don't think that it's the tools that are causing it, but just to make sure, can someone else test them for me? I only have one machine. :/
Fire up a VM running Ubuntu and try building on there. If it works, it's your tools. If it doesn't, it's your code.

Ten bucks says it's the tools.

Re: GRUB Error 25

Posted: Thu Jul 19, 2012 6:06 am
by zhiayang
Blacklight wrote: Fire up a VM running Ubuntu and try building on there. If it works, it's your tools. If it doesn't, it's your code.

Ten bucks says it's the tools.
I'm broke, sorry. :/

Code: Select all

Why do we need one?
Creating a dedicated (cross-)compiler for your OS development work can save you many headaches. If
...
... your bootloader stubbornly insists that it can't read your kernel binary...
Seems like what's happening... But it's not the typical error 13, is it? I'm downloading Ubuntu now. Just to re-assure myself... When I use

Code: Select all

TARGET=i586-elf
on a 64-bit OSX System, I do get a 32-bit binary... right?
Also when I want to switch to a long mode (64-bit) OS, is

Code: Select all

TARGET=x86_64-elf
enough to let the cross compiler (rebuilt from scratch, of course) make 64-bit binaries?
You can't actually do the latter on a 32-bit system, can you?

Re: GRUB Error 25

Posted: Thu Jul 19, 2012 6:48 am
by Combuster
requimrar wrote:You can't actually do the latter on a 32-bit system, can you?
On what machine was the first 64-bit compiler built? :wink:
I don't think that it's the tools that are causing it, but just to make sure, can someone else test them for me? I only have one machine. :/
I tested your configuration on a non-mac machine earlier and it worked for me. So obviously your mac binaries are not doing what they should, and I'm getting rather annoyed trying to get that point across.