Module Name:    src
Committed By:   skrll
Date:           Sat Dec 19 14:57:49 UTC 2015

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

Log Message:
C&P of change in rpi.conf (maybe factor out)

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.9 -r1.10 src/distrib/utils/embedded/conf/armv7.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/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.9 src/distrib/utils/embedded/conf/armv7.conf:1.10
--- src/distrib/utils/embedded/conf/armv7.conf:1.9	Sun Dec 13 23:02:56 2015
+++ src/distrib/utils/embedded/conf/armv7.conf	Sat Dec 19 14:57:49 2015
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.9 2015/12/13 23:02:56 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.10 2015/12/19 14:57:49 skrll Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -73,6 +73,23 @@ EOF
         	)
 
 	fi
+
+	#
+	# 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 >> ${mnt}/etc/rc.local << 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_amlogic() {

Reply via email to