slitaz-arm rev 105

tazberry: add suport for gpu_mem
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 18 03:45:38 2014 +0200 (2014-04-18)
parents 7f8c51f837a5
children 59d16a648604
files rpi/tazberry
line diff
     1.1 --- a/rpi/tazberry	Fri Apr 18 02:46:52 2014 +0200
     1.2 +++ b/rpi/tazberry	Fri Apr 18 03:45:38 2014 +0200
     1.3 @@ -26,6 +26,7 @@
     1.4  $(boldify "$(gettext 'Commands:')")
     1.5    oclock            $(gettext 'Display overclocking information')
     1.6    ls-functions      $(gettext 'List TazBerry functions')
     1.7 +  rpi_              $(gettext 'Execute any tazberry_function')
     1.8    testsuite         $(gettext 'Run TazBerry testsuite')
     1.9  
    1.10  EOT
    1.11 @@ -145,6 +146,25 @@
    1.12  		--textbox "$out" ${height} ${width}
    1.13  }
    1.14  
    1.15 +gpu_mem_box() {
    1.16 +	dialog \
    1.17 +		--clear \
    1.18 +		--title "$title" \
    1.19 +		--ok-label "Set mem" \
    1.20 +		--cancel-label "TazBerry" \
    1.21 +		--menu "\nSet the memory alocated to the GPU (in MB)" \
    1.22 +		${height} ${width} 14 \
    1.23 +"16"   "For server, NAS, base system without X" \
    1.24 +"32"   "For very small TFT and TV display" \
    1.25 +"64"   "Default value, fine for low latency desktop" \
    1.26 +"128"  "For a faster desktop, using a video player" \
    1.27 +"256"  "For media center, GL/3D applications" 2>${tmp}
    1.28 +	mem=$(cat $tmp)
    1.29 +	sed -i \
    1.30 +		-e s"/#gpu_mem=.*/gpu_mem=$mem/" \
    1.31 +		-e s"/gpu_mem=.*/gpu_mem=$mem/" /boot/config.txt
    1.32 +}
    1.33 +
    1.34  # Main Dialog menu
    1.35  main_box() {
    1.36  	dialog \
    1.37 @@ -154,11 +174,12 @@
    1.38  		--cancel-label "Quit" \
    1.39  		--menu "" ${height} ${width} 14 \
    1.40  "rpi-stats"      "$(gettext 'Show some RPi system stats')" \
    1.41 +"gpu-mem"        "$(gettext 'Set memory split between ARM and GPU')" \
    1.42 +"act-led"        "$(gettext 'Test the RPi onboard ACT green led')" \
    1.43 +"oclock"         "$(gettext 'Overclocking information and config')" \
    1.44 +"rpi-turbo"      "$(gettext 'Enable or disable RPi turbo on next boot')" \
    1.45  "boot-cmdline"   "$(gettext 'View boot args /boot/cmdline.txt')" \
    1.46  "boot-config"    "$(gettext 'View config file /boot/config.txt')" \
    1.47 -"oclock"         "$(gettext 'Overclocking information and config')" \
    1.48 -"rpi-turbo"      "$(gettext 'Enable or disable RPi turbo on next boot')" \
    1.49 -"act-led"        "$(gettext 'Test RPi onboard ACT green led')" \
    1.50  "packages"       "$(gettext 'Spk packages manager')" \
    1.51  "config"         "$(gettext 'System config (lang, keyboard)')" \
    1.52  "reboot"         "$(gettext 'Reboot SliTaz')" \
    1.53 @@ -166,8 +187,7 @@
    1.54  "quit"           "$(gettext 'Exit TazBerry tool')" 2>${tmp}
    1.55  	
    1.56  	# Handle options
    1.57 -	opt=${?}
    1.58 -	case "$opt" in
    1.59 +	case "$?" in
    1.60  		1|255) rm -rf ${tmpdir} && exit 0 ;;
    1.61  	esac
    1.62  	
    1.63 @@ -176,19 +196,21 @@
    1.64  	case "$action" in
    1.65  		rpi-stats)
    1.66  			msg_box "RPi Stats" "$(rpi_stats)" ;;
    1.67 -		boot-cmdline)
    1.68 -			text_box /boot/cmdline.txt ;;
    1.69 -		boot-config)
    1.70 -			text_box ${config} ;;
    1.71 +		gpu-mem)
    1.72 +			 gpu_mem_box ;;
    1.73 +		act-led)
    1.74 +			brightness="/sys/class/leds/led0/brightness"
    1.75 +			(echo "1" > ${brightness}
    1.76 +			sleep 3; echo "0" > ${brightness}) & ;;
    1.77  		oclock)
    1.78  			oclock_box ;;
    1.79  		rpi-turbo)
    1.80  			rpi_turbo && newline 
    1.81  			gettext "Press ENTER to go back to TazBerry"; read ;;
    1.82 -		act-led)
    1.83 -			brightness="/sys/class/leds/led0/brightness"
    1.84 -			(echo "1" > ${brightness}
    1.85 -			sleep 2; echo "0" > ${brightness}) & ;;
    1.86 +		boot-cmdline)
    1.87 +			text_box /boot/cmdline.txt ;;
    1.88 +		boot-config)
    1.89 +			text_box ${config} ;;
    1.90  		packages)
    1.91  			spk-dialog ;;
    1.92  		config)