Home | History | Annotate | Line # | Download | only in conf
      1  1.3  christos # $NetBSD: arm64mbr.conf,v 1.3 2024/02/17 15:07:03 christos Exp $
      2  1.1  jmcneill # ARM64 (MBR partitioning) customization script used by mkimage
      3  1.1  jmcneill #
      4  1.1  jmcneill board=arm64mbr
      5  1.1  jmcneill hostname=arm64
      6  1.1  jmcneill console=fb
      7  1.1  jmcneill resize=true
      8  1.1  jmcneill 
      9  1.1  jmcneill . ${DIR}/conf/evbarm.conf
     10  1.1  jmcneill 
     11  1.1  jmcneill kernel_GENERIC64="GENERIC64"
     12  1.1  jmcneill 
     13  1.1  jmcneill make_label() {
     14  1.1  jmcneill 	make_label_evbarm
     15  1.1  jmcneill }
     16  1.1  jmcneill 
     17  1.1  jmcneill make_fstab() {
     18  1.1  jmcneill 	make_fstab_evbarm
     19  1.1  jmcneill }
     20  1.1  jmcneill 
     21  1.1  jmcneill customize() {
     22  1.1  jmcneill 	customize_evbarm
     23  1.1  jmcneill 	cat >> "${mnt}/etc/rc.conf" << EOF
     24  1.1  jmcneill mdnsd=YES
     25  1.1  jmcneill devpubd=YES
     26  1.1  jmcneill wscons=\$(dev_exists wsdisplay0)
     27  1.1  jmcneill EOF
     28  1.1  jmcneill }
     29  1.1  jmcneill 
     30  1.1  jmcneill populate_common() {
     31  1.1  jmcneill 	# Rename kernel to netbsd.img
     32  1.1  jmcneill 	mv "${mnt}/boot/netbsd-${kernel_GENERIC64}.img" "${mnt}/boot/netbsd.img"
     33  1.1  jmcneill 
     34  1.1  jmcneill 	# Install EFI bootloader
     35  1.1  jmcneill 	mkdir -p "${mnt}/boot/EFI/BOOT"
     36  1.1  jmcneill 	cp "${release}/usr/mdec/bootaa64.efi" "${mnt}/boot/EFI/BOOT/bootaa64.efi"
     37  1.1  jmcneill 
     38  1.1  jmcneill 	# Install kernel to root of the FFS partition
     39  1.3  christos 	${GZIP_CMD} -dnc ${kernel}/netbsd-${kernel_GENERIC64}.gz > "${mnt}/netbsd"
     40  1.1  jmcneill 	echo "./netbsd type=file uname=root gname=wheel mode=0755" \
     41  1.1  jmcneill 	    >> "$tmp/selected_sets"
     42  1.1  jmcneill }
     43  1.1  jmcneill 
     44  1.1  jmcneill 
     45  1.1  jmcneill populate_rpi() {
     46  1.1  jmcneill 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
     47  1.1  jmcneill 	firmwarefiles="LICENCE.broadcom bootcode.bin fixup4cd.dat fixup4.dat fixup_cd.dat fixup.dat start4cd.elf start4.elf start_cd.elf start.elf"
     48  1.1  jmcneill 
     49  1.1  jmcneill 	cat > "${mnt}/boot/cmdline.txt" << EOF
     50  1.1  jmcneill root=ld0a console=${console}
     51  1.1  jmcneill EOF
     52  1.1  jmcneill 
     53  1.1  jmcneill 	cat > "${mnt}/boot/config.txt" << EOF
     54  1.1  jmcneill #
     55  1.1  jmcneill upstream_kernel=1
     56  1.1  jmcneill #
     57  1.1  jmcneill arm_64bit=1
     58  1.1  jmcneill os_prefix=dtb/broadcom/
     59  1.1  jmcneill cmdline=../../cmdline.txt
     60  1.1  jmcneill kernel=/netbsd.img
     61  1.1  jmcneill kernel_address=0x200000
     62  1.1  jmcneill enable_uart=1
     63  1.1  jmcneill force_turbo=0
     64  1.1  jmcneill EOF
     65  1.1  jmcneill 
     66  1.1  jmcneill 	echo "${bar} installing firmware files ${bar}"
     67  1.1  jmcneill 	(cd "${mnt}/boot" &&
     68  1.1  jmcneill 		for f in ${firmwarefiles}; do
     69  1.1  jmcneill 			echo " $f"
     70  1.1  jmcneill 			cp "${firmwaredir}/${f}" .
     71  1.1  jmcneill 		done
     72  1.1  jmcneill 	)
     73  1.1  jmcneill }
     74  1.1  jmcneill 
     75  1.1  jmcneill populate() {
     76  1.1  jmcneill 	echo "${bar} looking for kernel in ${kernel} ${bar}"
     77  1.1  jmcneill 	kernels=""
     78  1.1  jmcneill 	k="$kernel_GENERIC64"
     79  1.1  jmcneill 
     80  1.1  jmcneill 	# .img kernel
     81  1.1  jmcneill 	f="${kernel}/netbsd-${k}.img.gz"
     82  1.1  jmcneill 	test -f "${f}" && kernels="${kernels} ${f}"
     83  1.1  jmcneill 
     84  1.1  jmcneill 	# install files to /boot partition
     85  1.1  jmcneill 	for k in ${kernels}; do
     86  1.1  jmcneill 		tgt="$(basename ${k} | sed 's/\.gz$//')"
     87  1.1  jmcneill 		echo "${bar} installing ${k} to /boot/${tgt} ${bar}"
     88  1.1  jmcneill 		case "${k}" in
     89  1.1  jmcneill 		*.gz)
     90  1.3  christos 			${GZIP_CMD} -dnc "${k}" > "${mnt}/boot/${tgt}"
     91  1.1  jmcneill 			;;
     92  1.1  jmcneill 		*)
     93  1.1  jmcneill 			cp "${k}" "${mnt}/boot/${tgt}"
     94  1.1  jmcneill 			;;
     95  1.1  jmcneill 		esac ||
     96  1.1  jmcneill 			fail "Copy of ${k} to ${mnt}/boot/${tgt} failed"
     97  1.1  jmcneill 	done
     98  1.1  jmcneill 
     99  1.1  jmcneill 	# Board specific configuration
    100  1.1  jmcneill 	populate_rpi
    101  1.1  jmcneill 
    102  1.1  jmcneill 	# common configuration
    103  1.1  jmcneill 	populate_common
    104  1.1  jmcneill }
    105