Need help for first time updating FreeBSD stable from source

Hi, first time ever im trying to update/upgrade FreeBSD 14.2 stable with custom patch for nvidia passtrough.
Using these sources: https://docs.freebsd.org/en/books/handbook/cutting-edge/#updating-src-obtaining-src and https://dflund.se/~getz/Notes/2024/freebsd-gpu/ and https://github.com/Beckhoff/freebsd-src/tree/phab/corvink/14.2/nvidia-wip
but i have some issues.
Obtaining the source:
If the output says fatal: not a git repository, the files there are missing or were installed with a different method. A new checkout of the source is required.
So i have this issue which means i have to take few extra steps.
mv /usr/src /usr/src.bak
im doing this command as root but i have error:
mv: rename /usr/src to /usr/src.bak: Operation not supported

also it states:
Move the old directory out of the way. If there are no local modifications in this directory, it can be deleted.
So if i cant move and i have to delete it ... but im a bit worried/scared as i have tendencies to f**k up things specially at first try. Is there another way to rename /usr/src or i should exit from Xorg and do it in TTY( login shell) ?

Next thing:
Once i get rid of /usr/scr i should do this ? ( Obviously i have to change releng to stable)
Code:
A.1) If you do not have the source, you can clone:
git clone -b releng/14.1 https://git.freebsd.org/src.git /usr/src cd /usr/src
B.1) Next, edit the file sys/amd64/vmm/x86.c and find the following line:
static const char bhyve_id[12] = "Bhyve Bhyve ";
B.2) Change it to:
static const char bhyve_id[12] = "KVMKVMKVM\0\0\0";
B.3) Then, build and install the kernel:
make -j$(nproc) buildkernel make -j$(nproc) installkernel
Or just get corvins 14.2 patched
git clone --depth 1 --branch phab/corvink/14.2/nvidia-wip https://github.com/Beckhoff/freebsd-src

Links im using shows a bit different ways of doing it. Official handbook includes world and kernel and link im using for passtrough - only kernel.
Im so confused.
 
Are you using ZFS? Basically "If you are using ZFS and /usr/src is a separate dataset, you'll need to do different steps"
The error message on the mv indicates that or simply the user trying to do that does not have appropriate permissions.
 
Are you using ZFS? Basically "If you are using ZFS and /usr/src is a separate dataset, you'll need to do different steps"
The error message on the mv indicates that or simply the user trying to do that does not have appropriate permissions.
Yes, im using ZFS and im also doing it as root.
 
I would recommend not getting a shallow clone (--depth 1), do a full clone instead. You can't switch branches (not easy anyway) on a shallow clone. And you might want to switch back and forth between stable/14 and the phab/corvink/14.2/nvidia-wip branches. Or checkout a stable/14 branch, make a new develop branch and merge the changes from phab/corvink/14.2/nvidia-wip.
 
GlitchyDot , I too, read the handbook, but like your questions, I need additional help and practice to do this: clone update /usr/src and then build a new version of FreeBSD 14.2 or my favorite: a new version of GhostBSD github clone of kernel source code for /usr/src. I wrote notes about my choices to perform the simple steps to git clone update /usr/src kernel source code.
search on word 'compile' at my blog ghostbsd-arm64
https://ghostbsd-arm64.blogspot.com/search?q=compile
Compiling GhostBSD kernel /usr/src code. I also put in the steps for compiling FreeBSD /usr/src code. So learn from the examples.
HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024 Learn from more, similar examples about updating source code and compiling.



Search on word 'poudriere' or on word 'patch' at that same blog. You can find tips on setting up poudriere package builder.

I place these as examples in my personal blog, so that I might go back and repeat these same steps again in my near future. When I need to update/clone new version of FreeBSD source code and compile again.

GlitchyDot
you can follow along here and blog your own steps and test setup that work.
Your comments and suggestions will be helpful to us all. We all can practice and learn. What is working for you?

Standard update to /usr/src code to the latest​

git -C /usr/src pull --ff-only

Compiling to see if errors show up.​

MAKE buildKERNEL KERNCONF=GENERIC​

time make -j4 buildkernel KERNCONF=GENERIC -DNO_CLEAN



make installkernel KERNCONF=GENERIC

If a custom kernel was built, KERNCONF must also be set to use the new custom kernel:

Keep your own notes as you go along. Lets compare notes on Telegram or other medium as you like, GlitchyDot . Hope I was helpful to your success in updating kernel source code. Fred Finster

ps. I am learning about using GIT and github or gitxxxx to save my source code before editing and adding changes.
 
im not sure if i did it right, but when i type uname -v i get this
FreeBSD 14.2-STABLE #0 stable/14-n270286-b40f5ebc4581-dirty: Tue Feb 4 08:21:06 CST 2025 root@kodasBSD:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
Did i miss something ?
 
Back
Top