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
.komodules 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.koand place it in thezram/subdirectory of this module
# Example directory structure
ZRAM-Module/
βββ config.prop
βββ zram/
βββ zram.ko # Renamed kernel moduleEdit 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_ALGOmust match the algorithm implemented by your.komoduleZRAM_SIZEshould 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:
lz4kdzstdnlzo-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 GBZRAM_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