6.0 KiB
+++
vim: ft=markdown
title = 'OpenBSD-current: built from source' summary = 'Keeping up to date with OpenBSD-current. Some quick notes.' date = '2023-09-16T08:25:27+0200' #lastmod = '' categories = [ 'computerstuff' ] tags = [ 'openbsd' ]
+++
[Initially]({{< ref "2023-07-29-going-back-from-openbsd-snapshot/index.md" >}}) I wanted to not look at OpenBSD-current again but I did it again.
All went good this time and I could compile everything except the ports. I'm still looking to find a good solution to update all the packages in one run.
{{< alert >}} This post is about following OpenBSD-current and building OpenBSD from source. {{< /alert >}}
I'm still studying the ports(7), bulk(8) and dpb(1) manpages, as well as the release(8) and cvs(1) pages.
What went wrong the last time
I have no clue. The last time I had problems with the recent snapshot, when the packages could not get updated properly. This time they updated just fine. So maybe this was only an issue with that particular snapshot back then. Maybe, IDK.
Fetch the actual sources
The user is member of wsrc.
$ cd /usr/src
$ cvs -q up -Pd -A
$ cd /usr/xenocara
$ cvs -q up -Pd -A
$ cd /usr/ports
$ cvs -q up -Pd -A
Initially we fetched the source with
$ cd /usr
$ cvs -qd anoncvs@ftp.hostserver.de:/cvs checkout -P src
Same with xenocara
and ports
.
Create the kernel
$ cd /sys/arch/$(machine)/compile/GENERIC.MP
$ doas make obj
$ doas make config
$ doas make && doas make install
The current kernel gets copied to /obsd
and the new kernel gets
installed as /bsd
. On multi-processor machines /bsd
is actually
/bsd.mp
and the single processor kernel gets renamed to /bsd.sp
.
Reboot the machine to use the new kernel.
Build base system
$ cd /usr/src
$ doas make obj && doas make build
$ doas sysmerge
$ cd /dev && doas ./MAKEDEV all
This takes on my Lenovo X1 Carbon Gen7 something in between 8 to 12 hours usually.
Build and install Xenocara (X)
$ cd /src/xenocara
$ doas make bootstrap
$ doas make obj
$ doas make build
Building Xenocara took on my laptop (see above) around 1.5 hours.
Reboot
Once we built our new system, we want to boot into it.
Upgrading the ports
I do have a packagelist of the manually installed packages in my home folder. That looks something like this:
ImageMagick--
abook--
adb--
adwaita-icon-theme--
aircrack-ng--
alacritty--
anacron--
appstream-glib--
[...]
This is of no help to me, so I modified it a bit with sed:
$ sed s/--// packagelist.txt > localports
That removes only the two minuses at the end.
Now I cd
into /usr/ports
and I'm looking if the
resulting category/package name fits the ports directory
structure.
$ for i in `cat ~/localports`; do echo */$i; done | tee localports
Run the command without the | tee ...
part to see if any errors occur.
If the for loop finishes without errors, we can add the tee
part and
write the new localports file into /usr/ports
.
Make sure to remove the distfiles/<port>
sections.
The final file should look like this:
graphics/ImageMagick
mail/abook
devel/adb
security/aircrack-ng
x11/alacritty
sysutils/anacron
devel/appstream-glib
Some paths should be modified like the firefox browser is not found as firefox but as fitefox-i18n for example.
Notice, there is already the package adwaita-icon-theme
misssing
because there is no such port in the ports tree.
Within /usr/ports
, we run dpb
:
$ doas /usr/ports/infrastructure/bin/dpb -P localports
That's it. The screen gets filled with all the ports that are updated at once/in parallel.
I do have about 100 packages to build, which usually consumes around 40 minutes of time.
Creating a release
There are a few steps needed to create your own installation media.
First of all, we setup some space that we can mount with
noperm
options.
I use an external SSD
which I mount into /build
.
$ doas mount -o noperm /dev/sd2a /build
Set the owner of this directory to build and chmod the directory with 0700. Read along in the release man page.
I use four directories: dest
, release
, xdest
and xrelease
.
dist
and xdest
will be used to build the system, while
release
will hold the tarballs and the final installation media files
when in xrelease
the Xenocara release files will land.
{{< alert >}} Have a look at the manpage, permissions and owners are quite important for these tasks! {{< /alert >}}
It is the base system that we create first
$ export DESTDIR=/build/dest RELEASEDIR=/build/release
$ cd /usr/src/etc && doas make release
$ cd /usr/src/distrib/sets && doas sh checkflist
$ unset RELEASEDIR DESTDIR
Time for coffe, the second line above takes around an hour.
This step creates a base installation of OpenBSD within /build/dest
and
creates the installation media (tarballs) in /build/release
.
We continue with building the X release files
$ export DESTDIR=/build/xdest RELEASEDIR=/build/xrelease
$ doas make release
$ doas make checkdist
$ unset RELEASEDIR DESTDIR
This run is fairly quick, expect a few minutes to run.
Creating the installation media files
$ export RELDIR=/build/release RELXDIR=/build/xrelease
$ cd /usr/src/distrib/$(machine)/iso && doas make
$ doas make install
Also this is done in a few minutes.
You'll find your install73.img
and install.iso
files in $RELDIR
.
Ready to be used.
Conclusion
It is not hard to build OpenBSD from source, but it is very time consuming.
Ports need a little tweaking, though.