TuxPPC
TuxPPC
home   |   submit: news, guide,   |   volunteer   |     |  


Sponsored by
Sponsored by PowerMax.com

Buy iMac


News Editions

About iMac

About Linux

Getting Started

Getting Help

User Resources

Advertisement

Distributions

Software Picks






Search

 

Links
  iMacLinux Edition Thursday, 03 July 2003  



Posted by on Tuesday August 29th, 2000 03:22:44 PM
Newworld PowerMacs (iBook, PowerMac G4, iMac, etc.) should be booted using the yaboot booter for best results. This guide explains how to setup yaboot and create a boot menu between Mac OS and Linux. It is very different from setting up quik. This guide assumes you have Linux already installed, and want to install yaboot.


Creating a Bootstrap Partition

Newworld Macs (which are based on the CHRP standard) require a "blessed" CHRP openfirmware script to boot on a HFS or HFS+ partition. If you look on your Mac OS partitions, with a program that can see invisable files, you will find this CHRP openfirmware script in your Mac OS System Folder with the name tbxi.

This means, in almost all cases, you need a special bootstrap partition for Linux, as Linux can not reside on a HFS or a HFS+ partition, it requires a ext2 partition.

This "bootstrap" partition should be around 5 to 10 MB. Other guides recommend more space, but it is not neccessary, and just a waste of disk space. The format doesn't matter, as we will reformat it in Linux.

Installing the Required Software

You need to get the following pieces of software:

  • yaboot - rpm: Use the yaboot rpm from your distro. deb: apt-get install yaboot
  • ybin - tgz: Everybody should get it from .

    yaboot

    Install the yaboot RPM like any RPM: rpm -Uvh yaboot*.ppc.rpm.

    Debian's apt-get will take care of the downloading and installation for you.

    ybin

    Open a xterm in the directory, that ybin is in. Expand the archive, and go into the ybin directory:

    tar -zxvpf ybin-*.tar.gz
    cd ybin-*

    Type in make install. If all goes well you should see:

    installation successful.
    Any existing /boot/ofboot.b has been replaced, the old file has been moved to /boot/ofboot.b.preserved.

    yaboot.conf: Ybin Configuration

    /etc/yaboot.conf is yaboot and ybin's main configuration file. The first half of this file for ybin is something totally different from other bootloaders, so read carefully.

    Open up this file (as root) in your favorite text editor. For me, it's either joe or kedit.

    Setting the boot partition

    The "boot" partition is the "bootstrap" partition you created earlier that will be used to put that "blessed" txbi file that controls booting on New World Machines.

    boot=/dev/hda8

    Danger! This partition will be completely erased when you run mkofboot. It should be in standard Linux syntax, ie. /dev/hda7. Make sure you do not mess up this setting. mkofboot will prompt you before erasing it, to give you a second warning.

    Setting the root device

    The root device is the main device your Linux partition is on (and where the kernel is found). The device variable should be changed to resemble:

    device=hd:5

    Note: This must be in a special OpenFirmware format shown below:

  • Internal HD - hd:5 where 5 represents the partition number.
  • USB Zip drive - zip:5 where 5 represents the partition number.
  • External SCSI, Other IDE/ATAPI Configs - Refer to the .

    Multiple OS Settings

    Ybin and Yaboot are designed to boot between multiple operating systems on you computer.

  • timeout=20 - Specfies how many seconds before choosing the "Default OS". This number is in seconds.
  • default=macos - Specfies the Default OS. Must be either linux OR macos OR macosx
  • macos=hd:8 - Specfies Location of Mac OS. Must be in the OpenFirmware Format.
  • macosx=hd:9 - Specfies Location of Mac OS X. Must be in the OpenFirmware Format.

    yaboot.conf: yaboot Configuration

    Linux needs to have information on where to find the kernel, and any kernel arguments to pass to it. This is different from the top of the file, which deals with setting up the bootpartition using ybin.

    Note: This part of the file resembles quik.conf (used on older Macs) and lilo.conf (used on PCs). You don't have to set up these settings, but if you don't, Linux will prompt you on boot everytime for this info.

    Setting the image

    The "image" refers to the Linux path to the vmlinux kernel image. You should change it to /boot/vmlinux, as that is the preferred place to store the Linux kernel. It should be changed to look like:

    image=/boot/vmlinux

    Setting the root device

    Again, you have to root device -- but this time in Linux format. Example:

    root=/dev/hda5

    Setting the partition

    Finally, you have to specify (again!) the partition to boot. You do this with the partition= line. Example:

    partition=5

    More Kernel Arguments

    If you want to pass arguments to the kernel (for video settings, keyboard, etc.) use append= at the end of this file.

    Remove Uneccessary Lines

    There are several lines you may want to remove from this file. They are:

  • novideo # This gives you slow offb video. Only use if you are having video problems.
  • read-only # This mounts the Linux partition read-only. Remove it.

    Sample yaboot.conf

    If you configured yaboot.conf correctly, it should look like:

    ## example yaboot.conf for ybin and yaboot 0.6
    ## see man yaboot.conf for more details.
     
    ## change to your bootstrap partition ie /dev/hda2
    boot=/dev/hda7
    device=hd:5
    timeout=20
    default=macos
    macos=hd:8
    macosx=hd:9
    install=/boot/yaboot
    magicboot=/boot/ofboot.b
     
    image=/boot/vmlinux
            label=Linux
            root=/dev/hda5
            partition=5   
            append="video=aty128fb:vmode:17:cmode:32"  
    

    Setting up the BootStrap

    Now that yaboot.conf is configured, you should be able (as root) to run:

    mkofboot -v

    This will read the settings from yaboot.conf, and setup your partition. You will be warned one last time, that the partition you selected for a bootstrap, is about to be erased, and have the bootstrap installed.

    If all goes well, you should see:

          mkofboot: Creating HFS filesystem on /dev/hda2...
          mkofboot: Checking /dev/hda2 for valid HFS filesystem...
          mkofboot: Copying /boot/yaboot to /dev/hda2...
          mkofboot: Copying /etc/yaboot.conf to /dev/hda2...
          mkofboot: Installing first stage bootstrap: ofboot.b...
          mkofboot: Setting attributes on yaboot.b...
          mkofboot: Setting attributes on yaboot.conf...
          mkofboot: Setting attributes on ofboot.b...
          mkofboot: Blessing /dev/hda2...
          mkofboot: Cleaning up...
    

    Configuring OpenFirmware

    To get into OpenFirmware, you need to reboot your computer, holding down the command-option-o-f keys.

    Note: nvsetenv currently doesn't work on New World Macs, so you won't be able to use it.

    Finally, you need to change the default boot device (the device that gets booted by default).

    setenv boot-device hd:7,:tbxi

    Note: Replace hd:7 with the correct OpenFirmware device.

    You can turn off your machine now, as anything typed into OF is saved as soon as you type it in.

    Booting using Yaboot

    Newer Machines - iMac DV, PowerBook 2000, All G4s

    Hold down the option key on boot to get a graphical boot menu, offering a choice between whatever OS's you configured in yaboot.conf.

    If you don't hold down the option key on these machines, it will put up the standard yaboot prompt. This is explained in the section below.

    Older Machines - iBooks, Blue G3, iMac Rev. D or Earlier

    You will be prompted with the standard yaboot prompt at boot.

    Within 20 seconds (or whatever timeout you put in yaboot.conf), you can enter in what OS you want to boot. After 20 seconds, you will get the default OS. Any extra kernel arguments can be typed after the OS's name.

    Examples:

    linux Linux
    linux S Linux Single User
    macos Classic Mac OS
    macosx Mac OS X
    macosx init=/bin/sh Mac OS X - No GUI, Single User
