Skip to content

Commit

Permalink
Fix compatibility with firmware 1.0.4 hotfix 9
Browse files Browse the repository at this point in the history
We avoid to flash the bootlogo if the firmware > 1.0.4 hotfix 6
The BootLogo app is also disabled for these firmware

There is less space than before on /dev/mmcblk0p1  because the battery images are now also in this partition, so there no enough space for a 720p bootlogo anymore (smaller should be OK however).
  • Loading branch information
cizia64 committed Jun 9, 2024
1 parent 3e0c589 commit d03a509
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 45 deletions.
42 changes: 26 additions & 16 deletions Apps/BootLogo/launch.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
CrossMixFWfile="/mnt/SDCARD/trimui/firmwares/MinFwVersion.txt"
Current_FW_Revision=$(grep 'DISTRIB_DESCRIPTION' /etc/openwrt_release | cut -d '.' -f 3)
Required_FW_Revision=$(sed -n '2p' "$CrossMixFWfile")

if [ "$Current_FW_Revision" -gt "$Required_FW_Revision" ]; then # on firmware hotfix 9 there is less space than before on /dev/mmcblk0p1 so we avoid to flash the logo
/mnt/SDCARD/System/bin/sdl2imgshow \
-i "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" \
-f "/mnt/SDCARD/System/resources/DejaVuSans.ttf" \
-s 30 \
-c "220,220,220" \
-t "Not compatible with firmware superior to v1.0.4 hotfix 6" &
sleep 3
pkill -f sdl2imgshow
exit 1
fi

echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1416000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Expand All @@ -9,32 +24,29 @@ rm -f ./GoBackTo_Apps.json
cp /tmp/state.json ./GoBackTo_Apps.json
cp ./GoTo_Bootlogo_List.json /tmp/state.json


src_dir="/mnt/SDCARD/Apps/BootLogo/Images/"
dest_dir="/mnt/SDCARD/Apps/BootLogo/Thumbnails/"
find "$dest_dir" -type f -not -name "- Default Trimui.png" -exec rm -f {} \;
sync


/mnt/SDCARD/System/bin/sdl2imgshow \
-i "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" \
-f "/mnt/SDCARD/System/resources/DejaVuSans.ttf" \
-s 50 \
-c "220,220,220" \
-t "Generating thumbnails..." &
sleep 0.3
pkill -f sdl2imgshow

-i "/mnt/SDCARD/trimui/res/crossmix-os/bg-info.png" \
-f "/mnt/SDCARD/System/resources/DejaVuSans.ttf" \
-s 50 \
-c "220,220,220" \
-t "Generating thumbnails..." &
sleep 0.3
pkill -f sdl2imgshow

# Rename files to start with a capital letter
find "$src_dir" -type f -iname "*.bmp" | while read -r bmp_file; do
filename=$(basename "$bmp_file")
dirname=$(dirname "$bmp_file")
new_filename="$(echo "$filename" | awk '{print toupper(substr($0,1,1)) substr($0,2)}')"
# Lowercase extension
new_filename="$(echo "$new_filename" | sed 's/\.BMP$/.bmp/I')"
# replace underscores by spaces
# new_filename="$(echo "$new_filename" | sed 's/_/ /g')"
# Lowercase extension
new_filename="$(echo "$new_filename" | sed 's/\.BMP$/.bmp/I')"
# replace underscores by spaces
# new_filename="$(echo "$new_filename" | sed 's/_/ /g')"
mv "$bmp_file" "$dirname/$new_filename"
done
sync
Expand All @@ -52,7 +64,5 @@ sync
rm -f "/mnt/SDCARD/Apps/BootLogo/Thumbnails/Thumbnails_cache7.db"
echo "All conversions have been made."


sync
exit

64 changes: 35 additions & 29 deletions System/starts/°cutomization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ version=$(cat /mnt/SDCARD/System/usr/trimui/crossmix-version.txt)

if [ ! -e "/usr/trimui/fw_mod_done" ]; then

# Removing duplicated app
rm -rf /usr/trimui/apps/zformatter_fat32/

