Home | History | Annotate | Line # | Download | only in conf
evbppc.conf revision 1.1.2.2
      1  1.1.2.2  martin # $NetBSD: evbppc.conf,v 1.1.2.2 2024/02/03 11:47:06 martin Exp $ */
      2  1.1.2.2  martin # evbppc shared config
      3  1.1.2.2  martin #
      4  1.1.2.2  martin image=$HOME/${board}.img
      5  1.1.2.2  martin 
      6  1.1.2.2  martin MACHINE=evbppc
      7  1.1.2.2  martin 
      8  1.1.2.2  martin extra=48		# spare space
      9  1.1.2.2  martin init=32
     10  1.1.2.2  martin boot=$((192 - ${init}))
     11  1.1.2.2  martin ffsoffset=$(( (${init} + ${boot}) / 2 ))m
     12  1.1.2.2  martin 
     13  1.1.2.2  martin size=0		# autocompute
     14  1.1.2.2  martin msdosid=12
     15  1.1.2.2  martin 
     16  1.1.2.2  martin if $gpt; then
     17  1.1.2.2  martin 	partition_type="gpt"
     18  1.1.2.2  martin else
     19  1.1.2.2  martin 	partition_type="disklabel"
     20  1.1.2.2  martin fi
     21  1.1.2.2  martin 
     22  1.1.2.2  martin mkdir -p ${mnt}/boot
     23  1.1.2.2  martin 
     24  1.1.2.2  martin make_label_evbppc() {
     25  1.1.2.2  martin 	# compute all sizes in terms of sectors
     26  1.1.2.2  martin 	local totalsize=$(( ${size} / 512 ))
     27  1.1.2.2  martin 
     28  1.1.2.2  martin 	local bootsize=$(( ${boot} * 1024 ))
     29  1.1.2.2  martin 
     30  1.1.2.2  martin 	local bootoffset=$(( ${init} * 1024 ))
     31  1.1.2.2  martin 
     32  1.1.2.2  martin 	local asize=$(( ${totalsize} - ${bootsize} - ${bootoffset} ))
     33  1.1.2.2  martin 	local aoffset=$(( ${bootoffset} + ${bootsize} ))
     34  1.1.2.2  martin 
     35  1.1.2.2  martin 	local bps=512
     36  1.1.2.2  martin 	local spt=32
     37  1.1.2.2  martin 	local tpc=64
     38  1.1.2.2  martin 	local spc=2048
     39  1.1.2.2  martin 	local cylinders=$(( ${totalsize} / ${spc} ))
     40  1.1.2.2  martin 
     41  1.1.2.2  martin 	cat << EOF
     42  1.1.2.2  martin type: SCSI
     43  1.1.2.2  martin disk: STORAGE DEVICE
     44  1.1.2.2  martin label: fictitious
     45  1.1.2.2  martin flags: removable
     46  1.1.2.2  martin bytes/sector: ${bps}
     47  1.1.2.2  martin sectors/track: ${spt}
     48  1.1.2.2  martin tracks/cylinder: ${tpc}
     49  1.1.2.2  martin sectors/cylinder: ${spc}
     50  1.1.2.2  martin cylinders: ${cylinders}
     51  1.1.2.2  martin total sectors: ${totalsize}
     52  1.1.2.2  martin rpm: 3600
     53  1.1.2.2  martin interleave: 1
     54  1.1.2.2  martin trackskew: 0
     55  1.1.2.2  martin cylinderskew: 0
     56  1.1.2.2  martin headswitch: 0           # microseconds
     57  1.1.2.2  martin track-to-track seek: 0  # microseconds
     58  1.1.2.2  martin drivedata: 0 
     59  1.1.2.2  martin 
     60  1.1.2.2  martin 8 partitions:
     61  1.1.2.2  martin #     size         offset        fstype [fsize bsize cpg/sgs]
     62  1.1.2.2  martin  a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
     63  1.1.2.2  martin  c:   ${totalsize} 0             unused      0     0          #
     64  1.1.2.2  martin  e:   ${bootsize}  ${bootoffset} MSDOS                        #
     65  1.1.2.2  martin EOF
     66  1.1.2.2  martin }
     67  1.1.2.2  martin 
     68  1.1.2.2  martin make_fstab_evbppc_gpt() {
     69  1.1.2.2  martin 	cat > ${mnt}/etc/fstab << EOF
     70  1.1.2.2  martin # NetBSD /etc/fstab
     71  1.1.2.2  martin # See /usr/share/examples/fstab/ for more examples.
     72  1.1.2.2  martin NAME=${gpt_label_ffs:-netbsd-root}	/		ffs	rw,noatime	1 1
     73  1.1.2.2  martin NAME=${gpt_label_boot:-boot}		/boot		msdos	rw	1 1
     74  1.1.2.2  martin ptyfs		/dev/pts	ptyfs	rw
     75  1.1.2.2  martin procfs		/proc		procfs	rw
     76  1.1.2.2  martin tmpfs		/var/shm	tmpfs	rw,-m1777,-sram%25
     77  1.1.2.2  martin EOF
     78  1.1.2.2  martin }
     79  1.1.2.2  martin 
     80  1.1.2.2  martin make_fstab_evbppc_normal() {
     81  1.1.2.2  martin 	cat > ${mnt}/etc/fstab << EOF
     82  1.1.2.2  martin # NetBSD /etc/fstab
     83  1.1.2.2  martin # See /usr/share/examples/fstab/ for more examples.
     84  1.1.2.2  martin ROOT.a		/		ffs	rw,noatime	1 1
     85  1.1.2.2  martin ROOT.e		/boot		msdos	rw	1 1
     86  1.1.2.2  martin ptyfs		/dev/pts	ptyfs	rw
     87  1.1.2.2  martin procfs		/proc		procfs	rw
     88  1.1.2.2  martin tmpfs		/var/shm	tmpfs	rw,-m1777,-sram%25
     89  1.1.2.2  martin EOF
     90  1.1.2.2  martin }
     91  1.1.2.2  martin 
     92  1.1.2.2  martin # From Richard Neswold's:
     93  1.1.2.2  martin # http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
     94  1.1.2.2  martin # Also for the postfix stuff below
     95  1.1.2.2  martin make_fstab_evbppc_minwrites() {
     96  1.1.2.2  martin 	cat > ${mnt}/etc/fstab << EOF
     97  1.1.2.2  martin # NetBSD /etc/fstab
     98  1.1.2.2  martin # See /usr/share/examples/fstab/ for more examples.
     99  1.1.2.2  martin ROOT.a		/			ffs	rw,log,noatime,nodevmtime 1 1
    100  1.1.2.2  martin ROOT.e		/boot			msdos	rw			  1 1
    101  1.1.2.2  martin ptyfs		/dev/pts		ptyfs	rw
    102  1.1.2.2  martin procfs		/proc			procfs	rw
    103  1.1.2.2  martin tmpfs		/tmp			tmpfs	rw,-s32M
    104  1.1.2.2  martin tmpfs		/var/log		tmpfs	rw,union,-s32M
    105  1.1.2.2  martin tmpfs		/var/run		tmpfs	rw,union,-s1M
    106  1.1.2.2  martin tmpfs		/var/mail		tmpfs	rw,union,-s10M
    107  1.1.2.2  martin tmpfs		/var/spool/postfix	tmpfs	rw,union,-s20M
    108  1.1.2.2  martin tmpfs		/var/db/postfix		tmpfs	rw,union,-s1M
    109  1.1.2.2  martin tmpfs		/var/chroot		tmpfs	rw,union,-s10M
    110  1.1.2.2  martin tmpfs		/var/shm		tmpfs	rw,-m1777,-sram%25
    111  1.1.2.2  martin EOF
    112  1.1.2.2  martin }
    113  1.1.2.2  martin 
    114  1.1.2.2  martin make_fstab_evbppc() {
    115  1.1.2.2  martin 	if $gpt; then
    116  1.1.2.2  martin 		make_fstab_evbppc_gpt
    117  1.1.2.2  martin 	elif $minwrites; then
    118  1.1.2.2  martin 		make_fstab_evbppc_minwrites
    119  1.1.2.2  martin 	else
    120  1.1.2.2  martin 		make_fstab_evbppc_normal
    121  1.1.2.2  martin 	fi
    122  1.1.2.2  martin 	echo "./etc/fstab type=file uname=root gname=wheel mode=0644" \
    123  1.1.2.2  martin 	    >> "$tmp/selected_sets"
    124  1.1.2.2  martin 
    125  1.1.2.2  martin 	# Missing mount points from fstab
    126  1.1.2.2  martin 	echo "./proc type=dir uname=root gname=wheel mode=0755" \
    127  1.1.2.2  martin 	    >> "$tmp/selected_sets"
    128  1.1.2.2  martin }
    129  1.1.2.2  martin 
    130  1.1.2.2  martin customize_evbppc() {
    131  1.1.2.2  martin 	if $minwrites; then
    132  1.1.2.2  martin 		mkdir ${mnt}/etc/postfix
    133  1.1.2.2  martin 		(umask 022
    134  1.1.2.2  martin 		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
    135  1.1.2.2  martin 		    ${mnt}/etc/postfix/master.cf)
    136  1.1.2.2  martin 	fi
    137  1.1.2.2  martin 	
    138  1.1.2.2  martin 	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
    139  1.1.2.2  martin 	cat >> ${mnt}/etc/rc.conf << EOF
    140  1.1.2.2  martin dev_exists() {
    141  1.1.2.2  martin 	if /sbin/drvctl -l \$1 >/dev/null 2>&1 ; then
    142  1.1.2.2  martin 		printf YES
    143  1.1.2.2  martin 	else
    144  1.1.2.2  martin 		printf NO
    145  1.1.2.2  martin 	fi
    146  1.1.2.2  martin }
    147  1.1.2.2  martin 
    148  1.1.2.2  martin rc_configured=YES
    149  1.1.2.2  martin hostname=${hostname:-${board}}
    150  1.1.2.2  martin savecore=NO
    151  1.1.2.2  martin sshd=YES
    152  1.1.2.2  martin dhcpcd=YES
    153  1.1.2.2  martin ntpd=YES
    154  1.1.2.2  martin ntpd_flags="-g"
    155  1.1.2.2  martin creds_msdos=YES
    156  1.1.2.2  martin creds_msdos_partition=/boot
    157  1.1.2.2  martin certctl_init=YES
    158  1.1.2.2  martin EOF
    159  1.1.2.2  martin 
    160  1.1.2.2  martin 	if ! ${swap:-false}; then
    161  1.1.2.2  martin 		cat >> ${mnt}/etc/rc.conf << EOF
    162  1.1.2.2  martin no_swap=YES
    163  1.1.2.2  martin EOF
    164  1.1.2.2  martin 	fi
    165  1.1.2.2  martin 	if $resize; then
    166  1.1.2.2  martin 		cat >> ${mnt}/etc/rc.conf << EOF
    167  1.1.2.2  martin resize_${partition_type}=YES
    168  1.1.2.2  martin resize_root=YES
    169  1.1.2.2  martin resize_root_flags="-p"
    170  1.1.2.2  martin resize_root_postcmd="/sbin/reboot -n"
    171  1.1.2.2  martin EOF
    172  1.1.2.2  martin 	fi
    173  1.1.2.2  martin 
    174  1.1.2.2  martin 	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
    175  1.1.2.2  martin 	    >> "$tmp/selected_sets"
    176  1.1.2.2  martin 
    177  1.1.2.2  martin 	mkdir ${mnt}/etc/rc.d
    178  1.1.2.2  martin 	for _f in resize_${partition_type} creds_msdos; do
    179  1.1.2.2  martin 		cp ${DIR}/files/${_f} ${mnt}/etc/rc.d/${_f}
    180  1.1.2.2  martin 		echo "./etc/rc.d/${_f} type=file uname=root gname=wheel mode=0555" \
    181  1.1.2.2  martin 		    >> "$tmp/selected_sets"
    182  1.1.2.2  martin 	done
    183  1.1.2.2  martin 
    184  1.1.2.2  martin 	if [ ! -f ${release}/dev/MAKEDEV ]; then
    185  1.1.2.2  martin 		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
    186  1.1.2.2  martin 		exit 1
    187  1.1.2.2  martin 	fi
    188  1.1.2.2  martin 	echo "${bar} running MAKEDEV ${bar}"
    189  1.1.2.2  martin 	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
    190  1.1.2.2  martin 	    >> "$tmp/selected_sets"
    191  1.1.2.2  martin 
    192  1.1.2.2  martin 	echo "${bar} fixing up permissions"
    193  1.1.2.2  martin 	echo "./boot type=dir uname=root gname=wheel mode=0755" \
    194  1.1.2.2  martin 	    >> "$tmp/selected_sets"
    195  1.1.2.2  martin }
    196