2

I need to develop some stuff in the kernel for my honours project but im stuck at simply getting a stock kernel to compile and boot.

I've followed a few recipes but all of them just result in the following messages with NO other output or errors:

Loading Linux 5.7.11 ...
Loading initial ramdisk ...

After that it just stops. I've left it for hours with no change.

I've tried removing as many variables as possible and am mainly following this tutorial: https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html.

I've also done the exact same tutorial on VirtualBox and it works fine, so I'm thinking it's something specific to my Lenovo Ideapad S145. But I just don't know where to start debugging as there is just no output or error messages at all.

I should also add that I'm using Ubuntu 20.04.1 LTS.

Thanks in advance.

Edit: The exact process I use for comipling and installing is:

Download the latest stable from https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.7.11.tar.xz

unxz -v linux-5.7.11.tar.xz
tar -xvf linux-5.7.11.tar.xz
cd linux-5.7.11
cp /boot/config-5.4.0-42-generic .config
make menuconfig

Then I dont change anything and just save straight away

make -j 4
sudo make modules_install
sudo make install

The "make install" part does all the grub setup for me, then I just reboot and it gets stuck. These exact steps work on virtualbox but dont on my real Lenovo laptop.

Tristus
  • 21
  • 1
    You need to see the boot messages. Either boot the broken kernel, reboot and run journalctl -e -b 1 to see the log output of the last boot, or else edit /etc/default/grub in a working kernel, find the line that starts GRUB_CMDLINE_LINUX_DEFAULT and you'll probably see quiet splash, alter that to debug and save, then run sudo update-grub and reboot to the broken kernel; you'll then see the output of the boot log as you boot. Hopefully, this will give some indication of the problem. – Dan Scally Jul 31 '20 at 05:19
  • 2
    Thanks for the replies guys. @Do I did some tests and ive put "loglevel=7 debug" into the grub config, and when i boot my working kernel there is a butt ton of messages, but still none from my compiled kernel. I also did a test where I first booted the broken kernel and noted the time, then 10minutes latter I booted the working kernel, so that i could differentiate them in journalctl. Unfortunatly it looks like the broken kernel isnt even getting to the stage of logging anything in journal control :-/ . – Tristus Jul 31 '20 at 05:44
  • @DougSmythies Im about to commute home for the day, but once im there, ill try your method. – Tristus Jul 31 '20 at 05:50
  • It is unclear how you build kernels and how you install them. For me it works. – Pilot6 Jul 31 '20 at 06:50
  • @Pilot6 ah sorry, ive just added an edit to show the exact steps that Ive been doing. – Tristus Aug 02 '20 at 05:26
  • This is a wrong way to compile kernels for Ubuntu. Also maybe Secure Boot is enabled. – Pilot6 Aug 02 '20 at 08:19
  • @Pilot6 ah okay I see, though im still a little confused as it worked fine with the same version of Ubuntu on VirtualBox. How would you recommend I compile for Ubuntu 20? – Tristus Aug 02 '20 at 08:39
  • VirtualBox doesn't have Secure Boot. You can get the latest mainline kernels already compiled for Ubuntu here. You can also get debianized sources from git and build them using debian/rules. Using make install is completely wrong. – Pilot6 Aug 02 '20 at 08:45
  • ah sorry guys, i should have replied to this earlier. I got it working by following @DougSmythies method. I just added the "bindeb-pkg" parameter which builds the .dep packages and installing them worked. So ultimately I think I must have been doing somethings wrong when generating the initram or installing the kernel. – Tristus Aug 13 '20 at 06:19

2 Answers2

1

Instead of building the mainline kernel with make and installing it with make install you probably are better to try building a debian packaging from the kernel source and installing the .debs. That way you can easily remove it too.

unxz -v linux-5.7.11.tar.xz
tar -xvf linux-5.7.11.tar.xz
cd linux-5.7.11
cp /boot/config-5.4.0-42-generic .config

make deb-pkg INSTALL_MOD_STRIP=1 cd .. sudo dpkg -i *deb

0

if you are using grub (which it looks like you are) press e on the boot entry to temporerally edit it and remove the line saying gfxpayload=keep.

I've had this same issue before and removing that grub option fixed it. To make this permanent edit the /etc/default/grub file and look for a line saying GRUB_GFXPAYLOAD_LINUX=keep and delete it.

Whoman
  • 1