1 1.27 skrll # $NetBSD: rpi.conf,v 1.27 2015/03/06 11:11:55 skrll Exp $ 2 1.11 jakllsch # Raspberry Pi customization script used by mkimage 3 1.1 christos # 4 1.9 christos 5 1.9 christos board=rpi 6 1.16 christos kernel=$src/sys/arch/evbarm/compile/RPI/netbsd-RPI.bin 7 1.9 christos 8 1.9 christos . ${DIR}/conf/evbarm.conf 9 1.1 christos 10 1.1 christos firmwaredir=$src/external/broadcom/rpi-firmware/dist 11 1.1 christos firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" 12 1.1 christos 13 1.1 christos make_filesystems() { 14 1.9 christos make_filesystems_evbarm 15 1.1 christos } 16 1.1 christos 17 1.1 christos make_fstab() { 18 1.9 christos make_fstab_evbarm 19 1.1 christos } 20 1.1 christos 21 1.13 christos make_label() { 22 1.13 christos make_label_evbarm 23 1.13 christos } 24 1.13 christos 25 1.1 christos customize() { 26 1.9 christos customize_evbarm 27 1.13 christos cat >> ${mnt}/etc/rc.conf << EOF 28 1.1 christos wscons=YES 29 1.20 jmcneill devpubd=YES 30 1.1 christos EOF 31 1.1 christos 32 1.25 jmcneill # 33 1.25 jmcneill # If arm_freq is specified in config.txt, set CPU frequency 34 1.25 jmcneill # to match at boot time. 35 1.25 jmcneill # 36 1.25 jmcneill cp ${release}/etc/rc.local ${mnt}/etc/rc.local 37 1.26 jmcneill cat >> ${mnt}/etc/rc.local << EOF 38 1.25 jmcneill if /sbin/sysctl -q machdep.cpu.frequency.max; then 39 1.25 jmcneill cpufreq_max=\$(/sbin/sysctl -n machdep.cpu.frequency.max) 40 1.25 jmcneill cpufreq_cur=\$(/sbin/sysctl -n machdep.cpu.frequency.current) 41 1.25 jmcneill if [ ! "\$cpufreq_max" = "\$cpufreq_cur" ]; then 42 1.25 jmcneill /sbin/sysctl -w machdep.cpu.frequency.target=\$cpufreq_max 43 1.25 jmcneill fi 44 1.25 jmcneill fi 45 1.25 jmcneill EOF 46 1.25 jmcneill echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" \ 47 1.25 jmcneill >> "$tmp/selected_sets" 48 1.13 christos } 49 1.13 christos 50 1.13 christos populate() { 51 1.27 skrll rpi2_kernel="$(echo $kernel | sed 's/RPI/RPI2/g')" 52 1.27 skrll 53 1.13 christos cat > ${mnt}/boot/cmdline.txt << EOF 54 1.24 skrll root=ld0a console=fb 55 1.10 skrll #fb=1280x1024 # to select a mode, otherwise try EDID 56 1.1 christos #fb=disable # to disable fb completely 57 1.1 christos EOF 58 1.14 christos if [ ! -f ${kernel} ]; then 59 1.14 christos echo ${PROG}: Missing ${kernel} 1>&2 60 1.10 skrll exit 1 61 1.10 skrll fi 62 1.10 skrll 63 1.27 skrll echo "${bar} installing RPI kernel ${bar}" 64 1.16 christos case ${kernel} in 65 1.16 christos *.gz) 66 1.19 riz gzip -dc ${kernel} > ${mnt}/boot/kernel.img 67 1.16 christos ;; 68 1.16 christos *) 69 1.16 christos cp ${kernel} ${mnt}/boot/kernel.img 70 1.16 christos ;; 71 1.16 christos esac 72 1.10 skrll 73 1.27 skrll echo "${bar} installing RPI2 kernel ${bar}" 74 1.27 skrll case ${rpi2_kernel} in 75 1.27 skrll *.gz) 76 1.27 skrll gzip -dc ${rpi2_kernel} > ${mnt}/boot/kernel7.img 77 1.27 skrll ;; 78 1.27 skrll *) 79 1.27 skrll cp ${rpi_kernel} ${mnt}/boot/kernel7.img 80 1.27 skrll ;; 81 1.27 skrll esac 82 1.27 skrll 83 1.17 jmcneill echo "${bar} installing firmware files ${bar}" 84 1.1 christos (cd ${mnt}/boot && 85 1.1 christos for f in ${firmwarefiles}; do 86 1.17 jmcneill echo " $f" 87 1.13 christos cp ${firmwaredir}/${f} . 88 1.1 christos done 89 1.1 christos ) 90 1.1 christos 91 1.1 christos } 92