mirror of
https://codeberg.org/mart-w/nixos-x13s.git
synced 2024-11-14 19:54:47 +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
|
||||
dtb = "${config.boot.kernelPackages.kernel}/dtbs/qcom/${dtbName}";
|
||||
image = import "${inputs.nixpkgs}/nixos/lib/make-disk-image.nix" {
|
||||
inherit config lib pkgs;
|
||||
|
||||
|
@ -92,8 +91,6 @@
|
|||
|
||||
in
|
||||
{
|
||||
imports = [ "${toString modulesPath}/installer/cd-dvd/iso-image.nix" ];
|
||||
|
||||
hardware.deviceTree = {
|
||||
enable = true;
|
||||
name = "qcom/${dtbName}";
|
||||
|
@ -101,11 +98,18 @@
|
|||
|
||||
system.build.bootstrap-image = image;
|
||||
|
||||
boot.initrd.systemd.enable = true;
|
||||
boot.initrd.systemd.emergencyAccess = true;
|
||||
boot.loader.grub.enable = false;
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.systemd-boot.graceful = true;
|
||||
boot = {
|
||||
initrd = {
|
||||
systemd.enable = true;
|
||||
systemd.emergencyAccess = true;
|
||||
};
|
||||
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
systemd-boot.enable = true;
|
||||
systemd-boot.graceful = true;
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
|
@ -114,16 +118,16 @@
|
|||
bluetoothMac = "02:68:b3:29:da:98";
|
||||
};
|
||||
|
||||
isoImage = {
|
||||
makeEfiBootable = true;
|
||||
makeUsbBootable = true;
|
||||
|
||||
contents = [
|
||||
{
|
||||
source = dtb;
|
||||
target = "/x13s.dtb";
|
||||
}
|
||||
];
|
||||
fileSystems = {
|
||||
"/boot" = {
|
||||
fsType = "vfat";
|
||||
device = "/dev/disk/by-label/ESP";
|
||||
};
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
autoResize = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
|
|
27
module.nix
27
module.nix
|
@ -20,6 +20,21 @@ let
|
|||
);
|
||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
||||
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
|
||||
{
|
||||
options.nixos-x13s = {
|
||||
|
@ -44,9 +59,14 @@ in
|
|||
environment.systemPackages = [ pkgs.efibootmgr ];
|
||||
|
||||
hardware.enableAllFirmware = true;
|
||||
hardware.firmware = [ x13sPackages."x13s/extra-firmware" ];
|
||||
hardware.firmware = lib.mkBefore [ x13sPackages.graphics-firmware ];
|
||||
|
||||
boot = {
|
||||
initrd.systemd.enable = true;
|
||||
initrd.systemd.contents = {
|
||||
"/lib".source = lib.mkForce "${modulesWithExtra}/lib";
|
||||
};
|
||||
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
loader.systemd-boot.enable = lib.mkDefault true;
|
||||
loader.systemd-boot.extraFiles = {
|
||||
|
@ -65,9 +85,6 @@ in
|
|||
"pd_ignore_unused"
|
||||
"arm64.nopauth"
|
||||
# "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 = {
|
||||
|
@ -91,7 +108,7 @@ in
|
|||
"dispcc_sc8280xp"
|
||||
"phy_qcom_edp"
|
||||
"panel-edp"
|
||||
# "msm"
|
||||
"msm"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -14,12 +14,23 @@ let
|
|||
}
|
||||
);
|
||||
in
|
||||
rec {
|
||||
{
|
||||
linux_jhovold = pkgs.callPackage linux_x13s_pkg {
|
||||
src = sources.linux-jhovold;
|
||||
version = "6.11.0-rc1";
|
||||
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