DragonFly BSD

DragonFly BSD Source Code Full History

Author: Aaron LI

The current DragonFly BSD Git repository only has the code history since the fork in 2003, but no FreeBSD history before the fork. To get the full code history, I picked the FreeBSD code history until the DragonFly BSD fork commit to a separate Git repository, and then grafted it to the official DragonFly BSD code repository (see below for the details). I have pushed the grafted history to my DragonFly BSD repositories (@leaf, @github) for easier use by others.

Obtain the grafted history

To get the grafted history in your DragonFly BSD repository:

$ git remote add aly https://github.com/liweitianux/dragonflybsd.git
$ git fetch aly 'refs/replace/*:refs/replace/*'

Done :-)

If you prefer the repository on the leaf server, use:

$ git remote add aly git://leaf.dragonflybsd.org/~aly/dragonfly.git

This extends the DragonFly BSD source code history by ~50k commits from FreeBSD until the epoch of the FreeBSD source.

The method employed here is git-replace. The DragonFly BSD's first commit is replaced by its historical commits from the FreeBSD source repository. In fact, the first commit is not really get modified, but is only interpreted differently by Git. All commits in the DragonFly BSD repository remain intact, i.e., their hashes don't change. You can regard the grafted history as a separate branch and you can use the repository as usual.

To use the grafted history, for example,

$ git log --oneline | wc -l
99974  # as of 2020-03-02; would be 40943 without the grafted history

$ git blame README
3d0f88f7d545 (Sascha Wildner         2011-03-24 14:29:32 +0100  1) This is the top level of the DragonFly source directory.
3d0f88f7d545 (Sascha Wildner         2011-03-24 14:29:32 +0100  2) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000  3) For copyright information, please see the file COPYRIGHT in this
01876569b244 (jkh                    1997-01-01 14:06:29 +0000  4) directory (additional copyright information also exists for some
01876569b244 (jkh                    1997-01-01 14:06:29 +0000  5) sources in this tree - please see the specific source directories for
01876569b244 (jkh                    1997-01-01 14:06:29 +0000  6) more information).
01876569b244 (jkh                    1997-01-01 14:06:29 +0000  7) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000  8) The Makefile in this directory supports a number of targets for
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000  9) building components (or all) of the DragonFly source tree, the most
587429e4dfba (Sascha Wildner         2005-09-25 04:49:39 +0000 10) commonly used being ``buildworld'' and ``installworld'', which rebuild
587429e4dfba (Sascha Wildner         2005-09-25 04:49:39 +0000 11) and install everything in the DragonFly system from the source tree
587429e4dfba (Sascha Wildner         2005-09-25 04:49:39 +0000 12) except the kernel, the kernel-modules and the contents of /etc.  The
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 13) ``buildkernel'' and ``installkernel'' targets build and install
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 14) the kernel and the modules (see below).  Please see the top of
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 15) the Makefile in this directory for more information on the
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 16) standard build targets and compile-time flags.
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 17) 
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 18) Building a kernel is a somewhat involved process.  Documentation
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 19) for it can be found at:
a754a615a853 (Matthias Schmidt       2009-02-13 19:33:57 +0100 20)    http://www.dragonflybsd.org/docs/handbook/
16e9ff28733d (Sascha Wildner         2011-03-24 14:21:32 +0100 21) Also see the build(7) and config(8) man pages.
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 22) 
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 23) Note: If you want to build and install the kernel with the
acd838729503 (bmah                   2002-04-26 16:01:35 +0000 24) ``buildkernel'' and ``installkernel'' targets, you might need to build
587429e4dfba (Sascha Wildner         2005-09-25 04:49:39 +0000 25) world before.  More information is available in the DragonFly handbook.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 26) 
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 27) The kernel configuration files reside in the sys/config sub-directory.
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 28) The X86_64_GENERIC is the default x86_64 kernel configuration used in
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 29) release builds.  The VKERNEL64 is the default 64 bit vkernel(7) kernel
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 30) configuration file.  The file LINT64 contains entries for all possible
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 31) devices, not just those commonly used, and is meant more as a general
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 32) reference than an actual kernel configuration file (a kernel built
6dfa5e2f7c6d (Aaron LI               2018-06-01 12:47:58 +0800 33) from it wouldn't even run).  Also see the config(8) man page.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 34) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 35) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 36) Source Roadmap:
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 37) ---------------
acd838729503 (bmah                   2002-04-26 16:01:35 +0000 38) bin      System/user commands.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 39) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 40) contrib      Packages contributed by 3rd parties.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 41) 
98065e287e91 (alex                   2000-08-05 13:25:20 +0000 42) crypto       Cryptography stuff (see crypto/README).
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 43) 
b224b70ed7e3 (Aaron LI               2018-06-01 12:46:21 +0800 44) doc      Documentation for DragonFly BSD.
b224b70ed7e3 (Aaron LI               2018-06-01 12:46:21 +0800 45) 
acd838729503 (bmah                   2002-04-26 16:01:35 +0000 46) etc      Template files for /etc.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 47) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 48) games        Amusements.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 49) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 50) gnu      Various commands and libraries under the GNU Public License.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 51)      Please see gnu/COPYING* for more information.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 52) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 53) include      System include files.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 54) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 55) lib      System libraries.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 56) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 57) libexec      System daemons.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 58) 
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 59) nrelease Framework for building the ``live'' CD image.
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 60) 
e79a303f7db7 (Aaron LI               2018-06-02 13:31:45 +0800 61) initrd       Build system for statically linked /rescue utilities and
e79a303f7db7 (Aaron LI               2018-06-02 13:31:45 +0800 62)      initial ramdisk creation.
e79a303f7db7 (Aaron LI               2018-06-02 13:31:45 +0800 63) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 64) sbin     System commands.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 65) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 66) share        Shared resources.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 67) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 68) sys      Kernel sources.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 69) 
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 70) test     System tests.
b515e798ee9d (Jeroen Ruigrok/asmodai 2004-01-31 08:52:16 +0000 71) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 72) tools        Utilities for regression testing and miscellaneous tasks.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 73) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 74) usr.bin      User commands.
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 75) 
01876569b244 (jkh                    1997-01-01 14:06:29 +0000 76) usr.sbin System administration commands.

