Trail: Home > Information Repository >

Volume Labels

The boot volume chooser built into the Intel Mac firmware displays the name of each volume below its icon. This page describes how that volume name label is stored and rendered.

General

Text rendering is quite complex. It is built into every operating system, but when you have to operate in a pre-OS environment, you start cutting corners. Apple is doing exactly that for the boot volume chooser, and in fact has done it for a long time on Open Firmware based PowerPC Macs as well.

The volume label is stored as a pre-rendered image file in a special format. The file with the image has a well-known name and is located in the “blessed folder”, alongside the OS loader. That makes it easy for the boot volume chooser to find and display the label.

File Format

The label is stored in a very simple custom file format. It has a 5 byte header, followed by the uncompressed image data:

OffsetFormatContent
08-bit integer Fixed value: 1
116-bit integer, big endian Width of the image in pixels
316-bit integer, big endian Height of the image in pixels, must be 12
5Array of 8-bit integers Image data, 1 byte per pixel, in standard top-to-bottom, left-to-right order

The image data is interpreted as indices into a standard Macintosh 256 color palette. However, the firmware in Intel Macs only supports the 16 indices that are pure grey. All other values are mapped to white. The 16 grey values, from white to black:

00, f6, f7, 2a, f8, f9, 55, fa, fb, 80, fc, fd, ab, fe, ff, d6

Tools for Labels

Mac OS X automatically creates labels for volumes that have Mac OS X installed. (Note: It is not yet known whether this is done by the Installer, by the “Startup Disk” preference pane, or both.) These labels use only black and white, i.e. they don’t render the text with anti-aliasing. The reason for this is unknown.

The bless command line tool, which is used to set the blessed folder and the OS loader file, has some options to set the label for the affected disk. With the --label option, bless does the text rendering. It tries to use anti-aliasing, but unfortunately doesn’t create readable labels in the process. Apparently it doesn’t use the correct table for translating greyscale values to palette indices.

The --labelfile option to bless lets you provide your own pre-rendered image file. It must be in the format described above. In this case, bless will simply copy the contents of that file into the hidden file Volume Name Icon. (The file name apparently has changed to .disk_label in recent revisions of Mac OS X 10.4.)

The rEFIt repository contains a tool that creates label image files from greyscale images in a standard format like PNG. The tool is called vollabel.py and can be found in the images/vollabel directory of the repository. It is written in Python and requires that PIL (Python Imaging Library) is installed.