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