Razer Blade Pro (2019)

This page is a work in progress.

Prologue
This is a quick braindump of what was learnt during installation of Gentoo on a mid-2019 Razer Blade Pro 17 FHD. Some of it may be applicable to other Razer laptops from 2018/2019. Some of it may not apply to the reader's situation at all. Some of it may reflect the author's taste and habits.

BIOS/Firmware
If BIOS version 1.02 is installed, hold off upgrading a few seconds. There may exist a possibility to unlock a fair amount of options in the BIOS which may or may not be permanently hidden and locked, with later BIOS versions. This requires installing a modified BIOS, and installing a modified BIOS may or may not break your warranty (and your laptop). This section may possibly be expanded.

Booting the Gentoo Minimal ISO
Some quick notes:

Please disable Fast Boot. First in Windows, then shut down and do the same in the BIOS. (Hit F1 immediately/repeatedly after power on.) This is to limit the possibility that your Windows install becomes corrupted while we play around with stuff.

While in the BIOS, also disable Secure Boot, so booting from USB becomes possible. (If CSM also must be enabled is uncertain. If so, the interesting key to whack during POST becomes F12.)

The RBP17 has a spare M.2 slot. The BIOS will happily list EFI entries from one EFI partition on each boot medium. This permits having an untouched original NVME with the Windows install intact, and another device dedicated to Gentoo on the other. You will need a spare M.2 NVME device and a T5 Torx screwdriver. A heat transfer pad for the new NVME device is recommended, but not strictly required. Have a clean, dry, soft and well lit surface prior to opening the device. Take care not to scratch your brand new laptop, and make sure you know exactly where you put the screws.

The Gentoo Minimal ISO does not (at the time of writing) result in functional networking. (Neither wifi nor ethernet) Boot the installer with a well known usb wifi adapter plugged into the laptop for installing. Then grab a 5.4 kernel or better during installation.

UEFI boot from USB follows the same recipe for partitioning/GRUB as below.

Storage
Block storage is named /dev/nvme*something. No /dev/sda anymore.

Card reader
Unsure if supported by in-kernel driver yet.

Audio
A driver option is required for the HDA audio. Otherwise, the speakers will be mute.

Graphics
This is a working /etc/X11/xorg.conf, for use with x11-drivers/nvidia-drivers:

Hybrid graphics works. I emerge media-libs/mesa, x11-base/xorg-server and x11-drivers/nvidia-drivers with these flags:

ebuild  R    ] media-libs/mesa-19.3.0_rc6::gentoo  USE="X classic dri3 egl gallium gbm gles2 libglvnd llvm -d3d9 -debug -gles1 -lm-sensors -opencl -osmesa -pax_kernel (-selinux) -test -unwind -vaapi -valgrind -vdpau -vulkan -vulkan-overlay -wayland -xa -xvmc" ABI_X86="(64) -32 (-x32)" VIDEO_CARDS="i915 i965 intel (-freedreno) -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware" 0 KiB [ebuild  R    ] x11-base/xorg-server-1.20.6:0/1.20.6::gentoo  USE="ipv6 libglvnd suid udev xorg -debug -dmx -doc -elogind -kdrive -libressl -minimal (-selinux) -static-libs -systemd -unwind -wayland -xcsecurity -xephyr -xnest -xvfb" 0 KiB [ebuild  R    ] x11-drivers/nvidia-drivers-440.44:0/440::gentoo  USE="X acpi driver gtk3 kms libglvnd multilib tools -compat -static-libs -uvm -wayland" ABI_X86="(64) -32 (-x32)" 0 KiB

Using lightdm as the display manager, add this under [Seat:*] in /etc/lightdm/lightdm.conf: display-setup-script=/usr/local/bin/prepare-optimus.sh

After this, you no longer have an opengl eselect. By default, opengl stuff runs on the iGPU. To offload to the dGPU, prefix your command with:

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia

HDMI video/audio output not yet verified.

Wifi
Use driver iwlwifi. Make sure latest linux-firmware is installed.

Ethernet
Realtek 8125 is supported by r8169 in kernel 5.4.0-rc7, possibly a few rcs earlier.

Bluetooth
I believe this is part of the AX200 chip, but requires the btusb driver and appropriate firmware (intel/ibt-20-1-3.sfi, part of linux-firmware). Appears to work.

Keyboard
Audio control keys are exposed as both ACPI events and X11 keys. Ditto display backlight brightness. A Desktop Environment of choice may have prebuilt support for this. Do not make use of both mechanisms at the same time.

ACPI key events works independently of X11, but it is necessary to edit the relevant config file(s) for acpid.

Keyboard backlight keys works with no driver. This section to be expanded.

Touchpad
Rumor has it a certain minimum BIOS version for the touchpad is needed to work out of the box. This is a working /etc/X11/xorg.conf.d/70-synaptics.conf :

Sensors
Support for reading NVME temperatures comes in kernel 5.5. For now, use smartmontools or nvme-cli.

GRUB and UEFI
The installation handbook has plenty more details about GRUB and UEFI]]. The tl;dr version below deviates slightly from instructions in the link above.


 * Have a GPT partitioned NVME. (gdisk does the trick)
 * First partition should be of the order 100-200MB, type ef00.
 * Add swap, root (/) and /home partitions according to taste.
 * Format first partition as VFAT. (mkfs.vfat -F 32 /dev/nvme1n1p1verifythis )
 * mkswap for swap partition, mkfs.ext4 or mkfs.somethingelse for root and home.
 * Add partitions to /etc/fstab, first partition as '/boot'.
 * Execute:

Verify that /boot/grub and /boot/EFI got a number of files and directories present.

Add the following lines to /etc/default/grub:

Now build a kernel, place it in /boot/, and ensure it is named vmlinux-*, vmlinux-* or kernel-*. Finally, create the GRUB2-config file:

Select kernel config options for homecooked kernels
For a manual kernel configuration, a likely incomplete selection of relevant kernel config options follows:

To be expanded...