Creating a bootable USB drive for the Apple PowerPCs is complicated due to the fact that they use Apple's HFS (Hierarchical File System) as its native file system. But with the help of some special tools available on PowerPC Linux, construction of bootable drives is possible. Here is how it's done.
I have a PowerBook G4 running Xubuntu 10.04 and I will be using a 1 GB USB drive. This means that while the information is accurate for this hardware but you may have to adapt it to your circumstances.
I used the UNIX convention of the user prompt as
I have expanded many of the directories in the commands. This is to make clear what they're are. A isolated period for the current directory is hard to spot, so I wrote it as the longer version. You may, of course, use the shortest version to save typing.
The first step is to create a place to work. Open a terminal and create a directory to work in.
$ mkdir ~/liveusb $ cd ~/liveusb
We going to need two mount points. In Linux, a mount point is simply a directory, so:
$ mkdir ./iso $ mkdir ./usb
Open your browser and download the ISO image of Linux you want to use. My browser puts it in the Downloads directory. Move the ISO image to your working directory.
$ mv ~/Downloads/xubuntu-10.04-desktop-powerpc.iso ~/liveusb
To create the drive, it is necessary to work as
$ sudo -s [sudo] password for userid: #
When you plug a USB device into the computer, the Linux OS assigns it a serial device number and creates an entry for it in the
To determine which file is the USB drive, before you plug it in do:
# ls /dev/sd?
This gives you a list of all the existing serial drives. Now plug it in and repeat the above command. The new one is the one for the USB drive. Write it down; you'll need it later.
Note: For the following examples, I'll be using
If any window opened when you plugged in the drive, close them all. Also, if any partition was mounted, unmount it. You can tell if any are mounted with this command:
# mount | column -t /dev/hda3 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) none on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) none on /dev type devtmpfs (rw,mode=0755) none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) none on /dev/shm type tmpfs (rw,nosuid,nodev) none on /var/run type tmpfs (rw,nosuid,mode=0755) none on /var/lock type tmpfs (rw,noexec,nosuid,nodev) none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755) /dev/hda6 on /home type ext4 (rw) /dev/hda5 on /usr type ext4 (rw) /dev/sda2 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)
As you can see, the partition
# umount /dev/sda?
If it doesn't complain, it worked.
Warning: This step will destroy any data on the USB drive.
The drive must be partitioned in HFS. The utility
# mac-fdisk /dev/sda /dev/sda Command (? for help):
The first step is to initialize a new map. Use the
Command (? for help): i map already exists do you want to reinit? [n/y]: y size of 'device' is 2015232 blocks: new size of 'device' is 2015232 blocks Command (? for help):
If a map already exists, which is likely, answer
Now, take a look at the map; use the
Command (? for help): p /dev/sda # type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Free Extra 2015168 @ 64 (984.0M) Free space Block size=512, Number of Blocks=2015232 DeviceType=0x0, DeviceId=0x0 Command (? for help):
Now create the bootstrap partition with the
Command (? for help): b First block: 64 Command (? for help): p /dev/sda # type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Bootstrap bootstrap 1600 @ 64 (800.0k) NewWorld bootblock /dev/sda3 Apple_Free Extra 2013568 @ 1664 (983.2M) Free space Block size=512, Number of Blocks=2015232 DeviceType=0x0, DeviceId=0x0 Command (? for help):
The remainder of the drive will be used to hold the files from the ISO image. We will create a Linux partition for that. Use to
Command (? for help): c First block: 1664 Length (in blocks, kB (k), MB (M) or GB (G)): 2013568 Name of partition: xubuntu Command (? for help): p /dev/sda # type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Bootstrap bootstrap 1600 @ 64 (800.0k) NewWorld bootblock /dev/sda3 Apple_UNIX_SVR2 xubuntu 2013568 @ 1664 (983.2M) Linux native Block size=512, Number of Blocks=2015232 DeviceType=0x0, DeviceId=0x0 Command (? for help):
Now write the map to the drive with the
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):
Finally, quit with
Command (? for help): q #
Note: Your system might automatically mount the partitions. If it does, unmount them.
# umount /dev/sda?
You can list the partition on the device at anytime with the
# mac-fdisk -l /dev/sda /dev/sda # type name length base ( size ) system /dev/sda1 Apple_partition_map Apple 63 @ 1 ( 31.5k) Partition map /dev/sda2 Apple_Bootstrap bootstrap 1600 @ 64 (800.0k) NewWorld bootblock /dev/sda3 Apple_UNIX_SVR2 xubuntu 2013568 @ 1664 (983.2M) Linux native Block size=512, Number of Blocks=2015232 DeviceType=0x0, DeviceId=0x0
A file system has to be created on the partition. I choose to make it
# mkfs -v -t ext2 -L 'xubuntu-10.04' /dev/sda3
Note: This could take a long, long time, like 20-30 minutes. Also, the computer is doing a lot of I/O, so it may not be very responsive to anything you do, like move the mouse. My advice: go for coffee.
Mount the USB drive.
# mount /dev/sda3 ./usb
Mount the ISO file as a file system.
# mount -t iso9660 -o ro,loop=/dev/loop0 ./xubuntu-10.04-desktop-powerpc.iso ./iso
Now, load the ISO files to the device.
# (cd ./iso ; tar cBpf - .) | (cd ./usb ; tar xvBpf -)
This command is complicated but can be broken down. This parenthesis groups the commands. The pipe, '|' tells it to pipe the stdout of the first group to the stdin of the second.
The first command of the first group changes the directory to the ISO image. It then runs the Tape ARchiver (
The first command of the second group changes the directory to
The computer may be ready for more commands before all the bytes are written. This is because the low-level writes are buffered. It may be a while until it responds to your next command.
Now, get a copy of the bootloader,
# cp ./iso/install/yaboot ./iso/install/yaboot.conf ~/liveusb # chmod +w yaboot.conf # umount ./iso # umount ./usb
The bootstrap partition must be formatted before it can be used. Use the
# hformat -l LiveUSB /dev/sda2
The bootloader for Linux devices on the PowerPC is
# hmount /dev/sda2 # hcopy -r yaboot : # hattrib -c UNIX -t tbxi :yaboot # hattrib -b : # humount
root=/dev/ram partition=3 message=/install/boot.msg default=live
Save the changes and exit the editor.
Now, load the
# mount /dev/sda2 ./usb # cp ./yaboot.conf ./usb # umount ./usb
First, mount the partition.
# mount /dev/sda3 ./usb
Create a local copy and change it.
# cp ./usb/install/boot.msg ~/liveusb # chmod +w ./boot.msg
Open it in your favourite text editor and change it to what you like. Save it and exit the editor. Now, load it on the device.
# cp ./boot.msg ./usb/install # umount ./usb
The USB drive is now ready for use. The last thing to do is exit the
# exit $
You will need two things to create a LiveUSB drive from a Linux/Intel machine.
The first is
The other item you will need is
Shawn H Corey
(Insert your name here if you modified this documentation. Do not remove this comment.)
Thanks to Skeeve42 at Ubuntu forums for his pointers.
Thanks to OSXbook.com for their insights on Open Firmware works.
Thanks to homey at LinuxQuestions.org for the mount ISO command.
Thanks to Sergio Hernandez for pointing out the
Copyright 2010 by Shawn H Corey. All rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being Original Author, Copyright & Licences, and Document Licence.