Home | History | Annotate | Line # | Download | only in conf
armv7.conf revision 1.6
      1 # $NetBSD: armv7.conf,v 1.6 2015/07/15 11:29:16 martin 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="JETSONTK1"
     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-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
     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 populate_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
     83 ODROIDC-UBOOT-CONFIG
     84 
     85 setenv bootargs "root=ld0f awge0.mac-address=\${ethaddr} console=${console}"
     86 setenv bootcmd "fatload mmc 0:1 0x21000000 ${odroidc1_kernelimg}; bootm 0x21000000"
     87 run bootcmd
     88 EOF
     89 }
     90 
     91 populate_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
     96 setenv bootargs root=ld1a
     97 fatload mmc 1:1 0x90000000 ${jetsontk1_kernelimg}
     98 bootm 0x90000000
     99 EOF
    100 	"${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"
    101 }
    102 
    103 populate() {
    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