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