You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
248 lines
6.2 KiB
248 lines
6.2 KiB
+++
|
|
title = 'OpenBSD-current: built from source'
|
|
aliases = '/posts/2023-09-16-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 "48-going-back-from-openbsd-snapshot" >}}) 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.
|
|
|
|
[ports(7)]: https://man.openbsd.org/ports.7
|
|
[bulk(8)]: https://man.openbsd.org/bulk.8
|
|
[dpb(1)]: https://man.openbsd.org/dpb.1
|
|
[release(8)]: https://man.openbsd.org/release.8
|
|
[cvs(1)]: https://man.openbsd.org/cvs.1
|
|
|
|
## 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, <abbr title="I don't know">IDK</abbr>.
|
|
|
|
## Fetch the actual sources
|
|
|
|
The user is member of **wsrc**.
|
|
|
|
```console
|
|
$ 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
|
|
|
|
```console
|
|
$ cd /usr
|
|
$ cvs -qd anoncvs@ftp.hostserver.de:/cvs checkout -P src
|
|
```
|
|
|
|
Same with `xenocara` and `ports`.
|
|
|
|
## Create the kernel
|
|
|
|
```console
|
|
$ 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
|
|
|
|
```console
|
|
$ cd /usr/src
|
|
$ doas make obj && doas make build
|
|
```
|
|
|
|
```console
|
|
$ doas sysmerge
|
|
$ cd /dev && doas ./MAKEDEV all
|
|
```
|
|
|
|
This takes on my Lenovo X1 Carbon Gen7 something in between <mark>8 to 12 hours</mark> usually.
|
|
|
|
## Build and install Xenocara (X)
|
|
|
|
```console
|
|
$ cd /src/xenocara
|
|
$ doas make bootstrap
|
|
$ doas make obj
|
|
$ doas make build
|
|
```
|
|
|
|
Building Xenocara took on my laptop (see above) <mark>around 1.5 hours</mark>.
|
|
|
|
## 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:
|
|
|
|
```console
|
|
$ 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.
|
|
|
|
```console
|
|
$ 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`:
|
|
|
|
```console
|
|
$ 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
|
|
<mark>40 minutes</mark> 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 <abbr title="solid state disk">SSD</abbr>
|
|
which I mount into `/build`.
|
|
|
|
```console
|
|
$ 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][release].
|
|
|
|
[release]: https://man.openbsd.org/release
|
|
|
|
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
|
|
|
|
```console
|
|
$ 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 <mark>an hour</mark>.
|
|
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
|
|
|
|
```console
|
|
$ export DESTDIR=/build/xdest RELEASEDIR=/build/xrelease
|
|
$ doas make release
|
|
$ doas make checkdist
|
|
$ unset RELEASEDIR DESTDIR
|
|
```
|
|
|
|
This run is fairly quick, expect <mark>a few minutes</mark> to run.
|
|
|
|
### Creating the installation media files
|
|
|
|
```console
|
|
$ export RELDIR=/build/release RELXDIR=/build/xrelease
|
|
$ cd /usr/src/distrib/$(machine)/iso && doas make
|
|
$ doas make install
|
|
```
|
|
|
|
Also this is done in a <mark>few minutes</mark>.
|
|
|
|
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. I will continue to follow -current by
|
|
[upgrading to current snapshots]({{< ref "55-following-openbsd-current-snapshots" >}}).
|