62a97a3582
Signed-off-by: mason.huo <mason.huo@starfivetech.com>
23 lines
468 B
Bash
23 lines
468 B
Bash
#!/bin/sh
|
|
#
|
|
# hibernation This shell script to turn on swap partition and
|
|
# set the image_size as big as ram size.
|
|
|
|
case "$1" in
|
|
start)
|
|
# Set the hibernation image_size as large as the ram size.
|
|
total_mem=$(cat /proc/meminfo | sed -n '1p')
|
|
echo $((${total_mem: 10: 15}*1024)) > /sys/power/image_size
|
|
swapon PARTLABEL="hibernation"
|
|
;;
|
|
stop)
|
|
swapoff PARTLABEL="hibernation"
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop}"
|
|
exit 1
|
|
esac
|
|
|
|
exit 0
|
|
|