liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 81f5550bf0c85dc8b32ac9539cd4144ae4bd2227
parent b52133a28bfc8bd7e264a9a3b9ea0cce7e64224a
Author: Daniel Barlow <dan@telent.net>
Date:   Tue, 17 Dec 2024 23:24:31 +0000

config.logging.persistent enables /dev/pmsg0

- whatever's written to /dev/pmsg0 appears as
/sys/fs/pstore/pmsg-ramoops-0 after reboot

- only works on devices with the relevant device tree
support (gl-ar750 and whatever has it by default)

- nothing in the system is actually writing this file yet

- or reading it at boot time, for that matter

Diffstat:
Mdevices/gl-ar750/default.nix | 6+++++-
Adevices/gl-ar750/pstore-ramoops.dtsi | 10++++++++++
Mmodules/outputs.nix | 2+-
Mmodules/s6/default.nix | 8++++++++
4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix @@ -52,8 +52,9 @@ ''; - module = {pkgs, config, lim, ... }: + module = {pkgs, config, lim, lib, ... }: let + inherit (lib) mkIf; openwrt = pkgs.openwrt; firmwareBlobs = pkgs.pkgsBuildBuild.fetchFromGitHub { owner = "kvalo"; @@ -119,6 +120,9 @@ includePaths = [ "${openwrt.src}/target/linux/ath79/dts" ]; + includes = mkIf config.logging.persistent.enable [ + ./pstore-ramoops.dtsi + ]; }; networkInterfaces = diff --git a/devices/gl-ar750/pstore-ramoops.dtsi b/devices/gl-ar750/pstore-ramoops.dtsi @@ -0,0 +1,10 @@ +/ { +reserved-memory { + ramoops@03f00000 { + compatible = "ramoops"; + reg = <0x03f00000 0x10000>; + record-size = <0x1000>; + pmsg-size = <0x1000>; + }; + }; +}; diff --git a/modules/outputs.nix b/modules/outputs.nix @@ -104,7 +104,7 @@ in system.outputs = rec { dtb = liminix.builders.dtb { inherit (config.boot) commandLine; - dts = config.hardware.dts.includes ++ [config.hardware.dts.src]; + dts = [config.hardware.dts.src] ++ config.hardware.dts.includes; includes = config.hardware.dts.includePaths ++ [ "${o.kernel.headers}/include" ]; diff --git a/modules/s6/default.nix b/modules/s6/default.nix @@ -212,6 +212,9 @@ let in { options = { logging = { + persistent = { + enable = mkEnableOption "store logs across reboots"; + }; shipping = { enable = mkEnableOption "unix socket for log shipping"; socket = mkOption { @@ -263,6 +266,11 @@ in { )]; config = { + kernel.config = mkIf config.logging.persistent.enable { + PSTORE = "y"; + PSTORE_PMSG = "y"; + PSTORE_RAM = "y"; + }; filesystem = dir { etc = dir { s6-rc = dir {