Search for bootx

The Fine Print: The following comments are owned by whoever posted them.
(Reply)

by on Friday October 20th, 2000 09:47:31 AM
I know yaboot has been around since April and I am only now getting to it and you've probably haven't given yaboot a second thought for quite awhile but the information regarding nvsetenv does not hold true for us early buyers of the iMac. I have a rev B iMac and nvsetenv does not see the /dev/nvram device. From what I have read, this only works on the multi-colored iMacs. I'm writing this only from memory so I may be off on this. However, the workaround is to boot into OF and enter the command there minus the "nv" part. All-in-all, this is a very useful guide. Thanks for writing it. dave
by on Monday October 30th, 2000 01:01:18 PM
Okay, I fixed that part. At any rate, this whole guide needs some serious work, I'll be fixing this over the next week.
by on Monday April 02nd, 2001 01:24:18 AM
Are you still working on this FAQ?

I need to create bootstrap partition and place it early in the sequence of partitions. I do not want to reformat my entire disk. Is this possible?

by on Thursday July 19th, 2001 02:33:14 PM
For the benefit of other newbies, here's some info on what you need to do about partitioning to get this to work. Many thanks to the people who helped me sort this out.

Use the Apple utility Drive Setup to make the Mac OS partitions you need. Depending on your OS version, you will probably want your main Mac OS partition in HFS+ (won't be readable from Linux) and one in HFS that will be readable from Linux. Then use the pdisk utility to set up your linux partitions and give them the correct types. See for how to use it. Warning: back up first, this stuff is scary.

You must have a bootstrap partition before all the other MacOS partitions, with type Apple_Bootstrap. Use the C command to create it, the r command to move it.

The partition you will use as Linux root must not have type Apple_Free. Give it type Apple_UNIX_SVR2. Apparently some installers set the type of this partition; the SuSE one doesn't.

by on Thursday July 19th, 2001 02:35:17 PM
For the benefit of other newbies, here's some info on what you need to do about partitioning to get this to work. Many thanks to the people who helped me sort this out.

Use the Apple utility Drive Setup to make the Mac OS partitions you need. Depending on your OS version, you will probably want your main Mac OS partition in HFS+ (won't be readable from Linux) and one in HFS that will be readable from Linux. Then use the pdisk utility to set up your linux partitions and give them the correct types. See for how to use it. Warning: back up first, this stuff is scary.

You must have a bootstrap partition before all the other MacOS partitions, with type Apple_Bootstrap. Use the C command to create it, the r command to move it.

The partition you will use as Linux root must not have type Apple_Free. Give it type Apple_UNIX_SVR2. Apparently some installers set the type of this partition; the SuSE one doesn't.


  Legal and Privacy Notices Copyright © 2001