Build Own Generic CD

Dec 15, 2013
3 min read
May 31, 2023 18:15 EEST
mkdir -p /usr/local/etc/cvsup
cp /usr/share/examples/cvsup/cvs-supfile /usr/local/etc/cvsup/ncvs

Edit the file:

  * default host=cvsup5.de.freebsd.org
  * default base=/usr
  * default prefix=/home/storage/ncvs
  * default release=cvs
  * default delete use-rel-suffix

  -  If your network link is a T1 or faster, comment out the following line.
  * default compress

  -  Add these
src-all
src-crypto
src-eBones
src-secure
src-sys-crypto
ports-all
doc-all
  - www

cvsroot-all

Now checkout the sources:

mkdir /home/storage/ncvs
cvsup -g -L2 ncvs

Now compile your own system:

cd /usr/src
make buildworld

Create now the release files:

cd /usr/src/release
/etc/rc.d/adjkerntz start
adjkerntz -i
make release CHROOTDIR=/home/storage/ownfreebsd BUILDNAME=test \\
CVSROOT=/home/storage/ncvs RELEASETAG=RELENG_6 MAKE_ISOS=1

Build a Custom CD

Delete /usr/src and check it out from your local repository:

cd /usr
rm -R src
mkdir -p /usr/src
cd /usr
cvs -R  -d /home/storage/ncvs  co  -P -r RELENG_6 src
cd /usr/
cp -pR src src.orig

Then apply your changes to /usr/src (kernel config files, patches everything you need). We will use a unattened install procedure to install the own build kernels so we don’t have to modify the sysinstall package. To use our own install script edit:

  • /usr/src/usr.sbin/sysinstall/Makefile

and add:

CFLAGS+= -DLOAD_CONFIG_FILE=install.cfg

Now create a install.cfg file in /usr/src/release for an example see here.

Create a directory for own packages that will be included to the CD:

mkdir -p /root/ownpackages/disc1

Now copy all packages to the directory /root/ownpackages/disc1.

Make a diff with:

cd /usr
diff -Nur src.orig src >/root/patch.diff

You can try if the patch works with:

mkdir -p /home/storage/ownfreebsd/usr
cd /home/storage/ownfreebsd/usr && cvs -R  -d /home/storage/ncvs  co  -P -r RELENG_6 src
patch -s -d /home/storage/ownfreebsd/usr/src  < /root/patch.diff

cd /usr/src
make buildworld

cd /usr/src/release
make release KERNELS_BASE="I4B I4BSMP GENERIC SMP" \\
CHROOTDIR=/home/storage/ownfreebsd BUILDNAME=FreeBSD-I4B \\
CVSROOT=/home/storage/ncvs RELEASETAG=RELENG_6 MAKE_ISOS=1 \\
CD_PACKAGE_TREE=/root/ownpackages \\
KERNEL_FLAGS=-j4 WORLD_FLAGS=-j4 \\
LOCAL_PATCHES=/root/patch.diff PATCH_FLAGS=-p1 KERNELS="I4B I4BSMP" |tee /root/build.log

make release CHROOTDIR=/home/storage/ownfreebsd BUILDNAME=FreeBSD-I4B \\
CVSROOT=/home/storage/ncvs RELEASETAG=RELENG_6 MAKE_ISOS=1 \\
KERNEL_FLAGS=-j4 WORLD_FLAGS=-j4 \\
LOCAL_PATCHES=/root/patch.diff PATCH_FLAGS=-p1 KERNELS="I4B I4BSMP GENERIC SMP" |tee /root/build.log

For Quick Build

make release -DNOPORTS -DNODOC KERNELS_BASE="I4B I4BSMP GENERIC SMP" \\
CHROOTDIR=/home/storage/ownfreebsd BUILDNAME=FreeBSD-I4B \\
CVSROOT=/home/storage/ncvs RELEASETAG=RELENG_6 MAKE_ISOS=1 \\
KERNEL_FLAGS=-j4 WORLD_FLAGS=-j4 \\
LOCAL_PATCHES=/root/patch.diff PATCH_FLAGS=-p1 KERNELS="I4B I4BSMP" |tee /root/build.log

If you want that the new generated kernel should be installed you have to edit /usr/src/release/Makefile and replace GENERIC with your kernel.

Rebuild changes

cd /usr/src/release
make rerelease -DRELEASENOUPDATE -DNOPORTS -DNODOC KERNELS_BASE="I4B I4BSMP GENERIC SMP" \\
CHROOTDIR=/home/storage/ownfreebsd BUILDNAME=FreeBSD-I4B \\
CVSROOT=/home/storage/ncvs RELEASETAG=RELENG_6 MAKE_ISOS=1 \\
KERNEL_FLAGS=-j4 WORLD_FLAGS=-j4 \\
KERNELS="I4B I4BSMP" |tee /root/build.log

Rebuild only the Kernels

cd /usr/src/release
make release.3 CHROOTDIR=/home/storage/ownfreebsd BUILDNAME=FreeBSD-I4B \\
CVSROOT=/home/storage/ncvs RELEASETAG=RELENG_6 MAKE_ISOS=1 \\
LOCAL_PATCHES=/root/patch.diff PATCH_FLAGS=-p1 KERNELS="I4B I4BSMP" \\
-DNOCLEAN -DNO_CLEAN | tee /root/build.log

Replace install.cfg

We replace now the install.cfg with a new version:

cd /mnt
mkdir img
cd /usr/home/storage/ownfreebsd/R/cdrom/disc1/floppies

Related Posts