Custom FreeBSD ISO/IMG file

Hello all, after searching for a while I've given up on trying to find some recent information on trying to create my own custom FreeBSD iso/img file that can be installable.

Simply, I'd like to get an installed setup that I like create some form of snapshot/iso/img file that I can then install on a USB drive much like the default FreeBSD iso/img and install that on any machine (given an architecture like amd64).

Can anyone help me with the right docs, or a simple set of commands to get a running system as is installable?
 
So, I'm assuming from the release page that I would type this:

Code:
# Add this to loader.conf, once the machine is setup the way I like.
geom_md_load="YES"

# Reboot, because it will definitely load the module and I don't mind waiting

# Then type this (possibly adding /usr/src/release to the release.sh script):
cd ~/
sh release.sh memstick FreeBSD-custom-img-file.img

Unless I have this totally wrong, then please let me know. :)
 
Plus, looking around in /usr/src, it appears to be empty.

I don't know what I'm missing to make this work.
 
First you need to have the source code installed and then learn how to use it. It's often installed together with your FreeBSD installation, but if it isn't then you could consider doing this: svnlite co https://svn.freebsd.org/base/releng/11.2 /usr/src, it'll take a while but after that you'll have the complete source tree installed in /usr/src, which is step one.

Now you'll have access to /usr/src/release and can go crazy ;)

Even so I'd recommend to become familiar with the source tree first. Try upgrading your system for example, and look into things like /etc/src.conf (see src.conf(5)) and how to configure this thing (/usr/src/sys/amd64/conf/GENERIC).

A good start (IMO) would be chapter 25.3 of the handbook: upgrade FreeBSD from source, as well as chapter 8: configuring the FreeBSD kernel.

And there's always these forums :)
 
Good reads and will do, hopefully I can get an installable custom FreeBSD image soon.

Typically I just take the default installer and install a few things like bash, sshguard, and configure pf and ssh to get my main system to a point where I can use it faster and more securely.

Then I’m on my way, I just hate when I want to install it on another machine that I have to keep going through the same configuration files over and over. I just want a “.img” file that I can install on a given architecture and go ahead with other fun installs.

I’ll let you guys know how it progresses and post my steps when I can. :)
 
Welp, unfortunately, this was the last error I got trying to run the command at the bottom next to the green cursor position box.

Capture.PNG
 
First off I think you probably want to build images using root user.
Second for the statfs(2) error there are only so many error conditions looking at the manual.
I don't see the error code in your snapshot but this stands out to me in the manual:
[EACCES] Search permission is denied for a component of the path prefix of path.
I am building a release image now just to test. Have you built an unmodified RELEASE first to prove your method?
cd /usr/src/release
./release.sh memstick test.img
Too long a path is also a statfs error so I shortened the image name.
 
Some notes while waiting: You really should have >16GB disk space free when building RELEASE.
It is rather slow on a i3-2330M. I opened an xfce4 terminal and its been chugging along for over 6 hours now.
Clang building takes quite a bit of time.
 
Yes, I do have greater than 16gb of space, it’s mostly a new machine plus some small additions like screen as you might’ve noticed. Will give a whirl and report.
 
It failed for me with the same warning. Same spot too right after buildworld.
I am trying on a faster machine with the above approach.
 
OK got through buildworld and buildkernel quick and can confirm that make memstick runs as expected.
Will update if successful. I should end up with a memstick.img located somewhere.
 
That worked and made a 940 megabyte /usr/obj/usr/src/amd64.amd64/release/memstick.img.
No custom packages or conf's though like you wanted..
 
That method failed as it is trying to use FreeBSD 13 source.
Code:
cd: /usr/doc/en_US.ISO8859-1/htdocs/releases/13.0R: No such file or directory
 
That worked but it ignored the memstick directive and built mini-memstick, memstick, iso and bootonly.
Here is the tail end of the console output:
Code:
make -C /usr/src/release  release-done
touch release
true
mkdir -p /R
cp -a ftp /R/
cp -p disc1.iso /R/FreeBSD-11.2-RELEASE-p4-amd64-disc1.iso
cp -p bootonly.iso /R/FreeBSD-11.2-RELEASE-p4-amd64-bootonly.iso
cp -p memstick.img /R/FreeBSD-11.2-RELEASE-p4-amd64-memstick.img
cp -p mini-memstick.img /R/FreeBSD-11.2-RELEASE-p4-amd64-mini-memstick.img
cd /R && sha512 FreeBSD-11.2-RELEASE-p4-amd64* > /R/CHECKSUM.SHA512
cd /R && sha256 FreeBSD-11.2-RELEASE-p4-amd64* > /R/CHECKSUM.SHA256

I created a custom config file /usr/src/release/my.conf
Code:
TARGET="amd64"
TARGET_ARCH="amd64"
KERNEL="GENERIC"
SRCBRANCH="base/releng/11.2"
DOCBRANCH="doc/release/11.2.0"
PORTBRANCH="ports/branches/2018Q4"
Ran it with:
cd /usr/src/release
./release.sh -c my.conf memstick
 
Back
Top