在 Debian Linux 下编译 Kernel 4.2 时出现问题 (Jessie)

在 Debian Linux 下编译 Kernel 4.2 时出现问题 (Jessie)

这是我第一次尝试编译内核。我有一个全新的极简主义 Debian Jessie 安装,然后我...

sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils
sudo apt-get install kernel-package

获取内核

cd /mnt/local/btrfs_a/Kernel\ Downloads/
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.2.tar.xz

提炼

tar xvf linux-4.2.tar.xz
cd linux-4.2

复制现有的内核配置文件

cp /boot/config-$(uname -r) .config

以下几行没有进行任何更改...

make menuconfig
make-kpkg clean

编译

fakeroot make-kpkg --initrd --revision=1.0.NAS kernel_image kernel_headers

但这会导致:

IHEX    firmware/yam/1200.bin
IHEX    firmware/yam/9600.bin
make[1]: Leaving directory '/mnt/local/btrfs_a/Kernel Downloads/linux-4.2'
COLUMNS=150 dpkg -l 'gcc*' perl dpkg 'libc6*' binutils make dpkg-dev |\
awk '$1 ~ /[hi]i/ { printf("%s-%s\n", $2, $3) }'> debian/stamp/build/info
uname -a >> debian/stamp/build/info
echo using the compiler: >> debian/stamp/build/info
if [ -f include/generated/compile.h ]; then                      \
   grep LINUX_COMPILER include/generated/compile.h |             \
     sed -e 's/.*LINUX_COMPILER "//' -e 's/"$//' >>             \
               debian/stamp/build/info;                                  \
        elif [ -f include/linux/compile.h  ]; then                       \
    grep LINUX_COMPILER include/linux/compile.h |                \
      sed -e 's/.*LINUX_COMPILER "//' -e 's/"$//' >>            \
                debian/stamp/build/info;                                 \
         fi
echo done > debian/stamp/build/kernel
/usr/bin/make -f ./debian/rules         debian/stamp/binary/pre-linux-image-4.2.0
make[1]: Entering directory '/mnt/local/btrfs_a/Kernel Downloads/linux-4.2'
====== making target debian/stamp/install/linux-image-4.2.0 [new prereqs: ]======
This is kernel package version 13.014+nmu1.
rm -f -r .//mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0 .//mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0.deb
install -p -d -o root -g root  -m  755 /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/postinst.d /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/preinst.d \
              /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/postrm.d /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/etc/kernel/prerm.d
install -p -d -o root -g root  -m  755 /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0//boot
install -p -d -o root -g root  -m  755 /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/usr/share/doc/linux-image-4.2.0/examples
install -p    -o root -g root  -m  644 debian/changelog /mnt/local/btrfs_a/Kernel Downloads/linux-4.2/debian/linux-image-4.2.0/usr/share/doc/linux-image-4.2.0/changelog.Debian
install: target ‘Downloads/linux-4.2/debian/linux-image-4.2.0/usr/share/doc/linux-image-4.2.0/changelog.Debian’ is not a directory
debian/ruleset/targets/image.mk:34: recipe for target 'debian/stamp/install/linux-image-4.2.0' failed
make[1]: *** [debian/stamp/install/linux-image-4.2.0] Error 1
make[1]: Leaving directory '/mnt/local/btrfs_a/Kernel Downloads/linux-4.2'
debian/ruleset/local.mk:105: recipe for target 'kernel_image' failed
make: *** [kernel_image] Error 2

好的,我的初始文件夹是 ../Kernel Downloads/.. 一时兴起,我将其更改为“KernelDownloads”(没有空格)并尝试重新编译(从顶部)。现在它问我一大堆问题,这正常吗?我只是按回车键来获取默认值。这是正确的做法吗?

答案1

被问很多问题是制作内核的一种可能途径。我的知识有点老,但我倾向于从“make xconfig”开始,然后你可以浏览配置。都是同样的问题,但感觉不那么无情。

全部采用默认值是合理的。

答案2

看起来问题可能是内核文件所在的文件夹结构中存在空格。删除该空格后,一切正常!

相关内容