This will break booting into Gentoo! Any initramfs I generate in gentoo-kernel-bin has failed to load via this method and will not boot. Something must of changed with the initramfs generation, no longer allowing for this to work. Please use GRUB instead.
Seriously, do not follow this unless you want your system to not work.
This guide currently only covers instructions for the gentoo-kernel-bin package.
Since I installed Gentoo on an Intel Celeron Chromebook, I'm not waiting a day for the kernel to compile.
Adjust the instructions at your own discretion.
Also, this guide isn't intended to slander GRUB or advise you not to use it because it's bad or anything, but rather it's just providing a different way to boot Gentoo which may be better but I have no idea. More of a nerdy "Hey, look what I did!" thing.
Because why not? I mean, it's also slightly space saving. (and time saving if your doing an install on a slow machine currently)
Adding a symlink script to automatically link kernel files to two files during emerge config (Optional but Recommended)
Making symlinks for vmlinuz and initramfs really does help with convienence when updating kernels with a direct boot.
First, navigate to /usr/lib/kernel/postinst.d/ and run sudo nano 91-symlink-kernel.install
.
Copy this in.
#!/bin/bash
KERNEL_VERSION=$(ls -d /usr/src/linux-[0-9]*-gentoo-dist | sort -V | tail -n 1 | cut -d '-' -f 2)
ln -sf /boot/vmlinuz-$KERNEL_VERSION-gentoo-dist /boot/gentoo-vmlinuz
ln -sf /boot/initramfs-$KERNEL_VERSION-gentoo-dist.img /boot/gentoo-initramfs.img
echo "Successfully symlinked kernel for direct kernel booting! :3"
Make sure to run sudo chmod +x 91-symlink-kernel.install
to make it executable.
Now, run sudo emerge --config gentoo-kernel-bin
. Let it run. Once it is done, run ls -l /boot/gentoo-vmlinuz
and do the same with gentoo-initramfs.img.
If it points to /boot/vmlinuz or initramfs-yourcurrentversion-gentoo-dist, you're good to go to the next step.
Head over to https://github.com/AFellowSpeedrunner/directkernelbooting-uefikit and download the zip file from the code button.
For this next bit, I'd recommend using a USB drive, or if you really have to, your boot partition. Extract the files to the USB drive and reboot the machine into the UEFI Shell.
If you don't have a UEFI shell, then you can download the EFI file from somewhere and put it on the USB and boot to it.
After that, you can open the bootoptions.txt.example file by running edit bootoptions.txt.example
and following the instructions in the file.
After making changes to the file, press F3 and Y to save and quit.
You can now run installdirectkernel.nsh.
Usage: installdirectkernel.nsh 0 FS1:\boot\gentoo-vmlinuz "Gentoo" FS0:\bootoptions.txt
Please, for the love of god, edit this line yourself. Do not use this example or it may not boot.
After it is done, type reset into the console and your computer will restart.
Hit your BIOS key and remove the old boot entry. If all went well after saving, you should now be booting into Gentoo with no issues!
Run sudo emerge --unmerge grub
and let it work. After that head to your /efi folder or where ever GRUB is stored. Remove the EFI and GRUB files and folders. If they are also in /boot, delete them from there too BUT KEEP THE KERNEL AND SYMLINKS.
After that, you can also remove /etc/grub.d. If you really want to as well, go to /etc/fstab and remove the mount params for the boot partition and then umount the partition and delete the /efi folder.
This is just a nerdy thing I figured out within a couple of hours and really doesn't provide any kind of advantage, but it is really cool in my opinion.
Try this if you want. I hope this guide is useful for someone somewhere!
-Keyboard