个人工具

UbuntuHelp:MOLModulesHowto

来自Ubuntu中文

跳转至: 导航, 搜索

Introduction

If you are running a versions of Ubuntu release previous to 6.06 DapperDrake, then you need to build the MOL module for your kernel before installing Mac On Linux. This is not longer necessary in DapperDrake as the module are included in the kernel.

Preparing your system

You will need to enable the universe and multiverse, see AddingRepositoriesHowto for details. The following packages are required for building the MOL Modules.

mol-modules-source build-essential linux-headers-$(uname -r)

You can install them 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

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 bug #2728 Only a small change is needed to make sure the modules will compile. IconsPage?action=AttachFile&do=get&target=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:~$ gksudo 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"

IconsPage?action=AttachFile&do=get&target=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 the Modules

Now you can install the modules that you built. 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

IconsPage?action=AttachFile&do=get&target=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.