1 # $NetBSD: armv7.conf,v 1.10.4.1 2017/04/21 16:51:15 bouyer Exp $ 2 # ARMv7 customization script used by mkimage 3 # 4 board=armv7 5 console=fb 6 resize=true 7 8 . ${DIR}/conf/evbarm.conf 9 10 kernels_beagle="BEAGLEBOARD BEAGLEBONE" 11 kernels_awin="BPI CUBIEBOARD CUBIETRUCK HUMMINGBIRD_A31" 12 kernels_rpi="RPI2" 13 kernels_amlogic="ODROID-C1" 14 kernels_tegra="TEGRA" 15 16 make_label() { 17 make_label_evbarm 18 } 19 20 make_fstab() { 21 make_fstab_evbarm 22 } 23 24 customize() { 25 customize_evbarm 26 cat >> "${mnt}/etc/rc.conf" << EOF 27 mdnsd=YES 28 wscons=YES 29 devpubd=YES 30 EOF 31 } 32 33 populate_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 41 loaduimage=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 42 EOF 43 } 44 45 populate_awin() { 46 cat >> "${mnt}/boot/uEnv.txt" << EOF 47 bootargs=root=ld0a console=${console} 48 uenvcmd=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 49 EOF 50 } 51 52 populate_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 62 root=ld0a console=${console} 63 #fb=1280x1024 # to select a mode, otherwise try EDID 64 #fb=disable # to disable fb completely 65 EOF 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 83 if /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 89 fi 90 EOF 91 echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" \ 92 >> "$tmp/selected_sets" 93 } 94 95 populate_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 100 ODROIDC-UBOOT-CONFIG 101 102 setenv bootargs "root=ld0a awge0.mac-address=\${ethaddr} console=${console}" 103 setenv bootcmd "fatload mmc 0:1 0x21000000 ${odroidc1_kernelimg}; bootm 0x21000000" 104 run bootcmd 105 EOF 106 } 107 108 populate_tegra() { 109 tegra_kernelimg=netbsd-TEGRA.ub 110 tegra_loadaddr=0x90000000 111 112 # Create a boot.scr for Tegra U-Boot 113 cat > "${mnt}/boot/boot-TEGRA.txt" << EOF 114 setenv bootargs root=ld0a 115 fatload mmc 1:1 ${tegra_loadaddr} ${tegra_kernelimg} 116 fatload mmc 1:1 \${fdt_addr_r} tegra124-\${board}.dtb 117 fdt addr \${fdt_addr_r} 118 bootm ${tegra_loadaddr} - \${fdt_addr_r} 119 EOF 120 "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-TEGRA.txt" "${mnt}/boot/boot.scr" 121 } 122 123 populate() { 124 echo "${bar} looking for kernels in ${kernel} ${bar}" 125 kernels="" 126 # .ub kernels 127 for k in $kernels_beagle $kernels_awin $kernels_amlogic $kernels_tegra; do 128 f="${kernel}/netbsd-${k}.ub.gz" 129 test -f "${f}" && kernels="${kernels} ${f}" 130 done 131 # .bin kernels 132 for k in $kernels_rpi; do 133 f="${kernel}/netbsd-${k}.bin.gz" 134 test -f "${f}" && kernels="${kernels} ${f}" 135 done 136 137 # install kernels to /boot partition 138 for k in ${kernels}; do 139 tgt="$(basename ${k} | sed 's/\.gz$//')" 140 echo "${bar} installing ${k} to /boot/${tgt} ${bar}" 141 case "${k}" in 142 *.gz) 143 ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}" 144 ;; 145 *) 146 cp "${k}" "${mnt}/boot/${tgt}" 147 ;; 148 esac 149 done 150 151 # board specific configuration 152 populate_beagle 153 populate_awin 154 populate_rpi 155 populate_amlogic 156 populate_tegra 157 } 158