MacOnLinuxHowto

Differences between revisions 23 and 27 (spanning 4 versions)
Revision 23 as of 2006-05-24 05:52:08
Size: 12414
Editor: S0106000fb085cc63
Comment: add cat cleanup
Revision 27 as of 2008-08-06 16:34:59
Size: 59
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## This document should also cover
## 1) mol configuration
## 2) booting a mac os install from a hd partition
## 3) booting and installing mac os from/to a file (disk image)
## Document written by Wouter Eerdekens

attachment:IconsPage/PicDocs.png

[[TableOfContents]]

|| Note: installing MOL on dapper has become much simpler. I'll make a MacOnLinuxHowtoDapper, and then after the dapper release there can be a name change and rearange.||

This document tries to explain how to install Mac-on-Linux on Ubuntu. Mac-on-Linux is available in the universe repository, but you'll have to build the {{{mol.ko}}} and {{{sheep.ko}}} kernel modules yourself. There are no binary packages of these modules available for the default Ubuntu kernel.

Mac-on-Linux cannot be installed on machines with an Intel compatible processor. It is only available for !PowerPC.

= Preparing your system =

To install all of Mac-on-Linux, you'll need to enable the universe and multiverse (for Mac OS X support) repositories. You do this by editing your {{{/etc/apt/sources.list}}} file. In this file, change the lines

{{{
   #deb http://archive.ubuntu.com/ubuntu warty main restricted universe
   #deb-src http://archive.ubuntu.com/ubuntu warty main restricted universe
}}}

to look like this

{{{
   deb http://archive.ubuntu.com/ubuntu warty main restricted universe multiverse
   deb-src http://archive.ubuntu.com/ubuntu warty main restricted universe multiverse
}}}

After editing, you'll need to resynchronise your package index files with the command

{{{
   bash:~$ sudo apt-get update
}}}

Now you can install all the needed packages with the command

{{{
   bash:~$ sudo apt-get install mol-modules-source build-essential linux-headers-$(uname -r)
}}}

If you are running Breezy you will also need gcc-3.4
{{{
   bash:~$ sudo apt-get install gcc-3.4
}}}
To set gcc-3.4 as the default compiler run
{{{
   bash:~$ sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc
}}}
at the end of the building process you will need to set the default compiler back to gcc-4.0 using the command
{{{
   bash:~$ sudo ln -sf /usr/bin/gcc-4.0 /usr/bin/gcc
}}}


<!> '''Note'''
  If you run into problems modifying the sources.list file, check out this document: http://www.ubuntulinux.org/wiki/AddingRepositoriesHowto.

Short overview of the necessary packages:

{{{mol-modules-source}}}
  This package contains the source for the mol kernel modules.

{{{build-essential}}}
  A metapackage that depends on the applications and tools necessary to build Ubuntu packages.

{{{linux-headers}}}

just do
{{{
$ uname -r
}}}

and it will resolve to your current kernel version insuring that your kernel and headers source version match.

= Editing the kernel headers =
A bug in the Ubuntu kernel headers maycause the compilation of the Mac-on-Linux to fail.

