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