Skip to content
Linux on the PowerMac G5
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
deb_dmesg add debian dmesg output Dec 21, 2016

Linux on a PowerMac G5, ppc64

License: GPL v3 master

VNC session

Fedora 25

Debian 8.6.0

boot setup

This section decribe a working boot setup by using an updated GRUB as default bootloader (no need for yaboot).
- Tools must work for Big Endian machines, writing data accordingly, setups written by Little Endians machines will be swapped.
- This boot setup can be readed also as: "yaboot to grub2 bootloader migration"

Booting an installer directly on TARGET can leave you in an unbootable system:

  • Debian installer will do the job and will fail at configuring yaboot setup
  • Fedora installer will fail at missing required yaboot

We can do a full manual setup, or modify installs, we need:

  • kernelspace and userspace support to edit mac partition, for ppc64
  • a bootable grub image, for ppc64
  • hfs-util, for ppc64

I'm using buildroot to build a minimal kernel + initrd with needed tools to perform this tasks

partition map

OpenFirmare load the default ofprogram from the first HFS partition (Apple_Bootstrap) from a mac partition table.

below I use about 16M on sda2 due default partition is smaller to store grub2 image later.

parted /dev/sda
  GNU Parted 3.2
  Using /dev/sda
  Welcome to GNU Parted! Type 'help' to view a list of commands.
  (parted) p free                                    
  Model: ATA Hitachi HTS54251 (scsi)
  Disk /dev/sda: 160GB
  Sector size (logical/physical): 512B/512B
  Partition Table: mac
  Disk Flags: 
  Number  Start     End    Size  File system  Name   Flags
    1      512B  32.8kB  32.3kB               Apple
         32.8kB  1049kB  1016kB  Free Space
    2    1049kB  16.8MB  15.7MB  hfs                 boot
    3    16.8MB   256MB   239MB  ext4
    4     256MB  16.4GB  16.1GB  ext4         root   root

  sda         149.1G          
  sda1         31.5K          
  sda2 hfs       15M MAC_BOOT 
  sda3 ext4     228M BOOT     26507748-8918-49e0-9d3e-8e8c7b3da04d
  sda4 ext4      15G ROOT     46026799-c14a-4ae0-98fd-d5d70cd21c4c

Same result, from Cockpit's point-of-view


grub.img can be cross-compiled on a 32bit HOST too, checkout

  • Write a first grub.cfg that points to the final grub.cfg, located at (...hd,apple3)\boot\grub2\grub.cfg, using UUID:
    Note: paths here does not contain 'boot' since /boot is a mountpoint (to /dev/sda3 partition) for linux (ROOT on /dev/ sda4) when it's booted (off OpenFirmware).
cat grub.cfg
  search.fs_uuid 26507748-8918-49e0-9d3e-8e8c7b3da04d root
  set prefix=($root)/grub2
  configfile /grub2/grub.cfg
  • Build a GRUB2 image, embedding the configfile
grub2-mkimage -c grub.cfg -o grub -O powerpc-ieee1275 -C xz -p /usr/lib/grub/powerpc-ieee1275/*.mod
file grub
  grub: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped

This way, everytime OpenFirmware loads our GRUB, it will parse the configfile from /boot/grub2/grub.cfg

  • Just for info, you can check OpenFirmware path from linux:
grub2-ofpathname /dev/sda2

mac-blessing with hfsutils

hmount /dev/sda2
  Volume name is "MAC_BOOT"
  Volume was created on Thu Jan  1 03:01:17 1970
  Volume was last modified on Tue Dec 20 19:34:16 2016
  Volume has 12086784 bytes free

hcopy grub :grub

hattrib -t tbxi :grub

hattrib -b :

hdir :
  f  tbxi/UNIX         0   1698620 Dec 20 19:23 grub
  f  tbxi/UNIX         0   1691400 Jan  1  1970 another_grub.img

humount /dev/sda2

boot from OpenFirmware


enter OpenFirmware command prompt, run grub from default HFS (Apple_Bootstrap) partition:
0 > boot hd:,grub


store in nvram your default, OpenFirmware looks at first HFS partition, we have grub2 image there:

  • from OpenFirmware:
0 > printenv ok
will display nvram values, to set:
0 > setenv boot-volume 2 ok
0 > setenv boot-device hd:,grub ok
0 > setenv boot-file grub ok
  • from linux:
nvram --print-config --partitions
will display nvram values plus OpenFirmware known partitions, to set:
nvram --update-config boot-volume 2 -p "common"
nvram --update-config boot-device hd:,grub -p "common"
nvram --update-config boot-file grub -p "common"

Note: man nvram is some chars away...


cat /etc/fedora-release
  Fedora release 25 (Twenty Five)
  • autoload modules
cat /etc/sysconfig/modules/something.modules
  modprobe i2c-powermac
  modprobe rack-meter
  • thermal and scaling are working
find /sys -iname "*temp*"
cat /sys/devices/platform/windfarm.0/cpu-diode-temp-*
cat /proc/cpuinfo
  processor       : 0
  cpu             : PPC970, altivec supported
  clock           : 1304.400000MHz
  revision        : 2.2 (pvr 0039 0202)

  processor       : 1
  cpu             : PPC970, altivec supported
  clock           : 1304.400000MHz
  revision        : 2.2 (pvr 0039 0202)

  timebase        : 33333333
  platform        : PowerMac
  model           : PowerMac7,3
  machine         : PowerMac7,3
  motherboard     : PowerMac7,3 MacRISC4 Power Macintosh 
  detected as     : 336 (PowerMac G5)
  pmac flags      : 00000000
  L2 cache        : 512K unified
  pmac-generation : NewWorld

  Architecture:          ppc64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Big Endian
  CPU(s):                2
  On-line CPU(s) list:   0,1
  Thread(s) per core:    1
  Core(s) per socket:    1
  Socket(s):             2
  NUMA node(s):          1
  Model:                 2.2 (pvr 0039 0202)
  Model name:            PPC970, altivec supported
  CPU max MHz:           2000.0000
  CPU min MHz:           1304.4000
  L1d cache:             32K
  L1i cache:             64K
  L2 cache:              512K
  NUMA node0 CPU(s):     0,1
You can’t perform that action at this time.