git clone git://git.garbash.com/alex/www
Log | Files | Refs | README | LICENSE

commit 9cdd7c6298427fdad945f2567dd81c3472d59515
parent 0e3d713181cb5cbf7ee0255b28bd59784ec0d9d0
Author: alex <alex@garbash.com>
Date:   Wed, 22 Sep 2021 01:03:41 -0400

notes: Add note on getting /usr/src

This is what it's all about!

Mindex.html | 9+++++----
Anotes/006-use-the-src.txt | 45+++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/index.html b/index.html @@ -16,9 +16,10 @@ <h2>Done:</h2> <ul> -<li><a href="notes/005-ssh-hardening.txt">SSH hardening</a></li> -<li><a href="notes/004-mail-server.txt">Email (SPF, DKIM, etc)</a></li> -<li><a href="notes/003-httpd.txt">HTTP(S) server</a></li> -<li><a href="notes/002-install.txt">OpenBSD install on Linode</a></li> <li><a href="notes/001-domain-name.txt">Awesome domain name :)</a></li> +<li><a href="notes/002-install.txt">OpenBSD install on Linode</a></li> +<li><a href="notes/003-httpd.txt">HTTP(S) server</a></li> +<li><a href="notes/004-mail-server.txt">Email (SPF, DKIM, etc)</a></li> +<li><a href="notes/005-ssh-hardening.txt">SSH hardening</a></li> +<li><a href="notes/006-use-the-src.txt">Obtained the source code for the system</a></li> </ul> diff --git a/notes/006-use-the-src.txt b/notes/006-use-the-src.txt @@ -0,0 +1,45 @@ +006-use-the-src -- Tues Sept 21, 2021 + +Use the source, Luke! + +One of the main reasons to use a FOSS OS is that you can see the code! +For me as a dev, it's been a lifechanging experience. Often it's faster +to just look at the code than try to decipher Stack Overflow answers, +and I always learn more that way! + +Another perk of the *BSD's is that all of their source is in one repo. +This can of course make SCM slow, but from a curious-developer perspective +it's a dream come true. + +OpenBSD uses cvs(1) to manage their source, but they publish a read-only +git(1) mirror to GitHub, which I like to use for familiarity sake. + +Traditionally, all the source lives in /usr/src , and OpenBSD expects +you to put it there (for build purposes). + +To get it: + +1. Add yourself to the wsrc and wobj groups so you can build without doas + + # usermod -G wsrc,wobj <user> + +2. Clone a bare repo to /var/git (default /usr/src not big enough for .git) + + # mkdir /var/git + # chmod 775 /var/git + # chown root:wsrc /var/git + $ cd /var/git + $ git clone --bare https://github.com/openbsd/src + +3. Check out a new worktree at /usr/src + + $ git -C /var/git/src.git worktree add /usr/src + +4. Find your favorite tool and build it + + $ cd /usr/src/bin/ed + $ make obj # for out of tree build, see make(1) OBJDIR + $ make + $ ./obj/ed + +How cool is that?