# I installed kernel 13.0-RC5 but want to do download the sources



## Alain De Vos (Apr 3, 2021)

That worked, but where do I find the kernel sources for this, via git or subversion.
[ I deleted /usr/src by accident and want to repopulate it for this specific kernel ]


----------



## Menelkir (Apr 3, 2021)

Chapter 25. Updating and Upgrading FreeBSD
					

Information about how to keep a FreeBSD system up-to-date with freebsd-update or Git, how to rebuild and reinstall the entire base system, etc




					docs.freebsd.org


----------



## zirias@ (Apr 3, 2021)

Branches for 13 aren't in subversion. Most light-weight variant with git (single branch, no history):
`git clone https://git.freebsd.org/src.git --depth 1 --branch releng/13.0 /usr/src`

Single branch _with_ history:
`git clone https://git.freebsd.org/src.git --branch releng/13.0 --single-branch /usr/src`

Full repo (and still checkout 13.0 branch):
`git clone https://git.freebsd.org/src.git --branch releng/13.0 /usr/src`

The "tiny" flavor of git is enough for this (package: git-tiny, port: devel/git@tiny).

Then, if you're not at all interested in actually using git, you could also use net/gitup


----------



## Alain De Vos (Apr 3, 2021)

Error :
error: pathspec 'releng/13' did not match any file(s) known to git.
[ So i'm left with an installed kernel without sources ]


----------



## _martin (Apr 3, 2021)

They are also included online: 13.0-RC5 - the src.txz. If you want them to be extracted in /usr/src you can (among others) use: `tar --unlink -C / -xvPjf src.txz`).


----------



## Alain De Vos (Apr 3, 2021)

Thanks, so its not not git, its not svn, its ftp


----------



## zirias@ (Apr 3, 2021)

Then you mistyped the command. I missed the `.0` part before editing my post, but still, if git thinks this is a _path_, you didn't give it as argument to the `--branch` option.


----------



## Alain De Vos (Apr 3, 2021)

Please elaborate zirias which correct commands you I use to populate /usr/src with git for kernel 13


----------



## zirias@ (Apr 3, 2021)

Any of the 3 I presented. It depends on whether you want history or other branches in your local clone.

And if you don't care about history and branches at all, I suggest you have a look at net/gitup instead.


----------



## scottro (Apr 4, 2021)

Note that if using gitup, you may need to edit /usr/local/etc/gitup.conf.  It defaults to pulling 11.4. You have to find the section marked release, and change the default 11.3 to 13.0.   
For using git, I have page on it at https://srobb.net/fbsdgit.html. But as I only need it for pulling source, and not many of the other things one can do with it, net/gitup is sufficient for me.


----------



## Phishfry (Apr 4, 2021)

Why not use the distribution media? Like mount the memstick installer and extract src?
Source code is located at /usr/freebsd-dist/src.txz
Why would you need to download it if you just installed it. Obviously you have the source.


----------



## Snurg (Apr 4, 2021)

Alain De Vos said:


> Thanks, so its not not git, its not svn, its ftp


You can use http, even if the server is named "ftp"


----------



## zirias@ (Apr 4, 2021)

Phishfry said:


> Why not use the distribution media?


If you just want to build a custom kernel matching your currently running version, this is probably a simple solution.


----------

