1# $NetBSD: evbarm.conf,v 1.15 2014/03/31 17:05:03 christos Exp $ 2# evbarm shared config 3# 4image=$HOME/${board}.img 5 6specialdirs="/kern /proc" 7MACHINE=evbarm 8 9swap=256 10extra=8 # spare space 11boot=112 12init=8 13ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m 14 15size=0 # autocompute 16msdosid=12 17 18mkdir -p ${mnt}/boot 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 c: ${totalsize} 0 unused 0 0 # 63 d: ${totalsize} 0 unused 0 0 # 64 e: ${bootsize} ${bootoffset} MSDOS # 65EOF 66} 67 68make_fstab_evbarm_normal() { 69 cat > ${mnt}/etc/fstab << EOF 70# NetBSD /etc/fstab 71# See /usr/share/examples/fstab/ for more examples. 72/dev/ld0a / ffs rw,log 1 1 73/dev/ld0b none swap sw 0 0 74/dev/ld0e /boot msdos rw 1 1 75kernfs /kern kernfs rw 76ptyfs /dev/pts ptyfs rw 77procfs /proc procfs rw 78EOF 79} 80 81# From Richard Neswold's: 82# http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html 83# Also for the postfix stuff below 84make_fstab_evbarm_minwrites() { 85 cat > ${mnt}/etc/fstab << EOF 86# NetBSD /etc/fstab 87# See /usr/share/examples/fstab/ for more examples. 88/dev/ld0a / ffs rw,log,noatime,nodevmtime 1 1 89/dev/ld0b none swap sw 0 0 90/dev/ld0e /boot msdos rw 1 1 91kernfs /kern kernfs rw 92ptyfs /dev/pts ptyfs rw 93procfs /proc procfs rw 94tmpfs /tmp tmpfs rw,-s32M 95tmpfs /var/log tmpfs rw,union,-s32M 96tmpfs /var/run tmpfs rw,union,-s1M 97tmpfs /var/mail tmpfs rw,union,-s10M 98tmpfs /var/spool/postfix tmpfs rw,union,-s20M 99tmpfs /var/db/postfix tmpfs rw,union,-s1M 100tmpfs /var/chroot tmpfs rw,union,-s10M 101EOF 102} 103 104make_fstab_evbarm() { 105 if $minwrites; then 106 make_fstab_evbarm_minwrites 107 else 108 make_fstab_evbarm_normal 109 fi 110} 111 112customize_evbarm() { 113 cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf 114 if $minwrites; then 115 mkdir ${mnt}/etc/postfix 116 (umask 022 117 sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \ 118 ${mnt}/etc/postfix/master.cf) 119 fi 120 cat >> ${mnt}/etc/rc.conf << EOF 121rc_configured=YES 122hostname=${board} 123sshd=YES 124dhcpcd=YES 125EOF 126 if [ ! -f ${release}/dev/MAKEDEV ]; then 127 echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2 128 exit 1 129 fi 130 echo "${bar} running MAKEDEV ${bar}" 131 ${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \ 132 >> "$tmp/selected_sets" 133 134 echo "${bar} creating directories ${bar}" 135 mkdir ${mnt}/proc ${mnt}/kern 136} 137