33 lines
1 KiB
Plaintext
33 lines
1 KiB
Plaintext
|
#!/usr/bin/env sh
|
||
|
ESP_MOUNTPOINT=/boot/efi
|
||
|
|
||
|
# Mounting EFI System Partition
|
||
|
mount $ESP_MOUNTPOINT
|
||
|
# Going to current Linux source directory
|
||
|
cd /usr/src/linux
|
||
|
# Removing verion record
|
||
|
rm .version
|
||
|
# Checking if we already have config or it's a new kernel
|
||
|
[[ ! -f .config ]] && zcat /proc/config.gz > .config
|
||
|
# Completing merging kernel config options with current version
|
||
|
make -j32 oldconfig &&
|
||
|
## Showing kernel configurations interface
|
||
|
#make -j8 nconfig &&
|
||
|
# Compiling kernel using -jN (where N is number of threads)
|
||
|
# Common value is N = number of CPU cores
|
||
|
make -j32 bzImage modules &&
|
||
|
# Installing kernel modules
|
||
|
make modules_install &&
|
||
|
# Rebuilding 3rd party kernel modules
|
||
|
emerge -vq @module-rebuild &&
|
||
|
# Doing backup of current kernel version and copying new version to ESP partition
|
||
|
(
|
||
|
cd $ESP_MOUNTPOINT/EFI/gentoo
|
||
|
mv -f kernel.old.efi kernel.old2.efi &>/dev/null;
|
||
|
mv -f kernel.efi kernel.old.efi &>/dev/null;
|
||
|
cp /usr/src/linux/arch/x86/boot/bzImage kernel.efi
|
||
|
) &&
|
||
|
# Showing current kernels
|
||
|
echo "Current kernel files:" &&
|
||
|
file /boot/efi/EFI/gentoo/*
|