Kernel 2.6
#navi(contents-page-name): No such page: LinuxCONTENTS
REFERENCES
kernel-2.6 のバージョンも 2桁になった。そろそろまじめに、kernel-2.6 のお勉強をしましょう。kernel-2.4もそれほど勉強したわけではないが…。現在は、移行期間みたいな感じでそんなに、普及している感はないような気がするが、当然あと何ヶ月かすると、2.6ばっかになるんだろーなー。とういことで、UNIX USER 2004/3 〜 2004/9の連載"GCC プログラミング工房 --Linuxカーネル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ドライバの強化 | |
電源管理機能の強化 | |
カーネル構築方法の改善 |
# make O=/usr/src/kernel-2.6.x/build bzImage (とか、もしくは) # export KBUILD_OUTPUT=/usr/src/kernel-2.6.x/build # make bzImage
# 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
# vi Makefile EXTRAVERSION = -REDMAGIC1.0
とか。
# make bzImage # make modules # make modules_install # installkernel 2.6.x-REDMAGIC1.0 arch/i386/boot/bzImage System.map
フルスペル名 | 省略名 | 機能 |
---|---|---|
\-\-no-standard-include | -nostdinc | 初期検索パスのリセット |
\-\-include-directory | -I | 検索パスに追加 |
\-\-include-barrier | -I- | -I- より前に-Iで指定されているdirectoryが、quote_includeリストに追加され、-I- より後に指定されているdirectoryが、bracket_includeリストに追加される |
トップディレクトリに .config が作成される オプション設定内容を反映した include/linux/autoconf.h が作成される
include サブディレクトリ内部において、ターゲットアーキテクチャ用のヘッダーファイルを格納する asm-xxx へのシンボリックリンク asm が作成される
「-C /usr/src/linux-2.6.x」: カーネルソースツリーの指定 「SUBDIRS=$PWD」: モジュールソースディレクトリの指定
KERNEL_VERSION = $(shell uname -r) KERNEL_SRC = /lib/modules/$(KERNEL_VERSION)/build SUBDIR = $(shell pwd) all: modules obj-m := ks2k_cb.o ks2k_cb-objs := ks2k_pci.o ks2k_net.o ks2k_param.o dfu.o host_if.o rec.o send.o EXTRA = -DREDHAT9 modules: $(MAKE) -C $(KERNEL_SRC) EXTRA_CFLAGS='$(EXTRA)' SUBDIRS=$(SUBDIR) V=1 modules clean: rm -f core *.o *~ a.out *.d rm -f *.s *.i rm -f *.ko *.mod.c .*.cmd rm -f .*.ko .*.mod.c .*.cmd .*.d rm -rf .tmp_versions
TOPDIR/.config TOPDIR/include/asm が、存在するとアボートする
セクション | 配置されるもの |
---|---|
.text | 命令コード |
.data | 初期化済みデータ |
.bss | 初期化されていないデータ |
.rodata | 定数データ |