rpi_inst.conf revision 1.1
1# $NetBSD: rpi_inst.conf,v 1.1 2013/03/19 22:16:53 garbled 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 70customize_evbarm() { 71 echo "${bar} creating directories ${bar}" 72 mkdir ${mnt}/proc ${mnt}/kern 73} 74firmwaredir=$src/external/broadcom/rpi-firmware/dist 75firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf" 76 77make_filesystems() { 78 make_filesystems_evbarm 79} 80 81make_fstab() { 82 make_fstab_evbarm 83} 84 85make_label() { 86 make_label_evbarm 87} 88 89customize() { 90 customize_evbarm 91} 92 93populate() { 94 cat > ${mnt}/boot/cmdline.txt << EOF 95root=ld0a console=fb 96#fb=1280x1024 # to select a mode, otherwise try EDID 97#fb=disable # to disable fb completely 98EOF 99 if [ ! -f ${kernel} ]; then 100 echo ${PROG}: Missing ${kernel} 1>&2 101 exit 1 102 fi 103 104 echo "${bar} installing kernel ${bar}" 105 case ${kernel} in 106 *.gz) 107 gzip -dc ${kernel} > ${mnt}/boot/kernel.img 108 ;; 109 *) 110 cp ${kernel} ${mnt}/boot/kernel.img 111 ;; 112 esac 113 114 echo "${bar} installing firmware files ${bar}" 115 (cd ${mnt}/boot && 116 for f in ${firmwarefiles}; do 117 echo " $f" 118 cp ${firmwaredir}/${f} . 119 done 120 ) 121 122} 123