r1756 - in trunk/BOOK: appendices/ppc boot/ppc bootable/ppc introduction/ppc partitioning partitioning/ppc

ken at linuxfromscratch.org ken at linuxfromscratch.org
Fri Jun 9 17:04:24 PDT 2006

Author: ken
Date: 2006-06-09 18:04:23 -0600 (Fri, 09 Jun 2006)
New Revision: 1756

First attempt at making the ppc temporary system bootable, plus related cleanups, particularly for creating partitions.

Modified: trunk/BOOK/appendices/ppc/macmiscellany.xml
--- trunk/BOOK/appendices/ppc/macmiscellany.xml	2006-06-10 00:03:51 UTC (rev 1755)
+++ trunk/BOOK/appendices/ppc/macmiscellany.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -43,18 +43,21 @@
 	<para>Macintoshes use their own partition format - this means that other
 	machines are unlikely to be able to read or write to macintosh partitions
 	(in particular, fdisk does not understand them). The format allows a large
-	number of individual partitions, and the native Mac tools have a tendency
+	number of individual partitions, and the native Mac tools had a tendency
 	to insert small "filler" partitions between the real partitions. Under
 	linux, using more than 15 partitions can be problematic (shortage of device
 	nodes), so the normal approach is to use the Mac tools to create an area
 	of freespace at the <emphasis>front</emphasis> of the disk, then put the
 	Mac OS partition(s) after it and (re-)install the Mac OS.  The
 	freespace can then be partitioned using <command>parted</command> or the
-	older <command>mac-fdisk</command>.</para>
+	older <command>mac-fdisk</command>.  It seems that recent versions of the
+	Mac tools may no longer insert the filler partitions, so it may be
+	possible to do all the partitioning before installing OSX.</para>
-	<para>The Macintosh resizing and partitioning tools are destructive and will
-	delete all data when a partition is resized.</para>
+	<para>The Macintosh resizing and partitioning tools are destructive and may
+	delete all data when a partition is resized, even on unaltered partitions.
+	</para>
 	<para>For the Linux partitions, you will need a bootstrap partition - this
@@ -65,11 +68,17 @@
 	be confused with a <literal>/boot</literal> partition.  Other partitions
 	are as normal (at least one rootfs, perhaps swap, perhaps others).</para>
-	<para>If you follow this advice, partition 1 will be the apple partition
+	<para>According to the lfs-from-osx hint, the Mac partitioning tools
+	can create an apple_bootstrap partition and therefore there is no need
+	to use a Linux CD to create the desired partitions from freespace, but
+	using a Linux CD to create the partitions is a more widely tested approach.
+	</para>
+	<para>If you follow this approach, partition 1 will be the apple partition
 	map, partition 2 will be the bootstrap at the start of the disk, the
 	linux partitions will follow, and then the mac partition(s) - under OSX
 	the first mac partition will be number 3, under OS9 it would have a higher
-	number.</para>
+	number and there would be some apple driver partitions.</para>

Modified: trunk/BOOK/boot/ppc/hfsutils.xml
--- trunk/BOOK/boot/ppc/hfsutils.xml	2006-06-10 00:03:51 UTC (rev 1755)
+++ trunk/BOOK/boot/ppc/hfsutils.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -22,6 +22,11 @@
   <sect2 role="installation">
     <title>Installation of Hfsutils</title>
+    <para>If you have created, or will create, the ext2 filesystem on your
+    Mac using ext2fsx you can jump ahead to
+    <xref linkend="ch-boot-yaboot-build" role="."/>. The next three packages
+    are for people who cannot do that.</para>
     <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"

Modified: trunk/BOOK/boot/ppc/yaboot.xml
--- trunk/BOOK/boot/ppc/yaboot.xml	2006-06-10 00:03:51 UTC (rev 1755)
+++ trunk/BOOK/boot/ppc/yaboot.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -15,6 +15,62 @@
     <secondary>boot, configuring</secondary>
