Home | History | Annotate | Line # | Download | only in conf
evbarm.conf revision 1.26.2.1
      1  1.26.2.1  pgoyette # $NetBSD: evbarm.conf,v 1.26.2.1 2017/05/19 00:22:52 pgoyette 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.14  christos MACHINE=evbarm
      7       1.1  christos 
      8       1.1  christos swap=256
      9      1.20     skrll extra=48		# spare space
     10       1.1  christos init=8
     11      1.26  jmcneill boot=$((192 - ${init}))
     12      1.15  christos ffsoffset=$(( (${init} + ${boot} + ${swap}) / 2 ))m
     13       1.1  christos 
     14       1.1  christos size=0		# autocompute
     15       1.1  christos msdosid=12
     16       1.1  christos 
     17      1.15  christos mkdir -p ${mnt}/boot
     18      1.15  christos 
     19       1.5  christos make_label_evbarm() {
     20      1.10     htodd 	# compute all sizes in terms of sectors
     21      1.10     htodd 	local totalsize=$(( ${newsize} * 1024 * 2 / 512 ))
     22      1.10     htodd 
     23       1.1  christos 	local swapsize=$(( ${swap} * 1024 ))
     24       1.1  christos 	local bootsize=$(( ${boot} * 1024 ))
     25       1.1  christos 
     26       1.3     skrll 	local bootoffset=$(( ${init} * 1024 ))
     27       1.1  christos 	local swapoffset=$(( ${bootoffset} + ${bootsize} ))
     28       1.3     skrll 
     29       1.3     skrll 	local asize=$(( ${totalsize} - ${swapsize} - ${bootsize} - ${bootoffset} ))
     30       1.1  christos 	local aoffset=$(( ${swapoffset} + ${swapsize} ))
     31       1.1  christos 
     32       1.1  christos 	local bps=512
     33       1.1  christos 	local spt=32
     34       1.1  christos 	local tpc=64
     35       1.1  christos 	local spc=2048
     36       1.1  christos 	local cylinders=$(( ${totalsize} / ${spc} ))
     37       1.1  christos 
     38       1.5  christos 	cat << EOF
     39       1.1  christos type: SCSI
     40       1.1  christos disk: STORAGE DEVICE
     41       1.1  christos label: fictitious
     42       1.1  christos flags: removable
     43       1.1  christos bytes/sector: ${bps}
     44       1.1  christos sectors/track: ${spt}
     45       1.1  christos tracks/cylinder: ${tpc}
     46       1.1  christos sectors/cylinder: ${spc}
     47       1.1  christos cylinders: ${cylinders}
     48       1.1  christos total sectors: ${totalsize}
     49       1.1  christos rpm: 3600
     50       1.1  christos interleave: 1
     51       1.1  christos trackskew: 0
     52       1.1  christos cylinderskew: 0
     53       1.1  christos headswitch: 0           # microseconds
     54       1.1  christos track-to-track seek: 0  # microseconds
     55       1.1  christos drivedata: 0 
     56       1.1  christos 
     57       1.1  christos 8 partitions:
     58       1.1  christos #     size         offset        fstype [fsize bsize cpg/sgs]
     59       1.1  christos  a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
     60       1.1  christos  b:   ${swapsize}  ${swapoffset} swap                         #
     61      1.12      matt  c:   ${totalsize} 0             unused      0     0          #
     62       1.1  christos  e:   ${bootsize}  ${bootoffset} MSDOS                        #
     63       1.1  christos EOF
     64       1.1  christos }
     65       1.1  christos 
     66      1.11  christos make_fstab_evbarm_normal() {
     67       1.5  christos 	cat > ${mnt}/etc/fstab << EOF
     68       1.1  christos # NetBSD /etc/fstab
     69       1.1  christos # See /usr/share/examples/fstab/ for more examples.
     70      1.24  jmcneill /dev/ld0a	/		ffs	rw,noatime	1 1
     71       1.1  christos /dev/ld0b	none		swap	sw	0 0
     72       1.1  christos /dev/ld0e	/boot		msdos	rw	1 1
     73       1.1  christos kernfs		/kern		kernfs	rw
     74       1.1  christos ptyfs		/dev/pts	ptyfs	rw
     75       1.1  christos procfs		/proc		procfs	rw
     76      1.19  jmcneill tmpfs		/var/shm	tmpfs	rw,-m1777,-sram%25
     77       1.1  christos EOF
     78       1.1  christos }
     79       1.1  christos 
     80      1.11  christos # From Richard Neswold's:
     81      1.11  christos # http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
     82      1.11  christos # Also for the postfix stuff below
     83      1.11  christos make_fstab_evbarm_minwrites() {
     84      1.11  christos 	cat > ${mnt}/etc/fstab << EOF
     85      1.11  christos # NetBSD /etc/fstab
     86      1.11  christos # See /usr/share/examples/fstab/ for more examples.
     87      1.11  christos /dev/ld0a	/			ffs	rw,log,noatime,nodevmtime 1 1
     88      1.11  christos /dev/ld0b	none			swap	sw			  0 0
     89      1.11  christos /dev/ld0e	/boot			msdos	rw			  1 1
     90      1.11  christos kernfs		/kern			kernfs	rw
     91      1.11  christos ptyfs		/dev/pts		ptyfs	rw
     92      1.11  christos procfs		/proc			procfs	rw
     93      1.11  christos tmpfs		/tmp			tmpfs	rw,-s32M
     94      1.11  christos tmpfs		/var/log		tmpfs	rw,union,-s32M
     95      1.11  christos tmpfs		/var/run		tmpfs	rw,union,-s1M
     96      1.11  christos tmpfs		/var/mail		tmpfs	rw,union,-s10M
     97      1.11  christos tmpfs		/var/spool/postfix	tmpfs	rw,union,-s20M
     98      1.11  christos tmpfs		/var/db/postfix		tmpfs	rw,union,-s1M
     99      1.11  christos tmpfs		/var/chroot		tmpfs	rw,union,-s10M
    100      1.19  jmcneill tmpfs		/var/shm		tmpfs	rw,-m1777,-sram%25
    101      1.11  christos EOF
    102      1.11  christos }
    103      1.11  christos 
    104      1.11  christos make_fstab_evbarm() {
    105      1.11  christos 	if $minwrites; then
    106      1.11  christos 		make_fstab_evbarm_minwrites
    107      1.11  christos 	else
    108      1.11  christos 		make_fstab_evbarm_normal
    109      1.11  christos 	fi
    110      1.18     skrll 	echo "./etc/fstab type=file uname=root gname=wheel mode=0644" \
    111      1.18     skrll 	    >> "$tmp/selected_sets"
    112      1.20     skrll 
    113      1.20     skrll 	# Missing mount points from fstab
    114      1.20     skrll 	echo "./proc type=dir uname=root gname=wheel mode=0755" \
    115      1.20     skrll 	    >> "$tmp/selected_sets"
    116      1.20     skrll 	echo "./kern type=dir uname=root gname=wheel mode=0755" \
    117      1.20     skrll 	    >> "$tmp/selected_sets"
    118      1.11  christos }
    119      1.11  christos 
    120       1.1  christos customize_evbarm() {
    121      1.11  christos 	if $minwrites; then
    122      1.11  christos 		mkdir ${mnt}/etc/postfix
    123      1.11  christos 		(umask 022
    124      1.11  christos 		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
    125      1.11  christos 		    ${mnt}/etc/postfix/master.cf)
    126      1.11  christos 	fi
    127  1.26.2.1  pgoyette 	
    128  1.26.2.1  pgoyette 	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
    129       1.5  christos 	cat >> ${mnt}/etc/rc.conf << EOF
    130       1.7  jmcneill rc_configured=YES
    131       1.7  jmcneill hostname=${board}
    132       1.1  christos sshd=YES
    133       1.1  christos dhcpcd=YES
    134      1.16  jmcneill ntpd=YES
    135      1.16  jmcneill ntpd_flags="-g"
    136       1.1  christos EOF
    137      1.21  jmcneill 
    138      1.21  jmcneill 	if $resize; then
    139      1.21  jmcneill 		cat >> ${mnt}/etc/rc.conf << EOF
    140      1.21  jmcneill resize_disklabel=YES
    141      1.21  jmcneill resize_disklabel_disk=ld0
    142      1.21  jmcneill resize_disklabel_part=a
    143      1.21  jmcneill resize_root=YES
    144      1.22  jmcneill resize_root_flags="-p"
    145      1.21  jmcneill resize_root_postcmd="/sbin/reboot -n"
    146      1.21  jmcneill EOF
    147      1.21  jmcneill 	fi
    148      1.21  jmcneill 
    149      1.20     skrll 	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
    150      1.20     skrll 	    >> "$tmp/selected_sets"
    151      1.20     skrll 
    152      1.21  jmcneill 	mkdir ${mnt}/etc/rc.d
    153      1.21  jmcneill 	cp ${DIR}/files/resize_disklabel ${mnt}/etc/rc.d/resize_disklabel
    154      1.21  jmcneill 	echo "./etc/rc.d/resize_disklabel type=file uname=root gname=wheel mode=0555" \
    155      1.21  jmcneill 	    >> "$tmp/selected_sets"
    156      1.21  jmcneill 
    157       1.5  christos 	if [ ! -f ${release}/dev/MAKEDEV ]; then
    158       1.5  christos 		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
    159       1.1  christos 		exit 1
    160       1.1  christos 	fi
    161       1.1  christos 	echo "${bar} running MAKEDEV ${bar}"
    162      1.13     skrll 	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
    163      1.13     skrll 	    >> "$tmp/selected_sets"
    164       1.8  jmcneill 
    165      1.18     skrll 	echo "${bar} fixing up permissions"
    166      1.18     skrll 	echo "./boot type=dir uname=root gname=wheel mode=0755" \
    167      1.18     skrll 	    >> "$tmp/selected_sets"
    168       1.1  christos }
    169