【问题标题】:Unable to install Linux kernel on Ubuntu 20.04无法在 Ubuntu 20.04 上安装 Linux 内核
【发布时间】:2021-12-08 15:25:44
【问题描述】:

我是内核社区的新手,我正在学习如何编译和安装 Linux 内核,但我无法安装它。我正在运行 6 核 Ryzen 5 和 Ubuntu 20.04 LTS,并且我的编译器使用 gcc。我当前的内核版本是 5.11.0-38-generic,我正在尝试编译和安装 5.14.14 版本。简而言之,我使用 Greg Kroah Heartman 的 Linux Kernel 作为指南。首先,我从 kernel.org 下载最新的主线内核。然后,我运行make menuconfig 为我的系统生成一个.config。接下来,我运行make -j12 编译内核,它运行良好并且没有返回任何错误。我一直在安装它时遇到麻烦。运行make install 后,我得到以下错误输出:

arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
sh ./arch/x86/boot/install.sh \
    5.14.14 arch/x86/boot/bzImage \
    System.map "/boot"

 *** Missing file: arch/x86/boot/bzImage
 *** You need to run "make" before "make install".

make[1]: *** [arch/x86/boot/Makefile:161: install] Error 1
make: *** [arch/x86/Makefile:280: install] Error 2

install.sh 告诉我我的 arch 目录中没有 bzImage 文件。我检查了,确实文件丢失了。我尝试查找“丢失的 bzImage 文件”,但找不到任何有用的信息。为什么 make 不生成一个大的 zImage 文件?

【问题讨论】:

  • 安装部分需要root权限,即sudo make modules_install && sudo make install。而且,也许您需要手动编译 bzImage,即在安装部分之前make bzImage
  • 我以 root 用户运行 make install 并以非 root 用户身份编译,但它不起作用。我会在运行 make 之前尝试运行 make bzImage 看看它是否有效。

标签: gcc linux-kernel gnu-make ubuntu-12.04


【解决方案1】:

我在上述评论中尝试了 Justin Iurman 的建议,它对安装内核很有用。我需要在make 之前运行make bzImage。在make bzImage 成功之前,我必须在配置文件中编辑一行。但是,sudo make install 给出了一些奇怪的输出:

arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
sh ./arch/x86/boot/install.sh \
    5.14.14 arch/x86/boot/bzImage \
    System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.14.14 /boot/vmlinuz-5.14.14
run-parts: executing /etc/kernel/postinst.d/dkms 5.14.14 /boot/vmlinuz-5.14.14
 * dkms: running auto installation service for kernel 5.14.14                                                                                                                                              Error! Your kernel headers for kernel 5.14.14 cannot be found.
Please install the linux-headers-5.14.14 package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 5.14.14 cannot be found.
Please install the linux-headers-5.14.14 package,
or use the --kernelsourcedir option to tell DKMS where it's located
                                                                                                                                                                                                    [ OK ]
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.14.14 /boot/vmlinuz-5.14.14
update-initramfs: Generating /boot/initrd.img-5.14.14
W: missing /lib/modules/5.14.14
W: Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/5.14.14: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
cat: /var/tmp/mkinitramfs_lEKSEC/lib/modules/5.14.14/modules.builtin: No such file or directory
depmod: WARNING: could not open modules.order at /var/tmp/mkinitramfs_lEKSEC/lib/modules/5.14.14: No such file or directory
depmod: WARNING: could not open modules.builtin at /var/tmp/mkinitramfs_lEKSEC/lib/modules/5.14.14: No such file or directory
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 5.14.14 /boot/vmlinuz-5.14.14
run-parts: executing /etc/kernel/postinst.d/update-notifier 5.14.14 /boot/vmlinuz-5.14.14
run-parts: executing /etc/kernel/postinst.d/xx-update-initrd-links 5.14.14 /boot/vmlinuz-5.14.14
I: /boot/initrd.img.old is now a symlink to initrd.img-5.11.0-38-generic
I: /boot/initrd.img is now a symlink to initrd.img-5.14.14
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 5.14.14 /boot/vmlinuz-5.14.14
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.14.14
Found initrd image: /boot/initrd.img-5.14.14
Found linux image: /boot/vmlinuz-5.11.0-38-generic
Found initrd image: /boot/initrd.img-5.11.0-38-generic
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

看来虽然我可以安装内核,但它没有正常启动,但由于我的问题是关于安装内核,所以我将这个问题标记为关闭。

【讨论】:

    猜你喜欢
    • 2021-08-10
    • 2020-10-03
    • 2021-05-24
    • 2021-11-28
    • 2022-08-17
    • 2020-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多