From 17dbf01adfa8cc4704873a57ae3676fe09f961fa Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 30 Mar 2021 19:03:43 +0200
Subject: [PATCH 24/43] target: add pstore support

Signed-off-by: John Crispin <john@phrozen.org>
---
 target/linux/generic/config-5.10                | 15 ++++++++++++++-
 target/linux/generic/config-5.4                 | 14 +++++++++++++-
 .../linux/ipq40xx/patches-5.4/903-pstore.patch  | 17 +++++++++++++++++
 3 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq40xx/patches-5.4/903-pstore.patch

diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index 4eb5607f17..2582e8851a 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -4506,7 +4506,20 @@ CONFIG_PROC_SYSCTL=y
 # CONFIG_PSAMPLE is not set
 # CONFIG_PSB6970_PHY is not set
 # CONFIG_PSI is not set
-# CONFIG_PSTORE is not set
+CONFIG_PSTORE=y
+# CONFIG_PSTORE_842_COMPRESS is not set
+# CONFIG_PSTORE_BLK is not set
+CONFIG_PSTORE_COMPRESS=y
+CONFIG_PSTORE_COMPRESS_DEFAULT="deflate"
+# CONFIG_PSTORE_CONSOLE is not set
+CONFIG_PSTORE_DEFLATE_COMPRESS=y
+CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
+# CONFIG_PSTORE_LZ4HC_COMPRESS is not set
+# CONFIG_PSTORE_LZ4_COMPRESS is not set
+# CONFIG_PSTORE_LZO_COMPRESS is not set
+# CONFIG_PSTORE_PMSG is not set
+CONFIG_PSTORE_RAM=y
+# CONFIG_PSTORE_ZSTD_COMPRESS is not set
 # CONFIG_PTDUMP_DEBUGFS is not set
 # CONFIG_PTP_1588_CLOCK is not set
 # CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index da0e2e2186..b6673ede4d 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -4177,7 +4177,19 @@ CONFIG_PROC_SYSCTL=y
 # CONFIG_PSAMPLE is not set
 # CONFIG_PSB6970_PHY is not set
 # CONFIG_PSI is not set
-# CONFIG_PSTORE is not set
+CONFIG_PSTORE=y
+# CONFIG_PSTORE_842_COMPRESS is not set
+CONFIG_PSTORE_COMPRESS=y
+CONFIG_PSTORE_COMPRESS_DEFAULT="deflate"
+# CONFIG_PSTORE_CONSOLE is not set
+CONFIG_PSTORE_DEFLATE_COMPRESS=y
+CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y
+# CONFIG_PSTORE_LZ4HC_COMPRESS is not set
+# CONFIG_PSTORE_LZ4_COMPRESS is not set
+# CONFIG_PSTORE_LZO_COMPRESS is not set
+# CONFIG_PSTORE_PMSG is not set
+CONFIG_PSTORE_RAM=y
+# CONFIG_PSTORE_ZSTD_COMPRESS is not set
 # CONFIG_PTP_1588_CLOCK is not set
 # CONFIG_PTP_1588_CLOCK_IXP46X is not set
 # CONFIG_PTP_1588_CLOCK_KVM is not set
diff --git a/target/linux/ipq40xx/patches-5.4/903-pstore.patch b/target/linux/ipq40xx/patches-5.4/903-pstore.patch
new file mode 100644
index 0000000000..89ea4a438e
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.4/903-pstore.patch
@@ -0,0 +1,17 @@
+Index: linux-5.4.105/arch/arm/boot/dts/qcom-ipq4019.dtsi
+===================================================================
+--- linux-5.4.105.orig/arch/arm/boot/dts/qcom-ipq4019.dtsi
++++ linux-5.4.105/arch/arm/boot/dts/qcom-ipq4019.dtsi
+@@ -32,6 +32,12 @@
+ 			reg = <0x87e80000 0x180000>;
+ 			no-map;
+ 		};
++
++		ramoops@87f00000 {
++			compatible = "ramoops";
++			reg = <0x87df0000 0x10000>;
++			record-size = <0x1000>;
++		};
+ 	};
+ 
+ 	aliases {
-- 
2.25.1

