Home | History | Annotate | Line # | Download | only in conf
arm64.conf revision 1.1
      1 # $NetBSD: arm64.conf,v 1.1 2018/04/01 04:35:02 ryo Exp $
      2 # ARM64 customization script used by mkimage
      3 #
      4 board=arm64
      5 console=fb
      6 resize=true
      7 
      8 . ${DIR}/conf/evbarm.conf
      9 
     10 kernel_GENERIC64="GENERIC64"
     11 
     12 make_label() {
     13 	make_label_evbarm
     14 }
     15 
     16 make_fstab() {
     17 	make_fstab_evbarm
     18 }
     19 
     20 customize() {
     21 	customize_evbarm
     22 	cat >> "${mnt}/etc/rc.conf" << EOF
     23 mdnsd=YES
     24 wscons=YES
     25 devpubd=YES
     26 EOF
     27 }
     28 
     29 populate_common() {
     30 	# Rename kernel to netbsd.img
     31 	mv "${mnt}/boot/netbsd-${kernel_GENERIC64}.img" "${mnt}/boot/netbsd.img"
     32 	# Install boot configuration file
     33 	mkdir -p "${mnt}/boot/extlinux"
     34 	cp ${DIR}/files/arm64_extlinux.conf "${mnt}/boot/extlinux/extlinux.conf"
     35 }
     36 
     37 populate_allwinner() {
     38 	# U-Boot expects 64-bit DTB files to live in an allwinner/ subdirectory
     39 	mkdir -p "${mnt}/boot/dtb/allwinner"
     40 	mv "${mnt}"/boot/sun50i-*.dtb "${mnt}/boot/dtb/allwinner/"
     41 }
     42 
     43 populate_rpi() {
     44 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
     45 	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
     46 
     47 	cat > "${mnt}/boot/cmdline.txt" << EOF
     48 root=ld0a console=${console}
     49 EOF
     50 
     51 	cat > "${mnt}/boot/config.txt" << EOF
     52 arm_64bit=1
     53 kernel=netbsd.img
     54 kernel_address=0x200000
     55 enable_uart=1
     56 force_turbo=0
     57 EOF
     58 
     59 	echo "${bar} installing firmware files ${bar}"
     60 	(cd "${mnt}/boot" &&
     61 		for f in ${firmwarefiles}; do
     62 			echo " $f"
     63 			cp "${firmwaredir}/${f}" .
     64 		done
     65 	)
     66 }
     67 
     68 populate_nvidia() {
     69 	# Move tegra dtb files to /boot/dtb
     70 	mkdir -p "${mnt}/boot/dtb"
     71 	mv "${mnt}"/boot/tegra*.dtb "${mnt}/boot/dtb/"
     72 }
     73 
     74 populate() {
     75 	echo "${bar} looking for kernel in ${kernel} ${bar}"
     76 	kernels=""
     77 	k="$kernel_GENERIC64"
     78 
     79 	# .imgkernel
     80 	f="${kernel}/netbsd-${k}.img.gz"
     81 	test -f "${f}" && kernels="${kernels} ${f}"
     82 
     83 	# .dtb files
     84 	test -d "${KERNOBJDIR}/${k}" && \
     85 	    dtbs="$(${MAKE} -C ${KERNOBJDIR}/${k} -v DTB)" || \
     86 	    dtbs=
     87 	for dtb in $dtbs; do
     88 		f="${kernel}/${dtb}.gz"
     89 		test -f "${f}" && kernels="${kernels} ${f}"
     90 	done
     91 
     92 	# install files to /boot partition
     93 	for k in ${kernels}; do
     94 		tgt="$(basename ${k} | sed 's/\.gz$//')"
     95 		echo "${bar} installing ${k} to /boot/${tgt} ${bar}"
     96 		case "${k}" in
     97 		*.gz)
     98 			${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}"
     99 			;;
    100 		*)
    101 			cp "${k}" "${mnt}/boot/${tgt}"
    102 			;;
    103 		esac ||
    104 			fail "Copy of ${k} to ${mnt}/boot/${tgt} failed"
    105 	done
    106 
    107 	# SoC specific configuration
    108 	populate_allwinner
    109 	populate_nvidia
    110 
    111 	# Board specific configuration
    112 	populate_rpi
    113 
    114 	# common configuration
    115 	populate_common
    116 }
    117