slitaz-arm rev 122

Full overcloking support in tazberry
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 21 10:59:25 2014 +0200 (2014-04-21)
parents 73088f03f824
children 89c21345e633
files rpi/tazberry sat-rpi
line diff
     1.1 --- a/rpi/tazberry	Mon Apr 21 08:45:24 2014 +0100
     1.2 +++ b/rpi/tazberry	Mon Apr 21 10:59:25 2014 +0200
     1.3 @@ -24,7 +24,7 @@
     1.4  $(boldify "$(gettext 'Usage:')") $(basename $0) [command|rpi_function]
     1.5  
     1.6  $(boldify "$(gettext 'Commands:')")
     1.7 -  oclock            $(gettext 'Display overclocking information')
     1.8 +  oclock            $(gettext 'Configure overclocking')
     1.9    ls-functions      $(gettext 'List TazBerry functions')
    1.10    rpi_              $(gettext 'Execute any tazberry_function')
    1.11    testsuite         $(gettext 'Run TazBerry testsuite')
    1.12 @@ -74,6 +74,60 @@
    1.13  EOT
    1.14  }
    1.15  
    1.16 +# Unset overclocking
    1.17 +unset_oclock() {
    1.18 +	debug "unset_oclock"
    1.19 +	sed -i \
    1.20 +		-e '/# Overclocking.*/'d \
    1.21 +		-e '/arm_freq=/'d \
    1.22 +		-e '/core_freq=/'d \
    1.23 +		-e '/sdram_freq=/'d \
    1.24 +		-e '/over_voltage=/'d ${config}
    1.25 +	# Remove if 3 empty lines follows
    1.26 +	sed -i '1N;N;/^\n\n$/d;P;D' ${config}
    1.27 +}
    1.28 +
    1.29 +# Set overclocking: set_oclock [mode]
    1.30 +set_oclock() {
    1.31 +	debug "set_oclock $1"
    1.32 +	case "$1" in
    1.33 +		none)
    1.34 +			arm_freq=700
    1.35 +			core_freq=250
    1.36 +			sdram_freq=400
    1.37 +			over_voltage=0 ;;
    1.38 +		modest)
    1.39 +			arm_freq=800
    1.40 +			core_freq=300
    1.41 +			sdram_freq=400
    1.42 +			over_voltage=0 ;;
    1.43 +		medium)
    1.44 +			arm_freq=900
    1.45 +			core_freq=333
    1.46 +			sdram_freq=450
    1.47 +			over_voltage=2 ;;
    1.48 +		hight)
    1.49 +			arm_freq=950
    1.50 +			core_freq=450
    1.51 +			sdram_freq=450
    1.52 +			over_voltage=6 ;;
    1.53 +		turbo)
    1.54 +			arm_freq=1000
    1.55 +			core_freq=500
    1.56 +			sdram_freq=500
    1.57 +			over_voltage=6 ;;
    1.58 +	esac
    1.59 +	unset_oclock
    1.60 +	cat >> ${config} << EOT
    1.61 +# Overclocking Settings
    1.62 +arm_freq=$arm_freq
    1.63 +core_freq=$core_freq
    1.64 +sdram_freq=$sdram_freq
    1.65 +over_voltage=$over_voltage
    1.66 +
    1.67 +EOT
    1.68 +}
    1.69 +
    1.70  #
    1.71  # GUI Functions
    1.72  #
    1.73 @@ -126,24 +180,38 @@
    1.74  	esac
    1.75  }
    1.76  
    1.77 +# Overclocking info TODO: button to setup
    1.78  oclock_box() {
    1.79 -	out="$tmpdir/overclocking.txt"
    1.80 -	cat > ${out} << EOT
    1.81 -
    1.82 -Overclocking modes:
    1.83 --------------------
    1.84 -$(rpi_oclock)
    1.85 -
    1.86 -Current /boot/config.txt
    1.87 -------------------------
    1.88 -$(fgrep _freq /boot/config.txt)
    1.89 -$(fgrep over_voltage /boot/config.txt)
    1.90 -
    1.91 -EOT
    1.92 -	dialog --cr-wrap \
    1.93 -		--title "$title" \
    1.94 +	mode=$(fgrep arm_freq ${config} | cut -d '=' -f 2)
    1.95 +	case "$mode" in
    1.96 +		700) mode="none" ;;
    1.97 +		800) mode="modest" ;;
    1.98 +		900) mode="medium" ;;
    1.99 +		950) mode="high" ;;
   1.100 +		1000) mode="turbo" ;;
   1.101 +	esac
   1.102 +	dialog \
   1.103 +		--clear --colors \
   1.104 +		--extra-button \
   1.105 +		--title "{ Overclocking }" \
   1.106  		--ok-label "TazBerry" \
   1.107 -		--textbox "$out" ${height} ${width}
   1.108 +		--extra-label "Set Overclock" \
   1.109 +		--cancel-label "Unset Oclock" \
   1.110 +		--menu "\nSet Raspberry Pi overcloking, current setting: \Zb\Z2$mode" \
   1.111 +		${height} ${width} 14 \
   1.112 +"none"    "700MHz  ARM 250MHz core 400MHz SDRAM 0 overvolt" \
   1.113 +"modest"  "800MHz  ARM 300MHz core 400MHz SDRAM 0 overvolt" \
   1.114 +"medium"  "900MHz  ARM 333MHz core 450MHz SDRAM 2 overvolt" \
   1.115 +"high"    "950MHz  ARM 450MHz core 450MHz SDRAM 6 overvolt" \
   1.116 +"turbo"   "1000MHz ARM 500MHz core 500MHz SDRAM 6 overvolt"  2>${tmp}
   1.117 +	retval="$?"
   1.118 +	mode=$(cat $tmp)
   1.119 +	case "$retval" in
   1.120 +		0) continue ;;
   1.121 +		1) unset_oclock ;;
   1.122 +		3) set_oclock "$mode" ;;
   1.123 +		255) rm -rf ${tmpdir} && exit 0 ;;
   1.124 +	esac
   1.125  }
   1.126  
   1.127  gpu_mem_box() {
   1.128 @@ -176,13 +244,13 @@
   1.129  "rpi-stats"      "$(gettext 'Show some RPi system stats')" \
   1.130  "gpu-mem"        "$(gettext 'Set memory split between ARM and GPU')" \
   1.131  "act-led"        "$(gettext 'Test the RPi onboard ACT green led')" \
   1.132 -"oclock"         "$(gettext 'Overclocking information and config')" \
   1.133 +"oclock"         "$(gettext 'Overclocking configuration')" \
   1.134  "rpi-turbo"      "$(gettext 'Enable or disable RPi turbo on next boot')" \
   1.135  "boot-cmdline"   "$(gettext 'View boot args /boot/cmdline.txt')" \
   1.136  "boot-config"    "$(gettext 'View config file /boot/config.txt')" \
   1.137  "packages"       "$(gettext 'SliTaz packages manager') (spk)" \
   1.138  "config"         "$(gettext 'System config (lang, keyboard, wifi)')" \
   1.139 -"reboot"         "$(gettext 'Reboot SliTaz')" \
   1.140 +"reboot"         "$(gettext 'Reboot SliTaz system')" \
   1.141  "halt"           "$(gettext 'Halt the Raspberry Pi')" \
   1.142  "quit"           "$(gettext 'Exit TazBerry tool')" 2>${tmp}
   1.143  	
   1.144 @@ -240,12 +308,7 @@
   1.145  
   1.146  case "$1" in
   1.147  	oclock)
   1.148 -		newline
   1.149 -		boldify "Overclocking modes:"
   1.150 -		rpi_oclock
   1.151 -		boldify "Current config.txt:"
   1.152 -		cat ${config}
   1.153 -		newline ;;
   1.154 +		oclock_box ;;
   1.155  	
   1.156  	ls-functions)
   1.157  		newline
     2.1 --- a/sat-rpi	Mon Apr 21 08:45:24 2014 +0100
     2.2 +++ b/sat-rpi	Mon Apr 21 10:59:25 2014 +0200
     2.3 @@ -91,45 +91,6 @@
     2.4  	git clone --depth 1 ${rpi_git_url}firmware.git
     2.5  }
     2.6  
     2.7 -# --> will move to tazberry
     2.8 -set_oclock() {
     2.9 -	case "$oclock" in
    2.10 -		none)
    2.11 -			arm_freq=700
    2.12 -			core_freq=250
    2.13 -			sdram_freq=400
    2.14 -			over_voltage=0 ;;
    2.15 -		modest)
    2.16 -			arm_freq=800
    2.17 -			core_freq=300
    2.18 -			sdram_freq=400
    2.19 -			over_voltage=0 ;;
    2.20 -		medium)
    2.21 -			arm_freq=900
    2.22 -			core_freq=333
    2.23 -			sdram_freq=450
    2.24 -			over_voltage=2 ;;
    2.25 -		hight)
    2.26 -			arm_freq=950
    2.27 -			core_freq=450
    2.28 -			sdram_freq=450
    2.29 -			over_voltage=6 ;;
    2.30 -		turbo)
    2.31 -			arm_freq=1000
    2.32 -			core_freq=500
    2.33 -			sdram_freq=500
    2.34 -			over_voltage=6 ;;
    2.35 -	esac
    2.36 -	cat >> ${boot}/config.txt << EOT
    2.37 -# Overclocking Settings
    2.38 -arm_freq=$arm_freq
    2.39 -core_freq=$core_freq
    2.40 -sdram_freq=$sdram_freq
    2.41 -over_voltage=$over_voltage
    2.42 -
    2.43 -EOT
    2.44 -}
    2.45 -
    2.46  umount_sd() {
    2.47  	umount /dev/${dev}1 2>/dev/null || exit 1
    2.48  	umount /dev/${dev}3 2>/dev/null || exit 1
    2.49 @@ -196,12 +157,7 @@
    2.50  		separator
    2.51  		echo "Insert the SD card into your Raspberry Pi and boot!"
    2.52  		newline ;;
    2.53 -		
    2.54 -	ls-dev)
    2.55 -		newline
    2.56 -		fdisk -l | grep "^Disk /dev/sd*" 
    2.57 -		newline ;;
    2.58 -	
    2.59 +
    2.60  	gen)
    2.61  		# Separate boot files since the Raspberry Pi boots off a FAT32 /boot 
    2.62  		# partition on the sdcard.