Skip to content

Commit 11e41bb

Browse files
Lowing Overhead - Removing Memory Subtraction Solution
Removing Memory Subtraction Solution Lowering overhead by half from 50% to 25%
1 parent 96f29c6 commit 11e41bb

File tree

1 file changed

+1
-46
lines changed

1 file changed

+1
-46
lines changed

MerlinAU.sh

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,7 @@ _GetRequiredRAM_KB_()
36513651
{
36523652
local theURL="$1"
36533653
local zip_file_size_bytes zip_file_size_kb overhead_kb
3654-
local total_required_kb overhead_percentage=50
3654+
local total_required_kb overhead_percentage=25
36553655

36563656
# Size of the ZIP file in bytes #
36573657
zip_file_size_bytes="$(curl -LsI --retry 4 --retry-delay 5 "$theURL" | grep -i Content-Length | tail -1 | awk '{print $2}')"
@@ -8817,51 +8817,6 @@ Please manually update to version ${GRNct}${MinSupportedFirmwareVers}${NOct} or
88178817
return 1
88188818
fi
88198819

8820-
##---------------------------------------##
8821-
## Added by ExtremeFiretop [2025-May-29] ##
8822-
##---------------------------------------##
8823-
# Step 1: Find files
8824-
foundFiles=$( { /usr/bin/find -L "$FW_BIN_DIR" -name "*.w" -print; /usr/bin/find -L "$FW_BIN_DIR" -name "*.pkgtb" -print; } )
8825-
8826-
# Initialize the total size counter
8827-
total_size_bytes=0
8828-
8829-
IFS=$'\n' # Set IFS to newline to correctly iterate over files in case they contain spaces
8830-
for file in $foundFiles; do
8831-
if [ -f "$file" ]; then # Ensure the file exists and is a regular file
8832-
# Use wc -c to count the file size in bytes and add it to the total
8833-
size=$(wc -c <"$file")
8834-
total_size_bytes=$((total_size_bytes + size)) # Accumulate total size
8835-
fi
8836-
done
8837-
unset IFS # Reset IFS to default
8838-
8839-
# Display the total size in bytes
8840-
Say "Total size of files: $total_size_bytes bytes"
8841-
8842-
# Convert total size from bytes to KB and adjust the required space
8843-
total_size_kb="$((total_size_bytes / 1024))"
8844-
8845-
# Set the minimum required RAM cushion to 50MB (50 * 1024 = 51200)
8846-
minimum_cushion_kb=51200
8847-
8848-
# Subtract the calculated size from requiredRAM_kb
8849-
if [ "$total_size_kb" -gt 0 ]; then
8850-
requiredRAM_kb=$((requiredRAM_kb - total_size_kb))
8851-
Say "Adjusted required RAM by subtracting sizes of .w or .pkgtb files: $total_size_kb KB. New required RAM: ${requiredRAM_kb} KB"
8852-
8853-
# Check if the adjusted required space is less than the minimum cushion
8854-
if [ "$requiredRAM_kb" -lt "$minimum_cushion_kb" ]; then
8855-
# Add the difference to fulfill the minimum cushion
8856-
cushion_diff=$((minimum_cushion_kb - requiredRAM_kb))
8857-
requiredRAM_kb=$((requiredRAM_kb + cushion_diff))
8858-
Say "Added cushion of $cushion_diff KB to meet the minimum required RAM of 50MB."
8859-
fi
8860-
else
8861-
Say "No .w or .pkgtb file found for adjustment."
8862-
return 1
8863-
fi
8864-
88658820
freeRAM_kb="$(_GetFreeRAM_KB_)"
88668821
availableRAM_kb="$(_GetAvailableRAM_KB_)"
88678822
Say "Required RAM: ${requiredRAM_kb} KB - RAM Free: ${freeRAM_kb} KB - RAM Available: ${availableRAM_kb} KB"

0 commit comments

Comments
 (0)