GRUB Error 25

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
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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.
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: GRUB Error 25

Post 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.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Re: GRUB Error 25

Post 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
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GRUB Error 25

Post 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
Every good solution is obvious once you've found it.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GRUB Error 25

Post 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.
Every good solution is obvious once you've found it.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: GRUB Error 25

Post 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. ;-)
Every good solution is obvious once you've found it.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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)
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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. :/
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: GRUB Error 25

Post 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.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB Error 25

Post 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?
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: GRUB Error 25

Post 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.
"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 ]
Post Reply