1# $NetBSD: armv7.conf,v 1.8 2015/08/21 17:08:11 jmcneill 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="JETSONTK1" 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 78populate_amlogic() { 79 odroidc1_kernelimg=netbsd-ODROID-C1.ub 80 81 # Create a boot.ini for Amlogic U-Boot 82 cat >> "${mnt}/boot/boot.ini" << EOF 83ODROIDC-UBOOT-CONFIG 84 85setenv bootargs "root=ld0f awge0.mac-address=\${ethaddr} console=${console}" 86setenv bootcmd "fatload mmc 0:1 0x21000000 ${odroidc1_kernelimg}; bootm 0x21000000" 87run bootcmd 88EOF 89} 90 91populate_tegra() { 92 jetsontk1_kernelimg=netbsd-JETSONTK1.ub 93 94 # Create a boot.scr for Jetson TK1 U-Boot 95 cat > "${mnt}/boot/boot-JETSONTK1.txt" << EOF 96setenv bootargs root=ld1a 97fatload mmc 1:1 0x90000000 ${jetsontk1_kernelimg} 98bootm 0x90000000 99EOF 100 "${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-JETSONTK1.txt" "${mnt}/boot/boot.scr" 101} 102 103populate() { 104 echo "${bar} looking for kernels in ${kernel} ${bar}" 105 kernels="" 106 # .ub kernels 107 for k in $kernels_beagle $kernels_awin $kernels_amlogic $kernels_tegra; do 108 f="${kernel}/netbsd-${k}.ub.gz" 109 test -f "${f}" && kernels="${kernels} ${f}" 110 done 111 # .bin kernels 112 for k in $kernels_rpi; do 113 f="${kernel}/netbsd-${k}.bin.gz" 114 test -f "${f}" && kernels="${kernels} ${f}" 115 done 116 117 # install kernels to /boot partition 118 for k in ${kernels}; do 119 tgt="$(basename ${k} | sed 's/\.gz$//')" 120 echo "${bar} installing ${k} to /boot/${tgt} ${bar}" 121 case "${k}" in 122 *.gz) 123 ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}" 124 ;; 125 *) 126 cp "${k}" "${mnt}/boot/${tgt}" 127 ;; 128 esac 129 done 130 131 # board specific configuration 132 populate_beagle 133 populate_awin 134 populate_rpi 135 populate_amlogic 136 populate_tegra 137} 138