evbarm.conf revision 1.14       1  1.14  christos # $NetBSD: evbarm.conf,v 1.14 2014/03/31 16:20:49 christos Exp $
      2   1.1  christos # evbarm shared config
      3   1.1  christos #
      4   1.1  christos image=$HOME/${board}.img
      5   1.1  christos 
      6   1.1  christos specialdirs="/kern /proc"
      7  1.14  christos MACHINE=evbarm
      8   1.1  christos 
      9   1.1  christos swap=256
     10   1.1  christos extra=8		# spare space
     11   1.1  christos boot=112
     12   1.1  christos init=8
     13   1.1  christos 
     14   1.1  christos size=0		# autocompute
     15   1.1  christos msdosid=12
     16   1.1  christos 
     17   1.5  christos make_label_evbarm() {
     18  1.10     htodd 	# compute all sizes in terms of sectors
     19  1.10     htodd 	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
     20  1.10     htodd 
     21   1.1  christos 	local swapsize=$(( ${swap} * 1024 ))
     22   1.1  christos 	local bootsize=$(( ${boot} * 1024 ))
     23   1.1  christos 
     24   1.3     skrll 	local bootoffset=$(( ${init} * 1024 ))
     25   1.1  christos 	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
     26   1.3     skrll 
     27   1.3     skrll 	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
     28   1.1  christos 	local aoffset=$(( ${swapoffset} + ${swapsize} ))
     29   1.1  christos 
     30   1.1  christos 	local bps=512
     31   1.1  christos 	local spt=32
     32   1.1  christos 	local tpc=64
     33   1.1  christos 	local spc=2048
     34   1.1  christos 	local cylinders=$(( ${totalsize} / ${spc} ))
     35   1.1  christos 
     36   1.5  christos 	cat << EOF
     37   1.1  christos type: SCSI
     38   1.1  christos disk: STORAGE DEVICE
     39   1.1  christos label: fictitious
     40   1.1  christos flags: removable
     41   1.1  christos bytes/sector: ${bps}
     42   1.1  christos sectors/track: ${spt}
     43   1.1  christos tracks/cylinder: ${tpc}
     44   1.1  christos sectors/cylinder: ${spc}
     45   1.1  christos cylinders: ${cylinders}
     46   1.1  christos total sectors: ${totalsize}
     47   1.1  christos rpm: 3600
     48   1.1  christos interleave: 1
     49   1.1  christos trackskew: 0
     50   1.1  christos cylinderskew: 0
     51   1.1  christos headswitch: 0           # microseconds
     52   1.1  christos track-to-track seek: 0  # microseconds
     53   1.1  christos drivedata: 0 
     54   1.1  christos 
     55   1.1  christos 8 partitions:
     56   1.1  christos #     size         offset        fstype [fsize bsize cpg/sgs]
     57   1.1  christos  a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
     58   1.1  christos  b:   ${swapsize}  ${swapoffset} swap                         #
     59  1.12      matt  c:   ${totalsize} 0             unused      0     0          #
     60   1.1  christos  d:   ${totalsize} 0             unused      0     0          #
     61   1.1  christos  e:   ${bootsize}  ${bootoffset} MSDOS                        #
     62   1.1  christos EOF
     63   1.1  christos }
     64   1.1  christos 
     65  1.11  christos make_fstab_evbarm_normal() {
     66   1.5  christos 	cat > ${mnt}/etc/fstab << EOF
     67   1.1  christos # NetBSD /etc/fstab
     68   1.1  christos # See /usr/share/examples/fstab/ for more examples.
     69   1.1  christos /dev/ld0a	/		ffs	rw,log	1 1
     70   1.1  christos /dev/ld0b	none		swap	sw	0 0
     71   1.1  christos /dev/ld0e	/boot		msdos	rw	1 1
     72   1.1  christos kernfs		/kern		kernfs	rw
     73   1.1  christos ptyfs		/dev/pts	ptyfs	rw
     74   1.1  christos procfs		/proc		procfs	rw
     75   1.1  christos EOF
     76   1.1  christos }
     77   1.1  christos 
     78  1.11  christos # From Richard Neswold's:
     79  1.11  christos # http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
     80  1.11  christos # Also for the postfix stuff below
     81  1.11  christos make_fstab_evbarm_minwrites() {
     82  1.11  christos 	cat > ${mnt}/etc/fstab << EOF
     83  1.11  christos # NetBSD /etc/fstab
     84  1.11  christos # See /usr/share/examples/fstab/ for more examples.
     85  1.11  christos /dev/ld0a	/			ffs	rw,log,noatime,nodevmtime 1 1
     86  1.11  christos /dev/ld0b	none			swap	sw			  0 0
     87  1.11  christos /dev/ld0e	/boot			msdos	rw			  1 1
     88  1.11  christos kernfs		/kern			kernfs	rw
     89  1.11  christos ptyfs		/dev/pts		ptyfs	rw
     90  1.11  christos procfs		/proc			procfs	rw
     91  1.11  christos tmpfs		/tmp			tmpfs	rw,-s32M
     92  1.11  christos tmpfs		/var/log		tmpfs	rw,union,-s32M
     93  1.11  christos tmpfs		/var/run		tmpfs	rw,union,-s1M
     94  1.11  christos tmpfs		/var/mail		tmpfs	rw,union,-s10M
     95  1.11  christos tmpfs		/var/spool/postfix	tmpfs	rw,union,-s20M
     96  1.11  christos tmpfs		/var/db/postfix		tmpfs	rw,union,-s1M
     97  1.11  christos tmpfs		/var/chroot		tmpfs	rw,union,-s10M
     98  1.11  christos EOF
     99  1.11  christos }
    100  1.11  christos 
    101  1.11  christos make_fstab_evbarm() {
    102  1.11  christos 	if $minwrites; then
    103  1.11  christos 		make_fstab_evbarm_minwrites
    104  1.11  christos 	else
    105  1.11  christos 		make_fstab_evbarm_normal
    106  1.11  christos 	fi
    107  1.11  christos }
    108  1.11  christos 
    109   1.1  christos customize_evbarm() {
    110   1.6  christos 	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
    111  1.11  christos 	if $minwrites; then
    112  1.11  christos 		mkdir ${mnt}/etc/postfix
    113  1.11  christos 		(umask 022
    114  1.11  christos 		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
    115  1.11  christos 		    ${mnt}/etc/postfix/master.cf)
    116  1.11  christos 	fi
    117   1.5  christos 	cat >> ${mnt}/etc/rc.conf << EOF
    118   1.7  jmcneill rc_configured=YES
    119   1.7  jmcneill hostname=${board}
    120   1.1  christos sshd=YES
    121   1.1  christos dhcpcd=YES
    122   1.1  christos EOF
    123   1.5  christos 	if [ ! -f ${release}/dev/MAKEDEV ]; then
    124   1.5  christos 		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
    125   1.1  christos 		exit 1
    126   1.1  christos 	fi
    127   1.1  christos 	echo "${bar} running MAKEDEV ${bar}"
    128  1.13     skrll 	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
    129  1.13     skrll 	    >> "$tmp/selected_sets"
    130   1.8  jmcneill 
    131   1.8  jmcneill 	echo "${bar} creating directories ${bar}"
    132   1.8  jmcneill 	mkdir ${mnt}/proc ${mnt}/kern
    133   1.1  christos }
    134