-  <para>This is a place holder for yaboot</para>
+  <para os="a">Some of the idiosyncracies of booting on ppc are discussed in
+   <xref linkend="appendixe" role="."/>. Essentially, there are two options
+   here - either copy the bootloader to an  OSX root partition and boot from
+   Open Firmware, or use an install, Live, or rescue CD to set up a bootstrap
+   partition.</para>
+  <sect2 role=".">
+    <title>Copying the bootloader to OSX and booting from OF.</title>
+    <para os="b">You must now ensure that <filename>/tools/etc/yaboot.conf</filename>
+    contains the correct details for the CLFS system.  Consult
+    <xref linkend="ch-bootable-yaboot" role="."/> for details, but note that
+    at this point you do not need the <literal>install, magicboot, enablecdboot
+    </literal>or <literal>macosx</literal> parameters because these are not
+    available when you boot from Open Firmware.</para>
+    <para os="c">By this stage, you should have the temporary system on an ext2
+    filesystem on your Mac.  Now, from within OSX, copy
+    <filename>/tools/lib/yaboot/yaboot</filename>) and
+    <filename>/tools/etc/yaboot.conf</filename>) to the OSX <filename>/</filename>
+    directory.</para>
+   <para os="d">Each time you want to boot into the temporary system, hold down
+   the option-command-o-f keys to get to Open Firmware, then use the following
+   command, replacing <literal>X</literal> with the number of the partition
+   containing the <emphasis>OSX</emphasis> root filesystem (typically, this
+   will be '3').</para>
+<screen os="e" role="nodump"><userinput>boot hd:X,yaboot</userinput></screen>
+  </sect2>
+  <sect2 role=".">
+    <title>Using a CD to set up the bootstrap partition.</title>
+    <para os="f">This is particularly appropriate if you cannot write to an
+    ext2 filesystem from OSX. Boot from the CD, and (as necessary) create
+    partitions and filesystems, mount the CLFS partition at
+    <filename>/tools</filename>  and untar the temporary system there.</para>
+    <para os="g">Now set up <filename>/tools/etc/yaboot.conf</filename> - see
+    <xref linkend="ch-bootable-yaboot" role="."/> for details of what should be
+    in it, but note that the <emphasis>install</emphasis> and <emphasis>magicboot
+    </emphasis>specifications should point to<filename>/tools/lib/yaboot/</filename>
+    and <emphasis>not</emphasis> <filename>/usr/lib/yaboot</filename>.</para>
+    <para os="h">To write the bootloader to the disk, with <filename>/tools/sbin
+   </filename>first on your path and <filename>/proc</filename> mounted, run the
+   following command:</para>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../../bootable/ppc/yaboot.xml"
+    xpointer="xpointer(//*[@os='r'])"/>
+<screen os="j" role="nodump"><userinput>ybin -v -C /tools/etc/yaboot.conf</userinput></screen>
+  </sect2>

Modified: trunk/BOOK/bootable/ppc/yaboot.xml
--- trunk/BOOK/bootable/ppc/yaboot.xml	2006-06-10 00:03:51 UTC (rev 1755)
+++ trunk/BOOK/bootable/ppc/yaboot.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -30,10 +30,12 @@
   to a bootstrap partition and blessing it so that Open Firmware will boot from
   it.  This is all handled by <command>ybin</command> the yaboot installer.</para>
-  <para os="d">Ybin assembles all the information it needs by reading yaboot.conf,
-  then writes the bootstrap. When booted, the bootstrap provides an initial menu to
-  choose between linux, boot from CD, and e.g. osx (depending on what was in yaboot.conf).
-  If you boot to 'linux', yaboot kicks in and lets you select which kernel to use.</para>
+  <para os="d">Ybin writes an optional 'OS selector' menu into Open Firmware,
+  then writes yaboot and yaboot.conf to the bootstrap partition, blesses this,
+  and updates the boot device recorded in nvram. When booted, the OF provides
+  the initial menu to choose between linux, boot from CD, and e.g. OSX
+  (depending on what was in yaboot.conf). If you boot to 'linux', yaboot is
+  executed and lets you select which kernel to use.</para>
   <para os="e">Images (kernels) are specified, together with any necessary path,
   in yaboot.conf - the details are incorporated into the bootloader, but no attempt
@@ -44,12 +46,6 @@
   full OF path to the device, obtained by running <command>ofpath /dev/hdX</command>
