我正在尝试了解 Linux 内核,并且发现了一本我想读的好书。起始要求是一个易于构建的内核,我现在正在努力实现几天。截至目前,我正在运行带有 2.6.32-5 内核的 Debian Squeeze,这也是我想要“重新编译”的版本。该设置是在运行 Ubuntu 作为主机的 VM 上进行的。我还有足够的剩余空间(~21GB)。
我遵循的最后一个手册是Debian jessie 发行说明中的“编译新内核”。
所以我转到从 kernel.org 获得的解压内核包并运行
make menuconfig #(left the defaults there)
make-kpkg clean
fakeroot make-kpkg --initrd --revision=1.0.custom kernel_image
这会产生以下输出:
====== making target debian/stamp/conf/minimal_debian [new prereqs: ]======
This is kernel package version 13.014+nmu1.
test -d debian || mkdir debian
test ! -e stamp-building || rm -f stamp-building
install -p -m 755 /usr/share/kernel-package/rules debian/rules
for file in ChangeLog Control Control.bin86 config templates.in rules; do \
cp -f /usr/share/kernel-package/$file ./debian/; \
done
for dir in Config docs examples ruleset scripts pkg po; do \
cp -af /usr/share/kernel-package/$dir ./debian/; \
done
test -f debian/control || sed -e 's/=V/2.6.32.5/g' \
-e 's/=D/1.0.custom/g' -e 's/=A/amd64/g' \
-e 's/=SA//g' \
-e 's/=I//g' \
-e 's/=CV/2.6/g' \
-e 's/=M/Unknown Kernel Package Maintainer <[email protected]>/g' \
-e 's/=ST/linux/g' -e 's/=B/x86_64/g' \
-e 's/=R//g' /usr/share/kernel-package/Control > debian/control
test -f debian/changelog || sed -e 's/=V/2.6.32.5/g' \
-e 's/=D/1.0.custom/g' -e 's/=A/amd64/g' \
-e 's/=ST/linux/g' -e 's/=B/x86_64/g' \
-e 's/=M/Unknown Kernel Package Maintainer <[email protected]>/g' \
/usr/share/kernel-package/changelog > debian/changelog
chmod 0644 debian/control debian/changelog
test -d ./debian/stamp || mkdir debian/stamp
make -f debian/rules debian/stamp/conf/kernel-conf
make[1]: Entering directory '/root/kernel/linux-2.6.32.5'
====== making target debian/stamp/conf/kernel-conf [new prereqs: ]======
make ARCH=x86_64 \
oldconfig;
make[2]: Entering directory '/root/kernel/linux-2.6.32.5'
scripts/kconfig/conf -o arch/x86/Kconfig
#
# configuration written to .config
#
make[2]: Leaving directory '/root/kernel/linux-2.6.32.5'
make ARCH=x86_64 prepare
make[2]: Entering directory '/root/kernel/linux-2.6.32.5'
scripts/kconfig/conf -s arch/x86/Kconfig
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/linux/utsrelease.h
UPD include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CC kernel/bounds.s
GEN include/linux/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN include/asm/asm-offsets.h
CALL scripts/checksyscalls.sh
make[2]: Leaving directory '/root/kernel/linux-2.6.32.5'
echo done > debian/stamp/conf/kernel-conf
make[1]: Leaving directory '/root/kernel/linux-2.6.32.5'
make -f debian/rules debian/stamp/conf/full-changelog
make[1]: Entering directory '/root/kernel/linux-2.6.32.5'
====== making target debian/stamp/conf/full-changelog [new prereqs: ]======
for file in ChangeLog Control Control.bin86 config templates.in rules; do \
cp -f /usr/share/kernel-package/$file ./debian/; \
done
for dir in Config docs examples ruleset scripts pkg po; do \
cp -af /usr/share/kernel-package/$dir ./debian/; \
done
install -p -m 755 /usr/share/kernel-package/rules debian/rules
sed -e 's/=V/2.6.32.5/g' \
-e 's/=D/1.0.custom/g' -e 's/=A/amd64/g' \
-e 's/=SA//g' \
-e 's/=I//g' \
-e 's/=CV/2.6/g' \
-e 's/=M/Unknown Kernel Package Maintainer <[email protected]>/g' \
-e 's/=ST/linux/g' -e 's/=B/x86_64/g' \
-e 's/=R//g' /usr/share/kernel-package/Control > debian/control
sed -e 's/=V/2.6.32.5/g' -e 's/=D/1.0.custom/g' \
-e 's/=A/amd64/g' -e 's/=M/Unknown Kernel Package Maintainer <[email protected]>/g' \
-e 's/=ST/linux/g' -e 's/=B/x86_64/g' \
/usr/share/kernel-package/changelog > debian/changelog
chmod 0644 debian/control debian/changelog
make -f debian/rules debian/stamp/conf/kernel-conf
make[2]: Entering directory '/root/kernel/linux-2.6.32.5'
make[2]: 'debian/stamp/conf/kernel-conf' is up to date.
make[2]: Leaving directory '/root/kernel/linux-2.6.32.5'
make[1]: Leaving directory '/root/kernel/linux-2.6.32.5'
echo done > debian/stamp/conf/minimal_debian
====== making target debian/stamp/conf/vars [new prereqs: ]======
====== making target debian/stamp/build/kernel [new prereqs: vars]======
This is kernel package version 13.014+nmu1.
restore_upstream_debianization
test ! -f scripts/package/builddeb.kpkg-dist || mv -f scripts/package/builddeb.kpkg-dist scripts/package/builddeb
test ! -f scripts/package/Makefile.kpkg-dist || mv -f scripts/package/Makefile.kpkg-dist scripts/package/Makefile
/usr/bin/make ARCH=x86_64 \
bzImage
make[1]: Entering directory '/root/kernel/linux-2.6.32.5'
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CALL scripts/checksyscalls.sh
HOSTCC scripts/genksyms/genksyms.o
SHIPPED scripts/genksyms/lex.c
SHIPPED scripts/genksyms/parse.h
SHIPPED scripts/genksyms/keywords.c
HOSTCC scripts/genksyms/lex.o
SHIPPED scripts/genksyms/parse.c
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/selinux/mdp/mdp
HOSTCC scripts/kallsyms
HOSTCC scripts/conmakehash
CC init/main.o
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
CC init/do_mounts.o
CC init/do_mounts_initrd.o
LD init/mounts.o
CC init/initramfs.o
CC init/calibrate.o
LD init/built-in.o
HOSTCC usr/gen_init_cpio
GEN usr/initramfs_data.cpio
AS usr/initramfs_data.o
LD usr/built-in.o
LD arch/x86/crypto/built-in.o
AS arch/x86/ia32/ia32entry.o
CC arch/x86/ia32/sys_ia32.o
CC arch/x86/ia32/ia32_signal.o
CC arch/x86/ia32/ipc32.o
CC arch/x86/ia32/ia32_aout.o
CC arch/x86/ia32/audit.o
LD arch/x86/ia32/built-in.o
CC arch/x86/kernel/process_64.o
CC arch/x86/kernel/signal.o
AS arch/x86/kernel/entry_64.o
scripts/Makefile.build:265: recipe for target 'arch/x86/kernel/entry_64.o' failed
scripts/Makefile.build:365: recipe for target 'arch/x86/kernel' failed
Makefile:878: recipe for target 'arch/x86' failed
make[1]: Leaving directory '/root/kernel/linux-2.6.32.5'
debian/ruleset/targets/common.mk:295: recipe for target 'debian/stamp/build/kernel' failed
我在 UNIX 使用方面经验丰富(使用 Linux 已有几年),但到目前为止对内核一无所知。有人能帮忙吗?