How to install PLD on NewWorld Mac.


  As for now the easiest way to do it is get PPCRCD, you can find recent version at http://ppcrcd.pld-linux.org/. When you will have ppcrcd.iso you must burn it on CD using image burning. You can do it using "Disk Manager" on MacOS X, or simply using 'cdrecord' on any computer with unix-based operating system.


  When starting computer type and hold 'c' key to start from CDROM, type your PPCRCD options and wait until it boots.


  I will try to install it on /dev/hda device, so lets check is it in my /dev:
[root@ppcrcd ~]$ ls /dev/hd*
/dev/hda

partitioning


  Ok, now we have to partition this disk, I prefer ' mac-fdisk ' to do it.


  So, let's start:
[root@ppcrcd ~]$ mac-fdisk /dev/hda
/dev/hda
Command (? for help): ?
Notes:
  Base and length fields are blocks, which are 512 bytes long.
  The name of a partition is descriptive text.

Commands are:
  h    help
  p    print the partition table
  P    (print ordered by base address)
  i    initialize partition map
  s    change size of partition map
  b    create new 800K bootstrap partition
  c    create new Linux partition
  C    (create with type also specified)
  d    delete a partition
  r    reorder partition entry in map
  w    write the partition table
  q    quit editing (don't save changes)


  First check is there any partition, and if not create new partition table:
Command (? for help): p
No partition map exists
Command (? for help): i
size of 'device' is 253696 blocks: -ENTER-
new size of 'device' is 253696 blocks


  As mac-fdisk can't guess many things; after each command you should check actual table, so 'p' once again.
Command (? for help): p
/dev/hda
        #                type name   length   base    ( size )  system
/dev/hda1 Apple_partition_map Apple      63 @ 1       ( 31.5k)  Partition map
/dev/hda2          Apple_Free Extra  253632 @ 64      (123.8M)  Free space

Block size=512, Number of Blocks=253696
DeviceType=0x0, DeviceId=0x0
The numbers interesting us are 'legth' and 'base' of free space, "253632 @ 64" on my disk.


  Now create special bootstrap partition so you will be able to boot your PLD.
Command (? for help): b
First block: -ENTER-
First block: 64
Command (? for help): p
/dev/hda
        #                type name    length   base ( size ) system
/dev/hda1 Apple_partition_map Apple       63 @ 1    ( 31.5k) Partition map
/dev/hda2     Apple_Bootstrap bootstrap 1600 @ 64   (800.0k) NewWorld bootblock
/dev/hda3          Apple_Free Extra   252032 @ 1664 (123.1M) Free space
As you can see pressing ENTER doesn't work, you have to type it manually. Use 'base' of free space as first free block.


  Now some swap:
Command (? for help): c
First block: 1664
Length (in blocks, kB (k), MB (M) or GB (G)): 8M
Name of partition: swap
Command (? for help): p
/dev/hda
        #                type name    length   base ( size ) system
/dev/hda1 Apple_partition_map Apple       63 @ 1    ( 31.5k) Partition map
/dev/hda2     Apple_Bootstrap bootstrap 1600 @ 64   (800.0k) NewWorld bootblock
/dev/hda3     Apple_UNIX_SVR2 swap     16384 @ 1664 (  8.0M) Linux swap
/dev/hda4          Apple_Free Extra   235648 @ 18048 (115.1M) Free space


  And two identical linux partitions, for mdadm example:
Command (? for help): c
First block: 18048
Length (in blocks, kB (k), MB (M) or GB (G)): 117824
Name of partition: root1
Command (? for help): p
/dev/hda
        #                type name    length   base ( size ) system
/dev/hda1 Apple_partition_map Apple       63 @ 1    ( 31.5k) Partition map
/dev/hda2     Apple_Bootstrap bootstrap 1600 @ 64   (800.0k) NewWorld bootblock
/dev/hda3     Apple_UNIX_SVR2 swap     16384 @ 1664 (  8.0M) Linux swap
/dev/hda4     Apple_UNIX_SVR2 root1   117824 @ 18048 ( 57.5M) Linux native
/dev/hda5          Apple_Free Extra   117824 @ 135872 ( 57.5M) Free space

Block size=512, Number of Blocks=253696
DeviceType=0x0, DeviceId=0x0

Command (? for help): c
First block: 135872
Length (in blocks, kB (k), MB (M) or GB (G)): 117824
Name of partition: root2
Command (? for help): p
/dev/hda
        #                type name    length   base ( size ) system
/dev/hda1 Apple_partition_map Apple       63 @ 1    ( 31.5k) Partition map
/dev/hda2     Apple_Bootstrap bootstrap 1600 @ 64   (800.0k) NewWorld bootblock
/dev/hda3     Apple_UNIX_SVR2 swap     16384 @ 1664 (  8.0M) Linux swap
/dev/hda4     Apple_UNIX_SVR2 root1   117824 @ 18048 ( 57.5M) Linux native
/dev/hda5     Apple_UNIX_SVR2 root2   117824 @ 135872 ( 57.5M) Linux native

Block size=512, Number of Blocks=253696
DeviceType=0x0, DeviceId=0x0


  Done, now write and quit.
Command (? for help): w
IMPORTANT: You are about to write a changed partition map to disk.
For any partition you changed the start or size of, writing out
the map causes all data on that partition to be LOST FOREVER.
Make sure you have a backup of any data on such partitions you
want to keep before answering 'yes' to the question below!

Write partition map? [n/y]: y
The partition map has been saved successfully!

Syncing disks.

Partition map written to disk. If any partitions on this disk
were still in use by the system (see messages above), you will need
to reboot in order to utilize the new partition map.

Command (? for help): q


  Now check does kernel recognize new partition table, look at dmesg or to /dev directory.
[root@ppcrcd ~]$ dmesg | tail -n 1
 hda: [mac] hda1 hda2 hda3 hda4 hda5
[root@ppcrcd ~]$ ls /dev/hda*
/dev/hda  /dev/hda1  /dev/hda2  /dev/hda3  /dev/hda4  /dev/hda5


  If you are mortal debian enemy, or mac-fdisk isn't working for you; you can use pdisk or parted for partitioning your disk. pdisk does not differ much from mac-fdisk but can guess even less things, and has no 'b' option. Using parted you can resize partitions and do other cool things but it is dangerous and has some problems with mac disk partition table.

mdadm


  mdadm doesn't differ from this on PC's, but you need to know one thing. PPCRCD is using udev, so even after loading modules there won't be /dev/md* devices in /dev directory; mdadm needs these nods to exist so you will have or create them or use --auto option in mdadm and it will create them.


  Just check example:
[root@ppcrcd ~]$ modprobe md
[root@ppcrcd ~]$ modprobe raid0
[root@ppcrcd ~]$ ls /dev/md*
ls: /dev/md*: No such file or directory
[root@ppcrcd ~]$ mdadm --create /dev/md0 -l0 -n2 /dev/hda4 /dev/hda5
mdadm: error opening /dev/md0: No such file or directory
[root@ppcrcd ~]$ mdadm --create /dev/md0 -l0 -n2 /dev/hda4 /dev/hda5 --auto
mdadm: array /dev/md0 started.
[root@ppcrcd ~]$ ls -l /dev/md*
brw-rw----  1 root disk 9, 0 Apr 24 11:11 /dev/md0
As you can see after creating device it was handled by udev (it has 'disk' group, and mdadm uses 'root' as group). You can check it in syslog too:
[root@ppcrcd ~]$ grep udev /var/log/syslog | tail -n 1
Apr 24 11:11:02 ppcrcd udev[4118]: creating device node '/dev/md0'
So you don't have to worry about anything, just remember to add --auto, or --auto=yes to mdadm.


  And remember to create /boot partition when you use raid different than 0.

before installing


  Now you have to set up networking unless you have some media with rpms for ppc, if you have rpms on CD you should start PPCRCD loaded to memory so you will be able to use your cd-rom.


  Else, set up network, if it hasn't started automatically. The easiest way to do it is to use 'pldconf', I'm connected to internet throught router with IP 192.168.0.2, and it is my local dns server too. I'm doing:
Network -> Default gateway -> 192.168.0.2 -> [ Ok ]
        -> DNS setup       -> 192.168.0.2 -> [ Ok ]
        -> Ethernet cards  ->
                        IP address: 192.168.0.5
                        Module: sungem
                        Mask: 24
                        [ ] get from DHCP
                                          -> [ Ok ]
And I have network.


  If you have standard network card and you use dhcp probably it was recognized on startup.


  Try 'dig' to check is everything ok.


  And if you have other network connection you should be able to configure it in PPCRCD, but there's to much to describe, to fit everything in this howto.

installing


  For installing I will use this partition table:
/dev/hda1 Apple_partition_map Apple       63 @ 1    ( 31.5k) Partition map
/dev/hda2     Apple_Bootstrap bootstrap 1600 @ 64   (800.0k) NewWorld bootblock
/dev/hda3     Apple_UNIX_SVR2 swap     16384 @ 1664 (  8.0M) Linux swap
/dev/hda4     Apple_UNIX_SVR2 root    235648 @ 18048 (115.1M) Linux native


  So let's start to install.


  First format your root partition; it can be ext2/3, riserfs, xfs, jfs. Note: reiser4 isn't working well.
[root@ppcrcd ~]$ mkfs.reiserfs /dev/hda4
[...]
ReiserFS is successfully created on /dev/hda4.


  Prepare your new root. Perhaps you will have to specify filesystem type when mounting. Then check is all correct.
[root@ppcrcd ~]$ mkdir /dest
[root@ppcrcd ~]$ mount /dev/hda4 /dest/
[root@ppcrcd ~]$ df | grep hda4
/dev/hda4               117816     32840     84976  28% /dest
[root@ppcrcd ~]$ ls /dest/
[root@ppcrcd ~]$ touch /dest/ble
[root@ppcrcd ~]$ ls -l /dest/
ble
Mount other partitions if you are using separate partition for /usr or /boot.


  Prepare your swap partition too:
[root@ppcrcd ~]$ mkswap /dev/hda3
Setting up swapspace version 1, size = 8384 kB
no label, UUID=d4f4aaa1-dbe0-4b4a-8c78-ba29717a66b1
You should activate it if you don't have much memory. May be useful for installation.
[root@ppcrcd ~]$ swapon /dev/hda3
[root@ppcrcd ~]$ free | grep Swap
Swap:         8184          0       8184


  Now edit /etc/poldek.conf file. If you are installing from network you may be interested in changing source to some mirror. If you are instaling from other source change change it's location to correct. Write changes.


  Start poldek with /dest as root:
[root@ppcrcd ~]$ poldek -r /dest
Retrieving ftp://ftp.ppc.ac.pld-linux.org/dists/ac/PLD/ppc/PLD/RPMS/packages.dir.mdd...
[...]
Loading ftp://ftp.ppc.ac.pld-linux.org/dists/ac/ready/ppc/packages.dir.gz...
13145 packages read
Removed 18 duplicate packages from available set
Loading db packages [/dest/var/lib/rpm]...done
0 packages loaded

Welcome to the poldek shell mode. Type "help" for help with commands.


  Install base system packages: FHS, system and udev if you plan to use last it.
poldek> install FHS system
[...]
Retrieving ftp://ftp.ppc.ac.pld-linux.org/dists/ac/PLD/ppc/PLD/RPMS/setup-2.4.9-1.ppc.rpm...
......................... 100.0% [192.3K (36.2K/s)]
Executing rpm --upgrade -vh --root /dest --noorder...
Preparing...                ########################################### [100%]
   1:setup                  ########################################### [ 50%]
   2:FHS                    ########################################### [100%]
poldek> quit


  Now mount/bind needed system partitions:
[root@ppcrcd ~]$ mount -o bind /proc /dest/proc
[root@ppcrcd ~]$ mount -o bind /sys /dest/sys


  And dev if you are using udev:
[root@ppcrcd ~]$ mount -o bind /dev /dest/dev


  Install most necessary packages, those are kernel and yaboot. There will be lots of dependencies.
poldek> install kernel yaboot
[...]
Need to download about 31MB of archives. After unpacking about 62MB will be used.
Retrieving ftp://ftp.ppc.ac.pld-linux.org/dists/ac/ready/ppc/kernel-2.6.11.6-4.ppc.rpm...
[...]
Executing rpm --upgrade -vh --root /dest --noorder...
Preparing...                ########################################### [100%]
[...]
  50:geninitrd              ########################################### [ 98%]
  51:kernel                 ########################################### [100%]
ERROR: no argument passed to find_modules_for() - is your /etc/fstab correct?
mv: cannot stat `/boot/initrd': No such file or directory
[...]
Installing set #2
Processing dependencies...
yaboot-1.3.13-2 marks bash-2.05b-17 (cap /bin/bash)
  bash-2.05b-17 marks readline-4.3-11 (cap libhistory.so.4)
yaboot-1.3.13-2 marks hfsutils-3.2.6-3 (cap hfsutils >= 3.2.0)
yaboot-1.3.13-2 marks pmac-utils-2.1-6 (cap pmac-utils)
There are 5 packages to install (4 marked by dependencies):
I yaboot-1.3.13-2
D bash-2.05b-17, hfsutils-3.2.6-3, pmac-utils-2.1-6, readline-4.3-11
Need to download about 1MB of archives. After unpacking about 2MB will be used.
Retrieving ftp://ftp.ppc.ac.pld-linux.org/dists/ac/PLD/ppc/PLD/RPMS/yaboot-1.3.13-2.ppc.rpm...
......................... 100.0% [145.6K (41.5K/s)]
[...]
Retrieving ftp://ftp.ppc.ac.pld-linux.org/dists/ac/PLD/ppc/PLD/RPMS/readline-4.3-11.ppc.rpm...
......................... 100.0% [163.8K (37.6K/s)]
Executing rpm --upgrade -vh --root /dest --noorder...
Preparing...                ########################################### [100%]
   1:readline               ########################################### [ 20%]
[...]
   5:yaboot                 ########################################### [100%]
poldek> quit


  It is normal you will get errors about /etc/fstab when installing kernel.


  Edit /dest/etc/fstab and add your partitions:
[root@ppcrcd ~]$ vim /dest/etc/fstab
/dev/hda3     swap                swap        defaults                0 0
/dev/hda4     /               reiserfs        defaults                1 1


  Now chroot to your system. And mount /dev/pts.
[root@ppcrcd ~]$ chroot /dest/ /bin/bash
[root@ppcrcd ~]$ mount /dev/pts/


  (in chroot) Generate initrd using geninitrd.
[root@ppcrcd ~]$ ls -l /boot/
total 9821
lrwxrwxrwx  1 root root      21 Apr 24 13:56 System.map -> System.map-2.6.11.6-4
-rw-r--r--  1 root root  886430 Apr  1 11:17 System.map-2.6.11.6-4
lrwxrwxrwx  1 root root      20 Apr 24 13:57 initrd -> initrd-2.6.11.6-4.gz
-rw-r--r--  1 root root 4577469 Apr  1 11:17 vmlinux-2.6.11.6-4
lrwxrwxrwx  1 root root      18 Apr 24 13:56 vmlinuz -> vmlinuz-2.6.11.6-4
-rw-r--r--  1 root root 4577469 Apr  1 11:17 vmlinuz-2.6.11.6-4
[root@ppcrcd ~]$ geninitrd /boot/initrd-2.6.11.6-4.gz 2.6.11.6-4
WARNING: rootfs on IDE device but no related modules found, loading ide-generic.
[root@ppcrcd ~]$ ls /boot/initrd*
/boot/initrd  /boot/initrd-2.6.11.6-4.gz


  Configure yaboot, do it out of chroot as you have editors installed there. Edit /dest/etc/yaboot.conf.


  Important parts:
boot=/dev/hda2
device=hd:
partition=4
install=/lib/yaboot/yaboot
magicboot=/lib/yaboot/ofboot

image=/boot/vmlinuz
        label=PLD
        root=/dev/hda4
	initrd=/boot/initrd
        read-only


  (in chroot) You have to start mkofboot and ybin now. Before doing it check is there $TMP dir. If no, create it or change $TMP variable to point to correct location. Without it ybin will fail.
[root@ppcrcd ~]$ ls $TMP
ls: /root/tmp: No such file or directory
[root@ppcrcd ~]$ mkdir -p $TMP
[root@ppcrcd ~]$ mkofboot

mkofboot: Create hfs filesystem on /dev/hdb2? [y/N] y
[root@ppcrcd ~]$ ybin


  If there were no errors everything should work. You can exit from chroot.
[root@ppcrcd ~]$ exit
exit


  You should install more important packages, like man, poldek, rpm, packages needed for your internet connection (eg. eagle-usb), some syslogger, pldconf, good editor (vim), your favorite shell and utilities for your filesystem.
poldek> install poldek vim syslog-ng reiserfsprogs
Everything else try to install in your new system, after rebooting.

reboot and viola