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