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