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