summaryrefslogtreecommitdiff
path: root/distrib/utils/embedded/conf/x86.conf
blob: aa3b0bae36ed528e26195dcb9464293bbaada950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# $NetBSD: x86.conf,v 1.10 2021/07/06 11:49:36 jmcneill Exp $
# x86 shared config
#

image=$HOME/${board}.img
MACHINE=${board}
kernel=$src/sys/arch/${board}/compile/GENERIC/netbsd
bootfile=$release/usr/mdec/boot

extra=8		# spare space
size=0		# autocompute
netbsdid=169
init=63
ffsoffset=${init}b

make_label() {
	# compute all sizes in terms of sectors
	local totalsize=$(( ${size} / 512 ))

	local aoffset=${init}
	local asize=$(( ${totalsize} - ${aoffset} ))

	local bps=512
	local spt=32
	local tpc=64
	local spc=2048
	local cylinders=$(( ${totalsize} / ${spc} ))

	cat << EOF
type: SCSI
disk: STORAGE DEVICE
label: fictitious
flags: removable
bytes/sector: ${bps}
sectors/track: ${spt}
tracks/cylinder: ${tpc}
sectors/cylinder: ${spc}
cylinders: ${cylinders}
total sectors: ${totalsize}
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#     size         offset        fstype [fsize bsize cpg/sgs]
 a:   ${asize}     ${aoffset}    4.2BSD  ${fsize} ${bsize} 0  # 
 c:   ${totalsize} 0             unused      0     0          #
 d:   ${totalsize} 0             unused      0     0          #
EOF
}

make_fstab_normal() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/		ffs	rw,log	1 1
ptyfs		/dev/pts	ptyfs	rw
procfs		/proc		procfs	rw
EOF
}

# From Richard Neswold's:
# http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
# Also for the postfix stuff below
make_fstab_minwrites() {
	cat > ${mnt}/etc/fstab << EOF
# NetBSD /etc/fstab
# See /usr/share/examples/fstab/ for more examples.
/dev/${rootdev}0a	/			ffs	rw,log,noatime,nodevmtime 1 1
ptyfs		/dev/pts		ptyfs	rw
procfs		/proc			procfs	rw
tmpfs		/tmp			tmpfs	rw,-s32M
tmpfs		/var/log		tmpfs	rw,union,-s32M
tmpfs		/var/run		tmpfs	rw,union,-s1M
tmpfs		/var/mail		tmpfs	rw,union,-s10M
tmpfs		/var/spool/postfix	tmpfs	rw,union,-s20M
tmpfs		/var/db/postfix		tmpfs	rw,union,-s1M
tmpfs		/var/chroot		tmpfs	rw,union,-s10M
EOF
}

make_fstab() {
	if $minwrites; then
		make_fstab_minwrites
	else
		make_fstab_normal
	fi
	echo "./etc/fstab type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"

	echo "./proc type=dir uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
}

customize() {
	cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
	if $minwrites; then
		mkdir ${mnt}/etc/postfix
		(umask 022
		sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
		    ${mnt}/etc/postfix/master.cf)
	fi
	cat >> ${mnt}/etc/rc.conf << EOF
rc_configured=YES
hostname=${board}
sshd=YES
dhcpcd=YES
wscons=YES
devpubd=YES
EOF
	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
	    >> "$tmp/selected_sets"

	if [ ! -f ${release}/dev/MAKEDEV ]; then
		echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
		exit 1
	fi
	echo "${bar} running MAKEDEV ${bar}"
	${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
	    >> "$tmp/selected_sets"
}

populate() {
	if [ ! -f ${kernel} ]; then
		echo ${PROG}: Missing ${kernel} 1>&2
		exit 1
	fi

	echo "${bar} installing kernel ${bar}"
	cp ${kernel} ${mnt}/netbsd
	if [ ! -f ${bootfile} ]; then
		echo ${PROG}: Missing ${bootfile} 1>&2
		exit 1
	fi
	cp ${bootfile} ${mnt}/boot ||
	    fail "copy of ${bootfile} to ${mnt}/boot failed"

	echo "./netbsd type=file uname=root gname=wheel mode=0755" \
	    >> "$tmp/selected_sets"
	echo "./boot type=file uname=root gname=wheel mode=0444" \
	    >> "$tmp/selected_sets"
}