- 履歴一覧
- ソース を表示
- Linux/Kernel-2.6 は削除されています。
#navi(contents-page-name): No such page: Linux
Kernel-2.6†
kernel-2.6 のバージョンも 2桁になった。そろそろまじめに、kernel-2.6 のお勉強をしましょう。kernel-2.4もそれほど勉強したわけではないが…。現在は、移行期間みたいな感じでそんなに、普及している感はないような気がするが、当然あと何ヶ月かすると、2.6ばっかになるんだろーなー。とういことで、UNIX USER 2004/3 〜 2004/9の連載"GCC プログラミング工房 --Linuxカーネル2.6実習編--"に沿ってお勉強。 ![:)](image/face/smile.png)
- kernel-2.6の概要
- 2.6は、2.4のチューニングといった意味合いが強く、機能として大きく変わったところは、あまりない。
- kernel-2.4からkernel-2.6の変更点概要
分類 | 機能概要 |
大規模システム向けの強化 | 多数のプロセスがあっても、複数のCPUに効率的に振り分けられるよう、新しいプロセススケジューラーであるO(1)スケジューラーを導入 |
多数のCPUでの効率的な動作のために、ロックのさらなる細粒度化と新しい排他方式の導入 |
Linux2.4までは遅延処理をtaskqueueで行っていたが、各CPUで並列に動作するworkqueueに書き直し |
大量のメモリを積んでいる場合にも効率よく処理ができるよう、バウンスバッファの処理の改善 |
バッファキャッシュが廃止され、ブロックデバイスに対するI/Oがページ単位に(bioインターフェース) |
大規模システムでは、CPUに対してメモリアクセス時間が一様でないものがある。2.6では、メモリの確保時に近いところから確保したり、プロセスのスケジューリングもこれを意識するようになった。(NUMA対応) |
LVM2(Logical Volume Manager) |
ジャーナリングファイルシステム(Ext3、ReiserFS、XFS、JFS) |
非同期I/Oの追加 |
Huge TBLの導入 |
組込みシステム向けの強化 | 組込み向けCPU(とくにMMUを持たないCPU)への対応 |
不要な機能を削り、カーネルサイズを抑えるオプションの追加 |
新I/Oスケジューラー(Deadlineスケジューラー、anticipatoryスケジューラー) |
カーネルプリエンプション機能(応答性が重要になる用途向けに、カーネルの内部処理を実行中でも処理を切り替える機能) |
そのほかの強化 | セキュリティ機能の強化 |
ネットワーク機能の強化 |
新サウンドドライバ(ALSA)の追加 |
USBドライバの強化 |
電源管理機能の強化 |
カーネル構築方法の改善 |
第1回 makeターゲットをマスターせよ†
- 2.4から変わったとこ
- make dep が無くなった
- ビルドディレクトリの指定が可能になった (O変数 or 環境変数KBUILD_OUTPUT で指定 O変数優先)
- 組込み向けオプションと最適化スイッチが追加されている
- CONFIG_EMBDDEDを有効にすると、不要なカーネルオプションを徹底的に削り込むことができる
- CONFIG_CC_OPTIMAIZE_FOR_SIZEを有効にすると、gcc の最適化が、O2=>Osになる。
(これ前からなかったっけ?ちなみにリナザウは、この最適化オプションだった…)
- カーネルの設定を埋め込むことができる
- CONFIG_IKCONFIGを有効にすると、/proc/config.gzでカーネルのコンフィギュレーションが参照できる
- make help (こんなにたくさんターゲットあるんですね…)
# make ARCH=sh help
Cleaning targets:
clean - remove most generated files but keep the config
mrproper - remove all generated files + config + various backup files
Configuration targets:
oldconfig - Update current config utilising a line-oriented program
menuconfig - Update current config utilising a menu based program
xconfig - Update current config utilising a QT based front-end
gconfig - Update current config utilising a GTK based front-end
defconfig - New config with default answer to all options
allmodconfig - New config selecting modules when possible
allyesconfig - New config where all options are accepted with yes
allnoconfig - New minimal config
Other generic targets:
all - Build all targets marked with [*]
* vmlinux - Build the bare kernel
* modules - Build all modules
modules_install - Install all modules
dir/ - Build all files in dir and below
dir/file.[ois] - Build specified target only
rpm - Build a kernel as an RPM package
tags/TAGS - Generate tags file for editors
cscope - Generate cscope index
checkstack - Generate a list of stack hogs
Kernel packaging:
rpm-pkg - Build the kernel as an RPM package
binrpm-pkg - Build an rpm package containing the compiled kernel & modules
deb-pkg - Build the kernel as an deb package
Documentation targets:
Linux kernel internal documentation in different formats:
sgmldocs (SGML), psdocs (Postscript), pdfdocs (PDF)
htmldocs (HTML), mandocs (man pages, use installmandocs to install)
Architecture specific targets (sh):
zImage - Compressed kernel image (arch/sh/boot/zImage)
adx_defconfig - Build for adx
cqreek_defconfig - Build for cqreek
dreamcast_defconfig - Build for dreamcast
hp680_defconfig - Build for hp680
rts7751r2d_defconfig - Build for rts7751r2d
se7300_defconfig - Build for se7300
se7751_defconfig - Build for se7751
snapgear_defconfig - Build for snapgear
systemh_defconfig - Build for systemh
make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
make O=dir [targets] Locate all output files in "dir", including .config
make C=1 [targets] Check all c source with checker tool
Execute "make" or "make all" to build all targets marked with [*]
For further info see the ./README file
第2回 SYSLINUXの秘密†
- SYSLINUXとは、様々なディストリビューションのインストール用起動ディスクなどに使用されているブートローダー
- 2.4では、bzImageをFDにべた書きすれば、カーネルが起動したが、2.6では、SYSLINUXを使わないとダメなんだって。
- とりあえず知りたいのは、(b)zImageのビルドまでと、module関連。
- ここはあんまり用事ないので、SKIP
第3回 /usr/includeディレクトリの謎†
- /usr/include に含まれる include header file
- kernel に依存したヘッダーファイル : /usr/include/linux
- CPUアーキテクチャに依存したヘッダーファイル : /usr/include/asm
- ライブラリヘッダーファイル : 上記以外のファイル
第4回 GCCソースツリーから理解するインクルードの極意†
- この回では、gccのインクルード検索パスなんかの説明がされている。
- インクルードにおける、検索パスの操作オプション
フルスペル名 | 省略名 | 機能 |
\-\-no-standard-include | -nostdin | 初期検索パスのリセット |
\-\-include-directory | -I | 検索パスに追加 |
\-\-include-barrier | -I- | -I- より前に-Iで指定されているdirectoryが、quote_includeリストに追加され、-I- より後に指定されているdirectoryが、bracket_includeリストに追加される |
第5回 モジュール対決2.4vs2.6†
第6回 insmodコマンドを自作しよう!†
第7回 2.6モジュールを自作しよう!†