Home | History | Annotate | Line # | Download | only in conf
x86.conf revision 1.10
      1 # $NetBSD: x86.conf,v 1.10 2021/07/06 11:49:36 jmcneill Exp $
      2 # x86 shared config
      3 #
      4 
      5 image=$HOME/${board}.img
      6 MACHINE=${board}
      7 kernel=$src/sys/arch/${board}/compile/GENERIC/netbsd
      8 bootfile=$release/usr/mdec/boot
      9 
     10 extra=8		# spare space
     11 size=0		# autocompute
     12 netbsdid=169
     13 init=63
     14 ffsoffset=${init}b
     15 
     16 make_label() {
     17 	# compute all sizes in terms of sectors
     18 	local totalsize=$(( ${size} / 512 ))
     19 
     20 	local aoffset=${init}
     21 	local asize=$(( ${totalsize} - ${aoffset} ))
     22 
     23 	local bps=512
     24 	local spt=32
     25 	local tpc=64
     26 	local spc=2048
     27 	local cylinders=$(( ${totalsize} / ${spc} ))
     28 
     29 	cat << EOF
     30 type: SCSI
     31 disk: STORAGE DEVICE
     32 label: fictitious
     33 flags: removable
     34 bytes/sector: ${bps}
     35 sectors/track: ${spt}
     36 tracks/cylinder: ${tpc}
     37 sectors/cylinder: ${spc}
     38 cylinders: ${cylinders}
     39 total sectors: ${totalsize}
     40 rpm: 3600
     41 interleave: 1
     42 trackskew: 0
     43 cylinderskew: 0
     44 headswitch: 0           # microseconds
     45 track-to-track seek: 0  # microseconds
     46 drivedata: 0 
     47 
     48 8 partitions:
     49 #     size         offset        fstype [fsize bsize cpg/sgs]
     50  a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
     51  c:   ${totalsize} 0             unused      0     0          #
     52  d:   ${totalsize} 0             unused      0     0          #
     53 EOF
     54 }
     55 
     56 make_fstab_normal() {
     57 	cat > ${mnt}/etc/fstab << EOF
     58 # NetBSD /etc/fstab
     59 # See /usr/share/examples/fstab/ for more examples.
     60 /dev/${rootdev}0a	/		ffs	rw,log	1 1
     61 ptyfs		/dev/pts	ptyfs	rw
     62 procfs		/proc		procfs	rw
     63 EOF
     64 }
     65 
     66 # From Richard Neswold's:
     67 # http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
     68 # Also for the postfix stuff below
     69 make_fstab_minwrites() {
     70 	cat > ${mnt}/etc/fstab << EOF
     71 # NetBSD /etc/fstab
     72 # See /usr/share/examples/fstab/ for more examples.
     73 /dev/${rootdev}0a	/			ffs	rw,log,noatime,nodevmtime 1 1
     74 ptyfs		/dev/pts		ptyfs	rw
     75 procfs		/proc			procfs	rw
     76 tmpfs		/tmp			tmpfs	rw,-s32M
     77 tmpfs		/var/log		tmpfs	rw,union,-s32M
     78 tmpfs		/var/run		tmpfs	rw,union,-s1M
     79 tmpfs		/var/mail		tmpfs	rw,union,-s10M
     80 tmpfs		/var/spool/postfix	tmpfs	rw,union,-s20M
     81 tmpfs		/var/db/postfix		tmpfs	rw,union,-s1M
     82 tmpfs		/var/chroot		tmpfs	rw,union,-s10M
     83 EOF
     84 }
     85 
     86 make_fstab() {
     87 	if $minwrites; then
     88 		make_fstab_minwrites
     89 	else
     90 		make_fstab_normal
     91 	fi
     92 	echo "./etc/fstab type=file uname=root gname=wheel mode=0755" \
     93 	    >> "$tmp/selected_sets"
     94 
     95 	echo "./proc type=dir uname=root gname=wheel mode=0755" \
     96 	    >> "$tmp/selected_sets"
     97 }
     98 
     99 customize() {
    100 	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
    101 	if $minwrites; then
    102 		mkdir ${mnt}/etc/postfix
    103 		(umask 022
    104 		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
    105 		    ${mnt}/etc/postfix/master.cf)
    106 	fi
    107 	cat >> ${mnt}/etc/rc.conf << EOF
    108 rc_configured=YES
    109 hostname=${board}
    110 sshd=YES
    111 dhcpcd=YES
    112 wscons=YES
    113 devpubd=YES
    114 EOF
    115 	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
    116 	    >> "$tmp/selected_sets"
    117 
    118 	if [ ! -f ${release}/dev/MAKEDEV ]; then
    119 		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
    120 		exit 1
    121 	fi
    122 	echo "${bar} running MAKEDEV ${bar}"
    123 	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
    124 	    >> "$tmp/selected_sets"
    125 }
    126 
    127 populate() {
    128 	if [ ! -f ${kernel} ]; then
    129 		echo ${PROG}: Missing ${kernel} 1>&2
    130 		exit 1
    131 	fi
    132 
    133 	echo "${bar} installing kernel ${bar}"
    134 	cp ${kernel} ${mnt}/netbsd
    135 	if [ ! -f ${bootfile} ]; then
    136 		echo ${PROG}: Missing ${bootfile} 1>&2
    137 		exit 1
    138 	fi
    139 	cp ${bootfile} ${mnt}/boot ||
    140 	    fail "copy of ${bootfile} to ${mnt}/boot failed"
    141 
    142 	echo "./netbsd type=file uname=root gname=wheel mode=0755" \
    143 	    >> "$tmp/selected_sets"
    144 	echo "./boot type=file uname=root gname=wheel mode=0444" \
    145 	    >> "$tmp/selected_sets"
    146 }
    147