MkLinux: Using xhfs to install the Mach Kernel mklogo
Think Differently. Think MkLinux
Home | About | News | FAQ-O-Matic | Getting Started | Using MkLinux | Advanced Admin

Previous Next

Using xhfs to replace your Mach Kernel

Installing a new version of the Mach Kernel is a common reason for needing to write to a Macintosh HFS volume from within MkLinux. In this tutorial we will show you how this can be done safely and simply.

The Linux kernel contains support for the Macintosh type Hierarchical File System, HFS. While this support is generally safe enough for accessing a Macintosh volume in read only mode, it can do serious damage to your Mac partitions if you attempt to write to them. For this reason, we generally recommend that you use the linux HFS support in read only mode.

If you need to write a file to a Mac HFS volume from within Linux, then we suggest that you use the programs supplied by the hfsutils package. The HFS Utilities are not part of the Linux kernel, but are a script-able set of programs which can be used to access and modify HFS (but not HFS+) partitions.

The HFS utilities have both a command line interface, and a graphical user interface. The graphical interface is known as xhfs. You may, at first, feel more comfortable using xhfs to access your Macintosh partitions.

Start xhfs

You will need to be the root user to mount your Macintosh partitions. Either log in as root, su to root or use sudo. Start xhfs from the command line by typing "xhfs <return>" at the prompt. The xhfs interface will open on your screen showing your current directory on the right hand side.

xhfs window

Open the HFS partition

Click on the "Open..." button below the left hand file browser. A small window will pop up asking for the path to the HFS device. This will be a path such as "/dev/sda3" which signifies the third partition of the first SCSI device. (See the explanation on drive naming.)

Now click the "Open" button in the dialog box.

open dialog

Rename your current Mach Kernel

The contents of the top level directory of this partition will be displayed in the left hand file browser. Since our example involves upgrading your Mach Kernel, you need to change into the Extensions folder.

The file browser works much like the standard Macintosh file dialog. Scroll down the left hand window until you find the "System Folder:" and double click on this entry to enter the System Folder. Look for the "Extensions:" entry and double click on it.

Now that you are in the appropriate directory, look for your current copy of the "Mach Kernel". Since you will want to keep the current working version for a backup, you will want to rename it.

Select the file name "Mach Kernel" and the click the "Rename..." button in the middle of the window. A small dialog box will appear. Enter the new name for the file "Mach Kernel" and click the "Rename" button in the dialog box.

rename dialog

Copy over the new Mach Kernel

Now locate and select the file "Mach_Kernel" in the right hand file browser. Select this file by clicking on it once.

Double check that the radio button for "Raw Data" Mode is selected. This isn't a Macintosh file. You want it to be treated as a raw stream of data.

Now click the "<< Copy <<" button in the center of the window. This will copy the file "Mach_Kernel" from your Linux directory into the HFS directory in the left hand browser. The underscore in the name will be automatically converted into a space.

copy file

You're done!

At this point, you have a new version of the Mach Kernel stored safely in the Extensions folder of your Macintosh. You also have the previous working version saved there under a different name in the event that something goes wrong.

Choose "Quit" from the "File" menu to exit xhfs, or perform whatever additional file transfers that you need.