mirror of
https://codeberg.org/mart-w/nixos-x13s.git
synced 2024-11-21 14:54:49 +01:00
finally load the gpu firmware in initrd
This commit is contained in:
parent
8e16dc9e6a
commit
14777d1f0c
40
flake.nix
40
flake.nix
|
@ -79,7 +79,6 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
dtb = "${config.boot.kernelPackages.kernel}/dtbs/qcom/${dtbName}";
|
|
||||||
image = import "${inputs.nixpkgs}/nixos/lib/make-disk-image.nix" {
|
image = import "${inputs.nixpkgs}/nixos/lib/make-disk-image.nix" {
|
||||||
inherit config lib pkgs;
|
inherit config lib pkgs;
|
||||||
|
|
||||||
|
@ -92,8 +91,6 @@
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ "${toString modulesPath}/installer/cd-dvd/iso-image.nix" ];
|
|
||||||
|
|
||||||
hardware.deviceTree = {
|
hardware.deviceTree = {
|
||||||
enable = true;
|
enable = true;
|
||||||
name = "qcom/${dtbName}";
|
name = "qcom/${dtbName}";
|
||||||
|
@ -101,11 +98,18 @@
|
||||||
|
|
||||||
system.build.bootstrap-image = image;
|
system.build.bootstrap-image = image;
|
||||||
|
|
||||||
boot.initrd.systemd.enable = true;
|
boot = {
|
||||||
boot.initrd.systemd.emergencyAccess = true;
|
initrd = {
|
||||||
boot.loader.grub.enable = false;
|
systemd.enable = true;
|
||||||
boot.loader.systemd-boot.enable = true;
|
systemd.emergencyAccess = true;
|
||||||
boot.loader.systemd-boot.graceful = true;
|
};
|
||||||
|
|
||||||
|
loader = {
|
||||||
|
grub.enable = false;
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
systemd-boot.graceful = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
@ -114,16 +118,16 @@
|
||||||
bluetoothMac = "02:68:b3:29:da:98";
|
bluetoothMac = "02:68:b3:29:da:98";
|
||||||
};
|
};
|
||||||
|
|
||||||
isoImage = {
|
fileSystems = {
|
||||||
makeEfiBootable = true;
|
"/boot" = {
|
||||||
makeUsbBootable = true;
|
fsType = "vfat";
|
||||||
|
device = "/dev/disk/by-label/ESP";
|
||||||
contents = [
|
};
|
||||||
{
|
"/" = {
|
||||||
source = dtb;
|
device = "/dev/disk/by-label/nixos";
|
||||||
target = "/x13s.dtb";
|
fsType = "ext4";
|
||||||
}
|
autoResize = true;
|
||||||
];
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
27
module.nix
27
module.nix
|
@ -20,6 +20,21 @@ let
|
||||||
);
|
);
|
||||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
||||||
dtbEfiPath = "dtbs/x13s.dtb";
|
dtbEfiPath = "dtbs/x13s.dtb";
|
||||||
|
|
||||||
|
modulesClosure = pkgs.makeModulesClosure {
|
||||||
|
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
|
||||||
|
kernel = config.system.modulesTree;
|
||||||
|
firmware = config.hardware.firmware;
|
||||||
|
allowMissing = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
modulesWithExtra = pkgs.symlinkJoin {
|
||||||
|
name = "modules-closure";
|
||||||
|
paths = [
|
||||||
|
modulesClosure
|
||||||
|
x13sPackages.graphics-firmware
|
||||||
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.nixos-x13s = {
|
options.nixos-x13s = {
|
||||||
|
@ -44,9 +59,14 @@ in
|
||||||
environment.systemPackages = [ pkgs.efibootmgr ];
|
environment.systemPackages = [ pkgs.efibootmgr ];
|
||||||
|
|
||||||
hardware.enableAllFirmware = true;
|
hardware.enableAllFirmware = true;
|
||||||
hardware.firmware = [ x13sPackages."x13s/extra-firmware" ];
|
hardware.firmware = lib.mkBefore [ x13sPackages.graphics-firmware ];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
initrd.systemd.enable = true;
|
||||||
|
initrd.systemd.contents = {
|
||||||
|
"/lib".source = lib.mkForce "${modulesWithExtra}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
loader.efi.canTouchEfiVariables = true;
|
loader.efi.canTouchEfiVariables = true;
|
||||||
loader.systemd-boot.enable = lib.mkDefault true;
|
loader.systemd-boot.enable = lib.mkDefault true;
|
||||||
loader.systemd-boot.extraFiles = {
|
loader.systemd-boot.extraFiles = {
|
||||||
|
@ -65,9 +85,6 @@ in
|
||||||
"pd_ignore_unused"
|
"pd_ignore_unused"
|
||||||
"arm64.nopauth"
|
"arm64.nopauth"
|
||||||
# "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power
|
# "regulator_ignore_unused" # allows for > 30 sec to load msm, at the potential cost of power
|
||||||
|
|
||||||
# blacklist graphics in initrd so the firmware can load from disk
|
|
||||||
"rd.driver.blacklist=msm"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
initrd = {
|
initrd = {
|
||||||
|
@ -91,7 +108,7 @@ in
|
||||||
"dispcc_sc8280xp"
|
"dispcc_sc8280xp"
|
||||||
"phy_qcom_edp"
|
"phy_qcom_edp"
|
||||||
"panel-edp"
|
"panel-edp"
|
||||||
# "msm"
|
"msm"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,12 +14,23 @@ let
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
rec {
|
{
|
||||||
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
|
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
|
||||||
src = sources.linux-jhovold;
|
src = sources.linux-jhovold;
|
||||||
version = "6.11.0-rc1";
|
version = "6.11.0-rc1";
|
||||||
defconfig = "johan_defconfig";
|
defconfig = "johan_defconfig";
|
||||||
};
|
};
|
||||||
|
|
||||||
"x13s/extra-firmware" = pkgs.callPackage ./extra-firmware.nix { };
|
graphics-firmware =
|
||||||
|
let
|
||||||
|
gpu-src = pkgs.fetchurl {
|
||||||
|
url = "https://download.lenovo.com/pccbbs/mobiles/n3hdr20w.exe";
|
||||||
|
hash = "sha256-Jwyl9uKOnjpwfHd+VaGHjYs9x8cUuRdFCERuXqaJwEY=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.runCommand "graphics-firmware" { } ''
|
||||||
|
mkdir -vp "$out/lib/firmware/qcom/sc8280xp/LENOVO/21BX"
|
||||||
|
${lib.getExe pkgs.innoextract} ${gpu-src}
|
||||||
|
cp -v code\$GetExtractPath\$/*/*.mbn "$out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/"
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
{ stdenvNoCC, fetchFromGitHub }:
|
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
|
||||||
pname = "x13s-extra-firmware";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "ironrobin";
|
|
||||||
repo = "x13s-alarm";
|
|
||||||
rev = "efa51c3b519f75b3983aef67855b1561d9828771";
|
|
||||||
sha256 = "sha256-weETbWXz9aL2pDQDKk7fkb1ecQH0qrhUYDs2E5EiJcI=";
|
|
||||||
};
|
|
||||||
|
|
||||||
dontFixup = true;
|
|
||||||
dontBuild = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX
|
|
||||||
cp x13s-firmware/qcvss8280.mbn $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/
|
|
||||||
'';
|
|
||||||
}
|
|
Loading…
Reference in a new issue