An Apple a Day…
Total Page:16
File Type:pdf, Size:1020Kb
LINUXCOVER USERSTORY SchlagwortMac on Linux sollte hier stehen Running Mac OS X under Linux AN APPLE A DAY… We used the Ubuntu distribution for the PowerPC processor, as it proved impossible to get either Gentoo or the commercial Yellow Dog distribution to display a GUI on our iBook G4/800 with a Radeon Mobility 9200 graphics chip. The Ubuntu installer works with the Debian apt-get package manager, which downloads files off the Internet. Mac-on- Linux needs a few kernel modules for PPC Linux, and you will need to compile these modules yourself. Compiling these modules means installing a few tools, if they are not already installed. The fol- lowing command downloads the pack- ages and installs them: sudo apt-get install build-U essential linux-headers-2.6-U powerpc If you are prompted for a password, type Emulators now give users the ability to run their beloved Mac OS X on your normal user account password, as Ubuntu does not typically have an Linux, bringing birds of a feather back together. administrative (root) account (see [8]). Instead, users can run commands that BY OLIVER FROMMEL typically need root privileges using sudo. Unfortunately, the standard Ubuntu repository does not include the files, so he easiest way to run Mac pro- also gives you Linux device drivers that you will first need to add the Multiverse grams on Linux is the free Mac- have been optimized for this application repository, which includes packages that Ton-Linux [1] software. Mac-on- in an approach similar to Vmware’s, are not part of the standard Ubuntu dis- Linux does not give you a hardware which explains why Mac-on-Linux is tribution. To do so, add the lines in Box 1 emulation and thus requires an Apple quicker than an emulator. to your /etc/apt/sources.list. computer. The Mac-on-Linux package Now update the local cache with the theoretically supports other PowerPC Mac OS as a Linux Program new repository by typing sudo apt-get architectures [2], such as the Pegasos Mac-on-Linux boots a standard Apple update. Then install the source code for [3], but installing the Apple operating operating system as a Linux program. In the Mac-on-Linux kernel modules: system, MacOS, on these architectures our example, we’ll use Mac OS X, but would contravene the license agreement. Mac-on-Linux also supports older vari- sudo apt-get install mol- ants, such as System 9, which is still modules-source Linux for Apple fairly common. You can use Mac-on-Linux with any Gentoo users can download and com- Launch an editor to open a C header file Apple computer. Of course your Linux pile Mac-on-Linux in the typical Gentoo of this package and remove an error that distribution needs to support the Pow- way using emerge mol. Yellow Dog actu- will otherwise prevent you from building erPC processor [4]. The following distri- ally includes the program by default. the modules. If you prefer to use another butions have this ability: Fedora Core 3 [5], Gentoo [6], Debian [7], Ubuntu [8], Box 1: Additions to /etc/apt/sources.list and Yellow Dog [9]. 01 deb http://archive.ubuntu.com/ubuntu warty multiverse Mac-on-Linux does not emulate hard- 02 deb-src http://archive.ubuntu.com/ubuntu warty multiverse ware; it passes commands to the CPU. It 38 ISSUE 54 MAY 2005 WWW.LINUX- MAGAZINE.COM Mac on Linux COVER STORY editor rather than vi, replace vi with the Box 2: /etc/mol/tunconfig name of your preferred editor. 01 #!/bin/bash sudo vi /usr/src/linux-U 02 /sbin/ifconfig tun0 192.168.40.1 headers-2.6.8.1-4-powerpc/U 03 /sbin/iptables -D POSTROUTING -t nat -s 192.168.40.0/24 -d ! include/asm/setup.h 192.168.40.0/24 -j MASQUERADE 04 /sbin/iptables -t nat -s 192.168.40.0/24 -d ! 192.168.40.0/24 -A Delete the line containing #include POSTROUTING -j MASQUERADE <asm-m68k/setup.h> and save the file 05 /sbin/iptables -t filter -P FORWARD ACCEPT again. Then change to the directory with 06 echo 1 > /proc/sys/net/ipv4/ip_forward the Linux source code and unpack the archive that apt-get has stored there. The package manager resolves depen- on-Linux uses a terminal window to cd /usr/src dencies itself and additionally installs display messages that occur at boot sudo tar xzvf mol-modules.tar.gz the mol and mol-drivers-macosx, and time. These messages are stored perma- mol-drivers-linux, which you will only nently in a file below /var/log. This is You need to set a few environmental need if you want to run a PPC Linux ver- where you should look if something variables to make sure the modules sion with Mac-On-Linux. goes wrong. match your current kernel version: If you specify --loadonly when launch- ing the program, it tells you if the kernel Network Tunnel export KVERS="$(uname -r)" module is loaded (Figure 1). The most Setting up the network is a more diffi- export KSRC="/usr/src/linux- common mistake is to have kernel and cult proposal, and unfortunately, there headers-$(uname -r)" module versions that do not match. is no smart helper to point us in the export KDREV="ubuntu0" Although the parameter -a allows differ- right direction. Start by enabling the ent version numbers, you should not tunnel interface in /etc/mol/molrc.net; Now change to the Mac-on-Linux subdi- expect a configuration without matching this interface automatically loads the rectory and call the build script when numbers to work. right kernel module and assigns an IP you get there: After loading the module, you can address. To enable the tunnel interface, now turn to the video configuration. The remove the # in the line with netdev: cd modules/mol sudo molvconfig command launches the tun0 -tun. Your boot messages should sudo debian/rules build required program, which either tries out now include a line such as Ethernet the operating modes itself or allows you Interface 'tun-<tun0>' @ 00:00:0D: After a short delay, the build should to set a mode manually. In our lab, both EA:DB:EE. complete; you can now create a Debian approaches worked out fine with the A new disk appears in Mac OS X; you package with the files this step gave you: defaults. can open the disk by double clicking. startmol helps you organize the key- It contains special drivers Mac OS X sudo debian/rules binary-U board assignments. The --keyconfig para- needs to access the network in emula- mol-modules meter launches an interactive program, tion mode. To install the drivers, click on which displays the name of the key (for the Pkg package and follow the instruc- The final product should now be in example Return or Apple-Key) and tions. /usr/src. Change to this directory and prompts you to press that key. You will probably want to use Mac-on- install it on your Ubuntu system: After completing the configuration, Linux to access both your local network you can launch Mac OS X in a window and the Internet. To pass traffic to Mac- sudo dpkg -i mol-modules-U by typing sudo startmol -X. It automati- on-Linux, you need to edit the /etc/mol/ 2.6.8.1-3-powerpc_0.9.70+U cally locates the installation on your tunconfig script, which is launched by ubuntu0_powerpc.deb hard disk and “boots” the system. Mac- startmol. The default version of tuncon- This finally completes the preparation work, and you can go on to install the remaining packages for Mac-on-Linux: sudo apt-get install mol mol-U drivers-macosx Figure 1: Launching Mac-on-Linux with the --loadonly option logs the required modules. COVER STORY Mac on Linux Figure 2: Mac OS X browsing the Web in a Linux window. Figure 3: The PearPC start screen allows you to select the boot partition. fig launches a DHCP server and uses the approach. That is, you need a genuine Then copy the sample configuration files iptables command to map IP addresses. emulator that fools Mac OS X into to that directory: In our lab we used an alternative believing it is running on an Apple plat- tunconfig with a static IP address assign- form. It also helps if you enjoy experi- cp pearpc-0.3.1/ppccfg.example U ment (see Box 2). In Mac OS X, assign menting, and of course you need a set of ppc/ppccfg the IP address 192.168.40.2 to the net- Mac OS X installation CDs. work interface en3 and assign 192.168. PearPC [11] implements a PowerPC To imitate the graphics adapter, PearPC 40.1 as the router. CPU and a set of peripherals. The instal- also needs a video.x file, which you After you complete this complex con- lation is as easy as pie: again need to copy to your working figuration, Mac-on-Linux now has Inter- directory. Also, move the hard disk net access. tar xfj pearpc-0.3.1.tar.bz2 image, macosx.img, to the same direc- cd pearpc-0.3.1 tory to have all the files you need in the Accelerator ./configure --enable-ui=sdl U right place. To launch Mac-on-Linux in full screen --enable-cpu=jitc_x86 You can edit the ppccfg configuration mode in X, you need to modify a file make file with a text editor. For the time being, called /etc/mol/molrc.video.