-  <para os="f">Note that the man page mentions which filesystems yaboot can
-  navigate to find the images - the only linux filesystem type mentioned is ext2.
-  You can use ext3 because that can be read like ext2, but if you wish to use
-  reiserfs or any other filesystem you may need to create a separate boot partition
-  formatted as ext2.</para>
   <para os="h">Using the above information, determine the appropriate designators
   for the bootstrap partition and the root partition.  For the following example,
   it is assumed that the bootstrap partition is <filename class="partition">hda2
@@ -135,8 +131,9 @@
   <warning os="r">
-    <para>The following command will overwrite the current boot loader.
-    Do not run the command if this is not desired.</para>
+    <para>The following command will update the bootstrap partition and the
+    boot variable in Open Firmware. Do not run the command if this is not
+    desired.</para>
 <screen os="s" role="nodump"><userinput>ybin</userinput></screen>

Modified: trunk/BOOK/introduction/ppc/changelog.xml
--- trunk/BOOK/introduction/ppc/changelog.xml	2006-06-10 00:03:51 UTC (rev 1755)
+++ trunk/BOOK/introduction/ppc/changelog.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -34,6 +34,20 @@
+      <para>June 9, 2006</para>
+      <itemizedlist>
+        <listitem>
+          <para>[ken] - Some tidying of the additions to 'boot', corrections
+	  to partitioning, tidying and correcting the final instructions for
+	  making it bootable, and add instructions to boot the temporary system,
+	  either from OF via OSX, or using a CD to install the bootstrap. The
+	  instructions to boot from OF use an idea from Martin Schaffner's
+          lfs-from-osx hint.</para>
+        </listitem>
+      </itemizedlist>
+    </listitem>
+    <listitem>
       <para>June 8, 2006</para>

Added: trunk/BOOK/partitioning/ppc/creatingpartition.xml
--- trunk/BOOK/partitioning/ppc/creatingpartition.xml	                        (rev 0)
+++ trunk/BOOK/partitioning/ppc/creatingpartition.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+<sect1 id="ch-partitioning-creatingpartition">
+  <?dbhtml filename="creatingpartition.html"?>
+  <title>Creating a New Partition</title>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/creatingpartition.xml"
+    xpointer="xpointer(//*[@os='a'])"/>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/creatingpartition.xml"
+    xpointer="xpointer(//*[@os='b'])"/>
+    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
+    href="../common/creatingpartition.xml"
+    xpointer="xpointer(//*[@os='c'])"/>
+  <para os="c1">Open Firmware and the Mac OS's impose certain requirements on
+  partitioning.  This is discussed in <xref linkend="appendixe" role="."/>.
+  In particular, you cannot use <command>fdisk</command>, you will need an
+  <literal>apple_bootstrap</literal> partition, and that should precede any
+  OSX partition.</para>
+  <para os="d">Start a disk partitioning program such as <command>parted</command>
+  with a command line option naming the hard
+  disk on which the new partition will be created—for example
+  <filename class="devicefile">/dev/hda</filename> for the primary
+  Integrated Drive Electronics (IDE) disk. Create at least an apple bootstrap
+  partition, a Linux native partition, and a swap partition, if needed. Please
+  refer to <filename>parted(8)</filename> if you do not yet know how to use the
+  programs.</para>
+  <para os="e">Remember the designation of the new partition (e.g.,
+  <filename class="devicefile">hda5</filename>). This book will refer to
+  this as the CLFS partition. Also remember the designation of the swap
+  partition. These names will be needed later for the
+  <filename>/etc/fstab</filename> file. You will also need to know the
+  designation of the apple_bootstrap partition for the <filename>yaboot.conf
+  </filename> when you set this up before you run <command>ybin</command>.</para>

Modified: trunk/BOOK/partitioning/ppc-chapter.xml
--- trunk/BOOK/partitioning/ppc-chapter.xml	2006-06-10 00:03:51 UTC (rev 1755)
+++ trunk/BOOK/partitioning/ppc-chapter.xml	2006-06-10 00:04:23 UTC (rev 1756)
@@ -12,7 +12,7 @@
   <title>Preparing a New Partition</title>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/introduction.xml"/>
-  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/creatingpartition.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ppc/creatingpartition.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/creatingfilesystem.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/mounting.xml"/>

More information about the cross-lfs mailing list