From 8d66d1445261c250b74572df493646d7c0445fa0 Mon Sep 17 00:00:00 2001 From: Mason Huo Date: Fri, 14 Apr 2023 10:57:39 +0800 Subject: [PATCH] package: starfive: Optimize the swapon partition Check if the swap partition ("hibernation") exist or not before swapon command. Since the partlabel appears late, change the script excution sequence to 99. Signed-off-by: Mason Huo --- package/starfive/pm/{S00hibernation => S99hibernation} | 7 ++++++- package/starfive/pm/pm.mk | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) rename package/starfive/pm/{S00hibernation => S99hibernation} (74%) diff --git a/package/starfive/pm/S00hibernation b/package/starfive/pm/S99hibernation similarity index 74% rename from package/starfive/pm/S00hibernation rename to package/starfive/pm/S99hibernation index d3bab548..ac5a09fc 100644 --- a/package/starfive/pm/S00hibernation +++ b/package/starfive/pm/S99hibernation @@ -8,7 +8,12 @@ case "$1" in # 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" + FILE=/dev/disk/by-partlabel/hibernation + if [ -b "$FILE" ];then + swapon PARTLABEL="hibernation" + else + echo "No PARTLABEL=hibernation!" + fi ;; stop) swapoff PARTLABEL="hibernation" diff --git a/package/starfive/pm/pm.mk b/package/starfive/pm/pm.mk index e1748225..c3f311d1 100644 --- a/package/starfive/pm/pm.mk +++ b/package/starfive/pm/pm.mk @@ -7,7 +7,7 @@ PM_LICENSE = GPL-2.0+ define PM_INSTALL_TARGET_CMDS install -m 0755 -D package/starfive/pm/S90cpufreq $(TARGET_DIR)/etc/init.d/ - install -m 0755 -D package/starfive/pm/S00hibernation $(TARGET_DIR)/etc/init.d/ + install -m 0755 -D package/starfive/pm/S99hibernation $(TARGET_DIR)/etc/init.d/ endef $(eval $(generic-package))