1 1.3 jmcneill # $NetBSD: arm64.conf,v 1.3 2018/08/12 17:15:56 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.3 jmcneill mv "${mnt}"/boot/rk3399-*.dtb "${mnt}/boot/dtb/rockchip/" 48 1.2 jmcneill } 49 1.2 jmcneill 50 1.1 ryo populate_rpi() { 51 1.1 ryo firmwaredir="${src}/external/broadcom/rpi-firmware/dist" 52 1.1 ryo firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" 53 1.1 ryo 54 1.1 ryo cat > "${mnt}/boot/cmdline.txt" << EOF 55 1.1 ryo root=ld0a console=${console} 56 1.1 ryo EOF 57 1.1 ryo 58 1.1 ryo cat > "${mnt}/boot/config.txt" << EOF 59 1.1 ryo arm_64bit=1 60 1.1 ryo kernel=netbsd.img 61 1.1 ryo kernel_address=0x200000 62 1.1 ryo enable_uart=1 63 1.1 ryo force_turbo=0 64 1.1 ryo EOF 65 1.1 ryo 66 1.1 ryo echo "${bar} installing firmware files ${bar}" 67 1.1 ryo (cd "${mnt}/boot" && 68 1.1 ryo for f in ${firmwarefiles}; do 69 1.1 ryo echo " $f" 70 1.1 ryo cp "${firmwaredir}/${f}" . 71 1.1 ryo done 72 1.1 ryo ) 73 1.1 ryo } 74 1.1 ryo 75 1.1 ryo populate_nvidia() { 76 1.1 ryo # Move tegra dtb files to /boot/dtb 77 1.1 ryo mkdir -p "${mnt}/boot/dtb" 78 1.1 ryo mv "${mnt}"/boot/tegra*.dtb "${mnt}/boot/dtb/" 79 1.1 ryo } 80 1.1 ryo 81 1.1 ryo populate() { 82 1.1 ryo echo "${bar} looking for kernel in ${kernel} ${bar}" 83 1.1 ryo kernels="" 84 1.1 ryo k="$kernel_GENERIC64" 85 1.1 ryo 86 1.1 ryo # .imgkernel 87 1.1 ryo f="${kernel}/netbsd-${k}.img.gz" 88 1.1 ryo test -f "${f}" && kernels="${kernels} ${f}" 89 1.1 ryo 90 1.1 ryo # .dtb files 91 1.1 ryo test -d "${KERNOBJDIR}/${k}" && \ 92 1.1 ryo dtbs="$(${MAKE} -C ${KERNOBJDIR}/${k} -v DTB)" || \ 93 1.1 ryo dtbs= 94 1.1 ryo for dtb in $dtbs; do 95 1.1 ryo f="${kernel}/${dtb}.gz" 96 1.1 ryo test -f "${f}" && kernels="${kernels} ${f}" 97 1.1 ryo done 98 1.1 ryo 99 1.1 ryo # install files to /boot partition 100 1.1 ryo for k in ${kernels}; do 101 1.1 ryo tgt="$(basename ${k} | sed 's/\.gz$//')" 102 1.1 ryo echo "${bar} installing ${k} to /boot/${tgt} ${bar}" 103 1.1 ryo case "${k}" in 104 1.1 ryo *.gz) 105 1.1 ryo ${GZIP_CMD} -dc "${k}" > "${mnt}/boot/${tgt}" 106 1.1 ryo ;; 107 1.1 ryo *) 108 1.1 ryo cp "${k}" "${mnt}/boot/${tgt}" 109 1.1 ryo ;; 110 1.1 ryo esac || 111 1.1 ryo fail "Copy of ${k} to ${mnt}/boot/${tgt} failed" 112 1.1 ryo done 113 1.1 ryo 114 1.1 ryo # SoC specific configuration 115 1.1 ryo populate_allwinner 116 1.1 ryo populate_nvidia 117 1.2 jmcneill populate_rockchip 118 1.1 ryo 119 1.1 ryo # Board specific configuration 120 1.1 ryo populate_rpi 121 1.1 ryo 122 1.1 ryo # common configuration 123 1.1 ryo populate_common 124 1.1 ryo } 125