From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Testing on PowerMac G4
Date: Fri, 4 Jan 2008 21:37:36 +0100 [thread overview]
Message-ID: <20080104203736.GA9375@thorin> (raw)
In-Reply-To: <1199471219.17196.35.camel@dv>
On Fri, Jan 04, 2008 at 01:26:59PM -0500, Pavel Roskin wrote:
> >
> > AFAICT, it can only happen in three ways:
> >
> > 1- The firmware doesn't like GRUB image, and aborts with bogus errors before
> > transferring control to GRUB. You can easily tell this appart by checking
> > for early "Welcome to GRUB" message.
>
> I'm quite sure now that it's the case. That's how it looks on the
> surface, I just was extra cautious before I had a chance to learn more
> about OpenFirmware and the GRUB code.
>
> Not only there is no "Welcome to GRUB" message, but the screen is not
> erased and remains black on white. "CLAIM failed" is followed by the
> OpenFirmware prompt. There are no messages that the execution was
> interrupted, which would appear in other failure cases.
>
> I tried to convert grub-mkimage output to the binary format, and found
> that objcopy doesn't like it.
If you want to confirm that it's grub-mkimage's fault, you can try booting
kernel.elf directly. In theory it should give you a rescue prompt.
> In fact, the image doesn't even survive
> simple objcopy intact. "objcopy grubof.modules grubof.modules1"
> produces a file 208 bytes long.
What is grubof.modules ? I never heard of it.
> We just cannot expect OpenFirmware to process invalid ELF files. It can
> be looking for the section headers and finding non-zero data is the gap
> is not wide enough. It can be just anything.
>
> A quick look into util/elf/grub-mkimage.c finds "Don't bother preserving
> the section headers". I don't even know if the problem is specifically
> with the section headers or with something else. Perhaps
> util/elf/grub-mkimage.c should be rewritten as a linker script, or maybe
> it should use the BFD library that comes with binutils. I'm optimistic
> about the linker script, since all we need is essentially linking.
There's another [1] outstanding problem with elf/grub-mkimage.c:
http://lists.gnu.org/archive/html/grub-devel/2007-10/msg00056.html
I think what you propose is a good idea. It sounds odd that we have to
reimplement ELF handling when another GNU project already has. But I don't
know how the GRUB maintainers think about it.
[1] or, perhaps, it's the same problem?
> > > There is a possibility that grub_errno remains set to some error.
> >
> > Well, that's easy to tell appart with some printfs.
>
> What I see is the last invocation of grub_ofdisk_open() has grub_errno
> set to 13 (EACCESS) throughout the code.
Wait, that would be EACCES in Linux errno codes. In GRUB, grub_errno
13 means GRUB_ERR_UNKNOWN_DEVICE (at the time of writing; there isn't a
stable ABI for this afaik).
If grub_errno was set you should've seen an error message somewhere. It
seems there's something wrong in our error handling. :-/
> A quote from the glibc manual:
>
> These functions do not change `errno' when they succeed; thus, the value
> of `errno' after a successful call is not necessarily zero, and you
> should not use `errno' to determine _whether_ a call failed. The proper
> way to do that is documented for each function. _If_ the call failed,
> you can examine `errno'.
>
> grub_ofdisk_open() is in direct violation of that rule. The execution
> can reach the "fail:" label without having failed anywhere, yet the code
> returns grub_errno unconditionally.
Yeah, would be nice if functions had their behaviour more similar to Glibc
equivalents. I'm not sure how much of a "policy" is this in GRUB, though.
> That's not to negate your findings, of course.
I would really check the GRUB_IEEE1275_FLAG_NO_PARTITION_0 issue. It was just
a guess, but it smells really badly :-)
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
next prev parent reply other threads:[~2008-01-04 20:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-31 8:12 Testing on PowerMac G4 Pavel Roskin
2007-12-31 8:45 ` Jan Nieuwenhuizen
2007-12-31 22:37 ` Pavel Roskin
2007-12-31 23:34 ` Robert Millan
2008-01-02 6:46 ` Pavel Roskin
2008-01-02 10:32 ` Robert Millan
2008-01-03 8:09 ` Pavel Roskin
2008-01-03 12:11 ` Robert Millan
2008-01-03 15:28 ` Pavel Roskin
2008-01-03 15:57 ` Robert Millan
2008-01-03 16:23 ` Pavel Roskin
2008-01-04 12:32 ` Robert Millan
2008-01-04 12:54 ` Robert Millan
2008-01-04 18:26 ` Pavel Roskin
2008-01-04 20:37 ` Robert Millan [this message]
2008-01-05 1:45 ` Yoshinori K. Okuji
2008-01-05 11:43 ` Robert Millan
2008-01-05 2:10 ` Pavel Roskin
2008-01-05 11:45 ` Robert Millan
2008-01-05 1:27 ` Yoshinori K. Okuji
2008-01-05 2:02 ` Pavel Roskin
2008-01-05 10:31 ` Yoshinori K. Okuji
2008-01-05 11:46 ` Robert Millan
2007-12-31 14:04 ` Robert Millan
2007-12-31 22:58 ` Pavel Roskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080104203736.GA9375@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.