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