x86.conf revision 1.11 1 1.11 riastrad # $NetBSD: x86.conf,v 1.11 2023/09/27 00:24:13 riastradh 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 ptyfs /dev/pts ptyfs rw
62 1.1 christos procfs /proc procfs rw
63 1.1 christos EOF
64 1.1 christos }
65 1.1 christos
66 1.1 christos # From Richard Neswold's:
67 1.1 christos # http://rich-tbp.blogspot.com/2013/03/netbsd-on-rpi-minimizing-disk-writes.html
68 1.1 christos # Also for the postfix stuff below
69 1.4 christos make_fstab_minwrites() {
70 1.1 christos cat > ${mnt}/etc/fstab << EOF
71 1.1 christos # NetBSD /etc/fstab
72 1.1 christos # See /usr/share/examples/fstab/ for more examples.
73 1.3 christos /dev/${rootdev}0a / ffs rw,log,noatime,nodevmtime 1 1
74 1.1 christos ptyfs /dev/pts ptyfs rw
75 1.1 christos procfs /proc procfs rw
76 1.1 christos tmpfs /tmp tmpfs rw,-s32M
77 1.1 christos tmpfs /var/log tmpfs rw,union,-s32M
78 1.1 christos tmpfs /var/run tmpfs rw,union,-s1M
79 1.1 christos tmpfs /var/mail tmpfs rw,union,-s10M
80 1.1 christos tmpfs /var/spool/postfix tmpfs rw,union,-s20M
81 1.1 christos tmpfs /var/db/postfix tmpfs rw,union,-s1M
82 1.1 christos tmpfs /var/chroot tmpfs rw,union,-s10M
83 1.1 christos EOF
84 1.1 christos }
85 1.1 christos
86 1.4 christos make_fstab() {
87 1.1 christos if $minwrites; then
88 1.4 christos make_fstab_minwrites
89 1.1 christos else
90 1.4 christos make_fstab_normal
91 1.1 christos fi
92 1.6 skrll echo "./etc/fstab type=file uname=root gname=wheel mode=0755" \
93 1.6 skrll >> "$tmp/selected_sets"
94 1.7 skrll
95 1.7 skrll echo "./proc type=dir uname=root gname=wheel mode=0755" \
96 1.7 skrll >> "$tmp/selected_sets"
97 1.1 christos }
98 1.1 christos
99 1.4 christos customize() {
100 1.1 christos cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
101 1.1 christos if $minwrites; then
102 1.1 christos mkdir ${mnt}/etc/postfix
103 1.1 christos (umask 022
104 1.1 christos sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
105 1.1 christos ${mnt}/etc/postfix/master.cf)
106 1.1 christos fi
107 1.1 christos cat >> ${mnt}/etc/rc.conf << EOF
108 1.1 christos rc_configured=YES
109 1.1 christos hostname=${board}
110 1.1 christos sshd=YES
111 1.1 christos dhcpcd=YES
112 1.4 christos wscons=YES
113 1.4 christos devpubd=YES
114 1.11 riastrad certctl_init=YES
115 1.1 christos EOF
116 1.7 skrll echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" \
117 1.7 skrll >> "$tmp/selected_sets"
118 1.7 skrll
119 1.1 christos if [ ! -f ${release}/dev/MAKEDEV ]; then
120 1.1 christos echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
121 1.1 christos exit 1
122 1.1 christos fi
123 1.1 christos echo "${bar} running MAKEDEV ${bar}"
124 1.1 christos ${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
125 1.1 christos >> "$tmp/selected_sets"
126 1.1 christos }
127 1.4 christos
128 1.4 christos populate() {
129 1.4 christos if [ ! -f ${kernel} ]; then
130 1.4 christos echo ${PROG}: Missing ${kernel} 1>&2
131 1.4 christos exit 1
132 1.4 christos fi
133 1.4 christos
134 1.4 christos echo "${bar} installing kernel ${bar}"
135 1.4 christos cp ${kernel} ${mnt}/netbsd
136 1.4 christos if [ ! -f ${bootfile} ]; then
137 1.4 christos echo ${PROG}: Missing ${bootfile} 1>&2
138 1.4 christos exit 1
139 1.4 christos fi
140 1.8 kre cp ${bootfile} ${mnt}/boot ||
141 1.8 kre fail "copy of ${bootfile} to ${mnt}/boot failed"
142 1.6 skrll
143 1.6 skrll echo "./netbsd type=file uname=root gname=wheel mode=0755" \
144 1.6 skrll >> "$tmp/selected_sets"
145 1.6 skrll echo "./boot type=file uname=root gname=wheel mode=0444" \
146 1.6 skrll >> "$tmp/selected_sets"
147 1.4 christos }
148