Best practices for building custom releases with pkgbase?

asomers

Developer
TLDR; What is the best way to build a custom FreeBSD release based on pkgbase?

Background: I currently build a customized FreeBSD release. I build the isos from my own branch, then I run a private freebsd-update server to distribute updates, from my own branch. Trust that I have a good reason for doing this. I also use Poudriere to build all of my own packages. Now I must migrate everything to pkgbase.

Plan so far: I think I can create on my pkg server a dedicated pkgbase workspace. I'll use a bare git repository for freebsd-src, and create a separate worktree for each release branch (14.3, 15.0, etc). Then I can use "make packages" and "make update-packages" as appropriate in each worktree whenever I have an update to distribute. Finally, I'll symlink /usr/obj/path/to/worktree/repo/${ABI} to a place where nginx can find and serve it. On the client side, I'll create a /usr/local/etc/pkg/repos/MY_NAME.conf file pointing to my own nginx server. I'll have to set signature_type and mirror_type to "none", of course.

Questions:
  1. Are there any existing tools to help automate this process? Poudriere doesn't look helpful.
  2. Should I worry about serving the packages from the zroot/usr/obj dataset? That dataset is often treated as "temporary". Maybe I should create a separate dataset for the built packages. But I don't see any environment variables in make.conf(5) that can be used to change the pkg repos directory.
  3. "make packages" puts all of the packages into a directory named "latest". For consistency with the way vanilla FreeBSD works, I should probably name that "base_release_0". But I don't see any make.conf variables to control that, and the "latest" string seems to be hardcoded in Makefile.inc1. What am I missing?
  4. Is there anything else that I've completely overlooked?
 
While I have a custom USB release, I
have had no idea what pkgbase is...

Looked it up. Not a port. A system that treats system userland components as packages to have a modular base? Interesting...
 
make REPODIR=/path/to/pkgbase/repository/directory packages

will be sufficient. It will give you for example:

/path/to/pkgbase/repository/directory/FreeBSD:15:amd64/latest (a symlink)
/path/to/pkgbase/repository/directory/FreeBSD:15:amd64/15.snap20260326113019/
 
asomers
I'm kinda in a similar situation as you and documentation leaves a lot of questions and I'm starting to look into it myself.

I currently have this is /etc/src.conf
Code:
WITHOUT_DEBUG_FILES=yes
WITHOUT_KERNEL_SYMBOLS=yes
WITHOUT_TESTS=yes
WITHOUT_PROFILE=yes
WITHOUT_LLVM_ASSERTIONS=yes
WITH_MALLOC_PRODUCTION=yes
WITH_EXTRA_TCP_STACKS=1
WITHOUT_LIB32=yes

...and in /etc/make.conf
Code:
CPUTYPE?=znver4
WITHOUT_DEBUG=YES
WITH_EXTRA_TCP_STACKS=1

Some of the WITHOUT_ options appears to already be packaged separately, not sure if you still need to build everything or if you can toggle it somehow and what you do with options that don't have a package couterpart.
 
Hi,

I am not sure that is what you are looking for but release.sh can build custom release:

From the man page release(7):
PKGBASE Include base system packages or use with pkg(8) on the install media, instead of legacy tarball distribution sets.
 
Back
Top