Home | History | Annotate | Line # | Download | only in conf
armv7.conf revision 1.4
      1 # $NetBSD: armv7.conf,v 1.4 2015/05/24 17:11:18 christos Exp $
      2 # ARMv7 customization script used by mkimage
      3 #
      4 board=armv7
      5 console=fb
      6 
      7 . ${DIR}/conf/evbarm.conf
      8 
      9 kernels_beagle="BEAGLEBOARD BEAGLEBONE"
     10 kernels_awin="BPI CUBIEBOARD CUBIETRUCK HUMMINGBIRD_A31"
     11 kernels_rpi="RPI2"
     12 kernels_amlogic="ODROID-C1"
     13 kernels_tegra="JETSONTK1"
     14 
     15 make_label() {
     16 	make_label_evbarm
     17 }
     18 
     19 make_fstab() {
     20 	make_fstab_evbarm
     21 }
     22 
     23 customize() {
     24 	customize_evbarm
     25 	cat >> "${mnt}/etc/rc.conf" << EOF
     26 mdnsd=YES
     27 wscons=YES
     28 devpubd=YES
     29 EOF
     30 }
     31 
     32 populate_beagle() {
     33 	bboard_kernelimg=netbsd-BEAGLEBOARD.ub
     34 	bboard_loadaddr=81000000
     35 	bbone_kernelimg=netbsd-BEAGLEBONE.ub
     36 	bbone_loadaddr=82000000
     37 
     38 	# Create a uEnv.txt to auto boot the correct kernel
     39 	cat >> "${mnt}/boot/uEnv.txt" << EOF
     40 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
     41 EOF
     42 }
     43 
     44 populate_awin() {
     45 	cat >> "${mnt}/boot/uEnv.txt" << EOF
     46 bootargs=root=ld0a console=${console}
     47 uenvcmd=mmc dev 0; mmc rescan; if test \$fdtfile = sun7i-a20-cubieboard2.dtb; then setenv kernel netbsd-CUBIEBOARD2.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
     48 EOF
     49 }
     50 
     51 populate_rpi() {
     52 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
     53 	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
     54 
     55 	# RPI2 kernel needs to be installed as kernel7.img
     56 	if [ -f "${mnt}/boot/netbsd-RPI2.bin" ]; then
     57 		echo "${bar} renaming netbsd-RPI2.bin to kernel7.img ${bar}"
     58 		mv "${mnt}/boot/netbsd-RPI2.bin" "${mnt}/boot/kernel7.img"
     59 
     60 		cat > "${mnt}/boot/cmdline.txt" << EOF
     61 root=ld0a console=${console}
     62 #fb=1280x1024		# to select a mode, otherwise try EDID
     63 #fb=disable		# to disable fb completely
     64 EOF
     65 
     66 	        echo "${bar} installing firmware files ${bar}"
     67 		(cd "${mnt}/boot" &&
     68 			for f in ${firmwarefiles}; do
     69 				echo " $f"
     70 				cp "${firmwaredir}/${f}" .
     71 			done
     72         	)
     73 
     74 	fi
     75 }
     76 
     77 populate_amlogic() {
     78 	odroidc1_kernelimg=netbsd-ODROID-C1.ub
     79 
     80 	# Create a boot.ini for Amlogic U-Boot
     81 	cat >> "${mnt}/boot/boot.ini" << EOF
     82 ODROIDC-UBOOT-CONFIG
     83 
     84 setenv bootargs "root=ld0f awge0.mac-address=\${ethaddr} console=${console}"
     85 setenv bootcmd "fatload mmc 0:1 0x21000000 ${odroidc1_kernelimg}; bootm 0x21000000"
     86 run bootcmd
     87 EOF
     88 }
     89 
     90 populate_tegra() {
     91 	jetsontk1_kernelimg=netbsd-JETSONTK1.ub
     92 
     93 	# Create a boot.scr for Jetson TK1 U-Boot
     94 	cat > "${mnt}/boot/boot-JETSONTK1.txt" << EOF
     95 setenv bootargs root=ld1a
     96 fatload mmc 1:1 0x90000000 ${jetsontk1_kernelimg}
     97 bootm 0x90000000
     98 EOF
     99 	"${MKUBOOTIMAGE}" -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/tegra boot" "${mnt}/boot/boot-JETSONTK1.txt" "${mnt}/boot/boot-JETSONTK1.scr"
    100 }
    101 
    102 populate() {
    103 	echo "${bar} looking for kernels in ${kernel} ${bar}"
    104 	kernels=""
    105 	# .ub kernels
    106 	for k in $kernels_beagle $kernels_awin $kernels_amlogic $kernels_tegra; do
    107 		f="${kernel}/netbsd-${k}.ub.gz"
    108 		test -f "${f}" && kernels="${kernels} ${f}"
    109 	done
    110 	# .bin kernels
    111 	for k in $kernels_rpi; do
    112 		f="${kernel}/netbsd-${k}.bin.gz"
    113 		test -f "${f}" && kernels="${kernels} ${f}"
    114 	done
    115 
    116 	# install kernels to /boot partition
    117 	for k in ${kernels}; do
    118 		tgt="$(basename ${k} | sed 's/\.gz$//')"
    119 		echo "${bar} installing ${k} to /boot/${tgt} ${bar}"
    120 		case "${k}" in
    121 		*.gz)
    122 			${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}"
    123 			;;
    124 		*)
    125 			cp "${k}" "${mnt}/boot/${tgt}"
    126 			;;
    127 		esac
    128 	done
    129 
    130 	# board specific configuration
    131 	populate_beagle
    132 	populate_awin
    133 	populate_rpi
    134 	populate_amlogic
    135 	populate_tegra
    136 }
    137