# add pl language
if [ ! -e "/usr/trimui/res/skin/pl.lang" ]; then
cp "/mnt/SDCARD/trimui/res/lang/pl.lang" "/usr/trimui/res/lang/"
Expand All @@ -39,9 +42,6 @@ if [ ! -e "/usr/trimui/fw_mod_done" ]; then
cp /mnt/SDCARD/System/usr/trimui/res/apps/fn_editor/com.trimui.cpuperformance.sh /usr/trimui/apps/fn_editor/com.trimui.cpuperformance.sh
cp /mnt/SDCARD/System/usr/trimui/res/apps/fn_editor/com.trimui.cpuperformance.sh /usr/trimui/scene/com.trimui.cpuperformance.sh

# Removing duplicated app
rm -rf /usr/trimui/apps/zformatter_fat32/

# Apply default CrossMix theme, sound volume, and grid view
cp /mnt/SDCARD/System/usr/trimui/scripts/MainUI_default_system.json /mnt/UDISK/system.json
# sed -i "s|\"theme\":.*|\"theme\": \"/mnt/SDCARD/Themes/CrossMix - OS/\",|" "$system_json"
Expand All @@ -60,41 +60,47 @@ if [ ! -e "/usr/trimui/fw_mod_done" ]; then
fi

################ Flash boot logo ################
CrossMixFWfile="/mnt/SDCARD/trimui/firmwares/MinFwVersion.txt"
Current_FW_Revision=$(grep 'DISTRIB_DESCRIPTION' /etc/openwrt_release | cut -d '.' -f 3)
Required_FW_Revision=$(sed -n '2p' "$CrossMixFWfile")

SOURCE_FILE="/mnt/SDCARD/Apps/BootLogo/Images/- CrossMix-OS.bmp"
TARGET_PARTITION="/dev/mmcblk0p1"
MOUNT_POINT="/mnt/emmcblk0p1"
if ! [ "$Current_FW_Revision" -gt "$Required_FW_Revision" ]; then # on firmware hotfix 9 there is less space than before on /dev/mmcblk0p1 so we avoid to flash the logo

echo "Mounting $TARGET_PARTITION to $MOUNT_POINT..."
mkdir -p $MOUNT_POINT
mount $TARGET_PARTITION $MOUNT_POINT
SOURCE_FILE="/mnt/SDCARD/Apps/BootLogo/Images/- CrossMix-OS.bmp"
TARGET_PARTITION="/dev/mmcblk0p1"
MOUNT_POINT="/mnt/emmcblk0p1"

if [ $? -ne 0 ]; then
echo "Failed to mount $TARGET_PARTITION."
fi
echo "Mounting $TARGET_PARTITION to $MOUNT_POINT..."
mkdir -p $MOUNT_POINT
mount $TARGET_PARTITION $MOUNT_POINT

if [ -f "$SOURCE_FILE" ]; then
echo "Moving "$SOURCE_FILE" to $MOUNT_POINT/bootlogo.bmp..."
cp "$SOURCE_FILE" $MOUNT_POINT/bootlogo.bmp
if [ $? -ne 0 ]; then
echo "Failed to move bootlogo file."
echo "Failed to mount $TARGET_PARTITION."
fi

if [ -f "$SOURCE_FILE" ]; then
echo "Moving "$SOURCE_FILE" to $MOUNT_POINT/bootlogo.bmp..."
cp "$SOURCE_FILE" $MOUNT_POINT/bootlogo.bmp
if [ $? -ne 0 ]; then
echo "Failed to move bootlogo file."
else
echo "Bootlogo file moved successfully."
fi
sync
sync
sleep 0.3
sync
else
echo "Bootlogo file moved successfully."
echo "Source bootlogo file does not exist."
fi
sync
sync
sleep 0.3
sync
else
echo "Source bootlogo file does not exist."
fi

echo "Unmounting $TARGET_PARTITION..."
umount $TARGET_PARTITION
rmdir $MOUNT_POINT
echo "Unmounting $TARGET_PARTITION..."
umount $TARGET_PARTITION
rmdir $MOUNT_POINT

touch "/usr/trimui/fw_mod_done"
sync
touch "/usr/trimui/fw_mod_done"
sync
fi
fi

######################### CrossMix-OS at each boot #########################
Expand Down

0 comments on commit d03a509

Please sign in to comment.