* 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.
This commit is contained in:
parent
7921c5587a
commit
788a398aab
16 changed files with 117 additions and 39 deletions
0
packages/hardware/quirks/platforms/RK3326/010-governors
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/010-governors
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/050-audio_path
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/050-audio_path
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/050-modifiers
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/050-modifiers
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/060-game_settings
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/060-game_settings
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/090-ui_service
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3326/090-ui_service
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3399/040-affinity
Normal file → Executable file
0
packages/hardware/quirks/platforms/RK3399/040-affinity
Normal file → Executable file
|
@ -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}"
|
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
0
packages/jelos/sources/scripts/led_flash
Normal file → Executable file
0
packages/jelos/sources/scripts/led_flash
Normal file → Executable file
0
packages/jelos/sources/scripts/runemu.sh
Normal file → Executable file
0
packages/jelos/sources/scripts/runemu.sh
Normal file → Executable file
0
packages/jelos/sources/scripts/volume
Normal file → Executable file
0
packages/jelos/sources/scripts/volume
Normal file → Executable file
|
@ -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"
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue