aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/zram/zram/zram-swap-init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-extended/zram/zram/zram-swap-init')
-rwxr-xr-xmeta-oe/recipes-extended/zram/zram/zram-swap-init7
1 files changed, 6 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/zram/zram/zram-swap-init b/meta-oe/recipes-extended/zram/zram/zram-swap-init
index 0643dbca23..28082f7ff0 100755
--- a/meta-oe/recipes-extended/zram/zram/zram-swap-init
+++ b/meta-oe/recipes-extended/zram/zram/zram-swap-init
@@ -14,7 +14,7 @@ fi
ZRAM_SIZE_PERCENT=100
ZRAM_ALGORITHM=lz4
-[ -f /etc/default/zram ] && ./etc/default/zram || true
+[ -f /etc/default/zram ] && . /etc/default/zram || true
memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ')
memzram=$(($memtotal*${ZRAM_SIZE_PERCENT}/100))
@@ -24,3 +24,8 @@ modprobe -q zram || true
zramctl -a ${ZRAM_ALGORITHM} -s ${memzram}KB $device
mkswap -L "zram-swap" $device
+
+devname="${device##*/}"
+if [ ! -z ${ZRAM_SIZE_LIMIT+x} ]; then
+ echo ${ZRAM_SIZE_LIMIT} > /sys/block/$devname/mem_limit
+fi