Module Name:    src
Committed By:   jmcneill
Date:           Fri Feb  6 15:15:02 UTC 2015

Modified Files:
        src/distrib/utils/embedded/conf: rpi.conf

Log Message:
By default, RPI firmware sets the max CPU frequency to 600MHz. This can be
overridden by setting arm_freq in config.txt, but the default freq at boot
is still 600MHz.

Add logic to rc.local to compare the current vs. max CPU frequency; if they
differ, set the target frequency to the maximum.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/distrib/utils/embedded/conf/rpi.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.24 src/distrib/utils/embedded/conf/rpi.conf:1.25
--- src/distrib/utils/embedded/conf/rpi.conf:1.24	Thu Nov 28 13:39:18 2013
+++ src/distrib/utils/embedded/conf/rpi.conf	Fri Feb  6 15:15:01 2015
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.24 2013/11/28 13:39:18 skrll Exp $
+# $NetBSD: rpi.conf,v 1.25 2015/02/06 15:15:01 jmcneill Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -29,6 +29,22 @@ wscons=YES
 devpubd=YES
 EOF
 
+	#
+	# If arm_freq is specified in config.txt, set CPU frequency
+	# to match at boot time.
+	#
+	cp ${release}/etc/rc.local ${mnt}/etc/rc.local
+	cat > /tmp/a << EOF
+if /sbin/sysctl -q machdep.cpu.frequency.max; then
+	cpufreq_max=\$(/sbin/sysctl -n machdep.cpu.frequency.max)
+	cpufreq_cur=\$(/sbin/sysctl -n machdep.cpu.frequency.current)
+	if [ ! "\$cpufreq_max" = "\$cpufreq_cur" ]; then
+		/sbin/sysctl -w machdep.cpu.frequency.target=\$cpufreq_max
+	fi
+fi
+EOF
+	echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" \
+	    >> "$tmp/selected_sets"
 }
 
 populate() {

Reply via email to