rpi_inst.conf revision 1.13
1# $NetBSD: rpi_inst.conf,v 1.13 2020/01/01 14:16:51 skrll Exp $ 2# Raspberry Pi customization script used by mkimage 3# 4 5board=rpi_inst 6kerneldir=${KERNOBJDIR}/RPI_INSTALL 7kernel=$kerneldir/netbsd-RPI_INSTALL.img 8 9. ${DIR}/conf/evbarm.conf 10 11image=$HOME/${board}.img 12 13swap=8 14extra=8 # spare space 15boot=112 16init=8 17 18size=$(( 10485760 + ${swap} * 1024 * 512 + ${boot} * 1024 * 512 + ${init} * 1024 * 512 )) 19msdosid=12 20 21make_label() { 22 # compute all sizes in terms of sectors 23 local totalsize=$(( ${newsize} * 1024 * 2 / 512 )) 24 25 local swapsize=$(( ${swap} * 1024 )) 26 local bootsize=$(( ${boot} * 1024 )) 27 28 local bootoffset=$(( ${init} * 1024 )) 29 local swapoffset=$(( ${bootoffset} + ${bootsize} )) 30 31 local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} )) 32 local aoffset=$(( ${swapoffset} + ${swapsize} )) 33 34 local bps=512 35 local spt=32 36 local tpc=64 37 local spc=2048 38 local cylinders=$(( ${totalsize} / ${spc} )) 39 40 cat << EOF 41type: SCSI 42disk: STORAGE DEVICE 43label: fictitious 44flags: removable 45bytes/sector: ${bps} 46sectors/track: ${spt} 47tracks/cylinder: ${tpc} 48sectors/cylinder: ${spc} 49cylinders: ${cylinders} 50total sectors: ${totalsize} 51rpm: 3600 52interleave: 1 53trackskew: 0 54cylinderskew: 0 55headswitch: 0 # microseconds 56track-to-track seek: 0 # microseconds 57drivedata: 0 58 598 partitions: 60# size offset fstype [fsize bsize cpg/sgs] 61 a: ${asize} ${aoffset} 4.2BSD ${fsize} ${bsize} 0 # 62 b: ${swapsize} ${swapoffset} swap # 63 d: ${totalsize} 0 unused 0 0 # 64 e: ${bootsize} ${bootoffset} MSDOS # 65EOF 66} 67 68customize() { 69 echo "${bar} creating directories ${bar}" 70 mkdir ${mnt}/proc ${mnt}/kern 71} 72 73make_fstab() { 74 : 75} 76 77firmwaredir=$src/external/broadcom/rpi-firmware/dist 78firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" 79dtbs="$(${MAKE} -C ${kerneldir} -v DTB)" 80 81populate() { 82 cat > ${mnt}/boot/cmdline.txt << EOF 83root=ld0a console=fb 84#fb=1280x1024 # to select a mode, otherwise try EDID 85#fb=disable # to disable fb completely 86EOF 87 88 cat > ${mnt}/boot/config.txt << EOF 89# 90upstream_kernel=1 91# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md 92enable_uart=1 93force_turbo=0 94EOF 95 96 if [ ! -f ${kernel} ]; then 97 echo ${PROG}: Missing ${kernel} 1>&2 98 exit 1 99 fi 100 101 echo "${bar} installing kernel ${bar}" 102 case ${kernel} in 103 *.gz) 104 echo " ${kernel} uncompressed to kernel.img" 105 ${GZIP_CMD} -dc ${kernel} > ${mnt}/boot/kernel.img 106 ;; 107 *) 108 echo " ${kernel} copied" 109 cp ${kernel} ${mnt}/boot/kernel.img 110 ;; 111 esac || fail "copy of ${kernel} to ${mnt}/boot/kernel.img failed" 112 113 echo "${bar} installing firmware files ${bar}" 114 (cd ${mnt}/boot && 115 for f in ${firmwarefiles}; do 116 echo " $f" 117 cp ${firmwaredir}/${f} . || exit 1 118 done 119 for f in ${dtbs}; do 120 echo " $f" 121 cp ${kerneldir}/${f} . || exit 1 122 done 123 ) || fail "Copy of firmware to ${mnt}/boot failed" 124 125} 126