<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/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/2001/XInclude"
  href="../ppc/yaboot.xml"
  xpointer="xpointer(//*[@role='package'])"/>

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

    <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.  To prevent the build from
    failing due to compiler warnings, the -Werror flag is removed.  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/-Werror//" \
    -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/-Werror//"</parameter></term>
        <listitem>
          <para>This deletes the -Werror flag from the Makefile.</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>

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

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

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

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

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

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

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

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

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

    <important os="j0">
      <para>The multilib install of yaboot can fail if you miss any of the
      patches or seds, or omit the CFLAGS variable. <command>ld</command> will
      issue warnings, but the install will appear to complete successfully.
      That would result in an unbootable system, so you need to log the output
      to check it.</para>
    </important>

<screen os='f'><userinput>make PREFIX=/usr install 2&gt;&amp;1 | tee instlog</userinput></screen>

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

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

    <para os='i'>If the command gave you <emphasis>any</emphasis> output
    (... is incompatible with powerpc:common output) the build of yaboot is
    broken and you will have to correct your error(s) and repeat it.</para>

  </sect2>

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

</sect1>
