HOW TO Mac-On-Linux / MOL KVM on Ubuntu Mate PPC G5

Discussion in 'PowerPC Macs' started by AphoticD, Feb 23, 2017.

  1. AphoticD, Feb 23, 2017
    Last edited: Feb 26, 2017

    AphoticD macrumors 6502a

    AphoticD

    Joined:
    Feb 17, 2017
    Location:
    Queensland, Australia
    #1
    Preface

    Firstly, props to @LightBulbFun for an earlier thread "PowerMac G5 running Linux with a PowerPC virtual machine" which was inspiration to tackle MOL KVM and as stated in that thread, any record "On paper so to speak" is useful as there aren't a great deal of resources for this topic.


    An introduction to Mac-On-Linux (MOL)

    Mac-On-Linux is an emulator / virtualising solution for PowerPC to run Mac OS (X) atop a Linux PPC installation. The software has been around for decades. Back in about 1999 - 2000 I can recall setting up and operating Mac OS 8.6 (my favoured version of Mac OS at the time) on an underpowered Power Macintosh 7220/200 (603ev) with 160MB EDO RAM, which was a learning platform for me to run various flavours of Linux. I recall Debian, Yellow Dog and Slackware were the go to distros for PPC at the time. During this period MOL development was active and early OS X support was well underway.

    Although the software had mostly laid dormant throughout the past decade (official OS X guest supported ended at 10.3 Panther), there has been more recent development with added support for Tiger and KVM (Kernel-based Virtual Machine) on Linux ppc / ppc64. KVM essentially means that the VM guest can access the CPU hardware directly. My understanding is that in KVM "mode", an entire CPU (or thread) is allocated to the task of virtualising the assigned virtual machine.

    The result of KVM is much improved (near native) speed on the same hardware. QEMU KVM is currently serving great results for various platforms (including Linux PPC), however MOL appears to have the edge on performance and as we know on these old machines, every speed improvement counts.

    So after following the advice in the aforementioned thread and successfully getting QEMU KVM to install Tiger, I wanted to attempt to get MOL KVM working (as best as possible).

    It's important to note that before starting, I had installed both Tiger (10.4.11) and Leopard (10.5.8) natively on this machine on separate partitions and then repartitioned to add the Ubuntu Mate partitions in a "Triple boot" setup.

    In my prior attempts to get MOL working on a different G5 (Dual 1.8Ghz 2003), I found I had trouble with the Tiger installation DVD (and various formats of ISOs/rips) randomly failing during installation onto an image file, even though they all successfully passed the "Checking Installation Media" stage. Panther installed successfully in MOL from installation ISOs but I wanted Tiger on this G5. So, I went back and split up my Leopard partition with a 10GB partition for Tiger and installed Mac OS X 10.4 the old fashioned way (via DVD) and then updated to 10.4.11 and applied all the software updates.


    Compiling Mac-On-Linux / MOL KVM

    Platform
    : Ubuntu Mate 16.04.2 ppc64
    Hardware: Power Mac G5 Dual Core 2.3Ghz (Late 2005), 16GB RAM, Quadro FX4500 (512MB) PCIe

    Install dependencies.

    $ sudo apt-get install build-essential autoconf subversion zlibc zlib1g-dev libncurses-dev flex bison libx11-dev libxext-dev

    For reference, this installation is of ubuntu-mate-16.04.1-desktop-powerpc.iso with all the current software updates to bring it to 16.04.2. In addition and prior to playing with MOL, I had manually added the following packages for my own interest. Although not directly associated, any of these packages may have carried other dependencies which could be required;

    $ sudo apt-get install samba synergy ssh tasksel gparted ffmpeg mplayer gpac qemu-kvm openbios-ppc

    Download and compile MOL (KVM) from source:

    $ svn checkout svn://svn.code.sf.net/p/mac-on-linux/code/trunk mac-on-linux-code

    $ cd mac-on-linux-code
    $ export CFLAGS="-m32"
    <-- this is required to build 32 bit binaries on a ppc64 system
    $ ./autogen.sh
    $ make


    Enable these items in the menuconfig;
    > Machine Specific Build Targets > Virtualization type > (X) KVM kernel module
    > Network drivers > [X] TUN driver

    (Save/Exit to continue compiling)

    Once compiling has completed (approx 2 mins on my system).

    $ sudo make install


    CONFIGURE MACHINE OPTIONS
    - increase RAM, disable Altivec and boot from an existing Tiger partition.

    $ sudo vi /etc/mol/molrc.osx

    Change values:
    ram_size: 512 (or greater)
    disable_altivec: yes

    ---- edit 'blkdev:' options ----

    comment out /dev/cdrom line to disable access to the optical drive
    #blkdev: /dev/cdrom -cd ${cdboot}
    --
    Enable booting off an existing Tiger partition (-rw -boot). Edit, remove or comment out any lines that don't apply to your system.
    --
    ifempty ${altconfig} {
    # default configuration
    blkdev: /dev/sda6 -rw -boot #Tiger
    blkdev: /dev/sda3 -rw #Leopard
    } else {
    # alternate configuration
    #blkdev: /tmp/osx.image -rw
    #blkdev: /dev/loop0 -rw
    }

    --
    autoprobe_scsi: no
    --
    enable_usb: no

    Save/Write and exit (':wq')


    CONFIGURE SOUND
    - Disable All - I couldn't get either alsa or oss to work, so "nosound" is set to bypass and reduce conflicts/instability.

    $ sudo vi /etc/mol/molrc.sound
    --
    sound.driver: nosound
    startboing.enabled: no

    --
    Save/Write and exit (':wq')


    CONFIGURE VIDEO
    -- set base resolution and disable console video.

    $ sudo vi /etc/mol/molrc.video

    Edit resolution line, change to:
    resolution: 1024/768/60 # width/height/Hz

    Disable console video (I couldn't get this to work either)

    enable_console_video: no

    Save/Write and exit (':wq')


    CONFIGURE NETWORKING
    -- MOL will share the network with the guest via NAT and DHCP.

    Edit the MOL tunconfig script to specify a DNS to use:
    $ sudo vi /etc/mol/tunconfig

    Uncomment the NAMESERVER line and enter a valid DNS address. In my case I entered the local IP address of my xDSL modem.

    NAMESERVER=10.1.1.1 <-- change to a valid nameserver IP address.

    Scroll down to to the end of the file and then below the lines;

    "if [ "$IFACES" ] ; then
    echo 1 > /proc/sys/net/ipv4/ip_forward"


    Copy and paste;

    $IPTABLES -t nat -A POSTROUTING -j MASQUERADE

    Save/Write and exit (':wq')

    The "tunconfig" script will execute when MOL is started. You can view the table while running MOL with the command sudo iptables -t nat -L . You'll find that MOL/tunconfig will attempt to tidy up by flushing the "nat" table after exiting.


    Next is to modify MOL's DHCP config file to remove DNS confusion.

    $ sudo vi /etc/mol/dhcpd-mol.conf

    Scroll down to the subnet 192.168.41.0 section and comment out the next line;

    #option domain-name-servers 192.168.41.1;

    Save/Write and exit (':wq')


    FIRST BOOT
    We are now ready to boot Tiger in Mac-On-Linux !

    $ sudo startmol -X


    On the initial run, MOL will spit out a timebase_frequency value.
    Copy the "timebase_frequency:" output (such as "timebase_frequency: 0x01FCA554"), then add to the sessions.map as instructed;

    $ sudo vi /etc/mol/sessions.map

    Paste the line in near the top of the file.

    Save/write and exit (':wq')


    Once the guest system boots, the MOL drivers will appear on the desktop as a disk image, run the installer and reboot/shutdown then run again with;

    $ sudo startmol -X


    I found that using FTP to transfer files in and out of the system via guest and host works. Enable FTP Sharing in Mac OS X via System Preferences > Sharing and then access from the host side;

    $ sftp 192.168.41.2

    You can then get and put files to transfer. Of course you could always use scp .

    It may be possible to mount your host's SMB shares in the guest, but I couldn't get this to work - it just hangs when trying to connect to smb://192.168.41.1 from within the guest.

    While the old version of Safari works, I couldn't get TenFourFox to start up. Realising that TFF builds are CPU specific, I tried downloading the G3 edition and bumped the system memory up to 1GB, but still no luck.

    In further research I found there is a TenFourKit version of Webkit for Tiger, but all the links seem to be dead. I'll keep hunting for this as it could make Safari more usable.

    Good luck and post your screenshots!

    -AphoticD

    image1.png
     
  2. Lastic macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #2
  3. AphoticD thread starter macrumors 6502a

    AphoticD

    Joined:
    Feb 17, 2017
    Location:
    Queensland, Australia
    #3
    Thanks Lastic, your post helped get further onto the right path. It's now working perfectly in a nat/masquerade setup without using the proxy service. I have updated the CONFIGURE NETWORKING section and removed any mention of tinyproxy.

    It is safe to apt-get remove tinyproxy and remove the Proxy settings from within the guest Mac OS X System Preferences if anybody had tried this method.

    Still I would find the ultimate setup would be "Bridged" as in the VM is virtually on the same subnet as other LAN devices. But this config still eludes me.

    Cheers,
    AphoticD
     
  4. Lastic macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #4
    Currently at work so I can't troubleshoot further but could you give me your networking configuration on MOL and
    your ifconfig on Ubuntu since it's not clear to me how you have currently setup your network.

    I think you'll have to add your tun device to your eth device using brctl ?
     
  5. LightBulbFun macrumors 6502a

    LightBulbFun

    Joined:
    Nov 17, 2013
    Location:
    London UK
    #5
    very cool to see this guide :) its much better then my write up thats for sure heh. I wonder if the G5s support anything like VT-D it would be nice to pass through a dedicated GPU to the VM (something like a Radeon 9200 etc) tho I suspect that would require QEMU. also wondering if MOL can Boot OS9 in KVM mode Last i checked QEMU had issues doing so (but worked fine in emulator mode)
     

Share This Page