1125461Speter# $NetBSD: rpi_inst.conf,v 1.19 2022/11/19 09:19:27 yamt Exp $ 2125461Speter# Raspberry Pi customization script used by mkimage 3125461Speter# 4125461Speter 5125461Speterboard=rpi_inst 6125984Sobrienkerneldir=${KERNOBJDIR}/RPI_INSTALL 7125461Speterkernel=$kerneldir/netbsd-RPI_INSTALL.img 8125461Speter 9125461Speter. ${DIR}/conf/evbarm.conf 10125461Speter 11126929Speterimage=$HOME/${board}.img 12147687Speter 13125461Speterswap=8 14209313Skibextra=8 # spare space 15209313Skibinit=8 16209313Skibboot=$(( 192 - ${init} )) 17209313Skib 18209313Skibsize=$(( 10485760 + ${swap} * 1024 * 512 + ${boot} * 1024 * 512 + ${init} * 1024 * 512 )) 19209313Skibmsdosid=14 20125461Speter 21126541Sobrienmake_label() { 22126541Sobrien make_label_evbarm 23126541Sobrien} 24126541Sobrien 25126541Sobriencustomize() { 26147378Sups echo "${bar} creating directories ${bar}" 27147378Sups mkdir ${mnt}/proc 28125461Speter} 29126541Sobrien 30147378Supsmake_fstab() { 31126638Sobrien : 32126637Sobrien} 33126541Sobrien 34142732Sobrienfirmwaredir=$src/external/broadcom/rpi-firmware/dist 35142732Sobrienfirmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" 36142732Sobrien 37142732Sobrienpopulate() { 38142732Sobrien cat > ${mnt}/boot/cmdline.txt << EOF 39209248Smavroot=ld0a console=fb 40209248Smav#fb=1280x1024 # to select a mode, otherwise try EDID 41209248Smav#fb=disable # to disable fb completely 42209248SmavEOF 43145727Sdwhite 44209248Smav cat > ${mnt}/boot/config.txt << EOF 45126541Sobrien# 46126541Sobrienupstream_kernel=1 47126541Sobrienos_prefix=dtb/ 48126541Sobriencmdline=../cmdline.txt 49125461Speterkernel=/kernel.img 50126541Sobrien# UART settings, https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts 51126541Sobrienenable_uart=1 52126541Sobrienforce_turbo=0 53126541SobrienEOF 54126541Sobrien 55126541Sobrien if [ ! -f ${kernel} ]; then 56126541Sobrien echo ${PROG}: Missing ${kernel} 1>&2 57126541Sobrien exit 1 58126541Sobrien fi 59126541Sobrien 60126541Sobrien echo "${bar} installing kernel ${bar}" 61125461Speter case ${kernel} in 62125461Speter *.gz) 63125461Speter echo " ${kernel} uncompressed to kernel.img" 64126541Sobrien ${GZIP_CMD} -dc ${kernel} > ${mnt}/boot/kernel.img 65125461Speter ;; 66125461Speter *) 67125461Speter echo " ${kernel} copied" 68125461Speter cp ${kernel} ${mnt}/boot/kernel.img 69125461Speter ;; 70125461Speter esac || fail "copy of ${kernel} to ${mnt}/boot/kernel.img failed" 71125461Speter 72125461Speter echo "${bar} installing firmware files ${bar}" 73125461Speter (cd ${mnt}/boot && 74125461Speter for f in ${firmwarefiles}; do 75126541Sobrien echo " $f" 76125461Speter cp ${firmwaredir}/${f} . || exit 1 77125461Speter done 78125461Speter ) || fail "Copy of firmware to ${mnt}/boot failed" 79151051Sglebius 80151051Sglebius} 81151051Sglebius