# $NetBSD: riscv64.conf,v 1.1 2023/05/07 12:41:46 skrll Exp $
# RISCV64 customization script used by mkimage
#
board=riscv64
console=fb
resize=true
gpt=true
#gpt_hybrid=true
gpt_create_flags="-p 16"
gpt_label_boot="EFI"
gpt_label_ffs="netbsd-root"

. ${DIR}/conf/riscv.conf

kernel_GENERIC="GENERIC64"

make_label() {
	make_label_riscv
}

make_fstab() {
	make_fstab_riscv
}

customize() {
	customize_riscv
	cat >> "${mnt}/etc/rc.conf" << EOF
mdnsd=YES
devpubd=YES
wscons=\$(dev_exists wsdisplay0)
dhcpcd_flags="\$dhcpcd_flags -b"
EOF
}

populate_common() {
	# Install EFI bootloader
	mkdir -p "${mnt}/boot/EFI/BOOT"
	cp "${release}/usr/mdec/bootriscv64.efi" "${mnt}/boot/EFI/BOOT/bootriscv64.efi"

	# Install kernel to root of the FFS partition
	${GZIP_CMD} -dc ${kernel}/netbsd-${kernel_GENERIC}.gz > "${mnt}/netbsd"
	echo "./netbsd type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
}


populate() {

	# common configuration
	populate_common
}
