x86.conf revision 1.6 1 1.6 skrll # $NetBSD: x86.conf,v 1.6 2015/01/23 15:17:58 skrll 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.1 christos local totalsize=$(( ${newsize} * 1024 * 2 / 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.1 christos }
97 1.1 christos
98 1.4 christos customize() {
99 1.1 christos cp ${release}/etc/rc.conf ${mnt}/etc/rc.conf
100 1.1 christos if $minwrites; then
101 1.1 christos mkdir ${mnt}/etc/postfix
102 1.1 christos (umask 022
103 1.1 christos sed -e 's/fifo/unix/' < ${release}/etc/postfix/master.cf > \
104 1.1 christos ${mnt}/etc/postfix/master.cf)
105 1.1 christos fi
106 1.1 christos cat >> ${mnt}/etc/rc.conf << EOF
107 1.1 christos rc_configured=YES
108 1.1 christos hostname=${board}
109 1.1 christos sshd=YES
110 1.1 christos dhcpcd=YES
111 1.4 christos wscons=YES
112 1.4 christos devpubd=YES
113 1.1 christos EOF
114 1.1 christos if [ ! -f ${release}/dev/MAKEDEV ]; then
115 1.1 christos echo ${PROG}: Missing ${release}/dev/MAKEDEV 1>&2
116 1.1 christos exit 1
117 1.1 christos fi
118 1.1 christos echo "${bar} running MAKEDEV ${bar}"
119 1.1 christos ${HOST_SH} ${release}/dev/MAKEDEV -s all | sed -e 's:^\./:\./dev/:' \
120 1.1 christos >> "$tmp/selected_sets"
121 1.1 christos
122 1.1 christos echo "${bar} creating directories ${bar}"
123 1.1 christos mkdir ${mnt}/proc ${mnt}/kern
124 1.1 christos }
125 1.4 christos
126 1.4 christos populate() {
127 1.4 christos if [ ! -f ${kernel} ]; then
128 1.4 christos echo ${PROG}: Missing ${kernel} 1>&2
129 1.4 christos exit 1
130 1.4 christos fi
131 1.4 christos
132 1.4 christos echo "${bar} installing kernel ${bar}"
133 1.4 christos cp ${kernel} ${mnt}/netbsd
134 1.4 christos if [ ! -f ${bootfile} ]; then
135 1.4 christos echo ${PROG}: Missing ${bootfile} 1>&2
136 1.4 christos exit 1
137 1.4 christos fi
138 1.4 christos cp ${bootfile} ${mnt}/boot
139 1.6 skrll
140 1.6 skrll echo "./netbsd type=file uname=root gname=wheel mode=0755" \
141 1.6 skrll >> "$tmp/selected_sets"
142 1.6 skrll echo "./boot type=file uname=root gname=wheel mode=0444" \
143 1.6 skrll >> "$tmp/selected_sets"
144 1.4 christos }
145