AUTHOR:			Jimmy Anderson  <jimmy.anderson1057@gmail.com>

DATE:			2011-02-12

LICENSE:		GNU Free Documentation License  Version 1.2

SYNOPSIS:		How to build LFS for PowerPC (32bit) 


DESCRIPTION:

Most of the LFS book instructions also work, as is, for building a PowerPC 
system.   But not all of them.   A few deviations from the instructions 
found in the LFS books are needed to build a PowerPC LFS system.

This hint describes how to build LFS versions 5.1.1, 6.3, 6.5, 
6.6 & 6.7 for PowerPC.   

This hint does not describe how to build the PowerPC kernel or boot
loader.   Those are left as an exercise for the reader.   The CLFS
book may be helpful in learning how to build a bootloader and kernel 
for a PowerPC system.  

This hint only describes building PowerPC 32bit architecture.   It  does 
not describe how to build LFS for the PowerPC 64 bit machines.

PREREQUISITES:

A PowerPC machine running the proper tool set is required to build LFS.   
A PowerPC eMAC G4 running Fedora 10 is known to work with the instructions 
in this hint (except for building LFS 5.1.1).   

Familiarity with building LFS for x86 machines.  The reader ought to
have built LFS for x86 at least once prior to attempting a build for
PowerPC.


HINT:

Always follow the instructions in the LFS book exactly as written 
except for the deviations as described in this hint...

The dynamic linker for PowerPC is ld.so.1.   So, in all cases, instead
of using the string 'ld-linux.so.2' as found in the LFS book, use 
'ld.so.1' instead.

Always skip the build step of the grub bootloader package.
It is not needed on PowerPC and typically will not even compile for 
PowerPC.  

LFS provides a 'uname' patch for the coreutils package which is applied 
during the Chapter 6 build of coreutils.   The 'uname' patch does not
work for PowerPC and the build of coreutils will fail if it is applied.
This patch does not appear to be crucial so simply do not apply it during 
building of coreutils.   If the fix provided by the 'uname' patch is 
important to the reader, a processor independent version of it might be 
available somewhere in the CLFS download area.

JHALFS can be used to build LFS for PowerPC but the user must download
the LFS book, apply the needed PowerPC changes to it, and then point JHALFS
at the modified book to use as a 'working copy'.   

LFS 5.1.1 specific instructions:

   (5.1.1 is still interesting cause it is the last of the 2.4 based 
   LFS books) 

   Chap 5 & 6:
 
   1) use ld.so.1 instead of ld-linux.so.2 when patching gcc specs file. 
    
   Chap 5:
    
   2) The gcc pass 2 specs patch is broken on PowerPC.   
      Instead of the patch, you have to go find and fix up the sysv4.h 
      file up by hand.
    
   Chap 6:
    
   3) Skip the coreutils uname patch.
    
   4) Skip grub bootloader build on ppc.

   (Fedora 10 does not work for building LFS 5.1.1.  You'll need to 
    find an older PowerPC distro to build 5.1.1.)

LFS 6.3 specific instructions:

   The attached patch "lfs-6.3bookforppc.patch" can be applied to the 
   LFS 6.3 release book to create a LFS 6.3 book that will build for 
   PowerPC.  (It also contains some other changes not related to PowerPC).

LFS 6.4 does not build for PowerPC due to tool chain issues and it cannot
   be easily made to do so.   

LFS 6.5 and LFS 6.6 build for PowerPC without any deviations from the book.

LFS 6.7:

    When building zlib in Chapter 6, omit '-mstackrealign' from the
    definition of CFLAGS.   It is an unsupported compiler option on
    PowerPC.   

LFS 6.8:

    6.8 is not yet released and so it is too early to say for sure but at 
    this time, it looks like it may build for PowerPC with the only
    needed deviation being as described above for LFS 6.7.
 

LITERATURE	:

NA

ACKNOWLEDGEMENTS:

The excellent work of the LFS development team.

CHANGELOG:

[2011-02-12]

Initial version.