User:Vokiel/Razer-Blade-15-2020

Razer Blade 15 Base Model (Early 2020) Installation Log
This page is an installation log of gentoo linux on a Razer Blade 15 Base Model with an OLED. I won't go into detailed technical explanations in this log. I may drop a number of links which may eventually die and become inaccessible. I will however document everything that I've done, what worked well and what didn't. I will try to log everything in a neutral position as much as possible. I'll set my own requirements, and make my own choices. Some of which will most likely be wrong, so don't take this page as a Guide without asking for multiple opinions on it. If you find some problematic setup, don't hesitate to share it under the Discussions tab.

This is the product string I get from dmidecode:

Requirements

 * 1) Must not dual boot Windows or any other system.
 * 2) Must use an EFI boot partition on a GPT disk.
 * 3) Must use an LVM partition setup inside a LUKS container.
 * 4) Must use a key file to unlock the LUKS partition from a USB thumb drive or key.
 * 5) Should be able to use a normal fallback password
 * 6) Must be able to suspend/hibernate
 * 7) Must use the Nvidia proprietary driver with Optimus.
 * 8) Should use OpenRC
 * 9) Should use OpenRazer
 * 10) Should use Enlightenment
 * 11) First alternative is i3
 * 12) Second alternative is Xfce
 * 13) Should use GRUB with custom Razer theme
 * 14) Should use SDDM with custom Razer theme

Making a Bootable EFI USB Key
Originally from Sakaki's EFI Install Guide

All the above worked fine, however I had to use a different key server (hkps.pool.sks-keyservers.net) to retrieve the public key from Gentoo Release Engineering. Found this domain on some random forum post. Booting the Razer was successful with the livecd prompt showing up.

Connecting to the Network
Basically followed the Network Guide, but this always fails on WIFI for various reasons. My network is under WPA-PSK, so I used net-setup and followed the setup wizard. This gave me an Unreachable Network problem, which I had to fix by adding the default gateway manually with:

Creating the Partitions
LVM will be used on this laptop, so only 2 partitions are really needed: The standard EFI partition required for booting in UEFI mode and the actual Luks encrypted partition that will contain all other partitions.

With fdisk, we create a new GPT partition table and dump whatever was there before (g). After, it's simply a matter of creating an EFI partition (n, default, default, +512M, t, 1) and then an extended Linux Filesystem partition. (n, default, default, default)

EFI Partition
Needs to be vfat according to the EFI System Partition Guide.

LUKS Partition
First step is to erase or randomize the disk data to avoid usage pattern attacks. Taken from Arch's DM-crypt Drive Preparation

Encryption scheme is chosen to match cryptsetup's default values:

{{RootCmd|cryptsetup luksFormat /dev/nvme0n1p2|output= WARNING!

=
This will overwrite data on /dev/nvme0n1p2 irrevocably.

Are you sure? (Type 'yes' in capital letters): YES Enter passphrase for /dev/nvme0n1p2: }}

LVM Partitions
The LVM partitions created are: swap, /, /var, /var/log, /var/tmp, /home and a toy partition on /media

Format all partitions, XFS will be used for all /var reads/writes whereas the other file systems can just use EXT4:

Installing Gentoo from Stage 3
Following the Handbook closely:

Fetching the installation files and verifying their signature:

Same process as with the ISOs, but on the new laptop:

Configuring make.conf
This is a minimal make.conf file:

Helper commands that I used:

From Safe CFLAGS, that is -march=skylake

Chroot to /mnt/gentoo
Largely from the Installation Guide:

Requirements on this build are made to avoid fat environments like Gnome, KDE and SystemD. Starting leaner with default/linux/amd64/17.1/desktop (stable).

Configuring the kernel
EFI partition scheme, from EFI System Partition and NVMe:

Cryptsetup and LVM options, largely from Dm-crypt and LVM:

Adding iwd options with cryptsetup options:

From our LVM partitions and other uses: Docker, F2FS, MTP & Samba:

Network drivers, OpenVPN and Android USB tethering support:

Adding Bluetooth support:

For Power Management and other Intel features:

For using the proprietary nvidia driver and other platform adjustments:

For ALSA, PulseAudio and The USB Guide:

For the IMC Networks USB Camera:

For a DualShock, Logitech devices and the touchpad:

For I2C and Thunderbolt on Intel:

All options needed for Docker, Android studio and QEMU:

Initramfs tweaks:

Trimming the security model and other useless devices:

Resizing /var
While using the system, it became obvious that I underestimated size requirements of /var. That's mainly because the legacy /usr/portage moved to /var/... I resized /media and re-allocated some space.