This seems to be fixed in version 2.6.12.9-powerpc, but in case of problem, this issue is reported in Bugzilla as [https://bugzilla.ubuntu.com/show_bug.cgi?id=2728 bug #2728]

Only a small change is needed to make sure the modules will compile.

attachment:IconsPage/IconNote.png

<!> '''Note'''
  This is a hack. It just bypasses a bug in the kernel headers. You do not have to do this in Hoary. Only the Warty kernel headers have this problem. (The hack may be necessary if you upgraded from Warty to Hoary but kept the old kernel.)

You'll need to edit a file called setup.h within the hierarchy of the linux kernel headers.
{{{
   bash:~$ sudo gedit /usr/src/linux-headers-2.6.8.1-4-powerpc/include/asm/setup.h
}}}

In this file, you need to comment out the line {{{#include <asm-m68k/setup.h>}}} so the file will look like this:

{{{
   #ifdef __KERNEL__
   #ifndef _PPC_SETUP_H
   #define _PPC_SETUP_H

   #define m68k_num_memory num_memory
   #define m68k_memory memory

   /* #include <asm-m68k/setup.h> */
   /* We have a bigger command line buffer. */
   #undef COMMAND_LINE_SIZE
   #define COMMAND_LINE_SIZE 512

   #endif /* _PPC_SETUP_H */
   #endif /* __KERNEL__ */
}}}

Now you are ready to start compiling the kernel modules.

= Building the mol modules =

<!> '''Note'''
Before building the package you need to make sure you have {{{debhelper}}} and {{{m4}}} packages. If you don't the build will fail. So, to be sure :
{{{
   bash:~$ sudo apt-get install debhelper m4
}}}


The package {{{mol-modules-source}}} installed a file {{{mol-modules.tar.gz}}} in the directory {{{/usr/src}}}. Unpack the file with the commands

{{{
   bash:~$ cd /usr/src
   bash:~$ sudo tar xzvf mol-modules.tar.gz
}}}

Next, set some environment variables. These are needed for the compilation.
{{{
   bash:/usr/src$ export KVERS="$(uname -r)"
   bash:/usr/src$ export KSRC="/usr/src/linux-headers-$(uname -r)"
   bash:/usr/src$ export KEMAIL="your@email.address"
   bash:/usr/src$ export KMAINT="Your Name"
   bash:/usr/src$ export KDREV="ubuntu0"
}}}

attachment:IconsPage/IconNote.png

<!> '''Note'''
  You should, of course, replace {{{your@email.address}}} and {{{Your Name}}} with your actual email address and your name. These are used for the Maintainer field in the debian package you're about to create.

Use the following commands to actually build the modules:
{{{
   bash:/usr/src$ cd modules/mol
   bash:/usr/src/modules/mol$ sudo debian/rules build
}}}

After compiling the modules, create a debian package of the modules with the command
{{{
   bash:/usr/src/modules/mol$ sudo debian/rules binary-mol-modules
}}}

This will result in a debian package {{{mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb}}} in the directory {{{/usr/src}}}

= Installing Mac-on-Linux =

The first package you need to install are the kernel modules you just built. This is because they provide the virtual package {{{mol-modules}}} on which the ''mol'' package depends.

{{{
   bash:~$ sudo dpkg -i /usr/src/mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb
}}}

attachment:IconsPage/IconNote.png

<!> '''Note'''
  The file name will change as modifications are made to the *mol* source, so, make sure that you change the above line to match the file name as it exists on your computer. As of December,1st 2005, the file name is called {{{mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb}}}.

Now you can install the rest of the Mac-on-Linux packages

{{{
   bash:~$ sudo apt-get install mol mol-drivers-linux mol-drivers-macos mol-drivers-macosx
}}}

Short overview of these packages:

{{{mol}}}
  The actual Mac-on-Linux emulator.

{{{mol-drivers-linux}}}
  Package containing the drivers needed to run Linux within the emulator.

{{{mol-drivers-macos}}} (Not found)
  Package containing the drivers needed to run Mac OS 9 and earlier within the emulator.

{{{mol-drivers-macosx}}} (Not found)
  Package containing the drivers needed to run Mac OS X within the emulator.

= Running Mac-on-Linux as a normal user =

By default, Mac-on-Linux requires root privileges to run. The following command makes sure you can run Mac-on-Linux as a normal user.

{{{
   bash:~$ sudo dpkg-statoverride --update --add root root 4755 /usr/lib/mol/bin/mol
}}}

= Configuring and running Mac-on-Linux =

If you are not comfortable with editing text look at NanoHowto.

This assumes that you have a working install of Mac OS X or 9, on a partition on you harddrive somewhere.

There are a few settings you may want to play with be for you use mol. One of them is memory. The default is 96mb, which is barely enough to boot Mac OS X (although ok for Mac OS 9 if you arn't planning to do much).

In {{{/etc/mol/molrc.osx}}} (molrc.macos for Mac OS 9) find {{{ram_size: 96}}}
(or {{{ ram_size: 48}}} in molrc.macos) and change to at least '''128'''

Its possible to give mol more RAM than you physically have, and linux will deal with putting stuff into swap, but you are likely to end up with a slow system. (It may also crash if you give too much RAM; I had to keep a {{{ram_size}}} of 48 in my molrc.macos.)

Then it is worth setting up the video modes, run {{{sudo molvconfig}}}

You basically type 'y' to try out a confuration, and then 'y' if you can see a nice gradient on the screen. The red screen comes out as a stripes, but it seems to work anyway. If you get a random mess, blank screen or some other problem then press 'n'

Now you should be able to run {{{startmol --osx}}} (just startmol for Mac OS 9), and Mac OS X will boot up in a window or on a new virtual terminal. You need to install the MOL package that you find on the desktop. This provides sound and network drivers.

To exit mol, choose shutdown from the apple menu.

See its manpage for more usage information.

= Configuring Network =

If you are using mol to use the iTunes music store, or watch flash on the web, then you will need to get networking running.

You will need to install ''ipmasq'', ''dnsmasq'' and ''dhcpd'' using ''synaptic'' or

{{{
 sudo apt-get install ipmasq dnsmasq dhcpd
}}}

Then enable ''dhcp'' for the {{{tun0}}} interface that ''mol'' uses, in {{{/etc/default/dhcp}}}, put the line

{{{
 INTERFACES="tun0"
}}}

Then in {{{/etc/mol/molrc.net}}} add the line

{{{
 netdev: tun0 -tun
}}}

and in {{{/etc/mol/tunconfig}}} at the bottom just before

{{{
 exit 0
}}}

add the lines
{{{
   /etc/init.d/ipmasq restart
   /etc/init.d/dnsmasq restart
}}}

Now run {{{startmol --osx}}}, and we can set up the network on the Mac OS X side. MOL creates a network tunnel called tun0 at the linux end, and en3 on the Mac OS X end.

Once you have logged into to Mac OS X open up the system preferences. Make sure that {{{en3}}} is set to configure with DHCP.

Now open up Safari or Firefox, and if you are lucky you should have a web connection.

There is some more info at http://www.csse.monash.edu.au/~ctwardy/mol-debian-benh.html

= Trouble Shooting =

If you get mol module not found errors, try insmodding it manually
{{{
insmod /lib/modules/2.6.(your kernel version)-powerpc/misc/mol.ko
}}}

If OSX doesn't start, edit the blkdev settings in {{{/etc/mol/molrc.osx}}}. Your OSX boot partition should not be mounted under linux and should have the setting of
{{{
blkdev /dev/hda3 -boot -rw
}}}

Obviously the {{{hda3}}} part could be different for you.

= OS 9 Double Click and Slow Response Trouble =

If you are having very slow response with OS 9, you probably need to open the MOL Install CD that appears on the desktop and drag the MOLAudio to the System Folder. Then you need to go to the sound control panel and enable the MOL Audio for output. (Before I did this I was unable to even double click. Afterwards, the response was more snappy.) The real fix is to use a more recent version of Mac-on-Linux though. To do that, I am providing my notes below.

= To run Tiger and Eliminate Annoying Sluggish Behavior on MOL Install this Patched Version =

Thanks to folks on the MOL mailing list for these tips. [http://www.maconlinux.org/lists/index.html]

1) Download the latest kernel source. You can user uname -r to determine your version. Mine was 2.6.12-9-powerpc. You can also use the synaptic package manager or Adept to do this.

{{{sudo apt-get install linux-source-2.6.12}}}

2) Follow the instructions on this Wiki for building the kernel found at [https://wiki.ubuntu.com/KernelBuildPPCHowTo].

3) Download the patched MOL that Joe Jezak has kindly provided. [http://dev.gentoo.org/~josejx/] Look for the latest mol version he has provided.

4) Extract it using tar -jxvf

5) Build it using make.

6) Set up and start MOL using the instructions in the section above. Actually, I had better luck on the networking setup with the sheep driver. I just made the /etc/mol/molrc.net have the line:

{{{netdev: eth1 -sheep}}}

You may need eth0 instead if that is your primary network interface (do an ifconfig to find out). With this setting Tiger boots and gets an IP address via dhcp from my local wireless router.

A side note: I have not been able to boot an OS 9 partition with this setup and there have been some similar notes on a Yellow Dog Linux forum. If I figure that out, I'll append this note.

 
----

CategoryDocumentation CategoryCleanup
#REFRESH 0 http://help.ubuntu.com/community/MacOnLinuxHowto

MacOnLinuxHowto (last edited 2008-08-06 16:34:59 by localhost)