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