If you have a triple boot mac mini with OS X, Windows and Linux it might be useful to run OS X inside VirtualBox when Linux or Windows is running.

VirtualBox officially supports OS X Server as guest vm and runs as well other OS X versions as guest. – If Linux runs on a second (external) hard disk the first harddisk can be assigned to a virtualbox vm as raw device. And OS X should boot as guest (of type OS X server). However booting a vm with EFI instead of BIOS is still work in progress. With virtualbox 3.2.12:

  • limited screen resolutions
    (VBoxManage setextradata "VM name" VBoxInternal2/EfiGopMode N, N=0,1,2...4)
  • only first ide hard disk is bootable
  • overrides installed boot manager, e.g. rEFIt; and settings done by OS X start volume utility are completely ignored (missing virtualized hardware)
  • sometimes crashes in libata (ide disk access); maybe not related to efi boot

EFI boot can be disabled in system settings of the guest vm. But then you need a BIOS bootloader for the OS X kernel like Chameleon which seems to be a very active project.

  • chameleon could be installed to the disk containing OS X – but I prefer an unmodified disk
  • so chameleon should boot from cdrom

There are many cdrom iso images with chameleon online, but none met my needs:

  • boot leopard and snow leopard
  • boot from apple hardware but inside virtualbox
  • do not use hackintosh kext patches, except disabling native apple power management with Disabler.kext (else the guest uses 100% cpu)
  • screen resolution of guest vm be be selected in boot menu

The chameleon boot loader (2.0 RC4 r684) has lots of usage setups. But many of them are only documented by their source code.

  • the stage 2 loader of chameleon, boot, is in multiboot format
  • it can be chain loaded by syslinux mboot.c32
  • mboot.c in chameleon source reveals 3 command line arguments:
    biosdev=80 (or 81 for second hard disk, …)
    partno=2 (for second partition)
    timeout=5 (autostart after 5 seconds)
  • multi boot “kernels” may have “modules” (=initial ramdisk in case of linux kernel); chameleon uses a dmg image whith boot parameters and kext kernel modules
    – dmg format: compressed, with mbr partition, hfs+ filesystem in partition 1
    – /Extra/com.apple.Boot.plist defines boot parameters
    – /Extra/Extensions/ contains kext modules
  • isolinux.cfg example:
    kernel /mboot.c32
    append biosdev=80 timeout=1 partno=2 /boot --- /p800x600.dmg
  • com.apple.Boot.plist entry for Display resolution
    <key>Graphics Mode</key>
  • com.apple.Boot.plist entry for verbose mode
    <key>Kernel Flags</key>
  • the dmg image can be opened inside OS X

Based on this information osxboot.iso is a bootable cdrom image with

  • boot menu (syslinux based) to choose between
    800×600, 1024×768, 1280×1024
    and, if set as custom resoltions in virtualbox guest vm,
    1400×1050, 1440×900, 1920×1050, 1920×1200
    (VBoxManage setextradata "vmname" CustomVideoMode1 1920x1200x32)
  • boot menu to select silent or verbose boot
    (chameleon allows to add other flags)
  • default boot from second partition of first hard disk
    (which can be edited during boot)
  • OS X 10.5, leopard, or OS X 10.6, snow leopard, on apple hardware, running as virtualbox guest:
    – only kext module Disabler.kext (part of chameleon distribution) is loaded (allows cpu sleep mode for vm guest)
    – leopard runs only inside a 64 bit version of virtualbox (tested with linux)
  • EFI has to be disabled in the system properties of the virtualbox guest
  • Seems to run stable if the hard disk inside the vm is attached to the virtual SATA hard disk controller
    (to access raw devices Use Host I/O Cache must be enabled for the SATA controller!)

The chameleon boot loader has been patched to set display resolution and verbosity as multiboot arguments:

  • resx=800 (defines horizontal resolution)
  • resy=600 (defines vertical resolution)
  • verbosity=0 / verbosity=1 (sets verbosity: -v flag)

Google, howto isolinux, should give answers how a bootable isolinux cdrom image can be created.

Known bug: “About this Mac” system information crashes.

Software used for this article: SPBLinux 2.4 live cd

One Comment

  1. spblinux says:

    Update: the bootable cdrom (iso image) supports now leopard and snow leopard; a patched version of chameleon is used for better integration of chameleon into syslinux boot menu (size of iso image dropped to 11MB).

    VirtualBox 3.2.12 32 bit on windows, osx or linux host causes a kernel panic in OS X leopard guest vm; the same setup runs fine with snow leopard guest (both with unmodified kernel). However VirtualBox on 64 bit linux does run leopard and snow leopard guests. (Same behaviour with VirtualBox 4.0.2 32 bit under windows, osx or linux: only snow leopard runs.)

Leave a Reply