編譯系統核心

sgy618發表於2011-03-29

編譯系統核心

[@more@]◇ 下載核心原始碼

◇ 安裝核心原始碼
# rpm -ivh kernel-2.6.18-128.el5.src.rpm
# mkdir /usr/src/redhat/SOURCES
◇ 進入原始碼目錄,生成核心目錄樹
# cd /usr/src/redhat/SPECS
# rpmbuild -bp --target=$(uname -m) kernel-2.6.spec
◇ 複製核心目錄樹,到正確的位置
# cp –a /usr/src/redhat/BUILDS/linux-2.6.18.i686 /usr/src/kernels/
◇ 編輯核心樹,以生成新核心模組
# cd /usr/src/kernels/linux-2.6.18.i686
# make menuconfig
◇ 編譯系統核心
# make all
# make modules_install
◇ 或者直接編譯某項功能
# make ./fs/ntfs/ 一定要以 / 結尾
CHK include/linux/version.h
CHK include/linux/utsrelease.h
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
CC arch/i386/kernel/asm-offsets.s
GEN include/asm-i386/asm-offsets.h
HOSTCC scripts/genksyms/genksyms.o
HOSTCC scripts/genksyms/lex.o
HOSTCC scripts/genksyms/parse.o
HOSTLD scripts/genksyms/genksyms
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/kallsyms
HOSTCC scripts/pnmtologo
HOSTCC scripts/conmakehash
LD fs/ntfs/built-in.o
CC [M] fs/ntfs/aops.o
CC [M] fs/ntfs/attrib.o
CC [M] fs/ntfs/collate.o
CC [M] fs/ntfs/compress.o
CC [M] fs/ntfs/debug.o
CC [M] fs/ntfs/dir.o
CC [M] fs/ntfs/file.o
CC [M] fs/ntfs/index.o
CC [M] fs/ntfs/inode.o
CC [M] fs/ntfs/mft.o
CC [M] fs/ntfs/mst.o
CC [M] fs/ntfs/namei.o
CC [M] fs/ntfs/runlist.o
CC [M] fs/ntfs/super.o
CC [M] fs/ntfs/sysctl.o
CC [M] fs/ntfs/unistr.o
CC [M] fs/ntfs/upcase.o
LD [M] fs/ntfs/ntfs.o
/bin/sh: .tmp_versions/ntfs.mod: No such file or directory
# mkdir .tmp_versions
# make ./fs/ntfs/
CHK include/linux/version.h
CHK include/linux/utsrelease.h
◇ 將所有模組合併,成為一個單一檔案
# make ./fs/ntfs/*.ko
CHK include/linux/version.h
CHK include/linux/utsrelease.h
make[1]: `fs/ntfs/aops.o' is up to date.
make[1]: `fs/ntfs/attrib.o' is up to date.
make[1]: `fs/ntfs/built-in.o' is up to date.
make[1]: `fs/ntfs/collate.o' is up to date.
make[1]: `fs/ntfs/compress.o' is up to date.
make[1]: `fs/ntfs/debug.o' is up to date.
make[1]: `fs/ntfs/dir.o' is up to date.
make[1]: `fs/ntfs/file.o' is up to date.
make[1]: `fs/ntfs/index.o' is up to date.
make[1]: `fs/ntfs/inode.o' is up to date.
make[1]: `fs/ntfs/mft.o' is up to date.
make[1]: `fs/ntfs/mst.o' is up to date.
make[1]: `fs/ntfs/namei.o' is up to date.
make[1]: `fs/ntfs/runlist.o' is up to date.
make[1]: `fs/ntfs/super.o' is up to date.
make[1]: `fs/ntfs/sysctl.o' is up to date.
make[1]: `fs/ntfs/unistr.o' is up to date.
make[1]: `fs/ntfs/upcase.o' is up to date.
MODPOST
CC fs/ntfs/ntfs.mod.o
LD [M] fs/ntfs/ntfs.ko
◇ 複製核心模組到指定目錄。
# cp ./fs/ntfs/ntfs.ko /lib/modules/2.6.18-128.el5/kernel/fs/
◇ 更新核心模組的依賴關聯式資料庫
# depmod –a
◇ 檢查
# modinfo ntfs
filename: /lib/modules/2.6.18-128.el5/kernel/fs/ntfs.ko
license: GPL
version: 2.1.27
description: NTFS 1.2/3.x driver - Copyright (c) 2001-2006 Anton Altaparmakov
author: Anton Altaparmakov <>
srcversion: 6AE6952FC613A47160AA2DE
depends:
vermagic: 2.6.18-prep SMP mod_unload 686 REGPARM 4KSTACKS gcc-4.1
◇ 使用NTFS 核心模組
# mount –t ntfs /dev/sde1 /mnt

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23168012/viewspace-1047897/,如需轉載,請註明出處,否則將追究法律責任。

相關文章