diff --git a/packages/bsp/common/etc/init.d/armhwinfo b/packages/bsp/common/etc/init.d/armhwinfo index 8f514e0474..424e925feb 100755 --- a/packages/bsp/common/etc/init.d/armhwinfo +++ b/packages/bsp/common/etc/init.d/armhwinfo @@ -363,6 +363,9 @@ add_usb_storage_quirks() { } # add_usb_storage_quirks activate_zram() { + # Do not interfere with already present config-zram package + dpkg -l | grep -q 'zram-config' && return + # Load zram module with n instances (one per CPU core, 4 are the maximum) cpu_cores=$(grep -c '^processor' /proc/cpuinfo | sed 's/^0$/1/') [[ ${cpu_cores} -gt 4 ]] && zram_devices=4 || zram_devices=${cpu_cores} @@ -372,11 +375,12 @@ activate_zram() { # Use half of the real memory by default --> 1/${ram_divisor} ram_divisor=2 mem_info=$(LC_ALL=C free -w 2>/dev/null | grep "^Mem" || LC_ALL=C free | grep "^Mem") - memory_total=$(awk '{printf("%d",$2/1024)}' <<<${mem_info}) + memory_total=$(awk '{printf("%d",$2*1024)}' <<<${mem_info}) mem_per_zram_device=$(( ${memory_total} / ${zram_devices} / ${ram_divisor} )) for (( i=0; i /sys/block/zram${i}/disksize + [[ -f /sys/block/zram${i}/comp_algorithm ]] && echo lz4 >/sys/block/zram${i}/comp_algorithm 2>/dev/null mkswap /dev/zram${i} swapon -p 5 /dev/zram${i} done