Yes, you can see detailed changes made before 2003. See also the README blame example @leaf.

How the grafted history was created

DragonFly BSD was forked from FreeBSD at the following commit:

Branch: RELENG_4 (stable/4)

Date: Jun 15 2003, 2:22 AM

Author: hmp

Log: MFC: rev. 1.31

URL: SVN r116367, Git @86ba855

NOTE:

  1. The DragonFly BSD Git repository was converted from CVS, which was, however, not perfect. For example, many file renames/moves were not properly tracked.

  2. The CVS keyword $FreeBSD$ was not expanded in the FreeBSD Git repository.

Therefore, the DragonFly BSD source code at the first commit is not an exact copy of the FreeBSD code at the fork commit. So an extra graft commit is required to concatenate the two ends.

Create the history repository

$ git clone --branch stable/4 -- https://github.com/freebsd/freebsd freebsd4
$ cd freebsd4
$ git reset --hard 86ba855  # the fork commit

$ git init --bare ../dragonflybsd-history.git
$ git push ../dragonflybsd-history.git stable/4:master
$ cd ..
$ git clone dragonflybsd-history.git

$ git clone https://github.com/DragonFlyBSD/DragonFlyBSD dragonflybsd
$ cd dragonflybsd
$ first_commit=$(git rev-list --reverse --max-parents=0 HEAD | head -n 1)
$ git checkout ${first_commit}

$ cd ../dragonflybsd-history
$ rm -rf *
$ cp -a ../dragonflybsd/* .
$ git config diff.renameLimit 99999
$ git add .
$ git commit  # create the graft commit

See also my graft commit.

Graft the history in DragonFly BSD repository

$ cd ../dragonflybsd
$ git remote add history ../dragonflybsd-history/.git
$ git fetch history
$ graft_commit=$(git rev-parse --verify history/master)
$ first_commit=$(git rev-list --reverse --max-parents=0 HEAD | head -n 1)
$ git replace ${first_commit} ${graft_commit}

References