Solved How to create two poudriere jails from src with self-build world ?

I want to be able to build either 32-bit applications or 64-bit applications through poudriere.
Since there is no traditional multi-lib in FreeBSD I probably need two jails.
One 64-bit jail, and one 32-bit jail.

I searched the web and found a thread regarding 32-bit wine, and how to build a 32-bit jail.
As for now I only used jails with pre-build world for amd64.

In order to build a 32-bit jail, the OP from the thread mentioned above, did something like:
Code:
cd /usr/src
make -j8 TARGET=i386 buildworld
zfs create zroot/poudriere/jail/i386
make TARGET=i386 DESTDIR=/usr/local/poudriere/jail/i386 installworld
make TARGET=i386 DESTDIR=/usr/local/poudriere/jail/i386 distrib-dirs
make TARGET=i386 DESTDIR=/usr/local/poudriere/jail/i386 distribution
poudriere jail -c -j i386 -v 13.0-RC3 -a i386 -m null -M /usr/local/poudriere/jail/i386 -S /usr/src
Everything, except the last line makes sense.
I guess "*/jail/i386" is considered to be mounted on "*/jails/i386" since poudriere creates every new jail in a directory called jails.
So, basically to update that jail, I just need to re-run the make commands above ?

What does -S /usr/src do ?
It specifies the source path, but why do I need it if I already have "/usr/obj/usr/src/i386.i386" and "/usr/obj/usr/src/amd64.amd64".
Inspecting both, there are compiled tools from world which I could use to build/update a poudriere jail, right ?
So, everytime I rebuild world, "/usr/obj/usr/src/i386.i386" and "/usr/obj/usr/src/amd64.amd64" gets updated ?

Wouldn't it make sense to use something like -b instead of -S /usr/src ?
Example:
-> poudriere jail -c -j i386 -v 13.0-RC3 -a i386 -b -m /usr/src -M /usr/local/poudriere/jail/i386 ?
 
What does -S /usr/src do ?
Certain ports (kernel modules for example) need access to the actual source tree to be able to build properly. So a poudriere jail also contains a copy of the source tree (for that specific version) or else it won't be able to build those ports.

It specifies the source path, but why do I need it if I already have "/usr/obj/usr/src/i386.i386" and "/usr/obj/usr/src/amd64.amd64".
/usr/obj doesn't contain source files, its where the built files end up. There's a .../usr/src/ in that path because that's where the original code was built from. If you had built the source from a /tmp/somewhere/ directory, the built files would have ended up in /usr/obj/tmp/somewhere/i386.i386 and /usr/obj/tmp/somewhere/amd64.amd64.

Code:
     MAKEOBJDIRPREFIX      Defines the prefix for directory names in the tree
                           of built objects.  Defaults to /usr/obj if not
                           defined.  This variable should only be set in the
                           environment or /etc/src-env.conf and not via
                           /etc/make.conf or /etc/src.conf or the command
                           line.
build(7)

With regards to setting up a i386 build jail, you can simply do poudriere -c -j i386 -v 14.2-RELEASE -a i386. No need to build from source.
 
With regards to setting up a i386 build jail, you can simply do poudriere -c -j i386 -v 14.2-RELEASE -a i386. No need to build from source.
At the beginning I thought it would have some benefits (security-wise) even compiling poudrieres base system from source, but since the idea of it being a port builder, I don't see the point anymore.
Instead, using the pre-built base could be an option, too.

Compiling OS base system + kernel made sense, because I couldn't get the latest security fixes for 14.2-RELEASE-p2 for the userland...
freebsd-update told me that I am on the latest update, although running freebsd-version -kru reported:
14.2-RELEASE-p2
14.2-RELEASE-p2
14.2-RELEASE-p1 (userland)

After compiling world+kernel from source I got:
14.2-RELEASE-p2
14.2-RELEASE-p2
14.2-RELEASE-p2 (userland)

My main goal is ultimately to get wine(-proton, -devel, plain) to work on FreeBSD.

One question, though...
I don't quite get it, but how can I get a poudriere jail to manage its own ports ?
I have only one config file so, I can only specify one DISTFILE_CACHE for all ports, right ?

Can I do something like creating a jail, and then creating inside the jail the directory /usr/ports and populate it ?
And if I want to update the jail afterwards, just issue: poudriere jail -u -j $jailname without encountering any errors ?
Or would it be better to just create two ports outside the jails and let the amd64 reference the ports-amd64 dir, and i386 reference ports-i386 dir ?

EDIT:
The right command would be:
poudriere jail -c -j i386 -v 14.2-RELEASE -a i386
 
I don't quite get it, but how can I get a poudriere jail to manage its own ports ?
You create a ports tree for poudriere, see poudriere-ports(8).

I have two:
Code:
root@chibacity:~ # poudriere ports -l
PORTSTREE METHOD    TIMESTAMP           PATH
desktop   git+https 2025-03-30 14:40:14 /usr/local/poudriere/ports/desktop
server    git+https 2025-03-30 14:40:18 /usr/local/poudriere/ports/server

With the bulk and testport you can add -p to specify which ports tree to use. Or don't pass -p <portstree> and it'll use a portstree named 'default'.

Code:
EXAMPLES
     Creates a new checkout from Git called default from FreeBSD's official
     ports tree branch main.

       # poudriere ports -c

I have only one config file so, I can only specify one DISTFILE_CACHE for all ports, right ?
That's /usr/ports/distfiles with "normal" ports operations. You typically want to have all the source files in a single location, or else every build would have to download its own distfiles separately.

Or would it be better to just create two ports outside the jails and let the amd64 reference the ports-amd64 dir, and i386 reference ports-i386 dir ?
There is only one ports tree. All versions of FreeBSD, for all architectures, use one and the same ports tree. The ports tree for i386 is the exact same as for amd64, or aarch64, or PowerPC, or any other architecture.
 
Ahh, ok.
I think I got it now.
Before all that I used one port tree, the default one in /usr/ports, and thought that if I want to have poudriere manage its own tree, I need to stuff it inside the jail...
I will create the port trees outside of poudriere then.
Thank you very much 😁
 
I use make packagesystem to produce MANIFEST, base.txz, kernel.txz, src.txz, tests.txz and then create jails with poudriere jail -c -j 150 -m url=file:///path/to/15.0-CURRENT -K GENERIC -v 15.0. It extracts the tar balls to make the jails. Then when I want to update the jail, I rebuild the tarballs, poudriere jail -j 150 -u and it deletes and re-creates the jail from new tarballs. Super clean.

/path/to/15.0-CURRENT in this case is a dir with the MANIFEST and txz files that are in the release dir after running make packagesystem
 
Back
Top