src/distrib/syspatch
2023-04-30 01:15:27 +00:00
..
bsd.syspatch.mk SecBSD 1.3 -current: The Digital Resistance. A belief in the importance of privacy and the right to secure communication. 2023-04-30 01:15:27 +00:00
diff.sh SecBSD 1.3 -current: The Digital Resistance. A belief in the importance of privacy and the right to secure communication. 2023-04-30 01:15:27 +00:00
Makefile SecBSD 1.3 -current: The Digital Resistance. A belief in the importance of privacy and the right to secure communication. 2023-04-30 01:15:27 +00:00
Makefile.000 SecBSD 1.3 -current: The Digital Resistance. A belief in the importance of privacy and the right to secure communication. 2023-04-30 01:15:27 +00:00
README SecBSD 1.3 -current: The Digital Resistance. A belief in the importance of privacy and the right to secure communication. 2023-04-30 01:15:27 +00:00

$OpenBSD: README,v 1.4 2019/08/14 20:30:19 tb Exp $

Notes about the syspatch(8) build process
=========================================

The syspatch(8) build system will eventually be properly documented in its own
man(1) page but until things settle and the framework is robust, this file will
be used as a quick reminder.

Requirements for the build machine
----------------------------------

- ${FAKEROOT} must be a local mount point with the no perm mount option set and
  be owned by ${BUILDUSER} with a mode of 0700. It should be big enough to
  contain one full release per syspatch (~30G).

- ${SRCDIR} and ${XSRCDIR} must be checked out using the OPENBSD_X_X_BASE
  release tag.

- Timezone must be set to "Canada/Mountain".

Requirements for the fakeroot
-----------------------------

Before building the first syspatch, the same release used on the build machine
must be extracted under a subdirectory of ${FAKEROOT} to allow clean comparison
and find differing files between patched releases.

e.g.
FAKEROOT=/fakeroot
FAKE=${FAKEROOT}/syspatch/64-000_release
RELEASEDIR=/path/to/sets
mkdir -p ${FAKE}
install -m 0700 ${RELEASEDIR}/bsd{,.mp} ${FAKE}
for set in base comp game man xbase xshare xfont xserv; do
	tar xzphf ${RELEASEDIR}/${set}$(uname -r | tr -d '.').tgz -C ${FAKE}
done
mkdir -m 700 -p ${FAKE}/usr/share/relink/kernel/GENERIC{,.MP}
tar -C ${FAKE}/usr/share/relink/kernel -xzf ${FAKE}/usr/share/relink/kernel.tgz
rm ${FAKE}/usr/share/relink/kernel.tgz

Continuing syspatch builds
--------------------------

If syspatches were already built for this release on a different machine, the
following additional steps are required. Prepare a ${SYSPATCHES} directory
containing all the syspatches of the release. Make a copy of the ${FAKE}
directory and extract all the syspatches in it.

e.g.
SYSPATCHES=/path/to/syspatches
PATCHED=${FAKEROOT}/syspatch/64-018_mds
cp -Rp ${FAKE} ${PATCHED}
for _s in ${SYSPATCHES}/*.tgz; do tar -C ${PATCHED} -xzphf ${_s}; done

Then apply all the errata patches to the source trees.

Building a syspatch
-------------------

When building a xenocara syspatch, make sure to set XSRCDIR to the directory
where the xenocara checkout was made.
    # export XSRCDIR=/usr/xenocara

Everything is done as root under ${BSDSRCDIR}/distrib/syspatch/.

Before building the first syspatch, the obj directory must be created.
    # FAKEROOT=/fakeroot make -f Makefile.000 obj

Each syspatch requires its own Makefile numbered after the patch level.
    # cp Makefile.000 Makefile.001
    # ${EDITOR} Makefile.001
    -> set the ERRATA name and BUILD type

The patched release can now be built.
    # FAKEROOT=/fakeroot make -f Makefile.001 001_dummy/.plist
    # ${EDITOR} obj/001_dummy/.plist
    -> edit the plist to make sure it only contains files we want to end up in
       the syspatch(8) tarball

At last, a syspatch(8) can be created.
    # FAKEROOT=/fakeroot make -f Makefile.001 syspatch

Patches are incremental and must be built in order. In case an errata does not
apply to the current architecture and to prevent a gap in the numbering, the
"previous" fakeroot must be created manually by copying the previous one.
e.g.
    # cp -Rp /fakeroot/syspatch/61-010_perl /fakeroot/syspatch/61-011_sti