1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
.\" $OpenBSD: release.8,v 1.94 2018/06/23 23:19:11 rob Exp $
.\"
.\" Copyright (c) 2000 Marco S. Hyman
.\" Copyright (c) 2016 Theo Buehler <tb@openbsd.org>
.\"
.\" Permission to copy all or part of this material for any purpose is
.\" granted provided that the above copyright notice and this paragraph
.\" are duplicated in all copies. THIS SOFTWARE IS PROVIDED ``AS IS''
.\" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
.\" LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
.\" FOR A PARTICULAR PURPOSE.
.\"
.Dd $Mdocdate: June 23 2018 $
.Dt RELEASE 8
.Os
.Sh NAME
.Nm release
.Nd building an OpenBSD release
.Sh DESCRIPTION
There are several steps necessary to build a release:
.Pp
.Bl -enum -compact -offset indent
.It
Update sources.
.It
Build and install a new kernel.
.It
Build a new base system.
.It
Make and validate the base system release.
.It
Build and install Xenocara.
.It
Make and validate the Xenocara release.
.It
Make the third party packages.
.It
Create boot and installation disk images.
.El
.Pp
This manual describes the steps for the
.Em release
and
.Em stable
branches.
To build a
.Em current
release, additional steps may be required.
See
.Lk https://www.openbsd.org/faq/current.html
for any needed workarounds.
.Pp
Commands to be run as a user are preceded by a dollar sign
.Sq $ .
Commands that must be run as the superuser are preceded by a hash mark
.Sq # .
Privileges will be de-escalated to the user
.Sy build
whenever possible.
.Pp
Most of the defaults can be overridden by setting
the appropriate variables in
.Xr mk.conf 5 .
.Ss 1. Update sources
A
.Nm
should use sources that were checked out using the same
.Xr cvs 1
tag.
There are two families of tags:
.Bl -tag -width OPENBSD_x_y_BASE
.It OPENBSD_x_y_BASE
The sources for the
.Ox x.y
release.
.It OPENBSD_x_y
The sources for the
.Ox x.y
stable branch.
It contains the patches described in
.Lk https://www.openbsd.org/stable.html .
.El
.Pp
See
.Lk https://www.openbsd.org/anoncvs.html
for instructions on fetching the sources for the first time.
.Pp
To update existing sources to the versions identified by one of the above
tags, use the commands:
.Bd -literal -offset indent
$ cd /usr/src && cvs up -r TAG -Pd
$ cd /usr/xenocara && cvs up -r TAG -Pd
$ cd /usr/ports && cvs up -r TAG -Pd
.Ed
.Pp
.Sy Warning :
.Xr cvs 1
tags are
.Sq sticky .
See
.Xr cvs 1
for more information.
.Ss 2. Build and install a new kernel
Always build and install a new kernel and reboot before
building the programs that will use the kernel.
This ensures that any new system calls, for example, will be present
when needed.
.Pp
.Dl # cd /sys/arch/$(machine)/compile/GENERIC.MP
.Pp
Replace
.Pa GENERIC.MP
with a different kernel configuration if necessary.
.Pp
Create the build directory and configuration file,
then compile and install the kernel:
.Bd -literal -offset indent
# make obj
# make config
# make && make install
.Ed
.Pp
The current kernel is copied to
.Pa /obsd
and the new kernel to
.Pa /bsd .
Reboot.
.Ss 3. Build a new base system
The build process will place the object files in a tree under
.Pa /usr/obj .
This directory must be owned by build:wobj with mode 770.
.Pp
Create the tree of obj directories and begin the build:
.Bd -literal -offset indent
# cd /usr/src
# make obj && make build
.Ed
.Pp
After the build is completed, update
.Pa /etc ,
.Pa /var ,
and
.Pa /dev ,
using
.Xr sysmerge 8
and
.Xr MAKEDEV 8 :
.Bd -literal -offset indent
# sysmerge
# cd /dev && ./MAKEDEV all
.Ed
.Pp
At this point, the base system is up to date with the code
that will be made into a release.
.Ss 4. Make and validate the base system release
The base system release consists of at least one generic kernel,
some installation media, the release tarballs,
installation instructions, and checksum files.
.Pp
Create a
.Va RELEASEDIR
directory to store the release files.
This directory must be writable by
.Sy build .
.Pp
To build a release, it is necessary to prepare a filesystem mounted with the
.Em noperm
.Xr mount 8
option.
Either standard FFS or
.Xr mount_mfs 8
may be used.
The root of this filesystem must have owner
.Sy build
and mode 700.
On this filesystem, create a
.Va DESTDIR
directory.
This will be the root of a complete
.Ox
installation.
.Pp
.Sy Warning :
.Va DESTDIR
and
.Va RELEASEDIR
must not refer to any directory with
.Pa /mnt
in its path, as
.Pa /mnt
is used in the release generation process.
The
.Xr vnd 4
device vnd0
is also used and must not be configured.
.Pp
Make the release and check the contents of the release tarballs:
.Bd -literal -offset indent
# export DESTDIR=your-destdir RELEASEDIR=your-releasedir
# cd /usr/src/etc && make release
# cd /usr/src/distrib/sets && sh checkflist
# unset RELEASEDIR DESTDIR
.Ed
.Ss 5. Build and install Xenocara
Xenocara is based on the X.Org modular build system.
Its sources are supposed to be in
.Pa /usr/xenocara .
The
.Pa /usr/src
tree is also needed while building Xenocara.
The object directory
.Pa /usr/xobj
should be empty and owned by build:wobj with mode 770.
.Pp
The following steps will build and install Xenocara.
.Bd -literal -offset indent
# cd /usr/xenocara
# make bootstrap
# make obj
# make build
.Ed
.Ss 6. Make and validate the Xenocara release
Xenocara uses
.Va DESTDIR
and
.Va RELEASEDIR
as described above.
Use a different
.Va DESTDIR
for the Xenocara release than for the base release,
as the contents of
.Va DESTDIR
will be removed.
.Pp
The steps to build and validate the Xenocara release are:
.Bd -literal -offset indent
# export DESTDIR=your-destdir RELEASEDIR=your-releasedir
# make release
# make checkdist
# unset RELEASEDIR DESTDIR
.Ed
.Pp
At this point,
.Ox
base system and X Window System tarballs are in
.Va RELEASEDIR .
.Ss 7. Make the third party packages
The ports subsystem of contributed applications is capable of producing
packages for installation, either individually or in bulk.
This is described in
.Xr ports 7 .
.Ss 8. Create boot and installation disk images
The disk images
.No install${ Ns Va VERSION Ns }.fs
and
.No install${ Ns Va VERSION Ns }.iso
are suitable for installs without network connectivity.
They contain the tarballs and ports built in the previous steps.
.Bd -literal -offset indent
# export RELDIR=your-releasedir RELXDIR=your-xenocara-releasedir
# cd /usr/src/distrib/$(machine)/iso && make
# make install
.Ed
.Pp
The two installer images are now stored in the local release
directory.
.Sh SEE ALSO
.Xr cvs 1 ,
.Xr pkg_add 1 ,
.Xr mk.conf 5 ,
.Xr ports 7 ,
.Xr sysmerge 8
.Sh HISTORY
This document first appeared in
.Ox 2.8 .
|