Index ソフト・ハード Linuxタスク | カーネルコンパイル |
事前確認 ソースコード入手 ソースコード参照 ソースコードInstall Makefile 以前の設定情報クリア 既存パラメータ設定 カーネルコンフィグ カーネルのビルド モジュールのビルド モジュールのInstall カーネルのInstall 導入カーネルの配置 カーネルConfig参照 |
事前確認 ・予めカーネルに機能を設定 ・不要な機能は削除、カーネル自体負担を減らす。 ・バグの修正 ・現在のカーネルのバージョン ・$ uname --all ・開発環境 Documentation/Changes に記載) GNU C(gcc)、バージョン確認 GNU make、バージョン確認 $ make --version binutils、バージョン確認 利用者「root」の指定 $ld -v最新のカーネルのフルソースコード ・アーカイブ取得 カーネルの更新版ダウンロード・アーカイブの解凍 (GNU tar、Linuxディストリビューションにインストール) # tar zxf linux-2.6.xx.x.tar.gz # tar zxf linux-2.6.xx.x.tar.bz2ソースコード参照 ・「vi」タグジャンプ機能 ・「sourceNavigator」 ソースコードインストール ・カーネルファイル # ls /boot vmlinux-2.6.xx-x.xxxx_xxx・ファイルタイプ # ls /boot # file /boot/vmlinux-2.6.xx-x.xxxx_xxxMakefile ・/usr/src/linux/Makefile バージョン情報がカーネルファイルの名称以前の設定情報のクリア # cp /usr/src/.config /var/tmp/.config.org # make mrptoper make時の出力は抑制(2.6) 詳細情報 コマンドラインへ、V-1 VERBOSEモード、環境変数「KBUILD_VERBOSE」を「1」既存パラメータ設定の適用 ・最新カーネル付属の標準設定ファイル $ cd linux -2.6.XX $ make defconfig・ディストリビューション付属の設定ファイル $ cd linux -2.6.XX $ cp /boot/config-2.6.XX-***./config $ make oldconfigカーネルコンフィグ ・カーネルパラメータの設定ツール make config (テキスト型) make menuconfig (CUI型) make xonfig (GUI型) make gconfig (GUI型)・「/usr/src/.config」 ・ディストリビューションのサンプルを使用 一から見直しの場合は、サンプル不要 # cd /usr/src/linux/ # la configs i586、i686、smp(Symmetric Multiple Processor)、xen(仮想化技術)# make menuconfig ・組込み種別選択 カーネルへ直接リンク、[*]、<*> ローダブルモジュールとして、動的にロード、<M> 組み込まれない、[]、<>・各項目 General setup [*] Kernel .config support [*] Enable access to .config throuth /proc/config.gz Loadable module support Processor type and features マルチプロセッサー環境 Power management option (ACPI,APM) Bus option (PCI,PCMCIA,EISA,MCA,ISA) Excutable file formats Device Drivers File systems Profile support Kernel hacking Security options カーネルレベルのセキュリティ Cryptographic options 暗号アルゴリズム Library routines・保存確認 カーネル(vmlinux)のビルド(カーネルソースのコンパイル) # la -l .config # make bzImage 10分位 警告ありでもカーネルは出来上がる。 警告の取り除きカーネルモジュール(デバイスドライバ)のビルド # make modules 30分位 カーネルモジュールのインストール # make modules_install カーネルのインストール # /sbin/installkernel <kernel_version> <bootimage><makefile> kernel_version (/usr/src/linux/Makefile) VERSION.PATCHLEVEL..SUBLEVEL..EXTRAVERSION bootimage arch/i386/boot/copressed makefile System.map・インストール ・ブートローダ設定ファイルの更新 GNU GRUB・起動確認 再起動 GRUBの起動OS画面、新メニュー追加、選択 バージョン確認 unameコンパイルされて導入されたカーネルの配置 ・カーネルファイル # ls /boot vmlinux-2.6.xx-x.xxxx_xxx・ファイルタイプ # file /boot/vmlinux-2.6.xx-x.xxxx_xxx・シンボルマップ(/boot/) System.map -> System.map-2.6.xx-x.xxxx_xxx・initrd(初期RAMディスク、起動に必要なドライバ)(/boot/) initrd-2.6.16-x.xxxx.img・カーネルモジュール群 /lib/modules/2.6.xx-x.xxxx_xxx/「vmlinux」から「カーネルコンフィグレーション」を取得(2.6) ・カーネルコンパイル時の設定ファイルをカーネルへ埋め込む。 ・カーネル(vmlinux)のビルド時、 General setup [*] Kernel .config support [*] Enable access to .config throuth /proc/config.gz・binoffset はコンパイル済 ・/boot/vmlinux を解凍 /proc、/proc/config.gz から参照 |
All Rights Reserved. Copyright (C) ITCL |