Unable to install Linux kernel on Ubuntu 20.04

2.2k views Asked by At

I'm new to the kernel community and I'm learning how to compile and install the Linux kernel, but I'm unable to install it. I'm running a 6 core Ryzen 5 and Ubuntu 20.04 LTS, and I'm using gcc for my compiler. My current kernel version is 5.11.0-38-generic and I'm trying to compile and install version 5.14.14. I'm using Greg Kroah Heartman's Linux Kernel in a nutshell as a guide. First I download the most recent mainline kernel from kernel.org. Then, I run make menuconfig to generate a .config for my system. Next, I run make -j12 to compile the kernel, which runs fine and doesn't return any errors. I've been running into trouble with installing it. After running make install I get the following error output:

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 is telling me that there is no bzImage file in my arch directory. I checked and indeed the file is missing. I tried looking up "missing bzImage file" but couldn't find anything helpful. Why isn't make generating a big zImage file?

1

There are 1 answers

0
David Chidester On BEST ANSWER

I tried Justin Iurman's recommendation in the above comment and it worked for installing the kernel. I needed to run make bzImage before make. I had to edit one line in the config file before make bzImage was successful. However, sudo make install gave some strange output:

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

It seems that although I was able to install the kernel, it didn't boot properly, but since my question was on installing the kernel, I'll mark this question closed.