or how to install Fedora to laptops with Intel remapped NVME devices without possibility switch the mode to AHCI
Contents
Some new laptops, like HP ENVY 15 Laptop have problem with linux installation/work. The reason is the manufacturers use Intel Rapid Storage Technology with NVME disks and, accordingly, in the UEFI of these devices there is no possibility to switch these drives to AHCI mode, DELL Inspiron 7490 have that problem too.
The modern version of the Linux kernel does not provide support for this technology in such a combination and only shows a warning to the user to change the mode of the disks. There are two sets of patches to make these disks work, from Dan Williams, and another one from Daniel Drake based on previous, but they have not been merged into the mainline kernel.
Bad thing - both of them are not applicable for the latest kernel version.
Good thing - Daniel Drake supports his patch in Endless OS custom kernel.
- Install and use Endless OS.
- Use similar instruction for Debian/Ubuntu.
- Build Fedora custom live/installation media with a custom kernel with applied remapped NVME device support patch.
Another machine with Fedora, installed and configured sudo
is required.
Also, ~30G of free disk space and 1.5+ hours of free time is needed.
Setup environment variables:
export FEDORA_VERSION="37"
export FEDORA_ARCH="x86_64"
export PATCH_URL="https://github.com/endlessm/linux/commit/a2e548aaac239c9c3e79d61f5386856efaa98c4c.patch"
export HOST_IP=$(ip -4 addr show virbr0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
Or just source set-environment.sh script from this repository.
source set-environment.sh
-
Install build tools:
sudo dnf install fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby
-
Create working directory and enter to it:
mkdir fedora-custom-kernel
-
Get kernel package sources:
fedpkg clone -a kernel
-
Enter to the package source directory:
cd kernel
-
Switch to desired fedora kernel branch:
git checkout -b local origin/f"${FEDORA_VERSION}"
-
Install kernel build requirements:
sudo dnf builddep kernel.spec
-
Get the latest patch from Endless OS kernel repository, it can be found by searching commit with PCI: Add Intel remapped NVMe device support name.
wget -c "${PATCH_URL}" -O patch-intel-remapped-nvme-device-support.patch
-
Update kernel package spec file (kernel.spec):
- Replace
# define buildid .local
by%define buildid .local
- Add
Patch2: patch-intel-remapped-nvme-device-support.patch
line afterPatch1: patch-%{patchversion}-redhat.patch
- Add
ApplyOptionalPatch patch-intel-remapped-nvme-device-support.patch
line afterApplyOptionalPatch patch-%{patchversion}-redhat.patch
Or using command line:
sed -i 's/# define buildid .local/%define buildid .local/g' kernel.spec sed -i '/^Patch1: patch-%{patchversion}-redhat.patch/a Patch2: patch-intel-remapped-nvme-device-support.patch' kernel.spec sed -i '/^ApplyOptionalPatch patch-%{patchversion}-redhat.patch/a ApplyOptionalPatch patch-intel-remapped-nvme-device-support.patch' kernel.spec
- Replace
-
Build source package (optional):
fedpkg srpm
-
Build kernel packages:
fedpkg local
Or just use build-kernel.sh script from this repository.
./build-kernel.sh
Freshly built packages can be found in the fedora-custom-kernel/kernel/x86_64 directory.
-
Install build tools:
sudo dnf install lorax fedora-kickstarts pykickstart createrepo_c screen
-
Enter to the directory with freshly built kernel packages:
cd fedora-custom-kernel/kernel/x86_64
-
Create repository metadata:
createrepo .
-
Serve local repository with custom kernel packages:
screen -d -m python -m http.server 8080
-
Switch to main directory:
cd ../..
-
Create image build directory:
mkdir image
-
Enter image build directory:
cd image
-
Build boot image:
sudo sh -c 'setenforce 0 && lorax -p Fedora\ "${FEDORA_VERSION}" -v "${FEDORA_VERSION}" -r "${FEDORA_VERSION}" -s http://localhost:8080/ -s https://dl.fedoraproject.org/pub/fedora/linux/releases/"${FEDORA_VERSION}"/Everything/"${FEDORA_ARCH}"/os/ -s https://dl.fedoraproject.org/pub/fedora/linux/updates/"${FEDORA_VERSION}"/Everything/"${FEDORA_ARCH}"/ ./result/ && setenforce 1'
-
Create flat kickstart file:
ksflatten --config /usr/share/spin-kickstarts/fedora-live-workstation.ks -o flat-fedora-live-workstation.ks --version F"${FEDORA_VERSION}"
-
Update kickstart file:
sed -i 's#url --mirrorlist="https://mirrors.fedoraproject.org/mirrorlist?repo=rawhide\&arch=$basearch"#url --mirrorlist="https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever\&arch=$basearch"#g' flat-fedora-live-workstation.ks sed -i 's#repo --name="rawhide" --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=rawhide\&arch=$basearch#\# repo --name="rawhide" --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=rawhide\&arch=$basearch#g' flat-fedora-live-workstation.ks sed -i "/^# repo --name=\"rawhide\" --mirrorlist=https:\/\/mirrors.fedoraproject.org\/mirrorlist?repo=rawhide\&arch=\$basearch/a repo --name='fedora' --mirrorlist=https:\/\/mirrors.fedoraproject.org\/mirrorlist?repo=fedora-\$releasever\&arch=\$basearch" flat-fedora-live-workstation.ks sed -i "/^repo --name='fedora' --mirrorlist=https:\/\/mirrors.fedoraproject.org\/mirrorlist?repo=fedora-\$releasever\&arch=\$basearch/a repo --name='updates' --mirrorlist=https:\/\/mirrors.fedoraproject.org\/mirrorlist?repo=updates-released-f\$releasever\&arch=\$basearch" flat-fedora-live-workstation.ks sed -i "/^repo --name='updates' --mirrorlist=https:\/\/mirrors.fedoraproject.org\/mirrorlist?repo=updates-released-f\$releasever\&arch=\$basearch/a repo --name='fedora-custom-kernel' --cost=1 --baseurl=http:\/\/${HOST_IP}:8080/" flat-fedora-live-workstation.ks sed -i 's#part / --size=7680#part / --fstype="ext4" --size=10240#g' flat-fedora-live-workstation.ks
-
Build live/installation media image:
sudo -E sh -c 'setenforce 0 && livemedia-creator --make-iso --iso=result/images/boot.iso --ks flat-fedora-live-workstation.ks --releasever="${FEDORA_VERSION}" --macboot --resultdir=./live/ --live-rootfs-size 10 --iso-name Fedora-"${FEDORA_VERSION}" && setenforce 1'
Or just use build-image.sh script from this repository.
./build-image.sh
Congratulations, you have fedora-custom-kernel/image/live/images/boot.iso.
Now you can write it to DVD or USB flash drive using Fedora Media Writer and install it.
fedora-intel-remapped-nvme-device-support uses the Creative Commons Attribution Share Alike 4.0 International license. Please check the LICENSE file for more details.
Author: Oleksii Andrushevych vint21h@vint21h.pp.ua
For contributors list see CONTRIBUTORS file.