个人工具

“UbuntuHelp:MOLModulesHowto”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
第11行: 第11行:
 
You can install them with the command
 
You can install them with the command
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ sudo apt-get install mol-modules-source build-essential linux-headers-$(uname -r)
+
  bash:~$ sudo apt-get install mol-modules-source build-essential linux-headers-$(uname -r)
 
</nowiki></pre>
 
</nowiki></pre>
 
If you are running Breezy you will also need gcc-3.4
 
If you are running Breezy you will also need gcc-3.4
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ sudo apt-get install gcc-3.4
+
  bash:~$ sudo apt-get install gcc-3.4
 
</nowiki></pre>
 
</nowiki></pre>
 
To set gcc-3.4 as the default compiler run
 
To set gcc-3.4 as the default compiler run
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc
+
  bash:~$ sudo ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc
 
</nowiki></pre>
 
</nowiki></pre>
 
at the end of the building process you will need to set the default compiler back to gcc-4.0 using the command
 
at the end of the building process you will need to set the default compiler back to gcc-4.0 using the command
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ sudo ln -sf /usr/bin/gcc-4.0 /usr/bin/gcc
+
  bash:~$ sudo ln -sf /usr/bin/gcc-4.0 /usr/bin/gcc
 
</nowiki></pre>
 
</nowiki></pre>
 
<code><nowiki>mol-modules-source</nowiki></code>
 
<code><nowiki>mol-modules-source</nowiki></code>
第44行: 第44行:
 
You'll need to edit a file called setup.h within the hierarchy of the linux kernel headers.
 
You'll need to edit a file called setup.h within the hierarchy of the linux kernel headers.
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ gksudo gedit /usr/src/linux-headers-2.6.8.1-4-powerpc/include/asm/setup.h
+
  bash:~$ gksudo gedit /usr/src/linux-headers-2.6.8.1-4-powerpc/include/asm/setup.h
 
</nowiki></pre>
 
</nowiki></pre>
 
In this file, you need to comment out the line <code><nowiki>#include <asm-m68k/setup.h></nowiki></code> so the file will look like this:
 
In this file, you need to comment out the line <code><nowiki>#include <asm-m68k/setup.h></nowiki></code> so the file will look like this:
 
<pre><nowiki>
 
<pre><nowiki>
#ifdef <u>KERNEL</u>
+
  #ifdef __KERNEL__
#ifndef _PPC_SETUP_H
+
  #ifndef _PPC_SETUP_H
#define _PPC_SETUP_H
+
  #define _PPC_SETUP_H
#define m68k_num_memory num_memory
+
 
#define m68k_memory memory
+
  #define m68k_num_memory num_memory
/* #include <asm-m68k/setup.h> */
+
  #define m68k_memory memory
/* We have a bigger command line buffer. */
+
 
#undef COMMAND_LINE_SIZE
+
  /* #include <asm-m68k/setup.h> */
#define COMMAND_LINE_SIZE 512
+
  /* We have a bigger command line buffer. */
#endif /* _PPC_SETUP_H */
+
  #undef COMMAND_LINE_SIZE
#endif /* <u>KERNEL</u> */
+
  #define COMMAND_LINE_SIZE 512
 +
 
 +
  #endif /* _PPC_SETUP_H */
 +
  #endif /* __KERNEL__ */
 
</nowiki></pre>
 
</nowiki></pre>
 
Now you are ready to start compiling the kernel modules.
 
Now you are ready to start compiling the kernel modules.
第65行: 第68行:
 
Before building the package you need to make sure you have <code><nowiki>debhelper</nowiki></code> and <code><nowiki>m4</nowiki></code> packages. If you don't the build will fail. So, to be sure :
 
Before building the package you need to make sure you have <code><nowiki>debhelper</nowiki></code> and <code><nowiki>m4</nowiki></code> packages. If you don't the build will fail. So, to be sure :
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ sudo apt-get install debhelper m4
+
  bash:~$ sudo apt-get install debhelper m4
 
</nowiki></pre>
 
</nowiki></pre>
 
The package <code><nowiki>mol-modules-source</nowiki></code> installed a file <code><nowiki>mol-modules.tar.gz</nowiki></code> in the directory <code><nowiki>/usr/src</nowiki></code>. Unpack the file with the commands
 
The package <code><nowiki>mol-modules-source</nowiki></code> installed a file <code><nowiki>mol-modules.tar.gz</nowiki></code> in the directory <code><nowiki>/usr/src</nowiki></code>. Unpack the file with the commands
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ cd /usr/src
+
  bash:~$ cd /usr/src
bash:~$ sudo tar xzvf mol-modules.tar.gz
+
  bash:~$ sudo tar xzvf mol-modules.tar.gz
 
</nowiki></pre>
 
</nowiki></pre>
 
Next, set some environment variables. These are needed for the compilation.
 
Next, set some environment variables. These are needed for the compilation.
 
<pre><nowiki>
 
<pre><nowiki>
bash:/usr/src$ export KVERS="$(uname -r)"
+
  bash:/usr/src$ export KVERS="$(uname -r)"
bash:/usr/src$ export KSRC="/usr/src/linux-headers-$(uname -r)"
+
  bash:/usr/src$ export KSRC="/usr/src/linux-headers-$(uname -r)"
bash:/usr/src$ export KEMAIL="[email protected]"
+
  bash:/usr/src$ export KEMAIL="[email protected]"
bash:/usr/src$ export KMAINT="Your Name"
+
  bash:/usr/src$ export KMAINT="Your Name"
bash:/usr/src$ export KDREV="ubuntu0"
+
  bash:/usr/src$ export KDREV="ubuntu0"
 
</nowiki></pre>
 
</nowiki></pre>
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png
第85行: 第88行:
 
Use the following commands to actually build the modules:
 
Use the following commands to actually build the modules:
 
<pre><nowiki>
 
<pre><nowiki>
bash:/usr/src$ cd modules/mol
+
  bash:/usr/src$ cd modules/mol
bash:/usr/src/modules/mol$ sudo debian/rules build
+
  bash:/usr/src/modules/mol$ sudo debian/rules build
 
</nowiki></pre>
 
</nowiki></pre>
 
After compiling the modules, create a debian package of the modules with the command
 
After compiling the modules, create a debian package of the modules with the command
 
<pre><nowiki>
 
<pre><nowiki>
bash:/usr/src/modules/mol$ sudo debian/rules binary-mol-modules
+
  bash:/usr/src/modules/mol$ sudo debian/rules binary-mol-modules
 
</nowiki></pre>
 
</nowiki></pre>
 
This will result in a debian package <code><nowiki>mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb</nowiki></code> in the directory <code><nowiki>/usr/src</nowiki></code>
 
This will result in a debian package <code><nowiki>mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb</nowiki></code> in the directory <code><nowiki>/usr/src</nowiki></code>
第96行: 第99行:
 
Now you can install the modules that you built. They provide the virtual package <code><nowiki>mol-modules</nowiki></code> on which the ''mol'' package depends.
 
Now you can install the modules that you built. They provide the virtual package <code><nowiki>mol-modules</nowiki></code> on which the ''mol'' package depends.
 
<pre><nowiki>
 
<pre><nowiki>
bash:~$ sudo dpkg -i /usr/src/mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb
+
  bash:~$ sudo dpkg -i /usr/src/mol-modules-2.6.12-9-powerpc_0.9.70+ubuntu0_powerpc.deb
 
</nowiki></pre>
 
</nowiki></pre>
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconNote.png

2007年12月6日 (四) 10:43的最新版本

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="[email protected]"
   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 [email protected] 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.