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