mirror of
https://github.com/brain-hackers/brain-config.git
synced 2025-01-03 10:00:07 +09:00
Reads in gpu_mem_<size> settings and clears them when writing.
This commit is contained in:
parent
74e81c1c89
commit
a4397f7335
22
raspi-config
22
raspi-config
@ -331,8 +331,20 @@ do_memory_split() { # Memory Split
|
||||
return 1
|
||||
fi
|
||||
## get current memory split from /boot/config.txt
|
||||
arm=$(vcgencmd get_mem arm | cut -d '=' -f 2 | cut -d 'M' -f 1)
|
||||
gpu=$(vcgencmd get_mem gpu | cut -d '=' -f 2 | cut -d 'M' -f 1)
|
||||
tot=$(($arm+$gpu))
|
||||
if [ $tot -gt 512 ]; then
|
||||
CUR_GPU_MEM=$(get_config_var gpu_mem_1024 $CONFIG)
|
||||
elif [ $tot -gt 256 ]; then
|
||||
CUR_GPU_MEM=$(get_config_var gpu_mem_512 $CONFIG)
|
||||
else
|
||||
CUR_GPU_MEM=$(get_config_var gpu_mem_256 $CONFIG)
|
||||
fi
|
||||
if [ -z "$CUR_GPU_MEM" ] || [ $CUR_GPU_MEM = "0" ]; then
|
||||
CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG)
|
||||
[ -z "$CUR_GPU_MEM" ] && CUR_GPU_MEM=64
|
||||
fi
|
||||
[ -z "$CUR_GPU_MEM" ] || [ $CUR_GPU_MEM = "0" ] && CUR_GPU_MEM=64
|
||||
## ask users what gpu_mem they want
|
||||
if [ "$INTERACTIVE" = True ]; then
|
||||
NEW_GPU_MEM=$(whiptail --inputbox "How much memory should the GPU have? e.g. 16/32/64/128/256" \
|
||||
@ -342,6 +354,14 @@ do_memory_split() { # Memory Split
|
||||
true
|
||||
fi
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ $(get_config_var gpu_mem_1024 $CONFIG) != "0" ] || [ $(get_config_var gpu_mem_512 $CONFIG) != "0" ] || [ $(get_config_var gpu_mem_256 $CONFIG) != "0" ]; then
|
||||
if [ "$INTERACTIVE" = True ]; then
|
||||
whiptail --msgbox "Device-specific memory settings were found. These have been cleared." 20 60 2
|
||||
fi
|
||||
clear_config_var gpu_mem_1024 $CONFIG
|
||||
clear_config_var gpu_mem_512 $CONFIG
|
||||
clear_config_var gpu_mem_256 $CONFIG
|
||||
fi
|
||||
set_config_var gpu_mem "$NEW_GPU_MEM" $CONFIG
|
||||
ASK_TO_REBOOT=1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user