<?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-system-yaboot" role="wrap">
  <?dbhtml filename="yaboot.html"?>

  <title>Yaboot-&yaboot-version;</title>

  <indexterm zone="ch-system-yaboot">
    <primary sortas="a-Yaboot">Yaboot</primary>
  </indexterm>

  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
  href="../ppc/yaboot.xml"
  xpointer="xpointer(//*[@role='package'])"/>

  <sect2 role="installation">
    <title>Installation of Yaboot</title>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='a'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='b'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='c'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='d'])"/>

    <para>Existing multilib distributions alter gcc to default to 32-bit
    output.  Because our gcc defaults to 64-bit, we need to pass appropriate
    options to both the compiler and the linker.  The Makefile already
    overrides any CC and ignores LDFLAGS in favour of its own variables, so we
    need to use the following seds for a successful compile and install.</para>

<screen><userinput>sed -i -e "s/\(-print-libgcc-file-name\)/${BUILD32} \1/" \
    -e "s/\(-Bstatic\)/-melf32ppclinux \1/" Makefile
</userinput></screen>

    <variablelist os="j">
      <title>The meaning of the sed parameters:</title>

      <varlistentry>
        <term><parameter>"s/\(-print-libgcc-file-name\)/${BUILD32} \1/"</parameter></term>
        <listitem>
          <para>This picks a convenient place within the Makefile's lgcc
	  variable and inserts the flag to force <command>gcc</command> to
          create 32-bit code when compiling yaboot.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term><parameter>"s/\(-Bstatic\)/-melf32ppclinux \1/"</parameter></term>
        <listitem>
          <para>This picks the end of the LFLAGS which the Makefile passes to
	  the linker to create the second-stage linux loader, and inserts a
	  flag to force <command>ld</command> to use a suitable 32-bit
	  emulation picked from the output of <command>'ld -V'</command>.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <important>
      <para>The above patches and seds are critical in ensuring a
      successful build. In particular, the package will appear to install
      correctly without the second sed, but will fail to load linux,
      requiring you to use OF or a rescue disk to boot.</para>
    </important>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='e'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='f'])"/>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='g'])"/>

<screen os="h"><userinput>CFLAGS="${BUILD32}" make PREFIX=/usr</userinput></screen>

    <important>
      <para>The CFLAGS on the above command are equally critical
      for a successful install.</para>
    </important>

    <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
    href="../ppc/yaboot.xml"
    xpointer="xpointer(//*[@os='i'])"/>

<screen><userinput>make PREFIX=/usr install 2&gt;&amp;1 &gt;instlog</userinput></screen>

    <para os='k'>To ensure that the install was successful, run the following
    command:</para>

<screen os='l'><userinput>grep 'powerpc:common64' instlog</userinput></screen>

    <para os='m'>If the command gave you <emphasis>any</emphasis> output
    (... is incompatible with powerpc:common output) the build is broken and
    you will have to repeat it with <emphasis>all</emphasis> of the items
    marked as important.</para>

  </sect2>

  <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
  href="../ppc/yaboot.xml"
  xpointer="xpointer(id('contents-yaboot'))"/>

</sect1>
