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