Handbook:MIPS/Blocks/Kernel/ja

From Gentoo Wiki
Jump to: navigation, search
This page is a translated version of the page Handbook:MIPS/Blocks/Kernel and the translation is 62% complete.


設定を準備する

Important
On the Origin 200/2000, Indigo2 Impact (R10000), Octane/Octane2 and O2, a 64-bit kernel is required to boot these systems. For these machines, emerge sys-devel/kgcc64 to create a cross-compiler for building 64-bit kernels.

Many of the systems supported have sample .configs hiding in amongst the kernel source. Not all systems have configs distributed in this way. Those that do, can be configured using the commands mentioned in the table below.

System Configure command
Cobalt Servers make cobalt_defconfig
Indy, Indigo2 (R4k), Challenge S make ip22_defconfig
Origin 200/2000 make ip27_defconfig
Indigo2 Impact (R10k) make ip28_defconfig
O2 make ip32_defconfig

All of the Gentoo installation images provide a kernel config option as part of the image itself, accessible as /proc/config.gz. This may be used in many cases. It is best though if the kernel source matches closely the kernel that is currently running. To extract it, simply run it through zcat as shown below.

root #zcat /proc/config.gz > .config
Important
This kernel config is set up for a netboot image. That is, it will expect to find a root filesystem image somewhere nearby, either as a directory for initramfs, or a loopback device for initrd. When executing make menuconfig, don't forget to go into General Setup and disable the options for initramfs.

設定をカスタマイズする

Once a configuration is found, download it into the kernel source directory, and rename it to .config. From there, run make oldconfig to bring everything up to date according to the instructions above, and customize the configuration before compiling.

root #cd /usr/src/linux
root #cp /path/to/example-config .config
root #make oldconfig

Just press the ENTER (or Return) key at each prompt to accept the defaults for now ...

root #make menuconfig
Important
In the Kernel Hacking section, there is an option named "Are You Using A Cross Compiler?". This tells the kernel Makefiles to prepend "mips-linux-" (or mipsel-linux ... etc) to gcc and as commands when compiling the kernel. This should be turned off, even if cross-compiling. Instead, if a cross-compiler needs to be called, specify the prefix using the CROSS_COMPILE variable as shown in the next section.
Important
There is a known issue with JFS and ALSA on Octane systems where the ALSA fails to work. Given the experimental nature of JFS on MIPS, it is recommended that people avoid using JFS for the time being.

コンパイルおよびインストール

カーネルのコンフィグレーションが完了し、コンパイルとインストールをする時がきました。コンフィグレーションを終了させ、コンパイル作業を開始しましょう:

注意
64 ビットマシンでは、CROSS_COMPILE=mips64-unknown-linux-gnu- (または、リトルエンディアンシステムでは mips64el-... ) を指定することで 64 ビットコンパイラーを使用します。

ネイティブにコンパイルするには:

root #make vmlinux modules modules_install

Cross-compiling on target machine, adjust the mips64-unknown-linux-gnu- accordingly:

root #make vmlinux modules modules_install CROSS_COMPILE=mips64-unknown-linux-gnu-

When compiling on another machine, such as an x86 box, use the following commands to compile the kernel & install modules into a specific directory to be transferred to the target machine.

root #make vmlinux modules CROSS_COMPILE=mips64-unknown-linux-gnu-
root #make modules_install INSTALL_MOD_PATH=/somewhere
Important
When compiling a 64-bit kernel for the Indy, Indigo2 (R4k), Challenge S and O2, use the vmlinux.32 target instead of vmlinux. Otherwise, the machine will not be able to boot. This is to work around the PROM not understanding the ELF64 format.
root #make vmlinux.32
注意
make -jX とすることで、ビルドを並行処理させることができます( X には、並行処理を許可するビルドプロセスの数を指定します。 /etc/portage/make.conf の説明中の、 MAKEOPTS 変数についてと同様です。

上記の場合は vmlinux.32 が最終的なカーネルとして生成されます。

カーネルのコンパイルが終了したら、カーネルのイメージを /boot/ にコピーしましょう。

Note
On Cobalt servers, the bootloader will expect to see a compressed kernel image. Remember to gzip -9 the file once it is in /boot/.
root #cp vmlinux /boot/kernel-3.16.5-gentoo

Cobalt サーバー用では、カーネルイメージを圧縮します:

root #gzip -9v /boot/kernel-3.16.5-gentoo