From 5f84fe517be04b57b9df9acc9295906cf585145a Mon Sep 17 00:00:00 2001
From: Trevor Woerner <twoerner@gmail.com>
Date: Wed, 18 Aug 2021 14:40:04 -0400
Subject: [PATCH] features/zram: add

Add support for enabling zram in the kernel.

The zram module creates RAM-based block devices named /dev/zram<id> (<id>
= 0, 1, ...). Pages written to these disks are compressed and stored in
memory itself. These disks allow very fast I/O and compression provides
good amounts of memory savings. Some of the use cases include /tmp storage,
use as swap disks, various caches under /var and maybe many more.

Different compression algorithms can be selected which give trade-offs between
speed and compression.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 features/zram/zram.cfg | 23 +++++++++++++++++++++++
 features/zram/zram.scc |  5 +++++
 2 files changed, 28 insertions(+)
 create mode 100644 features/zram/zram.cfg
 create mode 100644 features/zram/zram.scc

diff --git a/features/zram/zram.cfg b/features/zram/zram.cfg
new file mode 100644
index 000000000..3174ae860
--- /dev/null
+++ b/features/zram/zram.cfg
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: MIT
+CONFIG_ZSMALLOC=y
+# CONFIG_ZSMALLOC_STAT is not set
+CONFIG_ZRAM=y
+CONFIG_ZRAM_DEF_COMP_LZORLE=y
+# CONFIG_ZRAM_DEF_COMP_ZSTD is not set
+# CONFIG_ZRAM_DEF_COMP_LZ4 is not set
+# CONFIG_ZRAM_DEF_COMP_LZO is not set
+# CONFIG_ZRAM_DEF_COMP_LZ4HC is not set
+# CONFIG_ZRAM_DEF_COMP_842 is not set
+CONFIG_ZRAM_DEF_COMP="lzo-rle"
+# CONFIG_ZRAM_WRITEBACK is not set
+# CONFIG_ZRAM_MEMORY_TRACKING is not set
+CONFIG_CRYPTO_LZO=y
+CONFIG_CRYPTO_842=y
+CONFIG_CRYPTO_LZ4=y
+CONFIG_CRYPTO_LZ4HC=y
+CONFIG_CRYPTO_ZSTD=y
+CONFIG_842_COMPRESS=y
+CONFIG_842_DECOMPRESS=y
+CONFIG_LZ4_COMPRESS=y
+CONFIG_LZ4HC_COMPRESS=y
+CONFIG_ZSTD_COMPRESS=y
diff --git a/features/zram/zram.scc b/features/zram/zram.scc
new file mode 100644
index 000000000..30388842a
--- /dev/null
+++ b/features/zram/zram.scc
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: MIT
+define KFEATURE_DESCRIPTION "Compressed RAM block device support"
+define KFEATURE_COMPATIBILITY all
+
+kconf non-hardware zram.cfg
-- 
GitLab