Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 166164 - sys-boot/yaboot - ybin path concatenation error prevents yaboot from dual-booting openbsd
Summary: sys-boot/yaboot - ybin path concatenation error prevents yaboot from dual-boo...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: Daniel Ostrow (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-10 03:19 UTC by Boney McCracker
Modified: 2007-03-10 01:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
BSD ybin patch (ybin.patch,839 bytes, patch)
2007-02-20 05:35 UTC, Joe Jezak (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Boney McCracker 2007-02-10 03:19:15 UTC
Yaboot doesn't dual-boot with BSD as advertised due to what appears to
be a path concatenation bug in the ybin shell script. This is of limited applicability, since I don't think there are too many people out there trying to dual-boot Gentoo and OpenBSD.

The advice available on the internet to overcome this is to boot into OpenFirmware and manually type a bootline every time, or hard-code OpenFirmware to boot only OpenBSD and get to your other OS through the clunky and painfully slow graphical bootloader that comes up when you hold down "option" at boot.

The ybin script itself needs to be patched (and it's probably just one or two lines).  That's beyond my knowledge.  But the work-around that I used may point a developer to exactly what needs fixing in the ybin script.

My work-around: Instead, I have edited a line in the OpenFirmware bootloader script that ybin creates in the Apple bootstrap partition. The script is named "ofboot.b" and the
offending line is near the top. Basically, it erroneously tacks a kernel
path onto the end of the line.

Before (this is a single line):
: bootybsd " Booting BSD..." .printf 100 ms load-base release-load-area
" /pci@f2000000/pci-bridge@d/mac-io@7/ata-4@1f000/disk@0:2,\
\ofwboot :,/bsd" $boot ;

After:

: bootybsd " Booting BSD..." .printf 100 ms load-base release-load-area
" /pci@f2000000/pci-bridge@d/mac-io@7/ata-4@1f000/disk@0:2,ofwboot"
$boot ;

Note that I have deleted the piece at the end ( :,/bsd).  In a nutshell,
replace the text between that second set of quotes with whatever command
you can successfully boot with at the OpenFirmware prompt. For me this
was simply "hd:2,ofwboot".

There is a second bug that is only binding if the user wishes to have "defaultos=bsd" in yaboot.conf (per the example file). Toward the bottom of ofboot.b, after the line "drop" is the command referring to whichever bootline is the default (either "bootyaboot" or "bootbsd"). The fix: "bootbsd" should be replaced with "bootybsd".

Note: Running ybin over-writes any changes, so the user must make a
copy of the fixed ofboot.b in your home directory for reference.


Reproducible: Always

Steps to Reproduce:
1.  Using the yaboot boot loader installed with Gentoo, and following standard yaboot documentation, configure for dual-boot of OpenBSD.
2. Select openbsd during boot up.
3.

Actual Results:  
The yaboot bootloader can't find the openbsd kernel.  As noted above, this is because the ybin script has built a bogus path to the openbsd kernel into the bootloader's file "ofboot.b" on the Apple bootstrap partition.

Expected Results:  
OpenBSD should boot.

I know this is "upstream", but I don't think yaboot is active and it's probably a simple patch.
Comment 1 Boney McCracker 2007-02-10 03:28:07 UTC
This is has been this way for as long as I've used OpenBSD (at least a year).  I know it's upstream, but I don't think yaboot is active and it's probably a simple patch.  Because yaboot is part of Linux and not OpenBSD, it's a Linux issue.

In summary (see details), the script "ybin" sticks a piece of unnecessary cruft into the path pointing to openbsd.  This can't be overcome by settings in yaboot.conf.  The unnecessary tidbit is simply  :,/bsd  but that prevents the bootloader from being able to boot openbsd.
Comment 2 Joe Jezak (RETIRED) gentoo-dev 2007-02-20 05:35:01 UTC
Created attachment 110709 [details, diff]
BSD ybin patch

Does this fix the problem with ybin?
Comment 3 Boney McCracker 2007-02-20 06:18:56 UTC
(In reply to comment #2)
> Created an attachment (id=110709) [edit]
> BSD ybin patch
> 
> Does this fix the problem with ybin?
> 

I can't test it because I no longer have that machine configured as a dual-boot.
However, the diff looks to me like it should do the trick.

Note that I only used that work-around with OpenBSD; the original may work fine with FreeBSD or NetBSD, with which I did not experiment.

Thank you!
Comment 4 Joe Jezak (RETIRED) gentoo-dev 2007-02-20 06:47:46 UTC
In that case, I'm not sure I want to commit the fix then.  I'd need someone to test it on all OSes that this could possibly make a difference on and confirm the results are okay. :p.

Are you willing to do that?  If not, then I probably won't push this patch, sorry.
Comment 5 Boney McCracker 2007-02-21 07:14:24 UTC
I'm not in a position to do that right now.  If I reconfigure that machine (my only macppc) again soon, I'll test it on obsd at least.

I really appreciate your effort on this, and I understand completely -- there are only so many people who are going to be dual-booting Gentoo and BSD on a macppc.

I don't even know of a maintainer for yaboot so I don't think it can be sent "upstream" per se.  If this does in fact apply to FreeBSD then it might be worth doing.  If not, the diff could be handed off to the OpenBSD devs.

Thanks again.