From 907b497d7e7669f3c2794ab313f8c42f80929bd6 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 19 Aug 2022 19:57:13 +0300 Subject: [PATCH] nixos/hardware/device-tree: use symbols from the exact kernel package --- nixos/modules/hardware/device-tree.nix | 23 ++++--------------- .../linux/kernel/manual-config.nix | 2 +- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index 55852776220d..4ce3a3e6c6af 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -56,23 +56,6 @@ let }; }; - # this requires kernel package - dtbsWithSymbols = pkgs.stdenv.mkDerivation { - name = "dtbs-with-symbols"; - inherit (cfg.kernelPackage) src nativeBuildInputs depsBuildBuild; - patches = map (patch: patch.patch) cfg.kernelPackage.kernelPatches; - buildPhase = '' - patchShebangs scripts/* - substituteInPlace scripts/Makefile.lib \ - --replace 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget))' 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) -@' - make ${pkgs.stdenv.hostPlatform.linux-kernel.baseConfig} ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" - make dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" - ''; - installPhase = '' - make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" - ''; - }; - filterDTBs = src: if isNull cfg.filter then "${src}/dtbs" else @@ -83,6 +66,8 @@ let | xargs -0 cp -v --no-preserve=mode --target-directory $out --parents ''; + filteredDTBs = filterDTBs cfg.kernelPackage; + # Compile single Device Tree overlay source # file (.dts) into its compiled variant (.dtbo) compileDTS = name: f: pkgs.callPackage({ stdenv, dtc }: stdenv.mkDerivation { @@ -197,7 +182,7 @@ in }; hardware.deviceTree.package = if (cfg.overlays != []) - then pkgs.deviceTree.applyOverlays (filterDTBs dtbsWithSymbols) (withDTBOs cfg.overlays) - else (filterDTBs cfg.kernelPackage); + then pkgs.deviceTree.applyOverlays filteredDTBs (withDTBOs cfg.overlays) + else filteredDTBs; }; } diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 36f033419a1d..a7d31de6eb75 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -186,7 +186,7 @@ let kernelConf.target "vmlinux" # for "perf" and things like that ] ++ optional isModular "modules" - ++ optional buildDTBs "dtbs" + ++ optionals buildDTBs ["dtbs" "DTC_FLAGS=-@"] ++ extraMakeFlags; installFlags = [