scripts/kernel_update.sh
2022-08-24 16:40:31 +02:00

38 lines
910 B
Bash
Executable file

#!/bin/bash
# Note: this script is meant to run post emerge --depclean
eselect kernel set 1
cp /usr/src/linux-$(uname -r)/.config /usr/src/linux
genkernel --install --lvm --luks --no-mountboot --no-ramdisk-modules \
--compress-initramfs-type=lz4 --initramfs-filename=initramfs.img initramfs
if [ -d "/usr/src/initramfs" ]; then
lz4cat /boot/initramfs.img | cpio --directory=/usr/src/initramfs -imdv
else
echo "/usr/src/initramfs does not exist. exiting"
exit
fi
cd /usr/src/linux
make -j16
if [ $? -eq 0 ]; then
mount /dev/nvme0n1p1 /boot/efi
cp arch/x86/boot/bzImage /boot/efi/EFI/Gentoo/gentoox64.efi
else
echo "Kernel compilation failed. Exiting"
exit
fi
# Signing for SecureBoot, expected directory is /etc/efikeys/
cd /etc/efikeys/
sbsign --key db.key --cert db.crt --output /boot/efi/EFI/Gentoo/gentoox64.efi /boot/efi/EFI/Gentoo/gentoox64.efi
umount /boot/efi