From 817c3793d41830410e1a22de2db94bf6ebb2f8d3 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 18 Feb 2023 15:13:19 +0000 Subject: [PATCH] move dts config from kernel to boot The kernel does not need to know about the DTS. I am prepared to be very slightly injured on this hill. --- devices/gl-ar750/default.nix | 12 ++++++------ devices/gl-mt300a/default.nix | 12 ++++++------ devices/gl-mt300n-v2/default.nix | 12 ++++++------ modules/base.nix | 22 ++++++++++++---------- modules/outputs.nix | 4 ++-- 5 files changed, 32 insertions(+), 30 deletions(-) diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix index 65dc16f..7666226 100644 --- a/devices/gl-ar750/default.nix +++ b/devices/gl-ar750/default.nix @@ -42,6 +42,12 @@ boot.tftp = { loadAddress = "0x00A00000"; }; + boot.dts = { + src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts"; + includes = [ + "${openwrt}/target/linux/ath79/dts" + ]; + }; kernel = { src = pkgs.pkgsBuildBuild.fetchurl { name = "linux.tar.gz"; @@ -61,12 +67,6 @@ patches ${openwrt}/target/linux/generic/hack-5.15/*.patch patches ${openwrt}/target/linux/ath79/patches-5.15/*.patch ''; - dts = { - src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts"; - includes = [ - "${openwrt}/target/linux/ath79/dts" - ]; - }; config = { MIPS_ELF_APPENDED_DTB = "y"; OF = "y"; diff --git a/devices/gl-mt300a/default.nix b/devices/gl-mt300a/default.nix index 1cdfec3..5c8a137 100644 --- a/devices/gl-mt300a/default.nix +++ b/devices/gl-mt300a/default.nix @@ -29,6 +29,12 @@ boot.tftp = { loadAddress = "0x00A00000"; }; + boot.dts = { + src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts"; + includes = [ + "${openwrt}/target/linux/ramips/dts" + ]; + }; kernel = { src = pkgs.fetchurl { @@ -49,12 +55,6 @@ patches ${openwrt}/target/linux/generic/hack-5.15/*.patch patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch ''; - dts = { - src = "${openwrt}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts"; - includes = [ - "${openwrt}/target/linux/ramips/dts" - ]; - }; config = { MIPS_ELF_APPENDED_DTB = "y"; OF = "y"; diff --git a/devices/gl-mt300n-v2/default.nix b/devices/gl-mt300n-v2/default.nix index a47d12a..52718c4 100644 --- a/devices/gl-mt300n-v2/default.nix +++ b/devices/gl-mt300n-v2/default.nix @@ -29,6 +29,12 @@ boot.tftp = { loadAddress = "0x00A00000"; }; + boot.dts = { + src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts"; + includes = [ + "${openwrt}/target/linux/ramips/dts" + ]; + }; kernel = { src = pkgs.fetchurl { @@ -49,12 +55,6 @@ patches ${openwrt}/target/linux/generic/hack-5.15/*.patch patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch ''; - dts = { - src = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts"; - includes = [ - "${openwrt}/target/linux/ramips/dts" - ]; - }; config = { MIPS_ELF_APPENDED_DTB = "y"; OF = "y"; diff --git a/modules/base.nix b/modules/base.nix index e290e06..9ef13a4 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -29,13 +29,6 @@ in { default = "true"; type = types.lines; } ; - dts = { - src = mkOption { type = types.path; }; - includes = mkOption { - default = []; - type = types.listOf types.path; - }; - }; config = mkOption { # mostly the values are y n or m, but sometimes # other strings are also used @@ -48,9 +41,18 @@ in { users = mkOption { type = types.attrsOf types.anything; }; - boot.commandLine = mkOption { - type = types.listOf types.nonEmptyStr; - default = []; + boot = { + dts = { + src = mkOption { type = types.path; }; + includes = mkOption { + default = []; + type = types.listOf types.path; + }; + }; + commandLine = mkOption { + type = types.listOf types.nonEmptyStr; + default = []; + }; }; device.defaultOutput = mkOption { type = types.nonEmptyStr; diff --git a/modules/outputs.nix b/modules/outputs.nix index 85fcc5f..18e80e2 100644 --- a/modules/outputs.nix +++ b/modules/outputs.nix @@ -23,8 +23,8 @@ in inherit (config.kernel) config src extraPatchPhase; }; dtb = (callPackage ../kernel/dtb.nix {}) { - dts = config.kernel.dts.src; - includes = config.kernel.dts.includes ++ [ + dts = config.boot.dts.src; + includes = config.boot.dts.includes ++ [ "${kernel.headers}/include" ]; };