1# $NetBSD: armv7.conf,v 1.10 2015/12/19 14:57:49 skrll Exp $ 2# ARMv7 customization script used by mkimage 3# 4board=armv7 5console=fb 6resize=true 7 8. ${DIR}/conf/evbarm.conf 9 10kernels_beagle="BEAGLEBOARD BEAGLEBONE" 11kernels_awin="BPI CUBIEBOARD CUBIETRUCK HUMMINGBIRD_A31" 12kernels_rpi="RPI2" 13kernels_amlogic="ODROID-C1" 14kernels_tegra="TEGRA" 15 16make_label() { 17 make_label_evbarm 18} 19 20make_fstab() { 21 make_fstab_evbarm 22} 23 24customize() { 25 customize_evbarm 26 cat >> "${mnt}/etc/rc.conf" << EOF 27mdnsd=YES 28wscons=YES 29devpubd=YES 30EOF 31} 32 33populate_beagle() { 34 bboard_kernelimg=netbsd-BEAGLEBOARD.ub 35 bboard_loadaddr=81000000 36 bbone_kernelimg=netbsd-BEAGLEBONE.ub 37 bbone_loadaddr=82000000 38 39 # Create a uEnv.txt to auto boot the correct kernel 40 cat >> "${mnt}/boot/uEnv.txt" << EOF 41loaduimage=if test \$board = am335x; then fatload mmc 0 ${bbone_loadaddr} ${bbone_kernelimg}; bootm ${bbone_loadaddr} root=ld0a; else fatload mmc 0 ${bboard_loadaddr} ${bboard_kernelimg}; bootm ${bboard_loadaddr} root=ld0a; fi 42EOF 43} 44 45populate_awin() { 46 cat >> "${mnt}/boot/uEnv.txt" << EOF 47bootargs=root=ld0a console=${console} 48uenvcmd=mmc dev 0; mmc rescan; if test \$fdtfile = sun7i-a20-cubieboard2.dtb; then setenv kernel netbsd-CUBIEBOARD.ub; elif test \$fdtfile = sun7i-a20-cubietruck.dtb; then setenv kernel netbsd-CUBIETRUCK.ub; elif test \$fdtfile = sun6i-a31-hummingbird.dtb; then setenv kernel netbsd-HUMMINGBIRD_A31.ub; elif test \$fdtfile = sun7i-a20-bananapi.dtb; then setenv kernel netbsd-BPI.ub; fi; fatload mmc 0:1 82000000 \$kernel; bootm 82000000 49EOF 50} 51 52populate_rpi() { 53 firmwaredir="${src}/external/broadcom/rpi-firmware/dist" 54 firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" 55 56 # RPI2 kernel needs to be installed as kernel7.img 57 if [ -f "${mnt}/boot/netbsd-RPI2.bin" ]; then 58 echo "${bar} renaming netbsd-RPI2.bin to kernel7.img ${bar}" 59 mv "${mnt}/boot/netbsd-RPI2.bin" "${mnt}/boot/kernel7.img" 60 61 cat > "${mnt}/boot/cmdline.txt" << EOF 62root=ld0a console=${console} 63#fb=1280x1024 # to select a mode, otherwise try EDID 64#fb=disable # to disable fb completely 65EOF 66 67 echo "${bar} installing firmware files ${bar}" 68 (cd "${mnt}/boot" && 69 for f in ${firmwarefiles}; do 70 echo " $f" 71 cp "${firmwaredir}/${f}" . 72 done 73 ) 74 75 fi 76 77 # 78 # If arm_freq is specified in config.txt, set CPU frequency 79 # to match at boot time. 80 # 81 cp ${release}/etc/rc.local ${mnt}/etc/rc.local 82 cat >> ${mnt}/etc/rc.local << EOF 83if /sbin/sysctl -q machdep.cpu.frequency.max; then 84 cpufreq_max=\$(/sbin/sysctl -n machdep.cpu.frequency.max) 85 cpufreq_cur=\$(/sbin/sysctl -n machdep.cpu.frequency.current) 86 if [ ! "\$cpufreq_max" = "\$cpufreq_cur" ]; then 87 /sbin/sysctl -w machdep.cpu.frequency.target=\$cpufreq_max 88 fi 89fi 90EOF 91 echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" \ 92 >> "$tmp/selected_sets" 93} 94 95populate_amlogic() { 96 odroidc1_kernelimg=netbsd-ODROID-C1.ub 97 98 # Create a boot.ini for Amlogic U-Boot 99 cat >> "${mnt}/boot/boot.ini" << EOF 100ODROIDC-UBOOT-CONFIG 101 102setenv bootargs "root=ld0f awge0.mac-address=\${ethaddr} console=${console}" 103setenv bootcmd "fatload mmc 0:1 0x21000000 ${odroidc1_kernelimg}; bootm 0x21000000" 104run bootcmd 105EOF 106} 107 108populate_tegra() { 109 tegra_kernelimg=netbsd-TEGRA.ub 110 111 # Create a boot.scr for Tegra U-Boot 112 cat > "${mnt}/boot/boot-TEGRA.txt" << EOF 113setenv bootargs root=ld1a 114fatload mmc 1:1 \${kernel_addr_r} ${tegra_kernelimg} 115fatload mmc 1:1 \${fdt_addr_r} tegra124-\${board}.dtb 116fdt addr \${fdt_addr_r} 117bootm \${kernel_addr_r} - \${fdt_addr_r} 118EOF 119 "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-TEGRA.txt" "${mnt}/boot/boot.scr" 120} 121 122populate() { 123 echo "${bar} looking for kernels in ${kernel} ${bar}" 124 kernels="" 125 # .ub kernels 126 for k in $kernels_beagle $kernels_awin $kernels_amlogic $kernels_tegra; do 127 f="${kernel}/netbsd-${k}.ub.gz" 128 test -f "${f}" && kernels="${kernels} ${f}" 129 done 130 # .bin kernels 131 for k in $kernels_rpi; do 132 f="${kernel}/netbsd-${k}.bin.gz" 133 test -f "${f}" && kernels="${kernels} ${f}" 134 done 135 136 # install kernels to /boot partition 137 for k in ${kernels}; do 138 tgt="$(basename ${k} | sed 's/\.gz$//')" 139 echo "${bar} installing ${k} to /boot/${tgt} ${bar}" 140 case "${k}" in 141 *.gz) 142 ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}" 143 ;; 144 *) 145 cp "${k}" "${mnt}/boot/${tgt}" 146 ;; 147 esac 148 done 149 150 # board specific configuration 151 populate_beagle 152 populate_awin 153 populate_rpi 154 populate_amlogic 155 populate_tegra 156} 157