ZRAM-Module
is a Magisk / KernelSU based module designed for Android kernels with ZRAM support. It allows automatic loading of user-defined compression algorithm modules (such as lz4kd
, zstdn
, etc.) and configures the ZRAM size at boot.
Ideal for custom kernel users, it enables kernel module loading and initialization without modifying the system partition.
- ✅ Supports loading custom compression algorithms (e.g.
lz4kd
,zstdn
) - ✅ Supports custom ZRAM size (in bytes)
- ✅ Automatically loads
.ko
modules at boot - ✅ Fully implemented via Magisk / KernelSU, no system partition modification required
- Compile the kernel source code for your device
- Build the desired compression algorithm module (e.g.,
crypto_zstdn.ko
) - Rename the compiled module to
zram.ko
and place it in thezram/
subdirectory of this module
# Example directory structure
ZRAM-Module/
├── config.prop
└── zram/
└── zram.ko # Renamed kernel module
Edit the config.prop
file in the module's root directory:
ZRAM_ALGO=lz4kd # Compression algorithm name (matches kernel module)
ZRAM_SIZE=12884901888 # ZRAM size in bytes (e.g., 12 GB)
📌 Note:
ZRAM_ALGO
must match the algorithm implemented by your.ko
moduleZRAM_SIZE
should not exceed your device’s physical RAM
If config.prop
is not configured, the module will fail to initialize.
- Compress the entire module directory into a ZIP file
- Flash the ZIP using Magisk/KernelSU or TWRP:
Magisk/KernelSU → Modules → Install from storage → Select ZIP file
- Reboot your device. The module will automatically load and initialize ZRAM.
A: Any compression algorithm module that you compile yourself, such as:
lz4kd
zstdn
lzo-rle
As long as the corresponding .ko
file is correctly placed in the zram/
directory.
A: The unit is bytes. For example:
ZRAM_SIZE=8589934592 # 8 GB
ZRAM_SIZE=12884901888 # 12 GB
ZRAM_SIZE=17179869184 # 16 GB
ZRAM_SIZE
larger than your device’s physical RAM, as it may cause system instability.
A: Yes. Please ensure that:
- Your kernel is compiled with ZRAM support
- Other system-level ZRAM features or tools (like Scene, etc.) are disabled to avoid conflicts
A: The module will fail to initialize, and the ZRAM device will not be set up. You can check the log to diagnose the issue:
./ZRAM-Module/zram_module.log