Gentoo – Building gentoo-sources automatically

In an effort to simplify and streamline the build process for updating and installing the frequent kernel updates outside of the Gentoo’s stable branch:

CURRENTKERNEL=$(ls /usr/src/linux -l | grep -o 'linux-[0-9]*.[0-9]*.[0-9]*-gentoo')
eselect kernel list
echo "Select kernel number:"
read -r SELKERN
eselect kernel set $SELKERN
cp "$KERNELDIRECTORY/.config" "/usr/src/linux/"
cd /usr/src/linux
make oldconfig
make menuconfig
make modules_prepare
make -j8
make modules_install
make install
#emerge acpi_call

What to modify:

  • make -j8 _ Change 8 to number of cores to compile on your system. This is fastest when set to be equal to the number of cores or logical threads on your system.
  • #emerge acpi_call _ Remove this if not using this module, if using a different module, change acpi_call to that module, or make a list: emerge module1 module2 etc.