From 788a398aabbcfa86501e2b275566ee99a16e350f Mon Sep 17 00:00:00 2001 From: fewtarius Date: Sun, 3 Dec 2023 13:04:06 +0000 Subject: [PATCH 1/5] * Add support for changing the merged storage target between the internal and external card. * Since JELOS creates the games directory structure it is possible that the overlay will hide games if you switch targets as it will consider them removed. Delete the empty directories and reboot to resolve. * Ex: find /storage/games-internal -type d -empty -delete && find /storage/games-external -type d -empty -delete && reboot * Merged storage can now be disabled persistently. * A new directory structure is required to enable switching: * /storage/games-internal/roms * /storage/games-external/roms * The target /storage/roms has not changed. * Lowers clocks to powersave for RK3566 devices. --- .../quirks/platforms/RK3326/010-governors | 0 .../quirks/platforms/RK3326/050-audio_path | 0 .../quirks/platforms/RK3326/050-modifiers | 0 .../quirks/platforms/RK3326/060-game_settings | 0 .../quirks/platforms/RK3326/090-ui_service | 0 .../quirks/platforms/RK3399/040-affinity | 0 .../platforms/RK3566/sleep.d/post/002-freq | 23 ++++++ .../platforms/RK3566/sleep.d/pre/002-freq | 19 +++++ packages/jelos/sources/post-update | 20 ++++- packages/jelos/sources/scripts/automount | 77 ++++++++++++++----- packages/jelos/sources/scripts/led_flash | 0 packages/jelos/sources/scripts/runemu.sh | 0 packages/jelos/sources/scripts/volume | 0 packages/ui/emulationstation/package.mk | 2 +- .../emulators/system.d/storage-roms.mount | 13 ---- .../emulators/udev.d/99-automount.rules | 2 +- 16 files changed, 117 insertions(+), 39 deletions(-) mode change 100644 => 100755 packages/hardware/quirks/platforms/RK3326/010-governors mode change 100644 => 100755 packages/hardware/quirks/platforms/RK3326/050-audio_path mode change 100644 => 100755 packages/hardware/quirks/platforms/RK3326/050-modifiers mode change 100644 => 100755 packages/hardware/quirks/platforms/RK3326/060-game_settings mode change 100644 => 100755 packages/hardware/quirks/platforms/RK3326/090-ui_service mode change 100644 => 100755 packages/hardware/quirks/platforms/RK3399/040-affinity create mode 100644 packages/hardware/quirks/platforms/RK3566/sleep.d/post/002-freq create mode 100644 packages/hardware/quirks/platforms/RK3566/sleep.d/pre/002-freq mode change 100644 => 100755 packages/jelos/sources/scripts/led_flash mode change 100644 => 100755 packages/jelos/sources/scripts/runemu.sh mode change 100644 => 100755 packages/jelos/sources/scripts/volume delete mode 100644 packages/virtual/emulators/system.d/storage-roms.mount diff --git a/packages/hardware/quirks/platforms/RK3326/010-governors b/packages/hardware/quirks/platforms/RK3326/010-governors old mode 100644 new mode 100755 diff --git a/packages/hardware/quirks/platforms/RK3326/050-audio_path b/packages/hardware/quirks/platforms/RK3326/050-audio_path old mode 100644 new mode 100755 diff --git a/packages/hardware/quirks/platforms/RK3326/050-modifiers b/packages/hardware/quirks/platforms/RK3326/050-modifiers old mode 100644 new mode 100755 diff --git a/packages/hardware/quirks/platforms/RK3326/060-game_settings b/packages/hardware/quirks/platforms/RK3326/060-game_settings old mode 100644 new mode 100755 diff --git a/packages/hardware/quirks/platforms/RK3326/090-ui_service b/packages/hardware/quirks/platforms/RK3326/090-ui_service old mode 100644 new mode 100755 diff --git a/packages/hardware/quirks/platforms/RK3399/040-affinity b/packages/hardware/quirks/platforms/RK3399/040-affinity old mode 100644 new mode 100755 diff --git a/packages/hardware/quirks/platforms/RK3566/sleep.d/post/002-freq b/packages/hardware/quirks/platforms/RK3566/sleep.d/post/002-freq new file mode 100644 index 000000000..d5c06cc41 --- /dev/null +++ b/packages/hardware/quirks/platforms/RK3566/sleep.d/post/002-freq @@ -0,0 +1,23 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +### Restore previous governors before going to sleep + +. /etc/profile + +### Grab the old governors. +OLD_CPU_FREQ=$(get_setting "sleep.cpugovernor") +if [ ! -n "${OLD_CPU_FREQ}" ]; then + OLD_CPU_FREQ="schedutil" +fi + +OLD_GPU_FREQ=$(get_setting "sleep.gpugovernor") +if [ ! -n "${OLD_GPU_FREQ}" ]; then + OLD_GPU_FREQ="simple_ondemand" +fi + +# Restore old governors. +set_cpu_gov "${OLD_CPU_FREQ}" +set_dmc_gov "${OLD_CPU_FREQ}" +set_gpu_gov "${OLD_GPU_FREQ}" diff --git a/packages/hardware/quirks/platforms/RK3566/sleep.d/pre/002-freq b/packages/hardware/quirks/platforms/RK3566/sleep.d/pre/002-freq new file mode 100644 index 000000000..4fbe8c64f --- /dev/null +++ b/packages/hardware/quirks/platforms/RK3566/sleep.d/pre/002-freq @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +# Store current freq governors and set governors to powersave. + +. /etc/profile + +### Get the current cpu and gpu governor, save for when the device wakes from sleep. +CUR_CPU_FREQ="$(cat ${CPU_FREQ}/scaling_governor)" +CUR_GPU_FREQ="$(cat ${GPU_FREQ}/governor)" + +set_setting sleep.cpugovernor "${CUR_CPU_FREQ}" +set_setting sleep.gpugovernor "${CUR_GPU_FREQ}" + +### Set all governors to powersave +set_cpu_gov powersave +set_dmc_gov powersave +set_gpu_gov powersave diff --git a/packages/jelos/sources/post-update b/packages/jelos/sources/post-update index a0ba48874..ab676e199 100644 --- a/packages/jelos/sources/post-update +++ b/packages/jelos/sources/post-update @@ -73,8 +73,12 @@ sed -i 's~"pulse"~"alsathread"~g' /storage/.config/retroarch/retroarch.cfg ### 20231114 - Update hosts.conf grep "127.0.0.1" /storage/.config/hosts.conf >/dev/null 2>&1 || cp /usr/config/hosts.conf /storage/.config/ -### 20231127 - Migrate games to overlayfs -systemctl stop storage-roms.mount +### 20231127 - Migrate games to overlayfs (updated 20231203) +NULL=$(cat /proc/mounts | grep -v -e "/storage/roms" 2>/dev/null | grep ${1}) +if [ ! "$?" = 0 ] +then + umount /storage/roms +fi GAMECOUNT=$(find /storage/roms -type f | wc -l) if [ "${GAMECOUNT}" -gt 20 ] && \ [ ! -e "/storage/.migrated_games" ] @@ -91,7 +95,17 @@ then else echo "Game weight too low (${GAMECOUNT}) or content already migrated." >>${LOG} fi -systemctl start storage-roms.mount + +### Migration part 2 +for GAMES in /storage/games-internal /storage/games-external +do + if [ ! -d "${GAMES}/roms" ] + then + mkdir -p "${GAMES}/roms" + mv "${GAMES}/"* "${GAMES}/roms/" + fi +done +systemctl restart jelos-automount ### 20231129 - Don't default to performance. EPP=$(get_setting system.power.epp) diff --git a/packages/jelos/sources/scripts/automount b/packages/jelos/sources/scripts/automount index 8f9837492..f833dd2f5 100755 --- a/packages/jelos/sources/scripts/automount +++ b/packages/jelos/sources/scripts/automount @@ -8,26 +8,51 @@ UPDATE_ROOT="/storage/.update" MOUNT_GAMES=$(get_setting system.automount) GAMES_DEVICE=$(get_setting system.gamesdevice) -MOUNT_PATH="/storage/games-external" -OVERLAY_PATH="/storage/roms" -start_overlay() { - if [ -e "/storage/.overlay_unsupported" ] +MS_ENABLED=$(get_setting system.merged.storage) +MS_DEVICE=$(get_setting system.merged.device) +MS_PATH="/storage/roms" +if [ -z "${MS_DEVICE}" ] +then + MS_DEVICE="external" +fi +MOUNT_PATH="/storage/games-${MS_DEVICE}" + +function start_ms() { + if [ -e "/storage/.ms_unsupported" ] || \ + [ "${MS_ENABLED}" = "false" ] then - # If we're not using the overlay, bind mount the external storage path + # If we're not using merged storage, bind mount the external storage path # so we don't need to change any configs. grep ${MOUNT_PATH} /proc/mounts >/dev/null 2>&1 if [ ! $? = 0 ] then MOUNT_PATH="/storage/games-internal" fi - log $0 "Executing bind mount of ${MOUNT_PATH} to ${OVERLAY_PATH}" - mount --bind ${MOUNT_PATH} ${OVERLAY_PATH} + log $0 "Executing bind mount of ${MOUNT_PATH} to ${MS_PATH}" + mount --bind ${MOUNT_PATH} ${MS_PATH} exit 0 else - log $0 "Enabling overlay." - systemctl enable storage-roms.mount >/dev/null 2>&1 - systemctl start storage-roms.mount >/dev/null 2>&1 + log $0 "Enabling merged storage." + + case ${MS_DEVICE} in + internal) + LOWER="internal" + UPPER="external" + ;; + *) + LOWER="external" + UPPER="internal" + ;; + esac + for DIR in /storage/games-${UPPER}/.tmp/games-workdir /storage/games-${LOWER}/roms /storage/games-${UPPER}/roms + do + if [ ! -d "${DIR}" ] + then + mkdir -p "${DIR}" + fi + done + mount overlay -t overlay -o lowerdir=/storage/games-${LOWER}/roms,upperdir=/storage/games-${UPPER}/roms,workdir=/storage/games-${UPPER}/.tmp/games-workdir /storage/roms fi } @@ -36,10 +61,18 @@ then set_setting system.automount 1 elif [[ "${MOUNT_GAMES}" == "0" ]] then - start_overlay + start_ms exit 0 fi +function unmount_roms() { + NULL=$(cat /proc/mounts | grep -v -e "${MS_PATH}" 2>/dev/null | grep ${1}) + if [ ! "$?" = "0" ] + then + umount -f "${MS_PATH}" + fi +} + function load_modules() { for MODULE in exfat vfat do @@ -53,24 +86,25 @@ function load_modules() { } function mount_games() { + unmount_roms FSTYPE=$(blkid -o export ${1} | awk 'BEGIN {FS="="} /TYPE/ {print $2}') case ${FSTYPE} in ext4) log $0 "Found supported partition for overlayfs." - if [ -e "/storage/.overlay_unsupported" ] + if [ -e "/storage/.ms_unsupported" ] then - rm -f /storage/.overlay_unsupported + rm -f /storage/.ms_unsupported fi - touch /storage/.overlay_supported + touch /storage/.ms_supported set_setting system.merged.storage 1 ;; *) log $0 "Partition does not support overlayfs, disabling." - if [ -e "/storage/.overlay_supported" ] + if [ -e "/storage/.ms_supported" ] then - rm -f /storage/.overlay_supported + rm -f /storage/.ms_supported fi - touch /storage/.overlay_unsupported + touch /storage/.ms_unsupported ;; esac @@ -92,10 +126,11 @@ function mount_games() { log $0 "Mounting ${1} on ${MOUNT_PATH}" /usr/bin/busybox mount ${1} ${MOUNT_PATH} >/dev/null 2>&1 fi - start_overlay + start_ms + exit 0 } -find_games() { +function find_games() { if /usr/bin/busybox mountpoint -q /storage ; then for DEV in $(for dev in mmcblk[0-9] sd[a-z] nvme[0-9]; do blkid | grep ${dev} | awk 'BEGIN {FS=":"}; /ext4/ || /fat/ {print $1}' | sort -r; done) do @@ -125,8 +160,8 @@ find_games() { break fi done - # If we're here there is no external storage to use, but we want to start the overlay anyway. - start_overlay + # If we're here there is no external storage to use, but we want to start merged storage or the bind mount anyway. + start_ms fi } diff --git a/packages/jelos/sources/scripts/led_flash b/packages/jelos/sources/scripts/led_flash old mode 100644 new mode 100755 diff --git a/packages/jelos/sources/scripts/runemu.sh b/packages/jelos/sources/scripts/runemu.sh old mode 100644 new mode 100755 diff --git a/packages/jelos/sources/scripts/volume b/packages/jelos/sources/scripts/volume old mode 100644 new mode 100755 diff --git a/packages/ui/emulationstation/package.mk b/packages/ui/emulationstation/package.mk index 3b5316a08..e09b16d77 100644 --- a/packages/ui/emulationstation/package.mk +++ b/packages/ui/emulationstation/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) PKG_NAME="emulationstation" -PKG_VERSION="ac666f2" +PKG_VERSION="a70b20b" PKG_GIT_CLONE_BRANCH="main" PKG_REV="1" PKG_ARCH="any" diff --git a/packages/virtual/emulators/system.d/storage-roms.mount b/packages/virtual/emulators/system.d/storage-roms.mount deleted file mode 100644 index e93769cbf..000000000 --- a/packages/virtual/emulators/system.d/storage-roms.mount +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Overlays directory -After=systemd-tmpfiles-setup.service -DefaultDependencies=no - -[Mount] -What=none -Where=/storage/roms -Type=overlay -Options=lowerdir=/storage/games-external,upperdir=/storage/games-internal,workdir=/storage/.tmp/games-workdir - -[Install] -WantedBy=jelos.target diff --git a/packages/virtual/emulators/udev.d/99-automount.rules b/packages/virtual/emulators/udev.d/99-automount.rules index ca3eba055..ba601f767 100644 --- a/packages/virtual/emulators/udev.d/99-automount.rules +++ b/packages/virtual/emulators/udev.d/99-automount.rules @@ -14,7 +14,7 @@ GOTO="exit" # mount or umount for hdds LABEL="harddisk" -ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl stop storage-roms.mount", RUN+="/usr/bin/systemctl restart jelos-automount.service" +ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl restart jelos-automount.service" GOTO="exit" # Exit From 2441f908d6e60bc3684fda36ce6098b756ddbc3a Mon Sep 17 00:00:00 2001 From: fewtarius Date: Sun, 3 Dec 2023 13:13:59 +0000 Subject: [PATCH 2/5] Disable merged storage by default, fix bind mount to use correct (updated) path. --- packages/jelos/config/system/configs/system.cfg | 1 + packages/jelos/sources/post-update | 7 +++++++ packages/jelos/sources/scripts/automount | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/jelos/config/system/configs/system.cfg b/packages/jelos/config/system/configs/system.cfg index d4866c174..2ce82e223 100644 --- a/packages/jelos/config/system/configs/system.cfg +++ b/packages/jelos/config/system/configs/system.cfg @@ -176,6 +176,7 @@ system.hostname=@DEVICENAME@ system.language=en_US system.loglevel=none system.power.audio=1 +system.merged.storage=0 system.power.cpu=1 system.power.pcie=0 system.power.rtpm=0 diff --git a/packages/jelos/sources/post-update b/packages/jelos/sources/post-update index ab676e199..e5eaff24a 100644 --- a/packages/jelos/sources/post-update +++ b/packages/jelos/sources/post-update @@ -125,6 +125,13 @@ do rm -rf ${FILE} 2>/dev/null done +### 20231203 - Disable merged storage by default. +MERGED_STORAGE=$(get_setting system.merged.storage) +if [ -z "${MERGED_STORAGE}" ] +then + set_setting system.merged.storage 0 +fi + ### Items below this line should not be removed. tocon "Update complete, rebooting..." reboot diff --git a/packages/jelos/sources/scripts/automount b/packages/jelos/sources/scripts/automount index f833dd2f5..c628713b9 100755 --- a/packages/jelos/sources/scripts/automount +++ b/packages/jelos/sources/scripts/automount @@ -30,7 +30,7 @@ function start_ms() { MOUNT_PATH="/storage/games-internal" fi log $0 "Executing bind mount of ${MOUNT_PATH} to ${MS_PATH}" - mount --bind ${MOUNT_PATH} ${MS_PATH} + mount --bind ${MOUNT_PATH}/roms ${MS_PATH} exit 0 else log $0 "Enabling merged storage." @@ -76,11 +76,11 @@ function unmount_roms() { function load_modules() { for MODULE in exfat vfat do - lsmod | grep ${MODULE} 2>/dev/null + lsmod | grep ${MODULE} >/dev/null 2>&1 if [ ! $? = 0 ] then log $0 "Loading ${MODULE}." - modprobe ${MODULE} 2>/dev/null + modprobe ${MODULE} >/dev/null 2>&1 fi done } From 893a14a72a184abc32575d1a4acc3cf78de6ee85 Mon Sep 17 00:00:00 2001 From: fewtarius Date: Sun, 3 Dec 2023 16:22:09 +0000 Subject: [PATCH 3/5] Additional merged storage optimizations, add a script to remove empty directories that may cause overlay issues. --- packages/jelos/sources/scripts/automount | 89 +++++++++++-------- .../jelos/sources/scripts/cleanup_overlay | 11 +++ .../jelos/system.d/jelos-automount.service | 1 - .../sources/Optimize Merged Storage.sh | 8 ++ packages/misc/modules/sources/gamelist.xml | 14 ++- packages/ui/emulationstation/package.mk | 2 +- 6 files changed, 84 insertions(+), 41 deletions(-) create mode 100755 packages/jelos/sources/scripts/cleanup_overlay create mode 100755 packages/misc/modules/sources/Optimize Merged Storage.sh diff --git a/packages/jelos/sources/scripts/automount b/packages/jelos/sources/scripts/automount index c628713b9..41d01cd78 100755 --- a/packages/jelos/sources/scripts/automount +++ b/packages/jelos/sources/scripts/automount @@ -5,46 +5,55 @@ . /etc/profile . /etc/os-release +### Vars UPDATE_ROOT="/storage/.update" MOUNT_GAMES=$(get_setting system.automount) GAMES_DEVICE=$(get_setting system.gamesdevice) - MS_ENABLED=$(get_setting system.merged.storage) MS_DEVICE=$(get_setting system.merged.device) + + +### Default to the external storage device. +MOUNT_PATH="/storage/games-external" + MS_PATH="/storage/roms" -if [ -z "${MS_DEVICE}" ] -then - MS_DEVICE="external" -fi -MOUNT_PATH="/storage/games-${MS_DEVICE}" + +function unmount() { + NULL=$(grep -e "${1}" /proc/mounts >/dev/null 2>&1) + if [ "$?" = "0" ] + then + log $0 "Unmount ${1}." + umount -f "${1}" 2>/dev/null ||: + fi +} function start_ms() { + ### Entrypoint will be either games card found (external), or not found (internal). + MOUNT_PATH="/storage/games-${1}" + + unmount ${MS_PATH} + + ### Determine if internal or external is the primary target by configuration. + case ${MS_DEVICE} in + internal) + LOWER="internal" + UPPER="external" + ;; + *) + LOWER="external" + UPPER="internal" + ;; + esac + if [ -e "/storage/.ms_unsupported" ] || \ - [ "${MS_ENABLED}" = "false" ] + [ "${MS_ENABLED}" = 0 ] then - # If we're not using merged storage, bind mount the external storage path - # so we don't need to change any configs. - grep ${MOUNT_PATH} /proc/mounts >/dev/null 2>&1 - if [ ! $? = 0 ] - then - MOUNT_PATH="/storage/games-internal" - fi log $0 "Executing bind mount of ${MOUNT_PATH} to ${MS_PATH}" mount --bind ${MOUNT_PATH}/roms ${MS_PATH} exit 0 else - log $0 "Enabling merged storage." + log $0 "Enabling merged storage of /storage/games-${LOWER} and /storage/games-${UPPER} to ${MS_PATH}." - case ${MS_DEVICE} in - internal) - LOWER="internal" - UPPER="external" - ;; - *) - LOWER="external" - UPPER="internal" - ;; - esac for DIR in /storage/games-${UPPER}/.tmp/games-workdir /storage/games-${LOWER}/roms /storage/games-${UPPER}/roms do if [ ! -d "${DIR}" ] @@ -52,7 +61,7 @@ function start_ms() { mkdir -p "${DIR}" fi done - mount overlay -t overlay -o lowerdir=/storage/games-${LOWER}/roms,upperdir=/storage/games-${UPPER}/roms,workdir=/storage/games-${UPPER}/.tmp/games-workdir /storage/roms + mount overlay -t overlay -o lowerdir=/storage/games-${LOWER}/roms,upperdir=/storage/games-${UPPER}/roms,workdir=/storage/games-${UPPER}/.tmp/games-workdir ${MS_PATH} fi } @@ -61,16 +70,12 @@ then set_setting system.automount 1 elif [[ "${MOUNT_GAMES}" == "0" ]] then - start_ms + start_ms internal exit 0 fi -function unmount_roms() { - NULL=$(cat /proc/mounts | grep -v -e "${MS_PATH}" 2>/dev/null | grep ${1}) - if [ ! "$?" = "0" ] - then - umount -f "${MS_PATH}" - fi +function create_game_dirs() { + systemd-tmpfiles --create /usr/lib/tmpfiles.d/JELOS-system-dirs.conf >/dev/null 2>&1 ||: } function load_modules() { @@ -86,7 +91,7 @@ function load_modules() { } function mount_games() { - unmount_roms + local MOUNT_PATH="/storage/games-external" FSTYPE=$(blkid -o export ${1} | awk 'BEGIN {FS="="} /TYPE/ {print $2}') case ${FSTYPE} in ext4) @@ -96,7 +101,6 @@ function mount_games() { rm -f /storage/.ms_unsupported fi touch /storage/.ms_supported - set_setting system.merged.storage 1 ;; *) log $0 "Partition does not support overlayfs, disabling." @@ -119,14 +123,18 @@ function mount_games() { [ -e "${1}" ] && \ [ ! -e "/storage/.please_resize_me" ] then + ### Udevil shouldn't mount it this early, but just in-case. umount /var/media/* 2>/dev/null + log $0 "Checking filesystem ${1}." fsck -Mly ${1} >/dev/null 2>&1 + log $0 "Mounting ${1} on ${MOUNT_PATH}" /usr/bin/busybox mount ${1} ${MOUNT_PATH} >/dev/null 2>&1 fi - start_ms + start_ms external + create_game_dirs exit 0 } @@ -160,13 +168,18 @@ function find_games() { break fi done - # If we're here there is no external storage to use, but we want to start merged storage or the bind mount anyway. - start_ms + log $0 "Could not find external card to mount, assume internal." + start_ms internal fi } +## Main.. + load_modules +### Unmount external storage if it's mounted. +unmount "${MOUNT_PATH}" + if [ -e "${GAMES_DEVICE}" ] then mount_games ${GAMES_DEVICE} diff --git a/packages/jelos/sources/scripts/cleanup_overlay b/packages/jelos/sources/scripts/cleanup_overlay new file mode 100755 index 000000000..924ddf044 --- /dev/null +++ b/packages/jelos/sources/scripts/cleanup_overlay @@ -0,0 +1,11 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +. /etc/profile + +for STORAGE in /storage/games-internal /storage/games-external +do + find ${STORAGE} -type d -empty -delete +done +reboot diff --git a/packages/jelos/system.d/jelos-automount.service b/packages/jelos/system.d/jelos-automount.service index ab8822b4c..5afbaefad 100644 --- a/packages/jelos/system.d/jelos-automount.service +++ b/packages/jelos/system.d/jelos-automount.service @@ -8,7 +8,6 @@ Type=oneshot Environment=HOME=/storage EnvironmentFile=/etc/profile ExecStart=/usr/bin/automount -ExecStartPost=systemd-tmpfiles --create /usr/lib/tmpfiles.d/JELOS-system-dirs.conf RemainAfterExit=yes [Install] diff --git a/packages/misc/modules/sources/Optimize Merged Storage.sh b/packages/misc/modules/sources/Optimize Merged Storage.sh new file mode 100755 index 000000000..a50f931a3 --- /dev/null +++ b/packages/misc/modules/sources/Optimize Merged Storage.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) + +source /etc/profile + +weston-terminal -f --command "/usr/bin/cleanup_overlay" diff --git a/packages/misc/modules/sources/gamelist.xml b/packages/misc/modules/sources/gamelist.xml index c79ec99d6..da8b8f228 100755 --- a/packages/misc/modules/sources/gamelist.xml +++ b/packages/misc/modules/sources/gamelist.xml @@ -60,6 +60,18 @@ 1 ./images/rclone-restore.svg + + ./Optimize Merged Storage.sh + Optimize Merged Storage + This tool can be run to clean up simple issues preventing games from being listed. + JELOS + JELOS + 5.0 + 2023 + Script + 1 + ./images/remove-mac-files.svg + ./Remove ._ Files.sh Remove ._ Files @@ -218,4 +230,4 @@ 1 ./images/yuzu.svg - \ No newline at end of file + diff --git a/packages/ui/emulationstation/package.mk b/packages/ui/emulationstation/package.mk index e09b16d77..708ac721d 100644 --- a/packages/ui/emulationstation/package.mk +++ b/packages/ui/emulationstation/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) PKG_NAME="emulationstation" -PKG_VERSION="a70b20b" +PKG_VERSION="209ae15" PKG_GIT_CLONE_BRANCH="main" PKG_REV="1" PKG_ARCH="any" From 4c1c0b1928a4d5fb4a51b2bb373bb4b4280e5942 Mon Sep 17 00:00:00 2001 From: fewtarius Date: Mon, 4 Dec 2023 01:26:09 +0000 Subject: [PATCH 4/5] Fix merged storage to switch on and off correctly. Hide internal/external switch, but make it available as system.merged.device (1/0). --- packages/jelos/autostart/008-perfmode | 1 + packages/jelos/package.mk | 1 - packages/jelos/sources/scripts/automount | 30 ++++++++----------- .../sources/Optimize Merged Storage.sh | 8 ----- packages/misc/modules/sources/gamelist.xml | 12 -------- packages/sysutils/autostart/sources/autostart | 3 ++ packages/ui/emulationstation/package.mk | 2 +- 7 files changed, 18 insertions(+), 39 deletions(-) delete mode 100755 packages/misc/modules/sources/Optimize Merged Storage.sh diff --git a/packages/jelos/autostart/008-perfmode b/packages/jelos/autostart/008-perfmode index 71d6770be..9aa468d71 100755 --- a/packages/jelos/autostart/008-perfmode +++ b/packages/jelos/autostart/008-perfmode @@ -4,6 +4,7 @@ # Minimal OS variable loading for performance . /etc/profile.d/001-functions +. /etc/profile.d/030-powerfunctions . /etc/profile.d/099-freqfunctions tocon "Setting performance mode..." diff --git a/packages/jelos/package.mk b/packages/jelos/package.mk index 50faf9ebf..75d7dea38 100644 --- a/packages/jelos/package.mk +++ b/packages/jelos/package.mk @@ -69,7 +69,6 @@ EOF cp ${PKG_DIR}/sources/scripts/* ${INSTALL}/usr/bin chmod 0755 ${INSTALL}/usr/bin/* 2>/dev/null ||: - enable_service jelos-automount.service ### Fix and migrate to autostart package enable_service jelos-autostart.service diff --git a/packages/jelos/sources/scripts/automount b/packages/jelos/sources/scripts/automount index 41d01cd78..806128b31 100755 --- a/packages/jelos/sources/scripts/automount +++ b/packages/jelos/sources/scripts/automount @@ -12,27 +12,20 @@ GAMES_DEVICE=$(get_setting system.gamesdevice) MS_ENABLED=$(get_setting system.merged.storage) MS_DEVICE=$(get_setting system.merged.device) - ### Default to the external storage device. MOUNT_PATH="/storage/games-external" MS_PATH="/storage/roms" function unmount() { - NULL=$(grep -e "${1}" /proc/mounts >/dev/null 2>&1) - if [ "$?" = "0" ] - then - log $0 "Unmount ${1}." - umount -f "${1}" 2>/dev/null ||: - fi + log $0 "Unmount ${1}." + umount -f "${1}" 2>/dev/null ||: } function start_ms() { ### Entrypoint will be either games card found (external), or not found (internal). MOUNT_PATH="/storage/games-${1}" - unmount ${MS_PATH} - ### Determine if internal or external is the primary target by configuration. case ${MS_DEVICE} in internal) @@ -139,10 +132,12 @@ function mount_games() { } function find_games() { - if /usr/bin/busybox mountpoint -q /storage ; then + if /usr/bin/busybox mountpoint -q /storage + then for DEV in $(for dev in mmcblk[0-9] sd[a-z] nvme[0-9]; do blkid | grep ${dev} | awk 'BEGIN {FS=":"}; /ext4/ || /fat/ {print $1}' | sort -r; done) do ROOTDEV=$(echo ${DEV} | sed -e "s#^/.*/##g" -e "s#p[0-9].*\$##g") + log $0 "Inspecting ${DEV}." SIZE=$(awk '/'${ROOTDEV}'$/ {print $3}' /proc/partitions) if (( ${SIZE} <= 8388608 )) then @@ -156,20 +151,20 @@ function find_games() { # Assume this is an android boot device and ignore it. continue fi - # Udevil might mount it, and we shouldn't care if it does. - NULL=$(cat /proc/mounts | grep -v -e "/var/media" 2>/dev/null | grep ${DEV}) - if [ ! "$?" = "0" ] && \ - [ -e "${DEV}" ] && \ + if [ -e "${DEV}" ] && \ [ ! -e "/storage/.please_resize_me" ] then GAMES_DEVICE=${DEV} log $0 "Found ${DEV} available to mount." mount_games "${DEV}" - break + else + log $0 "${DEV} not available." fi done log $0 "Could not find external card to mount, assume internal." start_ms internal + create_game_dirs + exit 0 fi } @@ -177,8 +172,9 @@ function find_games() { load_modules -### Unmount external storage if it's mounted. -unmount "${MOUNT_PATH}" +### Unmount any existing storage before beginning operations. +unmount /storage/games-external +unmount /storage/roms if [ -e "${GAMES_DEVICE}" ] then diff --git a/packages/misc/modules/sources/Optimize Merged Storage.sh b/packages/misc/modules/sources/Optimize Merged Storage.sh deleted file mode 100755 index a50f931a3..000000000 --- a/packages/misc/modules/sources/Optimize Merged Storage.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) - -source /etc/profile - -weston-terminal -f --command "/usr/bin/cleanup_overlay" diff --git a/packages/misc/modules/sources/gamelist.xml b/packages/misc/modules/sources/gamelist.xml index da8b8f228..69b5ad418 100755 --- a/packages/misc/modules/sources/gamelist.xml +++ b/packages/misc/modules/sources/gamelist.xml @@ -60,18 +60,6 @@ 1 ./images/rclone-restore.svg - - ./Optimize Merged Storage.sh - Optimize Merged Storage - This tool can be run to clean up simple issues preventing games from being listed. - JELOS - JELOS - 5.0 - 2023 - Script - 1 - ./images/remove-mac-files.svg - ./Remove ._ Files.sh Remove ._ Files diff --git a/packages/sysutils/autostart/sources/autostart b/packages/sysutils/autostart/sources/autostart index 492ab0733..84c82385f 100755 --- a/packages/sysutils/autostart/sources/autostart +++ b/packages/sysutils/autostart/sources/autostart @@ -43,6 +43,9 @@ then done fi +### Start the automount service +systemctl start jelos-automount + ### Run common start scripts for script in /usr/lib/autostart/common/* do diff --git a/packages/ui/emulationstation/package.mk b/packages/ui/emulationstation/package.mk index 708ac721d..3192f1b2e 100644 --- a/packages/ui/emulationstation/package.mk +++ b/packages/ui/emulationstation/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS) PKG_NAME="emulationstation" -PKG_VERSION="209ae15" +PKG_VERSION="adc7cb5" PKG_GIT_CLONE_BRANCH="main" PKG_REV="1" PKG_ARCH="any" From d30ac12886c5e92fa1333dd9468df6a14c831746 Mon Sep 17 00:00:00 2001 From: fewtarius Date: Mon, 4 Dec 2023 10:53:36 +0000 Subject: [PATCH 5/5] Bump AMD64 kernel to 6.6.4. --- packages/kernel/linux/package.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kernel/linux/package.mk b/packages/kernel/linux/package.mk index 580678b6a..db530d5b6 100644 --- a/packages/kernel/linux/package.mk +++ b/packages/kernel/linux/package.mk @@ -4,7 +4,7 @@ PKG_NAME="linux" PKG_LICENSE="GPL" -PKG_VERSION="6.6.3" +PKG_VERSION="6.6.4" PKG_URL="https://www.kernel.org/pub/linux/kernel/v6.x/${PKG_NAME}-${PKG_VERSION}.tar.xz" PKG_SITE="http://www.kernel.org" PKG_DEPENDS_HOST="ccache:host rsync:host openssl:host rdfind:host"